Tools: Add Selection tools to Texture Paint toolbar when Face Selection is enabled.
authorWilliam Reynish <billrey@me.com>
Mon, 11 Mar 2019 12:45:15 +0000 (13:45 +0100)
committerWilliam Reynish <billrey@me.com>
Mon, 11 Mar 2019 12:45:15 +0000 (13:45 +0100)
Consistent with the other paint modes.

release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

index 5e77d9c8fb9a4b24d612be25f59a0496d368f9b8..5940a3f70d795729eca7450832887c6065d99350 100644 (file)
@@ -923,6 +923,12 @@ class _defs_vertex_paint:
 
 class _defs_texture_paint:
 
+    @staticmethod
+    def poll_select_mask(context):
+        ob = context.active_object
+        return (ob.type == 'MESH' and
+                (ob.data.use_paint_mask))
+
     @staticmethod
     def generate_from_brushes(context):
         return generate_from_enum_ex(
@@ -1717,6 +1723,12 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
         ],
         'PAINT_TEXTURE': [
             _defs_texture_paint.generate_from_brushes,
+            None,
+            lambda context: (
+                VIEW3D_PT_tools_active._tools_select
+                if _defs_texture_paint.poll_select_mask(context)
+                else ()
+            ),
         ],
         'PAINT_VERTEX': [
             _defs_vertex_paint.generate_from_brushes,