Fix: Color Picker and Color Palette panels were appearing for non-color tools in...
authorWilliam Reynish <billrey@me.com>
Tue, 19 Mar 2019 18:31:36 +0000 (19:31 +0100)
committerWilliam Reynish <billrey@me.com>
Tue, 19 Mar 2019 18:31:36 +0000 (19:31 +0100)
Use correct poll method for both modes

release/scripts/startup/bl_ui/space_view3d_toolbar.py

index aa7b37a..9d2a3f9 100644 (file)
@@ -403,9 +403,13 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel):
     def poll(self, context):
         settings = self.paint_settings(context)
         brush = settings.brush
-        capabilities = brush.image_paint_capabilities
+        if context.image_paint_object:
+            capabilities = brush.image_paint_capabilities
+
+        elif context.vertex_paint_object:
+            capabilities = brush.vertex_paint_capabilities
 
-        return capabilities.has_color and (context.image_paint_object or context.vertex_paint_object)
+        return capabilities.has_color
 
     def draw(self, context):
         layout = self.layout
@@ -427,9 +431,13 @@ class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel):
     def poll(self, context):
         settings = self.paint_settings(context)
         brush = settings.brush
-        capabilities = brush.image_paint_capabilities
+        if context.image_paint_object:
+            capabilities = brush.image_paint_capabilities
+
+        elif context.vertex_paint_object:
+            capabilities = brush.vertex_paint_capabilities
 
-        return capabilities.has_color and (context.image_paint_object or context.vertex_paint_object)
+        return capabilities.has_color
 
     def draw(self, context):
         layout = self.layout