[Bf-blender-cvs] [0050fc1cb53] greasepencil-object: UI: Improve brush toolbar
Antonio Vazquez
noreply at git.blender.org
Mon Jul 23 20:27:29 CEST 2018
Commit: 0050fc1cb53cc59dd711bbe650bb1a5afdaccba3
Author: Antonio Vazquez
Date: Mon Jul 23 20:27:20 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0050fc1cb53cc59dd711bbe650bb1a5afdaccba3
UI: Improve brush toolbar
This is a temp solution to show all brushes and sort by use, not alphabetical.
This will be replace when new tool bar system is in place.
===================================================================
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 ca276d978ed..9eef7265a56 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -59,35 +59,41 @@ def generate_from_brushes_ex(
)
)
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
- if name.startswith("Draw "):
- text = name.replace("Draw ", "")
- icon_name = brush.name.lower().replace(" ", "_")
- elif name.startswith("Eraser "):
- text = name.replace("Eraser ", "")
- icon_name = "draw." + brush.name.lower().replace(" ", "_")
- elif name.startswith("Fill "):
- text = name.replace(" Area", "")
- icon_name = "draw_fill"
- else:
- text = name
- icon_name = "draw_pencil"
-
- brush_categories.setdefault(category, []).append(
- ToolDef.from_dict(
- dict(
- text=text,
- icon=icon_prefix + icon_name,
- data_block=name,
- widget=None,
- operator="gpencil.draw",
- draw_settings=draw_settings,
+ for e in brush_category_layout:
+ main_brush = context.blend_data.brushes[e[0]]
+
+ for brush in context.blend_data.brushes:
+ if brush.name.startswith(main_brush.name) and getattr(brush, brush_test_attr):
+ category = getattr(brush.gpencil_settings, brush_category_attr)
+ name = brush.name
+ if name.startswith("Draw "):
+ text = name.replace("Draw ", "")
+ icon_name = brush.name.lower().replace(" ", "_")
+ elif name.startswith("Eraser "):
+ text = name.replace("Eraser ", "")
+ icon_name = "draw." + brush.name.lower().replace(" ", "_")
+ elif name.startswith("Fill "):
+ text = name.replace(" Area", "")
+ icon_name = "draw_fill"
+ else:
+ text = name
+ icon_name = "draw_pencil"
+
+ if icon_name[-4:-3] == '.':
+ icon_name = icon_name[:-4]
+
+ brush_categories.setdefault(category, []).append(
+ ToolDef.from_dict(
+ dict(
+ text=text,
+ icon=icon_prefix + icon_name,
+ data_block=name,
+ widget=None,
+ operator="gpencil.draw",
+ draw_settings=draw_settings,
+ )
)
)
- )
def tools_from_brush_group(groups):
assert(type(groups) is tuple)
More information about the Bf-blender-cvs
mailing list