[Bf-blender-cvs] [7440144e2b3] master: GPencil: Hide selection tool in sculpt mode when mask is disabled

Matias Mendiola noreply at git.blender.org
Sat Aug 10 17:27:08 CEST 2019


Commit: 7440144e2b3836e3778cd5413cb1d1466878a6bf
Author: Matias Mendiola
Date:   Sat Aug 10 17:19:54 2019 +0200
Branches: master
https://developer.blender.org/rB7440144e2b3836e3778cd5413cb1d1466878a6bf

GPencil: Hide selection tool in sculpt mode when mask is disabled

The selection tool must be hidden if the sculpt mask is not enabled because these options are not usable in this mode.

Also, the Select tools have been moved to the bottom of the toolbar.

Now, the logic is similar to Meshes.

Differential Revision: http://developer.blender.org/D5452

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 13e9e5350b2..17e753d531f 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1502,6 +1502,15 @@ class _defs_gpencil_edit:
 
 class _defs_gpencil_sculpt:
 
+    @staticmethod
+    def poll_select_mask(context):
+        if context is None:
+            return True
+        ob = context.active_object
+        ts = context.scene.tool_settings
+        return (ob and ob.type == 'GPENCIL' and
+                (ts.gpencil_sculpt.use_select_mask))
+
     @staticmethod
     def generate_from_brushes(context):
         return generate_from_enum_ex(
@@ -2026,9 +2035,13 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
 
         ],
         'SCULPT_GPENCIL': [
-            *_tools_gpencil_select,
-            None,
             _defs_gpencil_sculpt.generate_from_brushes,
+            None,
+            lambda context: (
+                VIEW3D_PT_tools_active._tools_gpencil_select
+                if _defs_gpencil_sculpt.poll_select_mask(context)
+                else ()
+            ),
         ],
         'WEIGHT_GPENCIL': [
             _defs_gpencil_weight.generate_from_brushes,
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 65619ffd285..77e2938fd31 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -725,13 +725,15 @@ class VIEW3D_MT_editor_menus(Menu):
         mode_string = context.mode
         edit_object = context.edit_object
         gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}
+        ts = context.scene.tool_settings
 
         layout.menu("VIEW3D_MT_view")
 
         # Select Menu
         if gp_edit:
             if mode_string not in {'PAINT_GPENCIL', 'WEIGHT_GPENCIL'}:
-                layout.menu("VIEW3D_MT_select_gpencil")
+                if ts.gpencil_sculpt.use_select_mask:
+                    layout.menu("VIEW3D_MT_select_gpencil")
         elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
             mesh = obj.data
             if mesh.use_paint_mask:



More information about the Bf-blender-cvs mailing list