[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49206] trunk/blender/release/scripts/ startup/bl_ui: add mask buttons into the image space

Campbell Barton ideasman42 at gmail.com
Wed Jul 25 15:44:07 CEST 2012


Revision: 49206
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49206
Author:   campbellbarton
Date:     2012-07-25 13:44:07 +0000 (Wed, 25 Jul 2012)
Log Message:
-----------
add mask buttons into the image space

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_mask_common.py
    trunk/blender/release/scripts/startup/bl_ui/space_clip.py
    trunk/blender/release/scripts/startup/bl_ui/space_image.py

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_mask_common.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_mask_common.py	2012-07-25 13:09:20 UTC (rev 49205)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_mask_common.py	2012-07-25 13:44:07 UTC (rev 49206)
@@ -25,13 +25,18 @@
 from bpy.types import Menu
 
 
-class MASK_PT_mask():
+class MASK_PT_mask:
     # subclasses must define...
     #~ bl_space_type = 'CLIP_EDITOR'
     #~ bl_region_type = 'UI'
     bl_label = "Mask Settings"
     bl_options = {'DEFAULT_CLOSED'}
 
+    @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
 
@@ -43,7 +48,7 @@
         col.prop(mask, "frame_end")
 
 
-class MASK_PT_layers():
+class MASK_PT_layers:
     # subclasses must define...
     #~ bl_space_type = 'CLIP_EDITOR'
     #~ bl_region_type = 'UI'
@@ -51,10 +56,9 @@
 
     @classmethod
     def poll(cls, context):
-        sc = context.space_data
+        space_data = context.space_data
+        return space_data.mask and space_data.mode == 'MASK'
 
-        return sc.mask and sc.mode == 'MASKEDIT'
-
     def draw(self, context):
         layout = self.layout
 
@@ -104,7 +108,7 @@
         sc = context.space_data
         mask = sc.mask
 
-        if mask and sc.mode == 'MASKEDIT':
+        if mask and sc.mode == 'MASK':
             return mask.layers.active and mask.layers.active.splines.active
 
         return False
@@ -134,7 +138,7 @@
         sc = context.space_data
         mask = sc.mask
 
-        if mask and sc.mode == 'MASKEDIT':
+        if mask and sc.mode == 'MASK':
             mask_layer_active = mask.layers.active
             return (mask_layer_active and
                     mask_layer_active.splines.active_point)
@@ -183,13 +187,18 @@
     bl_label = "Mask Display"
     bl_options = {'DEFAULT_CLOSED'}
 
+    @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
 
-        sc = context.space_data
+        space_data = context.space_data
 
-        col.prop(layout, "mask_draw_type", text="")
-        col.prop(layout, "show_mask_smooth")
+        layout.prop(space_data, "mask_draw_type", text="")
+        layout.prop(space_data, "show_mask_smooth")
 
 
 class MASK_PT_tools():
@@ -198,6 +207,11 @@
     #~ bl_region_type = 'TOOLS'
     bl_label = "Mask Tools"
 
+    @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
 

Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-07-25 13:09:20 UTC (rev 49205)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-07-25 13:44:07 UTC (rev 49206)
@@ -20,13 +20,8 @@
 
 import bpy
 from bpy.types import Panel, Header, Menu
-from bl_ui.properties_mask_common import (MASK_PT_mask,
-                                          MASK_PT_layers,
-                                          MASK_PT_spline,
-                                          MASK_PT_point,
-                                          MASK_PT_display,
-                                          MASK_PT_tools)
 
+
 class CLIP_HT_header(Header):
     bl_space_type = 'CLIP_EDITOR'
 
@@ -166,16 +161,6 @@
         return clip and sc.view == 'CLIP'
 
 
-class CLIP_PT_mask_view_panel:
-
-    @classmethod
-    def poll(cls, context):
-        sc = context.space_data
-        clip = sc.clip
-
-        return clip and sc.view == 'CLIP' and sc.mode == 'MASKEDIT'
-
-
 class CLIP_PT_tracking_panel:
 
     @classmethod
@@ -427,11 +412,6 @@
         col.prop(settings, "object_distance")
 
 
