diff options
author | Simon Lenz <Amudtogal> | 2022-06-16 11:13:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-06-22 11:45:18 +0300 |
commit | df2ab4e758c73bc72a95fcc02ac1e711bbd86b17 (patch) | |
tree | d494bf031041336e05aa7cbb4c4a2064da39f420 /source/blender/editors/mask | |
parent | 5946ea938a07bf95c7682af919ee33c715e1fa42 (diff) |
Mask Editor: Add toggle for mask spline drawing
Adds an overlay option to show/hide the spline points & lines of masks in the Mask Editor.
It also moves the "smooth" option up (its position left of the selection dropdown was missleading).
{F11847272}
This emerged from a discussion in https://developer.blender.org/D12776
Differential Revision: https://developer.blender.org/D13314
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r-- | source/blender/editors/mask/mask_add.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_edit.c | 32 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 20 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_relationships.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_select.c | 18 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_shapekey.c | 8 |
7 files changed, 62 insertions, 28 deletions
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index 42f3acaa6bc..37c1815fca3 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -583,7 +583,7 @@ void MASK_OT_add_vertex(wmOperatorType *ot) /* api callbacks */ ot->exec = add_vertex_exec; ot->invoke = add_vertex_invoke; - ot->poll = ED_maskedit_poll; + ot->poll = ED_maskedit_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -862,7 +862,7 @@ void MASK_OT_primitive_circle_add(wmOperatorType *ot) /* api callbacks */ ot->exec = primitive_circle_add_exec; ot->invoke = primitive_add_invoke; - ot->poll = ED_maskedit_poll; + ot->poll = ED_maskedit_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -897,7 +897,7 @@ void MASK_OT_primitive_square_add(wmOperatorType *ot) /* api callbacks */ ot->exec = primitive_square_add_exec; ot->invoke = primitive_add_invoke; - ot->poll = ED_maskedit_poll; + ot->poll = ED_maskedit_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 1bd224fe763..a18419ad422 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -776,7 +776,9 @@ void ED_mask_draw_region( } /* draw! */ - draw_mask_layers(C, mask_eval, draw_flag, draw_type, width, height); + if (draw_flag & MASK_DRAWFLAG_SPLINE) { + draw_mask_layers(C, mask_eval, draw_flag, draw_type, width, height); + } if (do_draw_cb) { ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index b2d49bcc642..915f90a1537 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -42,6 +42,22 @@ bool ED_maskedit_poll(bContext *C) return false; } +bool ED_maskedit_visible_splines_poll(bContext *C) +{ + ScrArea *area = CTX_wm_area(C); + if (area) { + switch (area->spacetype) { + case SPACE_CLIP: + return ED_space_clip_maskedit_visible_splines_poll(C); + case SPACE_SEQ: + return ED_space_sequencer_maskedit_poll(C); + case SPACE_IMAGE: + return ED_space_image_maskedit_visible_splines_poll(C); + } + } + return false; +} + bool ED_maskedit_mask_poll(bContext *C) { ScrArea *area = CTX_wm_area(C); @@ -58,6 +74,22 @@ bool ED_maskedit_mask_poll(bContext *C) return false; } +bool ED_maskedit_mask_visible_splines_poll(bContext *C) +{ + const ScrArea *area = CTX_wm_area(C); + if (area) { + switch (area->spacetype) { + case SPACE_CLIP: + return ED_space_clip_maskedit_mask_visible_splines_poll(C); + case SPACE_SEQ: + return ED_space_sequencer_maskedit_mask_poll(C); + case SPACE_IMAGE: + return ED_space_image_maskedit_mask_visible_splines_poll(C); + } + } + return false; +} + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 3ca9f4d06e2..14976d860f6 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -907,7 +907,7 @@ void MASK_OT_slide_point(wmOperatorType *ot) /* api callbacks */ ot->invoke = slide_point_invoke; ot->modal = slide_point_modal; - ot->poll = ED_maskedit_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1297,7 +1297,7 @@ void MASK_OT_slide_spline_curvature(wmOperatorType *ot) /* api callbacks */ ot->invoke = slide_spline_curvature_invoke; ot->modal = slide_spline_curvature_modal; - ot->poll = ED_maskedit_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1336,7 +1336,7 @@ void MASK_OT_cyclic_toggle(wmOperatorType *ot) /* api callbacks */ ot->exec = cyclic_toggle_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1493,7 +1493,7 @@ void MASK_OT_delete(wmOperatorType *ot) /* api callbacks */ ot->invoke = WM_operator_confirm; ot->exec = delete_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1551,7 +1551,7 @@ void MASK_OT_switch_direction(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_switch_direction_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1613,7 +1613,7 @@ void MASK_OT_normals_make_consistent(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_normals_make_consistent_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1693,7 +1693,7 @@ void MASK_OT_handle_type_set(wmOperatorType *ot) /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = set_handle_type_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1849,7 +1849,7 @@ void MASK_OT_feather_weight_clear(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_feather_weight_clear_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2043,7 +2043,7 @@ void MASK_OT_duplicate(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_duplicate_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2084,7 +2084,7 @@ void MASK_OT_copy_splines(wmOperatorType *ot) static bool paste_splines_poll(bContext *C) { - if (ED_maskedit_mask_poll(C)) { + if (ED_maskedit_mask_visible_splines_poll(C)) { return BKE_mask_clipboard_is_empty() == false; } diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c index afeb1500267..1f175ce51fc 100644 --- a/source/blender/editors/mask/mask_relationships.c +++ b/source/blender/editors/mask/mask_relationships.c @@ -62,7 +62,7 @@ void MASK_OT_parent_clear(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_parent_clear_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index e5fe108b6cd..4bd80208b9e 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -222,7 +222,7 @@ void MASK_OT_select_all(wmOperatorType *ot) /* api callbacks */ ot->exec = select_all_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -398,7 +398,7 @@ void MASK_OT_select(wmOperatorType *ot) /* api callbacks */ ot->exec = select_exec; ot->invoke = select_invoke; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; ot->get_name = ED_select_pick_get_name; /* flags */ @@ -504,7 +504,7 @@ void MASK_OT_select_box(wmOperatorType *ot) ot->invoke = WM_gesture_box_invoke; ot->exec = box_select_exec; ot->modal = WM_gesture_box_modal; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_UNDO; @@ -627,7 +627,7 @@ void MASK_OT_select_lasso(wmOperatorType *ot) ot->invoke = WM_gesture_lasso_invoke; ot->modal = WM_gesture_lasso_modal; ot->exec = clip_lasso_select_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; ot->cancel = WM_gesture_lasso_cancel; /* flags */ @@ -745,7 +745,7 @@ void MASK_OT_select_circle(wmOperatorType *ot) ot->invoke = WM_gesture_circle_invoke; ot->modal = WM_gesture_circle_modal; ot->exec = circle_select_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; ot->get_name = ED_select_circle_get_name; /* flags */ @@ -809,7 +809,7 @@ void MASK_OT_select_linked_pick(wmOperatorType *ot) /* api callbacks */ ot->invoke = mask_select_linked_pick_invoke; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -864,7 +864,7 @@ void MASK_OT_select_linked(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_select_linked_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -963,7 +963,7 @@ void MASK_OT_select_more(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_select_more_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -983,7 +983,7 @@ void MASK_OT_select_less(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_select_less_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c index dd54d84a90b..55145f27012 100644 --- a/source/blender/editors/mask/mask_shapekey.c +++ b/source/blender/editors/mask/mask_shapekey.c @@ -67,7 +67,7 @@ void MASK_OT_shape_key_insert(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_shape_key_insert_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -113,7 +113,7 @@ void MASK_OT_shape_key_clear(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_shape_key_clear_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -197,7 +197,7 @@ void MASK_OT_shape_key_feather_reset(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_shape_key_feather_reset_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -356,7 +356,7 @@ void MASK_OT_shape_key_rekey(wmOperatorType *ot) /* api callbacks */ ot->exec = mask_shape_key_rekey_exec; - ot->poll = ED_maskedit_mask_poll; + ot->poll = ED_maskedit_mask_visible_splines_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |