[Bf-blender-cvs] [f94c969] GPencil_EditStrokes: GPencil Toolshelf Panels - Split into two panels

Joshua Leung noreply at git.blender.org
Sun Oct 12 06:37:57 CEST 2014


Commit: f94c969193b812ff6db69c25758584efae67fd09
Author: Joshua Leung
Date:   Sun Oct 12 17:33:26 2014 +1300
Branches: GPencil_EditStrokes
https://developer.blender.org/rBf94c969193b812ff6db69c25758584efae67fd09

GPencil Toolshelf Panels - Split into two panels

* Split Grease Pencil toolshelf panels into 2: One for drawing tools, and the
  other for the new stroke-editing tools

* Added support for Grease Pencil toolshelf panels in Node Editor. As this gets
  added before all the other bits and pieces, this currently becomes the first
  tab in the menu (which is not what we want). This will do for now, since I'm not
  sure what alternatives to doing it this way exist.

===================================================================

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/space_clip.py
M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_node.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 2b94147..b48e4aa 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -23,11 +23,13 @@ import bpy
 from bpy.types import Menu
 
 
-class GreasePencilPanel():
+class GreasePencilDrawingToolsPanel():
     # subclass must set
     # bl_space_type = 'IMAGE_EDITOR'
     # bl_region_type = 'TOOLS'
     bl_label = "Grease Pencil"
+    bl_category = "Grease Pencil"
+    bl_region_type = 'TOOLS'
 
     @staticmethod
     def draw(self, context):
@@ -66,13 +68,28 @@ class GreasePencilPanel():
                 row.active = gpd.draw_mode in ('SURFACE', 'STROKE')
                 row.prop(gpd, "use_stroke_endpoints")
 
+        if context.space_data.type == 'VIEW_3D':
+            col.separator()
+            col.separator()
+
+            col.label(text="Measure:")
+            col.operator("view3d.ruler")
+
+
+class GreasePencilStrokeEditPanel():
+    # subclass must set
+    # bl_space_type = 'IMAGE_EDITOR'
+    bl_label = "Stroke Tools"
+    bl_category = "Grease Pencil"
+    bl_region_type = 'TOOLS'
 
-        # TODO: use a separate panel for these?
-        layout.separator()
+    @staticmethod
+    def draw(self, context):
+        layout = self.layout
 
         col = layout.column(align=True)
 
-        col.label(text="Select Strokes:")
+        col.label(text="Select:")
         subcol = col.column(align=True)
         subcol.active = bool(context.editable_gpencil_strokes)
         subcol.operator("gpencil.select_all", text="Select All")
@@ -80,7 +97,7 @@ class GreasePencilPanel():
 
         col.separator()
 
-        col.label(text="Edit Strokes:")
+        col.label(text="Edit:")
         subcol = col.column(align=True)
         subcol.active = bool(context.editable_gpencil_strokes)
         subcol.operator("gpencil.strokes_duplicate", text="Duplicate")
@@ -94,13 +111,6 @@ class GreasePencilPanel():
         subcol.operator("transform.rotate").gpencil_strokes = True      # icon='MAN_ROT'
         subcol.operator("transform.resize", text="Scale").gpencil_strokes = True      # icon='MAN_SCALE'
 
-        if context.space_data.type == 'VIEW_3D':
-            col.separator()
-            col.separator()
-
-            col.label(text="Measure:")
-            col.operator("view3d.ruler")
-
 
 ###############################
 
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 3382633..371f210 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -21,7 +21,10 @@
 import bpy
 from bpy.types import Panel, Header, Menu, UIList
 from bpy.app.translations import pgettext_iface as iface_
-from bl_ui.properties_grease_pencil_common import GreasePencilPanel
+from bl_ui.properties_grease_pencil_common import (
+        GreasePencilDrawingToolsPanel,
+        GreasePencilStrokeEditPanel
+        )
 
 
 class CLIP_UL_tracking_objects(UIList):
