[Bf-blender-cvs] [95cf2fb] GPencil_Editing_Stage3: GPencil Stroke EditMode: Replace 3D view menus when in stroke editmode

Joshua Leung noreply at git.blender.org
Sat Sep 19 14:10:46 CEST 2015


Commit: 95cf2fbc94cfd3ae2897261a0cb3b88c72e29925
Author: Joshua Leung
Date:   Sat Sep 19 17:38:46 2015 +1200
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rB95cf2fbc94cfd3ae2897261a0cb3b88c72e29925

GPencil Stroke EditMode: Replace 3D view menus when in stroke editmode

After playing around with the current workflow the other day, it became clear
that the current editing workflow could still do with some tweaks to be more
convenient.

* To make it less confusing/ambiguous what "mode" we're in when editing
  Grease Pencil strokes, and also to provide another way of seeing all
  the available operators, the Select and "Edit" menus in the 3D View
  header now show Grease Pencil specific lists of operators now.

* Also, added a quick-access button to the header to toggle onion skinning.
  Even with the Pie Menu and the Properties Panel, the existing ways of
  quickly toggling this aren't good enough.


TODO:
* The "Mode Selector" is now the next target to tweak. As Strokes EditMode is not
  a per-object setting, but rather, per GPencil datablock, this will be quite hairy
  to hack around.

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

M	release/scripts/startup/bl_ui/space_view3d.py

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index bb0ad00..d8e5fb9 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -118,6 +118,16 @@ class VIEW3D_HT_header(Header):
             row.operator("pose.paste", text="", icon='PASTEDOWN').flipped = False
             row.operator("pose.paste", text="", icon='PASTEFLIPDOWN').flipped = True
 
+        # GPencil
+        if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
+            row = layout.row(align=True)
+            row.operator("gpencil.copy", text="", icon='COPYDOWN')
+            row.operator("gpencil.paste", text="", icon='PASTEDOWN')
+
+            if context.active_gpencil_layer:
+                gpl = context.active_gpencil_layer
+                layout.prop(gpl, "use_onion_skinning", text="Onion Skins", icon='PARTICLE_PATH') # XXX: icon
+
 
 class VIEW3D_MT_editor_menus(Menu):
     bl_space_type = 'VIEW3D_MT_editor_menus'
@@ -131,11 +141,14 @@ class VIEW3D_MT_editor_menus(Menu):
         obj = context.active_object
         mode_string = context.mode
         edit_object = context.edit_object
+        gp_edit = context.gpencil_data and context.gpencil_data.use_stroke_edit_mode
 
         layout.menu("VIEW3D_MT_view")
 
         # Select Menu
-        if mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
+        if gp_edit:
+            layout.menu("VIEW3D_MT_select_gpencil")
+        elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
             mesh = obj.data
             if mesh.use_paint_mask:
                 layout.menu("VIEW3D_MT_select_paint_mask")
@@ -144,7 +157,9 @@ class VIEW3D_MT_editor_menus(Menu):
         elif mode_string != 'SCULPT':
             layout.menu("VIEW3D_MT_select_%s" % mode_string.lower())
 
-        if mode_string == 'OBJECT':
+        if gp_edit:
+            pass
+        elif mode_string == 'OBJECT':
             layout.menu("INFO_MT_add", text="Add")
         elif mode_string == 'EDIT_MESH':
             layout.menu("INFO_MT_mesh_add", text="Add")
@@ -157,7 +172,9 @@ class VIEW3D_MT_editor_menus(Menu):
         elif mode_string == 'EDIT_ARMATURE':
             layout.menu("INFO_MT_edit_armature_add", text="Add")
 
-        if edit_object:
+        if gp_edit:
+            layout.menu("VIEW3D_MT_edit_gpencil")
+        elif edit_object:
             layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
         elif obj:
             if mode_string != 'PAINT_TEXTURE':
@@ -883,6 +900,27 @@ class VIEW3D_MT_select_edit_armature(Menu):
         layout.operator("object.select_pattern", text="Select Pattern...")
 
 
+class VIEW3D_MT_select_gpencil(Menu):
+    bl_label = "Select"
+    
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("gpencil.select_border")
+        layout.operator("gpencil.select_circle")
+
+        layout.separator()
+
+        layout.operator("gpencil.select_all", text="(De)select All").action = 'TOGGLE'
+        layout.operator("gpencil.select_all", text="Inverse").action = 'INVERT'
+        layout.operator("gpencil.select_linked", text="Linked")
+
+        layout.separator()
+
+        layout.operator("gpencil.select_more")
+        layout.operator("gpencil.select_less")
+
+
 class VIEW3D_MT_select_paint_mask(Menu):
     bl_label = "Select"
 
@@ -2821,6 +2859,63 @@ class VIEW3D_MT_edit_armature_delete(Menu):
         layout.operator("armature.dissolve", text="Dissolve")
 
 
+# ********** GPencil Stroke Edit menu **********
+
+
+class VIEW3D_MT_edit_gpencil(Menu):
+    bl_label = "GPencil"
+    
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("ed.undo")
+        layout.operator("ed.redo")
+        layout.operator("ed.undo_history")
+
+        layout.separator()
+
+        layout.menu("VIEW3D_MT_edit_gpencil_transform")
+        layout.menu("VIEW3D_MT_object_animation")   # NOTE: provides keyingset access...
+       
+        layout.separator()
+
+        layout.menu("VIEW3D_MT_edit_gpencil_delete")
+        layout.operator("gpencil.duplicate_move", text="Duplicate")
+        layout.operator("transform.mirror", text="Mirror").gpencil_strokes = True
+
+        layout.separator()
+
+        layout.operator("gpencil.copy", text="Copy")
+        layout.operator("gpencil.paste", text="Paste")
+
+        layout.separator()
+
+        layout.operator("gpencil.reveal")
+        layout.operator("gpencil.hide", text="Show Active Layer Only").unselected = True
+        layout.operator("gpencil.hide", text="Hide Active Layer").unselected = False
+
+        layout.separator()
+
+        layout.operator("gpencil.convert", text="Convert to Geometry...")
+
+
+class VIEW3D_MT_edit_gpencil_transform(Menu):
+    bl_label = "Transform"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("transform.translate").gpencil_strokes = True
+        layout.operator("transform.rotate").gpencil_strokes = True
+        layout.operator("transform.resize", text="Scale").gpencil_strokes = True
+
+        layout.separator()
+
+        layout.operator("transform.bend", text="Bend").gpencil_strokes = True
+        layout.operator("transform.shear", text="Shear").gpencil_strokes = True
+        layout.operator("transform.tosphere", text="To Sphere").gpencil_strokes = True
+
+
 # ********** Panel **********




More information about the Bf-blender-cvs mailing list