-class CLIP_PT_tools_mask(MASK_PT_tools, CLIP_PT_mask_view_panel, Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'TOOLS'
-
-
 class CLIP_PT_tools_grease_pencil(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
@@ -447,7 +427,7 @@
 
         if sc.mode == 'DISTORTION':
             return sc.view == 'CLIP'
-        elif sc.mode == 'MASKEDIT':
+        elif sc.mode == 'MASK':
             return True
 
         return False
@@ -643,21 +623,6 @@
         col.prop(clip.tracking.camera, "k3")
 
 
-class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'UI'
-
-
-class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'UI'
-
-
-class CLIP_PT_active_mask_point(MASK_PT_point, Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'UI'
-
-
 class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
@@ -703,16 +668,6 @@
             row.prop(clip, "display_aspect", text="")
 
 
-class CLIP_PT_mask(MASK_PT_mask, CLIP_PT_mask_view_panel, Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'UI'
-
-
-class CLIP_PT_mask_display(MASK_PT_display, CLIP_PT_mask_view_panel, Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'UI'
-
-
 class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
@@ -722,7 +677,7 @@
     def poll(cls, context):
         sc = context.space_data
 
-        return sc.mode != 'MASKEDIT'
+        return sc.mode != 'MASK'
 
     def draw(self, context):
         layout = self.layout
@@ -1067,32 +1022,20 @@
 
     def draw(self, context):
         layout = self.layout
-        sc = context.space_data
 
-        if sc.mode == 'MASKEDIT':
-            layout.operator("mask.select_border")
-            layout.operator("mask.select_circle")
+        layout.operator("clip.select_border")
+        layout.operator("clip.select_circle")
 
-            layout.separator()
+        layout.separator()
 
-            layout.operator("mask.select_all"
-                            ).action = 'TOGGLE'
-            layout.operator("mask.select_all",
-                            text="Inverse").action = 'INVERT'
-        else:
-            layout.operator("clip.select_border")
-            layout.operator("clip.select_circle")
+        layout.operator("clip.select_all"
+                        ).action = 'TOGGLE'
+        layout.operator("clip.select_all",
+                        text="Inverse").action = 'INVERT'
 
-            layout.separator()
+        layout.menu("CLIP_MT_select_grouped")
 
-            layout.operator("clip.select_all"
-                            ).action = 'TOGGLE'
-            layout.operator("clip.select_all",
-                            text="Inverse").action = 'INVERT'
 
-            layout.menu("CLIP_MT_select_grouped")
-
-
 class CLIP_MT_select_grouped(Menu):
     bl_label = "Select Grouped"
 
@@ -1186,5 +1129,48 @@
 
         layout.operator("clip.stabilize_2d_select")
 
+
+# -----------------------------------------------------------------------------
+# Mask (similar code in space_image.py, keep in sync)
+
+
+from bl_ui.properties_mask_common import (MASK_PT_mask,
+                                          MASK_PT_layers,
+                                          MASK_PT_spline,
+                                          MASK_PT_point,
+                                          MASK_PT_display,
+                                          MASK_PT_tools)
+
+
+class CLIP_PT_mask(MASK_PT_mask, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+
+
+class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+
+
+class CLIP_PT_mask_display(MASK_PT_display, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+
+
+class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+
+
+class CLIP_PT_active_mask_point(MASK_PT_point, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+
+class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+
+# --- end mask ---
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)

Modified: trunk/blender/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_image.py	2012-07-25 13:09:20 UTC (rev 49205)
+++ trunk/blender/release/scripts/startup/bl_ui/space_image.py	2012-07-25 13:44:07 UTC (rev 49206)
@@ -27,7 +27,7 @@
     bl_region_type = 'UI'
 
 
-class BrushButtonsPanel():
+class BrushButtonsPanel:
     bl_space_type = 'IMAGE_EDITOR'
     bl_region_type = 'UI'
 
@@ -849,5 +849,48 @@
             col.prop(toolsettings, "uv_relax_method")
 
 
+
+# -----------------------------------------------------------------------------
+# Mask (similar code in space_clip.py, keep in sync)
+# note! - panel placement does _not_ fit well with image panels... need to fix
+
+from bl_ui.properties_mask_common import (MASK_PT_mask,
+                                          MASK_PT_layers,
+                                          MASK_PT_spline,
+                                          MASK_PT_point,
+                                          MASK_PT_display,
+                                          MASK_PT_tools)
+
+
+class IMAGE_PT_mask(MASK_PT_mask, Panel):
+    bl_space_type = 'IMAGE_EDITOR'
+    bl_region_type = 'PREVIEW'
+
+
+class IMAGE_PT_mask_layers(MASK_PT_layers, Panel):
+    bl_space_type = 'IMAGE_EDITOR'
+    bl_region_type = 'PREVIEW'
+
+
+class IMAGE_PT_mask_display(MASK_PT_display, Panel):
+    bl_space_type = 'IMAGE_EDITOR'
+    bl_region_type = 'PREVIEW'
+
+
+class IMAGE_PT_active_mask_spline(MASK_PT_spline, Panel):
+    bl_space_type = 'IMAGE_EDITOR'
+    bl_region_type = 'PREVIEW'
+
+
+class IMAGE_PT_active_mask_point(MASK_PT_point, Panel):
+    bl_space_type = 'IMAGE_EDITOR'
+    bl_region_type = 'PREVIEW'
+
+class IMAGE_PT_tools_mask(MASK_PT_tools, Panel):
+    bl_space_type = 'IMAGE_EDITOR'
+    bl_region_type = 'UI'  # is 'TOOLS' in the clip editor
+
+# --- end mask ---
+
 if __name__ == "__main__":  # only for live edit.

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list