@@ -1050,10 +1053,14 @@ class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
 # --- end mask ---
 
 
-class CLIP_PT_tools_grease_pencil(GreasePencilPanel, Panel):
+# Grease Pencil drawing tools
+class CLIP_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+
+
+# Grease Pencil stroke editing tools
+class CLIP_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
     bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'TOOLS'
-    bl_category = "Grease Pencil"
 
 
 class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 927e517..83cfd8c 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -25,7 +25,10 @@ from bl_ui.properties_paint_common import (
         brush_texpaint_common,
         brush_mask_texture_settings,
         )
-from bl_ui.properties_grease_pencil_common import GreasePencilPanel
+from bl_ui.properties_grease_pencil_common import (
+        GreasePencilDrawingToolsPanel,
+        GreasePencilStrokeEditPanel
+        )
 from bpy.app.translations import pgettext_iface as iface_
 
 
@@ -1142,10 +1145,14 @@ class IMAGE_PT_scope_sample(Panel):
         sub.prop(sima.scopes, "accuracy")
 
 
-class IMAGE_PT_tools_grease_pencil(GreasePencilPanel, Panel):
+# Grease Pencil drawing tools
+class IMAGE_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
+    bl_space_type = 'IMAGE_EDITOR'
+
+
+# Grease Pencil stroke editing tools
+class IMAGE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
     bl_space_type = 'IMAGE_EDITOR'
-    bl_region_type = 'TOOLS'
-    bl_category = "Grease Pencil"
 
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 24e8d2e..0c844af 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -19,6 +19,10 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Header, Menu, Panel
+from bl_ui.properties_grease_pencil_common import (
+        GreasePencilDrawingToolsPanel,
+        GreasePencilStrokeEditPanel
+        )
 
 
 class NODE_HT_header(Header):
@@ -437,6 +441,19 @@ class NODE_UL_interface_sockets(bpy.types.UIList):
             layout.alignment = 'CENTER'
             layout.template_node_socket(color)
 
+# Tool Shelf ------------------
+
+
+# Grease Pencil drawing tools
+class NODE_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
+    bl_space_type = 'NODE_EDITOR'
+
+
+# Grease Pencil stroke editing tools
+class NODE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
+    bl_space_type = 'NODE_EDITOR'
+
+# -----------------------------
 
 def node_draw_tree_view(layout, context):
     pass
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 1969572..122d7eb 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -19,7 +19,10 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Menu, Panel, UIList
-from bl_ui.properties_grease_pencil_common import GreasePencilPanel
+from bl_ui.properties_grease_pencil_common import (
+        GreasePencilDrawingToolsPanel,
+        GreasePencilStrokeEditPanel
+        )
 from bl_ui.properties_paint_common import (
         UnifiedPaintPanel,
         brush_texture_settings,
@@ -1113,7 +1116,7 @@ class VIEW3D_PT_stencil_projectpaint(View3DPanel, Panel):
         col.label("Image")
         row = col.row(align=True)
         row.template_ID(ipaint, "stencil_image")
- 
+
         col.label("Visualization")
         row = col.row(align=True)
         row.prop(ipaint, "stencil_color", text="")
@@ -1745,11 +1748,14 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
             sub.prop(pe, "fade_frames", slider=True)
 
 
-# Grease Pencil tools
-class VIEW3D_PT_tools_grease_pencil(GreasePencilPanel, Panel):
+# Grease Pencil drawing tools
+class VIEW3D_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
+    bl_space_type = 'VIEW_3D'
+
+
+# Grease Pencil stroke editing tools
+class VIEW3D_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
     bl_space_type = 'VIEW_3D'
-    bl_region_type = 'TOOLS'
-    bl_category = "Grease Pencil"
 
 
 # Note: moved here so that it's always in last position in 'Tools' panels!




More information about the Bf-blender-cvs mailing list