Fix #137391: Do Not Restrict Marker Operations on Region Size
Remove the checks for region size in operator_markers_region_active as that interferes too much. The only thing really interfering with playhead movement when the area gets too narrow is MARKER_OT_select. So this PR adds a new poll function for that in particular. That allows a lot of simplification. Pull Request: https://projects.blender.org/blender/blender/pulls/137399
This commit is contained in:
committed by
Harley Acheson
parent
6655b16207
commit
d6d6a7e36f
@@ -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<SpaceAction *>(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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user