Brushstroke Tools: Initial Version #328

Merged
Simon Thommes merged 229 commits from SimonThommes/blender-studio-tools:brushstroke_tools-initial-version into main 2024-11-06 15:03:47 +01:00
Showing only changes of commit 5405881df3 - Show all commits

View File

@ -2,6 +2,12 @@ import bpy
from . import utils from . import utils
from . import settings as settings_py from . import settings as settings_py
warning_icons_dict = {
'ERROR': 'CANCEL',
'WARNING': 'ERROR',
'INFO': 'INFO',
}
def draw_panel_ui_recursive(panel, panel_name, mod, items, display_mode, hide_panel=False): def draw_panel_ui_recursive(panel, panel_name, mod, items, display_mode, hide_panel=False):
scene = bpy.context.scene scene = bpy.context.scene
@ -257,6 +263,16 @@ def draw_effect_panel_recursive(effects_panel, material, prev_node):
draw_effect_panel_recursive(effects_panel, material, node) draw_effect_panel_recursive(effects_panel, material, node)
def draw_mod_warnings(layout, mod):
if utils.compare_versions(bpy.app.version, (4,3,0)) < 0:
return
if mod.node_warnings:
warnings_header, warnings_panel = layout.panel(mod.name+'_warnings', default_closed = True)
warnings_header.label(text=f'Warnings ({len(mod.node_warnings)})')
if warnings_panel:
for warning in mod.node_warnings: # TODO sort warnings by type and alphabet
warnings_panel.label(text=warning.message,icon=warning_icons_dict[warning.type])
class BSBST_UL_brushstroke_objects(bpy.types.UIList): class BSBST_UL_brushstroke_objects(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname): def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
settings = data settings = data
@ -447,6 +463,8 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
mod.node_group.interface.items_tree.items(), mod.node_group.interface.items_tree.items(),
display_mode) display_mode)
draw_mod_warnings(style_panel, mod)
# expose add modifier operator for preset context # expose add modifier operator for preset context
if is_preset: if is_preset:
style_panel.operator('brushstroke_tools.preset_add_mod', icon='ADD') style_panel.operator('brushstroke_tools.preset_add_mod', icon='ADD')