[Bf-blender-cvs] [84a1b8c] GPencil_EditStrokes: Reshuffling of extra tool settings

Joshua Leung noreply at git.blender.org
Thu Nov 27 14:49:21 CET 2014


Commit: 84a1b8c179b0639575f2f092e167d3e01fac5639
Author: Joshua Leung
Date:   Thu Nov 27 14:44:19 2014 +1300
Branches: GPencil_EditStrokes
https://developer.blender.org/rB84a1b8c179b0639575f2f092e167d3e01fac5639

Reshuffling of extra tool settings

Previously it was necessary to expose the editmode and stroke placement settings
at the bottom of the settings panel when it was displayed in the Sequencer, as
the sequencer doesn't have a toolbar for hosting those settings.

This commit moves those out into a separate panel, which can be included in other
editors too. This applies to editors which have a toolshelf for displaying these
settings too (e.g. nodes editor), where the toolshelf is often collapsed, making it
valuable to be able to set these settings from more than one place.

(While not great from a long-term standpoint, such duplication is a "good enough"
solution in the meantime, until we figure out a better solution)

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/space_node.py
M	release/scripts/startup/bl_ui/space_sequencer.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 0492ffc..7619683 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -252,19 +252,6 @@ class GreasePencilDataPanel():
         if gpd:
             self.draw_layers(context, layout, gpd)
 
-            # only sequencer doesn't have a toolbar to show these settings in,
-            # so only show this for the sequencer...
-            if context.space_data.type == 'SEQUENCE_EDITOR':
-                layout.separator()
-                layout.separator()
-
-                layout.prop(gpd, "use_stroke_edit_mode", text="Enable Stroke Editing", icon='EDIT', toggle=True)
-
-                layout.separator()
-                layout.separator()
-
-                gpencil_stroke_placement_settings(context, layout, gpd)
-
     def draw_layers(self, context, layout, gpd):
         row = layout.row()
 
@@ -360,3 +347,28 @@ class GreasePencilDataPanel():
         row.active = gpl.use_ghost_custom_colors
         row.prop(gpl, "after_color", text="")
         sub.prop(gpl, "ghost_after_range", text="After")
+
+
+class GreasePencilToolsPanel():
+    # subclass must set
+    # bl_space_type = 'IMAGE_EDITOR'
+    # bl_options = {'DEFAULT_CLOSED'}
+    bl_label = "Grease Pencil Settings"
+    bl_region_type = 'UI'
+
+    @classmethod
+    def poll(cls, context):
+        return (context.gpencil_data is not None)
+
+    @staticmethod
+    def draw(self, context):
+        layout = self.layout
+
+        gpd_owner = context.gpencil_data_owner
+        gpd = context.gpencil_data
+
+        layout.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True)
+
+        layout.separator()
+
+        gpencil_stroke_placement_settings(context, layout, gpd)
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 5351603..4cc72f1 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -23,6 +23,7 @@ from bl_ui.properties_grease_pencil_common import (
         GreasePencilDrawingToolsPanel,
         GreasePencilStrokeEditPanel,
         GreasePencilDataPanel,
+        GreasePencilToolsPanel,
         )
 
 
@@ -456,17 +457,30 @@ class NODE_PT_grease_pencil(GreasePencilDataPanel, Panel):
         snode = context.space_data
         return snode is not None and snode.node_tree is not None
 
+
+class NODE_PT_grease_pencil_tools(GreasePencilToolsPanel, Panel):
+    bl_space_type = 'NODE_EDITOR'
+    bl_region_type = 'UI'
+    bl_options = {'DEFAULT_CLOSED'}
+
+    # NOTE: this is just a wrapper around the generic GP tools panel
+	# It contains access to some essential tools usually found only in
+	# toolbar, but which may not necessarily be open
+
+
 # Tool Shelf ------------------
 
 
 # Grease Pencil drawing tools
 class NODE_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
     bl_space_type = 'NODE_EDITOR'
+    bl_region_type = 'TOOLS'
 
 
 # Grease Pencil stroke editing tools
 class NODE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
     bl_space_type = 'NODE_EDITOR'
+    bl_region_type = 'TOOLS'
 
 # -----------------------------
 
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 7fb40f5..3f6066f 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -19,7 +19,7 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Header, Menu, Panel
-from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel
+from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel, GreasePencilToolsPanel
 from bpy.app.translations import pgettext_iface as iface_
 
 
@@ -1026,5 +1026,14 @@ class SEQUENCER_PT_grease_pencil(GreasePencilDataPanel, SequencerButtonsPanel_Ou
     # But, it should only show up when there are images in the preview region
 
 
+class SEQUENCER_PT_grease_pencil_tools(GreasePencilToolsPanel, SequencerButtonsPanel_Output, Panel):
+    bl_space_type = 'SEQUENCE_EDITOR'
+    bl_region_type = 'UI'
+
+    # NOTE: this is just a wrapper around the generic GP tools panel
+	# It contains access to some essential tools usually found only in
+	# toolbar, which doesn't exist here...
+
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)




More information about the Bf-blender-cvs mailing list