[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47320] branches/soc-2011-tomato/release/ scripts/startup/bl_ui/space_clip.py: Initial expose of tools into interface for mask editing.

Sergey Sharybin sergey.vfx at gmail.com
Fri Jun 1 15:05:05 CEST 2012


Revision: 47320
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47320
Author:   nazgul
Date:     2012-06-01 13:05:05 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
Initial expose of tools into interface for mask editing.
Maybe no ideal, but looks better than completely empty panels.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2012-06-01 12:38:03 UTC (rev 47319)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2012-06-01 13:05:05 UTC (rev 47320)
@@ -44,9 +44,12 @@
 
                 sub.menu("CLIP_MT_clip")
 
-                if clip and sc.mode != 'MASKEDITING':
-                    sub.menu("CLIP_MT_track")
-                    sub.menu("CLIP_MT_reconstruction")
+                if clip:
+                    if sc.mode == 'MASKEDITING':
+                        sub.menu("CLIP_MT_mask")
+                    else:
+                        sub.menu("CLIP_MT_track")
+                        sub.menu("CLIP_MT_reconstruction")
 
         if sc.mode != 'MASKEDITING':
             layout.prop(sc, "view", text="", expand=True)
@@ -55,6 +58,14 @@
             if sc.view == 'CLIP':
                 layout.prop(sc, "mode", text="")
                 layout.prop(sc, "pivot_point", text="", icon_only=True)
+
+                if sc.mode == 'MASKEDITING':
+                    toolsettings = context.tool_settings
+
+                    row = layout.row(align=True)
+                    row.prop(toolsettings, "use_proportional_edit_mask", text="", icon_only=True)
+                    if toolsettings.use_proportional_edit_objects:
+                        row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
             elif sc.view == 'GRAPH':
                 row = layout.row(align=True)
 
@@ -75,15 +86,8 @@
         row.template_ID(sc, "clip", open='clip.open')
 
         if sc.mode == 'MASKEDITING':
-            toolsettings = context.tool_settings
-
             row = layout.row()
             row.template_ID(sc, "mask", new="mask.new")
-            
-            row = layout.row(align=True)
-            row.prop(toolsettings, "use_proportional_edit_mask", text="", icon_only=True)
-            if toolsettings.use_proportional_edit_objects:
-                row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
 
         if clip:
             tracking = clip.tracking
@@ -116,34 +120,34 @@
         return clip and sc.view == 'CLIP'
 
 
-class CLIP_PT_tracking_panel:
+class CLIP_PT_mask_view_panel:
 
     @classmethod
     def poll(cls, context):
         sc = context.space_data
         clip = sc.clip
 
-        return clip and sc.mode == 'TRACKING' and sc.view == 'CLIP'
+        return clip and sc.view == 'CLIP' and sc.mode == 'MASKEDITING'
 
 
-class CLIP_PT_reconstruction_panel:
+class CLIP_PT_tracking_panel:
 
     @classmethod
     def poll(cls, context):
         sc = context.space_data
         clip = sc.clip
 
-        return clip and sc.mode == 'RECONSTRUCTION' and sc.view == 'CLIP'
+        return clip and sc.mode == 'TRACKING' and sc.view == 'CLIP'
 
 
-class CLIP_PT_distortion_panel:
+class CLIP_PT_reconstruction_panel:
 
     @classmethod
     def poll(cls, context):
         sc = context.space_data
         clip = sc.clip
 
-        return clip and sc.mode == 'DISTORTION' and sc.view == 'CLIP'
+        return clip and sc.mode == 'RECONSTRUCTION' and sc.view == 'CLIP'
 
 
 class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
@@ -372,11 +376,51 @@
         col.prop(settings, "object_distance")
 
 
-class CLIP_PT_tools_grease_pencil(CLIP_PT_distortion_panel, Panel):
+class CLIP_PT_tools_mask(CLIP_PT_mask_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
+    bl_label = "Mask Tools"
+
+    def draw(self, context):
+        layout = self.layout
+
+        col = layout.column(align=True)
+        col.label(text="Transform:")
+        col.operator("transform.translate")
+        col.operator("transform.rotate")
+        col.operator("transform.resize", text="Scale")
+
+        col = layout.column(align=True)
+        col.label(text="Spline:")
+        col.operator("mask.delete")
+        col.operator("mask.cyclic_toggle")
+
+        col = layout.column(align=True)
+        col.label(text="Parenting:")
+        col.operator("mask.parent_set")
+        col.operator("mask.parent_clear")
+
+
+class CLIP_PT_tools_grease_pencil(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
     bl_label = "Grease Pencil"
 
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        if not clip:
+            return False
+
+        if sc.mode == 'DISTORTION':
+            return sc.view == 'CLIP'
+        elif sc.mode == 'MASKEDITING':
+            return True
+
+        return False
+
     def draw(self, context):
         layout = self.layout
 
@@ -591,7 +635,7 @@
         active = mask.layers.active
         if active:
             layout.prop(active, "name")
-            
+
             # blending
             row = layout.row(align=True)
             row.prop(active, "alpha")
@@ -718,12 +762,11 @@
             col.label(text="Display Aspect Ratio:")
             row = col.row()
             row.prop(clip, "display_aspect", text="")
-        
+
         if sc.mode == 'MASKEDITING':
             col = layout.column()
             col.prop(sc, "mask_draw_type", text="")
             col.prop(sc, "show_mask_smooth")
-            
 
 
 class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
@@ -900,6 +943,7 @@
             layout.operator("clip.open", icon='FILESEL')
 
 
+
 class CLIP_PT_tools_clip(CLIP_PT_clip_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
@@ -1079,18 +1123,28 @@
 
     def draw(self, context):
         layout = self.layout
+        sc = context.space_data
 
-        layout.operator("clip.select_border")
-        layout.operator("clip.select_circle")
+        if sc.mode == 'MASKEDITING':
+            layout.operator("mask.select_border")
+            layout.operator("mask.select_circle")
 
-        layout.separator()
+            layout.separator()
 
-        layout.operator("clip.select_all").action = 'TOGGLE'
-        layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
+            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.menu("CLIP_MT_select_grouped")
+            layout.separator()
 
+            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"
 
@@ -1132,6 +1186,54 @@
         props.action = 'UNLOCK'
 
 
+class CLIP_MT_mask(Menu):
+    bl_label = "Mask"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("mask.delete")
+
+        layout.separator()
+        layout.operator("mask.cyclic_toggle")
+
+        layout.separator()
+        layout.operator("mask.parent_clear")
+        layout.operator("mask.parent_set")
+
+        layout.separator()
+        layout.operator("mask.shape_key_clear")
+        layout.operator("mask.shape_key_insert")
+
+        layout.separator()
+        layout.menu("CLIP_MT_mask_visibility")
+        layout.menu("CLIP_MT_mask_transform")
+
+
+class CLIP_MT_mask_visibility(Menu):
+    bl_label = "Show/Hide"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("mask.hide_view_clear", text="Show Hidden")
+        layout.operator("mask.hide_view_set", text="Hide Selected")
+
+        props = layout.operator("mask.hide_view_set", text="Hide Unselected")
+        props.unselected = True
+
+
+class CLIP_MT_mask_transform(Menu):
+    bl_label = "Transform"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("transform.translate")
+        layout.operator("transform.rotate")
+        layout.operator("transform.resize")
+
+
 class CLIP_MT_camera_presets(Menu):
     """Predefined tracking camera intrinsics"""
     bl_label = "Camera Presets"




More information about the Bf-blender-cvs mailing list