UI: remove mask toolbar, use menus instead
authorCampbell Barton <ideasman42@gmail.com>
Mon, 22 Oct 2018 07:08:19 +0000 (18:08 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 22 Oct 2018 07:08:19 +0000 (18:08 +1100)
release/scripts/startup/bl_ui/properties_mask_common.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_image.py

index ad78685d7ff99c6fc59c45d8e0c0c382dd5ba3fe..4d502cf3c467e2e54dd720ff01251629708d33e3 100644 (file)
@@ -258,62 +258,14 @@ class MASK_PT_transforms:
         col.operator("transform.transform", text="Scale Feather").mode = 'MASK_SHRINKFATTEN'
 
 
-class MASK_PT_tools:
-    # subclasses must define...
-    # ~ bl_space_type = 'CLIP_EDITOR'
-    # ~ bl_region_type = 'TOOLS'
-    bl_label = "Mask Tools"
-    bl_category = "Mask"
-
-    @classmethod
-    def poll(cls, context):
-        space_data = context.space_data
-        return space_data.mask and space_data.mode == 'MASK'
-
-    def draw(self, context):
-        layout = self.layout
-
-        col = layout.column(align=True)
-        col.label(text="Spline:")
-        col.operator("mask.delete")
-        col.operator("mask.cyclic_toggle")
-        col.operator("mask.switch_direction")
-        col.operator("mask.handle_type_set")
-        col.operator("mask.feather_weight_clear")
-
-        col = layout.column(align=True)
-        col.label(text="Parenting:")
-        row = col.row(align=True)
-        row.operator("mask.parent_set", text="Parent")
-        row.operator("mask.parent_clear", text="Clear")
-
-        col = layout.column(align=True)
-        col.label(text="Animation:")
-        row = col.row(align=True)
-        row.operator("mask.shape_key_insert", text="Insert Key")
-        row.operator("mask.shape_key_clear", text="Clear Key")
-        col.operator("mask.shape_key_feather_reset", text="Reset Feather Animation")
-        col.operator("mask.shape_key_rekey", text="Re-Key Shape Points")
-
-
-class MASK_PT_add:
-    # subclasses must define...
-    # ~ bl_space_type = 'CLIP_EDITOR'
-    # ~ bl_region_type = 'TOOLS'
+class MASK_MT_add(Menu):
     bl_label = "Add"
-    bl_category = "Mask"
-
-    @classmethod
-    def poll(cls, context):
-        space_data = context.space_data
-        return space_data.mode == 'MASK'
 
     def draw(self, context):
         layout = self.layout
 
-        col = layout.column(align=True)
-        col.operator("mask.primitive_circle_add", icon='MESH_CIRCLE')
-        col.operator("mask.primitive_square_add", icon='MESH_PLANE')
+        layout.operator("mask.primitive_circle_add", icon='MESH_CIRCLE')
+        layout.operator("mask.primitive_square_add", icon='MESH_PLANE')
 
 
 class MASK_MT_mask(Menu):
@@ -328,6 +280,7 @@ class MASK_MT_mask(Menu):
         layout.operator("mask.cyclic_toggle")
         layout.operator("mask.switch_direction")
         layout.operator("mask.normals_make_consistent")
+        layout.operator("mask.handle_type_set")
         layout.operator("mask.feather_weight_clear")  # TODO, better place?
 
         layout.separator()
@@ -406,6 +359,7 @@ class MASK_MT_select(Menu):
 
 classes = (
     MASK_UL_layers,
+    MASK_MT_add,
     MASK_MT_mask,
     MASK_MT_visibility,
     MASK_MT_transform,
index e92eade758c447425c001a18e082ff5e6828524a..0df3f2ed85c17be2a531827f5ed163368b0ab1c6 100644 (file)
@@ -320,6 +320,7 @@ class CLIP_MT_masking_editor_menus(Menu):
         if clip:
             layout.menu("MASK_MT_select")
             layout.menu("CLIP_MT_clip")  # XXX - remove?
+            layout.menu("MASK_MT_add")
             layout.menu("MASK_MT_mask")
         else:
             layout.menu("CLIP_MT_clip")  # XXX - remove?
@@ -1121,9 +1122,7 @@ from .properties_mask_common import (
     MASK_PT_spline,
     MASK_PT_point,
     MASK_PT_display,
-    MASK_PT_tools,
     MASK_PT_transforms,
-    MASK_PT_add,
 )
 
 
@@ -1152,20 +1151,11 @@ class CLIP_PT_mask(MASK_PT_mask, Panel):
     bl_region_type = 'UI'
 
 
-class CLIP_PT_tools_mask_add(MASK_PT_add, Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'TOOLS'
-
-
 class CLIP_PT_tools_mask_transforms(MASK_PT_transforms, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
 
 
-class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'TOOLS'
-
 # --- end mask ---
 
 
@@ -1553,8 +1543,6 @@ classes = (
     CLIP_PT_mask_display,
     CLIP_PT_active_mask_spline,
     CLIP_PT_active_mask_point,
-    CLIP_PT_tools_mask,
-    CLIP_PT_tools_mask_add,
     CLIP_PT_tools_mask_transforms,
     CLIP_PT_footage,
     CLIP_PT_tools_scenesetup,
index 1a9b8ab83b15c5febaaae9ff5cc1027ff023d33d..67cdd9d8938026828b57ef2b3c89344819a5ff47 100644 (file)
@@ -646,6 +646,7 @@ class MASK_MT_editor_menus(Menu):
         if show_uvedit:
             layout.menu("IMAGE_MT_uvs")
         if show_maskedit:
+            layout.menu("MASK_MT_add")
             layout.menu("MASK_MT_mask")
 
 
@@ -659,8 +660,6 @@ from .properties_mask_common import (
     MASK_PT_spline,
     MASK_PT_point,
     MASK_PT_display,
-    MASK_PT_tools,
-    MASK_PT_add,
 )
 
 
@@ -689,18 +688,6 @@ class IMAGE_PT_active_mask_point(MASK_PT_point, Panel):
     bl_region_type = 'UI'
 
 
-class IMAGE_PT_tools_mask(MASK_PT_tools, Panel):
-    bl_space_type = 'IMAGE_EDITOR'
-    bl_region_type = 'TOOLS'
-    bl_category = 'Mask'
-
-
-class IMAGE_PT_tools_mask_add(MASK_PT_add, Panel):
-    bl_space_type = 'IMAGE_EDITOR'
-    bl_region_type = 'TOOLS'
-    bl_category = 'Mask'
-
-
 # --- end mask ---
 
 
@@ -1381,7 +1368,6 @@ classes = (
     IMAGE_HT_header,
     MASK_MT_editor_menus,
     IMAGE_PT_mask,
-    IMAGE_PT_tools_mask_add,
     IMAGE_PT_mask_layers,
     IMAGE_PT_mask_display,
     IMAGE_PT_active_mask_spline,
@@ -1395,7 +1381,6 @@ classes = (
     IMAGE_PT_paint,
     IMAGE_PT_tools_brush_overlay,
     IMAGE_PT_tools_brush_texture,
-    IMAGE_PT_tools_mask,
     IMAGE_PT_tools_mask_texture,
     IMAGE_PT_tools_brush_tool,
     IMAGE_PT_paint_stroke,