Fix: Empty tool settings with primitive tools in grease pencil draw mode

`UnifiedPaintPanel.get_brush_mode()` may return `None` when the current
tool doesn't use brushes. In the specific case of primitive tools
("Line", "Polyline", "Arc", etc) in grease pencil draw mode, the tools
actually should use brushes, but this isn't implemented properly yet
with brush assets. Still handle this case cleanly.
This commit is contained in:
Julian Eisel
2024-07-11 19:22:01 +02:00
parent 901f5495cb
commit 70dc26cbef

View File

@@ -60,14 +60,21 @@ class BrushAssetShelf:
'SCULPT_CURVES': "VIEW3D_AST_brush_sculpt_curves",
}
mode = UnifiedPaintPanel.get_brush_mode(context)
if not mode:
return None
return mode_map[mode]
@staticmethod
def draw_popup_selector(layout, context, brush, show_name=True):
preview_icon_id = brush.preview.icon_id if brush and brush.preview else 0
shelf_name = BrushAssetShelf.get_shelf_name_from_context(context)
if not shelf_name:
return
layout.template_asset_shelf_popover(
BrushAssetShelf.get_shelf_name_from_context(context),
shelf_name,
name=brush.name if (brush and show_name) else None,
icon='BRUSH_DATA' if not preview_icon_id else 'NONE',
icon_value=preview_icon_id,