[Bf-blender-cvs] [9d976a4] blender-v2.78-release: GPencil D+W Pie: Don't show editing operators when not in editmode

Joshua Leung noreply at git.blender.org
Thu Sep 22 11:15:32 CEST 2016


Commit: 9d976a4f7adfd6b50ca68630f02d69b78762dede
Author: Joshua Leung
Date:   Wed Sep 21 15:06:39 2016 +1200
Branches: blender-v2.78-release
https://developer.blender.org/rB9d976a4f7adfd6b50ca68630f02d69b78762dede

GPencil D+W Pie: Don't show editing operators when not in editmode

These operators only operate on the selected strokes, but when not in editmode,
stroke vertices are not shown.

Safe for 2.78

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.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 e42f726..318ba64 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -473,11 +473,13 @@ class GPENCIL_PIE_settings_palette(Menu):
         layout = self.layout
 
         pie = layout.menu_pie()
-        # gpd = context.gpencil_data
+        gpd = context.gpencil_data
         gpl = context.active_gpencil_layer
         palcolor = context.active_gpencil_palettecolor
         brush = context.active_gpencil_brush
 
+        is_editmode = bool(gpd and gpd.use_stroke_edit_mode and context.editable_gpencil_strokes)
+
         # W - Stroke draw settings
         col = pie.column(align=True)
         if palcolor is not None:
@@ -510,32 +512,33 @@ class GPENCIL_PIE_settings_palette(Menu):
         row.prop(gpl, "hide")
         col.prop(gpl, "use_onion_skinning")
 
-        # NW - Move stroke Down
-        col = pie.column(align=True)
-        col.label("Arrange Strokes")
-        col.operator("gpencil.stroke_arrange", text="Send to Back").direction = 'BOTTOM'
-        col.operator("gpencil.stroke_arrange", text="Send Backward").direction = 'DOWN'
-
-        # NE - Move stroke Up
-        col = pie.column(align=True)
-        col.label("Arrange Strokes")
-        col.operator("gpencil.stroke_arrange", text="Bring to Front").direction = 'TOP'
-        col.operator("gpencil.stroke_arrange", text="Bring Forward").direction = 'UP'
-
-        # SW - Move stroke to color
-        col = pie.column(align=True)
-        col.operator("gpencil.stroke_change_color", text="Move to Color")
+        # NW/NE/SW/SE - These operators are only available in editmode
+        # as they require strokes to be selected to work
+        if is_editmode:
+            # NW - Move stroke Down
+            col = pie.column(align=True)
+            col.label("Arrange Strokes")
+            col.operator("gpencil.stroke_arrange", text="Send to Back").direction = 'BOTTOM'
+            col.operator("gpencil.stroke_arrange", text="Send Backward").direction = 'DOWN'
+
+            # NE - Move stroke Up
+            col = pie.column(align=True)
+            col.label("Arrange Strokes")
+            col.operator("gpencil.stroke_arrange", text="Bring to Front").direction = 'TOP'
+            col.operator("gpencil.stroke_arrange", text="Bring Forward").direction = 'UP'
+
+            # SW - Move stroke to color
+            col = pie.column(align=True)
+            col.operator("gpencil.stroke_change_color", text="Move to Color")
+
+            # SE - Join strokes
+            col = pie.column(align=True)
+            col.label("Join Strokes")
+            row = col.row()
+            row.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
+            row.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY'
+            col.operator("gpencil.stroke_flip", text="Flip direction")
 
-        # SE - Join strokes
-        col = pie.column(align=True)
-        col.label("Join Strokes")
-        row = col.row()
-        row.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
-        row.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY'
-        col.operator("gpencil.stroke_flip", text="Flip direction")
-
-        gpd = context.gpencil_data
-        if gpd:
             col.prop(gpd, "show_stroke_direction", text="Show drawing direction")




More information about the Bf-blender-cvs mailing list