Commit: d4b7d488ffa8811fe4247c5d5a268702a64d57c2
Author: Antonio Vazquez
Date:   Wed Jul 11 13:26:20 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBd4b7d488ffa8811fe4247c5d5a268702a64d57c2

Fix error in toolbar for mesh modes

The category array must be shared.

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

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 11287e1068e..8bb96a4880a 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -38,52 +38,43 @@ def generate_from_brushes_ex(
         brush_test_attr,
         brush_category_attr,
         brush_category_layout,
-):
-    # Categories
-    brush_categories = {}
-    for brush in context.blend_data.brushes:
-        if getattr(brush, brush_test_attr):
-            category = getattr(brush, brush_category_attr)
-            name = brush.name
-            brush_categories.setdefault(category, []).append(
-                ToolDef.from_dict(
-                    dict(
-                        text=name,
-                        icon=icon_prefix + category.lower(),
-                        data_block=name,
-                    )
-                )
-            )
-
-
-def generate_from_brushes_gpencil(
-    context, *,
-    icon_prefix,
-    brush_test_attr,
-    brush_category_attr,
-    brush_category_layout,
 ):
     def draw_settings(context, layout, tool):
         _defs_gpencil_paint.draw_settings_common(context, layout, tool)
 
     # Categories
     brush_categories = {}
-    for brush in context.blend_data.brushes:
-        if getattr(brush, brush_test_attr):
-            category = getattr(brush.gpencil_settings, brush_category_attr)
-            name = brush.name
-            brush_categories.setdefault(category, []).append(
-                ToolDef.from_dict(
-                    dict(
-                        text=name,
-                        icon=icon_prefix + category.lower().replace(" ", "_"),
-                        data_block=name,
-                        widget=None,
-                        operator="gpencil.draw",
-                        draw_settings=draw_settings,
+    if context.mode != 'GPENCIL_PAINT':
+        for brush in context.blend_data.brushes:
+            if getattr(brush, brush_test_attr):
+                category = getattr(brush, brush_category_attr)
+                name = brush.name
+                brush_categories.setdefault(category, []).append(
+                    ToolDef.from_dict(
+                        dict(
+                            text=name,
+                            icon=icon_prefix + category.lower(),
+                            data_block=name,
+                        )
+                    )
+                )
+    else:
+        for brush in context.blend_data.brushes:
+            if getattr(brush, brush_test_attr):
+                category = getattr(brush.gpencil_settings, brush_category_attr)
+                name = brush.name
+                brush_categories.setdefault(category, []).append(
+                    ToolDef.from_dict(
+                        dict(
+                            text=name,
+                            icon=icon_prefix + category.lower().replace(" ", 
"_"),
+                            data_block=name,
+                            widget=None,
+                            operator="gpencil.draw",
+                            draw_settings=draw_settings,
+                        )
                     )
                 )
-            )
 
     def tools_from_brush_group(groups):
         assert(type(groups) is tuple)
@@ -998,7 +989,7 @@ class _defs_gpencil_paint:
 
     @staticmethod
     def generate_from_brushes(context):
-        return generate_from_brushes_gpencil(
+        return generate_from_brushes_ex(
             context,
             icon_prefix="brush.gpencil.",
             brush_test_attr="use_paint_grease_pencil",

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to