Fix brush menu broken before adding uv and texture data
authorAaron Carlisle <carlisle.b3d@gmail.com>
Tue, 18 Apr 2017 03:42:17 +0000 (23:42 -0400)
committerAaron Carlisle <carlisle.b3d@gmail.com>
Tue, 18 Apr 2017 03:42:17 +0000 (23:42 -0400)
To reproduce: 1) go to texture paint mode 2) go into the brush menu

Pointed out by @lijenstina on IRC also fix is authored by him.

release/scripts/startup/bl_ui/space_view3d.py

index f13c7095f67718f4b9eb98571adb7794dd4681ee..9245def7473244fc80e5f20d708a3551413cacc3 100644 (file)
@@ -1699,7 +1699,7 @@ class VIEW3D_MT_brush(Menu):
         layout = self.layout
 
         settings = UnifiedPaintPanel.paint_settings(context)
-        brush = settings.brush
+        brush = getattr(settings, "brush", None)
 
         ups = context.tool_settings.unified_paint_settings
         layout.prop(ups, "use_unified_size", text="Unified Size")
@@ -1708,6 +1708,11 @@ class VIEW3D_MT_brush(Menu):
             layout.prop(ups, "use_unified_color", text="Unified Color")
         layout.separator()
 
+        # skip if no active brush
+        if not brush:
+            layout.label(text="No Brushes currently available", icon="INFO")
+            return
+
         # brush paint modes
         layout.menu("VIEW3D_MT_brush_paint_modes")
 
@@ -1720,10 +1725,6 @@ class VIEW3D_MT_brush(Menu):
         elif context.vertex_paint_object or context.weight_paint_object:
             layout.prop_menu_enum(brush, "vertex_tool")
 
-        # skip if no active brush
-        if not brush:
-            return
-
         # TODO: still missing a lot of brush options here
 
         # sculpt options