Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Inch <mythologylover75@gmail.com>2022-04-10 08:10:26 +0300
committerRyan Inch <mythologylover75@gmail.com>2022-04-10 08:10:26 +0300
commit4d53ec76a3d8b0a72fcc7a795067a159ce6dcd2c (patch)
tree1cd5a61303596c2be0b8523db98ca0410ba6fbbd
parentc9fba919c2e17f940a6e4c2daa4a5dccc515f646 (diff)
space_view3d_brush_menus: Improve brush icon support.
- Brushes menu: print terminal warning and use fallback icon if tool/mode isn't supported yet. - Add icons for new sculpt mode tools to brushes menu.
-rw-r--r--space_view3d_brush_menus/__init__.py2
-rw-r--r--space_view3d_brush_menus/brush_menu.py6
-rw-r--r--space_view3d_brush_menus/brushes.py43
3 files changed, 38 insertions, 13 deletions
diff --git a/space_view3d_brush_menus/__init__.py b/space_view3d_brush_menus/__init__.py
index e5ab8d4d..92426744 100644
--- a/space_view3d_brush_menus/__init__.py
+++ b/space_view3d_brush_menus/__init__.py
@@ -6,7 +6,7 @@ bl_info = {
"name": "Dynamic Brush Menus",
"description": "Fast access to brushes & tools in Sculpt and Paint Modes",
"author": "Ryan Inch (Imaginer)",
- "version": (1, 1, 9),
+ "version": (1, 1, 10),
"blender": (2, 80, 0),
"location": "Spacebar in Sculpt/Paint Modes",
"warning": '',
diff --git a/space_view3d_brush_menus/brush_menu.py b/space_view3d_brush_menus/brush_menu.py
index c844316b..7f01c65d 100644
--- a/space_view3d_brush_menus/brush_menu.py
+++ b/space_view3d_brush_menus/brush_menu.py
@@ -51,7 +51,7 @@ class BrushOptionsMenu(Menu):
def sculpt(self, mode, layout, context):
has_brush = utils_core.get_brush_link(context, types="brush")
- icons = brushes.brush_icon[mode][has_brush.sculpt_tool] if \
+ icons = brushes.get_brush_icon(mode, has_brush.sculpt_tool) if \
has_brush else "BRUSH_DATA"
layout.row().menu("VIEW3D_MT_sv3_brushes_menu",
@@ -73,7 +73,7 @@ class BrushOptionsMenu(Menu):
def vw_paint(self, mode, layout, context):
has_brush = utils_core.get_brush_link(context, types="brush")
- icons = brushes.brush_icon[mode][has_brush.vertex_tool] if \
+ icons = brushes.get_brush_icon(mode, has_brush.vertex_tool) if \
has_brush else "BRUSH_DATA"
if mode == 'VERTEX_PAINT':
@@ -111,7 +111,7 @@ class BrushOptionsMenu(Menu):
toolsettings = context.tool_settings.image_paint
has_brush = utils_core.get_brush_link(context, types="brush")
- icons = brushes.brush_icon[mode][has_brush.image_tool] if \
+ icons = brushes.get_brush_icon(mode, has_brush.image_tool) if \
has_brush else "BRUSH_DATA"
if context.image_paint_object and not toolsettings.detect_data():
diff --git a/space_view3d_brush_menus/brushes.py b/space_view3d_brush_menus/brushes.py
index dc9d5912..c84fbe13 100644
--- a/space_view3d_brush_menus/brushes.py
+++ b/space_view3d_brush_menus/brushes.py
@@ -32,10 +32,16 @@ brush_datapath = {
brush_icon = {
'SCULPT': {
"BLOB": 'BRUSH_BLOB',
+ "BOUNDARY": 'BRUSH_GRAB',
"CLAY": 'BRUSH_CLAY',
"CLAY_STRIPS": 'BRUSH_CLAY_STRIPS',
+ "CLAY_THUMB": 'BRUSH_CLAY_STRIPS',
+ "CLOTH": 'BRUSH_SCULPT_DRAW',
"CREASE": 'BRUSH_CREASE',
+ "DISPLACEMENT_ERASER": 'BRUSH_SCULPT_DRAW',
+ "DISPLACEMENT_SMEAR": 'BRUSH_SCULPT_DRAW',
"DRAW": 'BRUSH_SCULPT_DRAW',
+ "DRAW_FACE_SETS": 'BRUSH_MASK',
"DRAW_SHARP": 'BRUSH_SCULPT_DRAW',
"ELASTIC_DEFORM": 'BRUSH_GRAB',
"FILL": 'BRUSH_FILL',
@@ -44,7 +50,9 @@ brush_icon = {
"INFLATE": 'BRUSH_INFLATE',
"LAYER": 'BRUSH_LAYER',
"MASK": 'BRUSH_MASK',
+ "MULTIPLANE_SCRAPE": 'BRUSH_SCRAPE',
"NUDGE": 'BRUSH_NUDGE',
+ "PAINT": 'BRUSH_SCULPT_DRAW',
"PINCH": 'BRUSH_PINCH',
"POSE": 'BRUSH_GRAB',
"ROTATE": 'BRUSH_ROTATE',
@@ -52,21 +60,22 @@ brush_icon = {
"SIMPLIFY": 'BRUSH_DATA',
"SMOOTH": 'BRUSH_SMOOTH',
"SNAKE_HOOK": 'BRUSH_SNAKE_HOOK',
- "THUMB": 'BRUSH_THUMB'
+ "THUMB": 'BRUSH_THUMB',
+ "TOPOLOGY": 'BRUSH_GRAB',
},
'VERTEX_PAINT': {
"AVERAGE": 'BRUSH_BLUR',
"BLUR": 'BRUSH_BLUR',
"DRAW": 'BRUSH_MIX',
- "SMEAR": 'BRUSH_BLUR'
+ "SMEAR": 'BRUSH_BLUR',
},
'WEIGHT_PAINT': {
"AVERAGE": 'BRUSH_BLUR',
"BLUR": 'BRUSH_BLUR',
"DRAW": 'BRUSH_MIX',
- "SMEAR": 'BRUSH_BLUR'
+ "SMEAR": 'BRUSH_BLUR',
},
'TEXTURE_PAINT': {
@@ -75,10 +84,26 @@ brush_icon = {
"FILL": 'BRUSH_TEXFILL',
"MASK": 'BRUSH_TEXMASK',
"SMEAR": 'BRUSH_SMEAR',
- "SOFTEN": 'BRUSH_SOFTEN'
- }
+ "SOFTEN": 'BRUSH_SOFTEN',
+ },
}
+def get_brush_icon(mode, tool):
+ mode_icons = brush_icon.get(mode, None)
+
+ if mode_icons == None:
+ print(f"Warning: icons for mode {mode} aren't supported")
+ return 'BRUSH_DATA'
+
+ icon = mode_icons.get(tool, None)
+
+ if icon == None:
+ print(f"Warning: Could not find icon for tool {tool} in mode {mode}")
+ return 'BRUSH_DATA'
+
+
+ return icon
+
class BrushesMenu(Menu):
bl_label = "Brush"
@@ -120,7 +145,7 @@ class BrushesMenu(Menu):
utils_core.menuprop(
column_flow.row(), item.name,
'bpy.data.brushes["%s"]' % item.name,
- brush_datapath[mode], icon=brush_icon[mode][item.sculpt_tool],
+ brush_datapath[mode], icon=get_brush_icon(mode, item.sculpt_tool),
disable=True, custom_disable_exp=(item.name, current_brush),
path=True
)
@@ -131,7 +156,7 @@ class BrushesMenu(Menu):
utils_core.menuprop(
column_flow.row(), item.name,
'bpy.data.brushes["%s"]' % item.name,
- brush_datapath[mode], icon=brush_icon[mode][item.vertex_tool],
+ brush_datapath[mode], icon=get_brush_icon(mode, item.vertex_tool),
disable=True, custom_disable_exp=(item.name, current_brush),
path=True
)
@@ -142,7 +167,7 @@ class BrushesMenu(Menu):
utils_core.menuprop(
column_flow.row(), item.name,
'bpy.data.brushes["%s"]' % item.name,
- brush_datapath[mode], icon=brush_icon[mode][item.vertex_tool],
+ brush_datapath[mode], icon=get_brush_icon(mode, item.weight_tool),
disable=True, custom_disable_exp=(item.name, current_brush),
path=True
)
@@ -153,7 +178,7 @@ class BrushesMenu(Menu):
utils_core.menuprop(
column_flow.row(), item.name,
'bpy.data.brushes["%s"]' % item.name,
- brush_datapath[mode], icon=brush_icon[mode][item.image_tool],
+ brush_datapath[mode], icon=get_brush_icon(mode, item.image_tool),
disable=True, custom_disable_exp=(item.name, current_brush),
path=True
)