diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-12-16 08:44:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-12-16 08:48:51 +0300 |
commit | f3dadd4115eeb19858a3f6c81765b4e412ad1f7d (patch) | |
tree | e1993ad1ba5cbcbb57fd891261bfe40a63432dbc /release/scripts/startup | |
parent | e720661b7d4a320c32a3db3b0082454c42d576f2 (diff) |
UI: de-duplicate mask context menu
- Use the clip mask context menu for the image editor.
- Remove redundant CLIP_MT_mask_handle_type_menu.
- Remove "Add" items (was only in image mask context menu)
as the convention is not to include these in the context menu.
Diffstat (limited to 'release/scripts/startup')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_mask_common.py | 26 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_clip.py | 36 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 37 |
3 files changed, 31 insertions, 68 deletions
diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py index 108a417c97d..3342fe1985a 100644 --- a/release/scripts/startup/bl_ui/properties_mask_common.py +++ b/release/scripts/startup/bl_ui/properties_mask_common.py @@ -25,6 +25,32 @@ from bpy.types import Menu, UIList from bpy.app.translations import contexts as i18n_contexts +# Use by both image & clip context menus. +def draw_mask_context_menu(layout, context): + layout.operator_menu_enum("mask.handle_type_set", "type") + layout.operator("mask.switch_direction") + layout.operator("mask.cyclic_toggle") + + layout.separator() + layout.operator("mask.copy_splines", icon='COPYDOWN') + layout.operator("mask.paste_splines", icon='PASTEDOWN') + + layout.separator() + + layout.operator("mask.shape_key_rekey", text="Re-key Shape Points") + layout.operator("mask.feather_weight_clear") + layout.operator("mask.shape_key_feather_reset", text="Reset Feather Animation") + + layout.separator() + + layout.operator("mask.parent_set") + layout.operator("mask.parent_clear") + + layout.separator() + + layout.operator("mask.delete") + + class MASK_UL_layers(UIList): def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 9afdcdff9a5..f93629a4f03 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -1445,15 +1445,6 @@ class CLIP_MT_select_grouped(Menu): layout.operator_enum("clip.select_grouped", "group") -class CLIP_MT_mask_handle_type_menu(Menu): - bl_label = "Set Handle Type" - - def draw(self, _context): - layout = self.layout - - layout.operator_enum("mask.handle_type_set", "type") - - class CLIP_MT_tracking_context_menu(Menu): bl_label = "Context Menu" @@ -1507,30 +1498,8 @@ class CLIP_MT_tracking_context_menu(Menu): layout.operator("clip.delete_track") elif mode == 'MASK': - - layout.menu("CLIP_MT_mask_handle_type_menu") - layout.operator("mask.switch_direction") - layout.operator("mask.cyclic_toggle") - - layout.separator() - - layout.operator("mask.copy_splines", icon='COPYDOWN') - layout.operator("mask.paste_splines", icon='PASTEDOWN') - - layout.separator() - - layout.operator("mask.shape_key_rekey", text="Re-key Shape Points") - layout.operator("mask.feather_weight_clear") - layout.operator("mask.shape_key_feather_reset", text="Reset Feather Animation") - - layout.separator() - - layout.operator("mask.parent_set") - layout.operator("mask.parent_clear") - - layout.separator() - - layout.operator("mask.delete") + from .properties_mask_common import draw_mask_context_menu + draw_mask_context_menu(layout, context) class CLIP_PT_camera_presets(PresetPanel, Panel): @@ -1801,7 +1770,6 @@ classes = ( CLIP_MT_tracking_pie, CLIP_MT_reconstruction_pie, CLIP_MT_solving_pie, - CLIP_MT_mask_handle_type_menu ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 3b70110e182..c795b575a88 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -778,44 +778,13 @@ class IMAGE_MT_mask_context_menu(Menu): @classmethod def poll(cls, context): sima = context.space_data - return (sima.show_maskedit) + return sima.show_maskedit def draw(self, context): layout = self.layout - sima = context.space_data - - if not sima.mask: - layout.operator("mask.new") - layout.separator() - layout.operator("mask.primitive_circle_add", icon='MESH_CIRCLE') - layout.operator("mask.primitive_square_add", icon='MESH_PLANE') - else: - layout.operator_menu_enum("mask.handle_type_set", "type") - layout.operator("mask.switch_direction") - layout.operator("mask.cyclic_toggle") - - layout.separator() - layout.operator("mask.primitive_circle_add", icon='MESH_CIRCLE') - layout.operator("mask.primitive_square_add", icon='MESH_PLANE') - - layout.separator() - layout.operator("mask.copy_splines", icon='COPYDOWN') - layout.operator("mask.paste_splines", icon='PASTEDOWN') - - layout.separator() - - layout.operator("mask.shape_key_rekey", text="Re-key Shape Points") - layout.operator("mask.feather_weight_clear") - layout.operator("mask.shape_key_feather_reset", text="Reset Feather Animation") - - layout.separator() - - layout.operator("mask.parent_set") - layout.operator("mask.parent_clear") - - layout.separator() + from .properties_mask_common import draw_mask_context_menu + draw_mask_context_menu(layout, context) - layout.operator("mask.delete") # ----------------------------------------------------------------------------- # Mask (similar code in space_clip.py, keep in sync) |