diff --git a/source/blender/editors/animation/anim_markers.cc b/source/blender/editors/animation/anim_markers.cc index fe5264d1c7a..9b78fcba8f6 100644 --- a/source/blender/editors/animation/anim_markers.cc +++ b/source/blender/editors/animation/anim_markers.cc @@ -211,12 +211,6 @@ static bool operator_markers_region_active(bContext *C) return false; } - /* Minimum vertical size to select markers, while still scrubbing frames. */ - ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); - if (region && region->winy < UI_MARKERS_MINY) { - return false; - } - switch (area->spacetype) { case SPACE_ACTION: { SpaceAction *saction = static_cast(area->spacedata.first); @@ -739,6 +733,22 @@ static bool ed_markers_poll_markers_exist(bContext *C) return (markers && markers->first); } +static bool ed_markers_poll_markers_exist_visible(bContext *C) +{ + ScrArea *area = CTX_wm_area(C); + if (area == nullptr) { + return false; + } + + /* Minimum vertical size to select markers, while still scrubbing frames. */ + ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); + if (region && region->winy < UI_MARKERS_MINY) { + return false; + } + + return ed_markers_poll_markers_exist(C); +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -1446,7 +1456,7 @@ static void MARKER_OT_select(wmOperatorType *ot) ot->idname = "MARKER_OT_select"; /* api callbacks */ - ot->poll = ed_markers_poll_markers_exist; + ot->poll = ed_markers_poll_markers_exist_visible; ot->exec = ed_marker_select_exec; ot->invoke = WM_generic_select_invoke; ot->modal = WM_generic_select_modal; diff --git a/source/blender/editors/include/UI_view2d.hh b/source/blender/editors/include/UI_view2d.hh index fba1599d3a9..bc323079cd3 100644 --- a/source/blender/editors/include/UI_view2d.hh +++ b/source/blender/editors/include/UI_view2d.hh @@ -471,7 +471,7 @@ void UI_view2d_smooth_view(const bContext *C, ARegion *region, const rctf *cur, #define UI_TIME_SCRUB_MARGIN_Y (23 * UI_SCALE_FAC) #define UI_TIME_CACHE_MARGIN_Y (UI_TIME_SCRUB_MARGIN_Y / 6.0f) #define UI_ANIM_MINY (HEADERY * UI_SCALE_FAC * 1.1f) -#define UI_MARKERS_MINY (HEADERY * UI_SCALE_FAC * 2.4f) +#define UI_MARKERS_MINY (HEADERY * UI_SCALE_FAC * 2.0f) /** \} */ diff --git a/source/blender/editors/space_action/space_action.cc b/source/blender/editors/space_action/space_action.cc index c2b10f7dbba..090ffddc403 100644 --- a/source/blender/editors/space_action/space_action.cc +++ b/source/blender/editors/space_action/space_action.cc @@ -185,7 +185,7 @@ static void action_main_region_draw(const bContext *C, ARegion *region) View2D *v2d = ®ion->v2d; short marker_flag = 0; - const int min_height = saction->flag & SACTION_SHOW_MARKERS ? UI_MARKERS_MINY : UI_ANIM_MINY; + const int min_height = UI_ANIM_MINY; /* scrollers */ if (region->winy >= UI_ANIM_MINY) { @@ -241,15 +241,13 @@ static void action_main_region_draw(const bContext *C, ARegion *region) } /* markers */ - if (region->winy >= UI_MARKERS_MINY) { - UI_view2d_view_orthoSpecial(region, v2d, true); + UI_view2d_view_orthoSpecial(region, v2d, true); - marker_flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) | - DRAW_MARKERS_MARGIN; + marker_flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) | + DRAW_MARKERS_MARGIN; - if (saction->flag & SACTION_SHOW_MARKERS) { - ED_markers_draw(C, marker_flag); - } + if (saction->flag & SACTION_SHOW_MARKERS) { + ED_markers_draw(C, marker_flag); } /* preview range */ diff --git a/source/blender/editors/space_graph/space_graph.cc b/source/blender/editors/space_graph/space_graph.cc index 399444cda35..22fb9f9e257 100644 --- a/source/blender/editors/space_graph/space_graph.cc +++ b/source/blender/editors/space_graph/space_graph.cc @@ -214,7 +214,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) bAnimContext ac; View2D *v2d = ®ion->v2d; - const int min_height = sipo->flag & SIPO_SHOW_MARKERS ? UI_MARKERS_MINY : UI_ANIM_MINY; + const int min_height = UI_ANIM_MINY; /* clear and setup matrix */ UI_ThemeClearColor(region->winy > min_height ? TH_BACK : TH_TIME_SCRUB_BACKGROUND); @@ -258,7 +258,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) v2d->tot.xmax += 10.0f; } - if ((sipo->flag & SIPO_NODRAWCURSOR) == 0 && region->winy >= UI_MARKERS_MINY) { + if ((sipo->flag & SIPO_NODRAWCURSOR) == 0) { uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -301,7 +301,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) } /* markers */ - if (sipo->mode != SIPO_MODE_DRIVERS && region->winy >= UI_MARKERS_MINY) { + if (sipo->mode != SIPO_MODE_DRIVERS) { UI_view2d_view_orthoSpecial(region, v2d, true); int marker_draw_flag = DRAW_MARKERS_MARGIN; if (sipo->flag & SIPO_SHOW_MARKERS) { diff --git a/source/blender/editors/space_nla/space_nla.cc b/source/blender/editors/space_nla/space_nla.cc index 684dd18e8b8..891fe7728ff 100644 --- a/source/blender/editors/space_nla/space_nla.cc +++ b/source/blender/editors/space_nla/space_nla.cc @@ -247,7 +247,7 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) bAnimContext ac; View2D *v2d = ®ion->v2d; - const int min_height = snla->flag & SNLA_SHOW_MARKERS ? UI_MARKERS_MINY : UI_ANIM_MINY; + const int min_height = UI_ANIM_MINY; /* clear and setup matrix */ UI_ThemeClearColor(region->winy > min_height ? TH_BACK : TH_TIME_SCRUB_BACKGROUND); @@ -277,12 +277,10 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) } /* markers */ - if (region->winy >= UI_MARKERS_MINY) { - UI_view2d_view_orthoSpecial(region, v2d, true); - int marker_draw_flag = DRAW_MARKERS_MARGIN; - if (snla->flag & SNLA_SHOW_MARKERS) { - ED_markers_draw(C, marker_draw_flag); - } + UI_view2d_view_orthoSpecial(region, v2d, true); + int marker_draw_flag = DRAW_MARKERS_MARGIN; + if (snla->flag & SNLA_SHOW_MARKERS) { + ED_markers_draw(C, marker_draw_flag); } /* preview range */