[Bf-blender-cvs] [54a13da1b11] blender2.8: Tool System: only show select tool w/ paint mask

Campbell Barton noreply at git.blender.org
Wed Aug 29 08:20:22 CEST 2018


Commit: 54a13da1b11cbf954a30303e3f9a1286863b3bb3
Author: Campbell Barton
Date:   Wed Aug 29 16:21:48 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB54a13da1b11cbf954a30303e3f9a1286863b3bb3

Tool System: only show select tool w/ paint mask

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index bab751e496d..0ae2ea66688 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1009,6 +1009,11 @@ class _defs_sculpt:
 
 class _defs_vertex_paint:
 
+    @staticmethod
+    def poll_select_mask(context):
+        mesh = context.object.data
+        return mesh.use_paint_mask
+
     @staticmethod
     def generate_from_brushes(context):
         return generate_from_brushes_ex(
@@ -1052,6 +1057,11 @@ class _defs_texture_paint:
 
 class _defs_weight_paint:
 
+    @staticmethod
+    def poll_select_mask(context):
+        mesh = context.object.data
+        return (mesh.use_paint_mask or mesh.use_paint_mask_vertex)
+
     @staticmethod
     def generate_from_brushes(context):
         return generate_from_brushes_ex(
@@ -1731,6 +1741,12 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
         ],
         'PAINT_VERTEX': [
             _defs_vertex_paint.generate_from_brushes,
+            None,
+            lambda context: (
+                VIEW3D_PT_tools_active._tools_select
+                if _defs_vertex_paint.poll_select_mask(context)
+                else ()
+            ),
         ],
         'PAINT_WEIGHT': [
             # TODO, check for mixed pose mode
@@ -1740,8 +1756,11 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
             _defs_weight_paint.sample_weight,
             _defs_weight_paint.sample_weight_group,
             None,
-            # TODO, override brush events
-            *_tools_select,
+            lambda context: (
+                VIEW3D_PT_tools_active._tools_select
+                if _defs_weight_paint.poll_select_mask(context)
+                else ()
+            ),
             None,
             _defs_weight_paint.gradient,
         ],



More information about the Bf-blender-cvs mailing list