[Bf-blender-cvs] [8abecb7] GPencil_EditStrokes: GPencil UI: Experimental "tool palette" pie menu

Joshua Leung noreply at git.blender.org
Sat Oct 11 15:54:12 CEST 2014


Commit: 8abecb7a5020e81d3672c94518c8f31bc697cc40
Author: Joshua Leung
Date:   Sun Oct 12 02:54:01 2014 +1300
Branches: GPencil_EditStrokes
https://developer.blender.org/rB8abecb7a5020e81d3672c94518c8f31bc697cc40

GPencil UI: Experimental "tool palette" pie menu

Double-tapping D brings up a pie menu providing access to many of the different
Grease Pencil drawing and editing tools.

The current implementation is a quick test of how this could work.
* Double-tapping D is the best compromise I managed to find so far which allows
  the pie to show, but without getting triggered everytime something else happens
* I've left off one or two tools since they didn't work terribly well,
  as they rely on mouse position at time of invocation
* Even now, the drawing tools take a little getting used to (i.e. you must immediately
  start drawing once you click. But, once gotten used to, it seems to be ok...

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	source/blender/editors/gpencil/gpencil_ops.c

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

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 5bda423..196beb2 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -19,6 +19,10 @@
 # <pep8 compliant>
 
 
+import bpy
+from bpy.types import Menu
+
+
 class GreasePencilPanel():
     # subclass must set
     # bl_space_type = 'IMAGE_EDITOR'
@@ -73,3 +77,49 @@ class GreasePencilPanel():
 
             col.label(text="Measure:")
             col.operator("view3d.ruler")
+
+
+###############################
+
+
+class GPENCIL_PIE_tool_palette(Menu):
+    """A pie menu for quick access to Grease Pencil tools"""
+    bl_label = "Grease Pencil Tools"
+
+    def draw(self, context):
+        layout = self.layout
+
+        pie = layout.menu_pie()
+
+        # W - Drawing Settings
+        col = pie.column()
+        col.operator("gpencil.draw", text="Draw", icon='GREASEPENCIL').mode = 'DRAW'
+        col.operator("gpencil.draw", text="Straight Lines", icon='LINE_DATA').mode = 'DRAW_STRAIGHT'
+        col.operator("gpencil.draw", text="Poly", icon='MESH_DATA').mode = 'DRAW_POLY'
+
+        # E - Eraser
+        # XXX: needs a dedicated icon...
+        pie.operator("gpencil.draw", text="Eraser", icon='FORCE_CURVE').mode = 'ERASER'
+
+        # Editing tools
+        if context.editable_gpencil_strokes:
+            # S - Select
+            col = pie.column()
+            col.operator("gpencil.select_all", text="Select All", icon='PARTICLE_POINT')
+            col.operator("gpencil.select_circle", text="Circle Select", icon='META_EMPTY')
+            #col.operator("gpencil.select", text="Stroke Under Mouse").entire_strokes = True
+
+            # N - Move
+            pie.operator("transform.translate", icon='MAN_TRANS').gpencil_strokes = True
+
+            # NW - Rotate
+            pie.operator("transform.rotate", icon='MAN_ROT').gpencil_strokes = True
+
+            # NE - Scale
+            pie.operator("transform.resize", text="Scale", icon='MAN_SCALE').gpencil_strokes = True
+
+            # SW - Copy
+            pie.operator("gpencil.strokes_duplicate", text="Copy...", icon='PARTICLE_PATH')
+
+            # SE - Mirror?  (Best would be to do Settings here...)
+            pie.operator("transform.mirror", text="Mirror", icon='MOD_MIRROR').gpencil_strokes = True
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index c4e6d86..7b0710a 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -108,6 +108,11 @@ void ED_keymap_gpencil(wmKeyConfig *keyconf)
 	
 	kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, 0, DKEY);
 	RNA_boolean_set(kmi->ptr, "gpencil_strokes", true);
+	
+	
+	/* Pie Menu */
+	/* XXX: This is currently still experimental! */
+	WM_keymap_add_menu_pie(keymap, "GPENCIL_PIE_tool_palette", DKEY, KM_DBL_CLICK, 0, 0);
 }
 
 /* ****************************************** */




More information about the Bf-blender-cvs mailing list