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
2 changed files with 23 additions and 21 deletions
Showing only changes of commit 7577c20668 - Show all commits

View File

@ -445,7 +445,7 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
continue continue
if not mod.type == 'NODES': if not mod.type == 'NODES':
mod_panel.label(text="Only 'Nodes' modifiers supported for preset interface") mod_panel.label(text="Only 'Nodes' modifiers supported")
continue continue
# show settings for nodes modifiers # show settings for nodes modifiers

View File

@ -78,30 +78,32 @@ def find_context_brushstrokes(dummy):
@persistent @persistent
def refresh_preset(dummy): def refresh_preset(dummy):
settings = bpy.context.scene.BSBST_settings context = bpy.context
settings = context.scene.BSBST_settings
if not settings: if not settings:
return return
if not settings.preset_object: for ob in [settings.preset_object, get_active_context_brushstrokes_object(context)]:
return if not ob:
for mod in settings.preset_object.modifiers:
mod_info = settings.preset_object.modifier_info.get(mod.name)
if not mod_info:
mod_info = settings.preset_object.modifier_info.add()
mod_info.name = mod.name
if not mod.type == 'NODES':
continue continue
if not mod.node_group: for mod in ob.modifiers:
continue mod_info = ob.modifier_info.get(mod.name)
for v in mod.node_group.interface.items_tree.values(): if not mod_info:
if type(v) is bpy.types.NodeTreeInterfacePanel: mod_info = ob.modifier_info.add()
v_id = f'Panel_{v.index}' # TODO: replace with panel identifier once that is exposed in Blender 4.3 mod_info.name = mod.name
else: if not mod.type == 'NODES':
v_id = v.identifier
if v_id in [s.name for s in mod_info.socket_info]:
continue continue
n = mod_info.socket_info.add() if not mod.node_group:
n.name = v_id continue
# TODO: clean up old settings for v in mod.node_group.interface.items_tree.values():
if type(v) is bpy.types.NodeTreeInterfacePanel:
v_id = f'Panel_{v.index}' # TODO: replace with panel identifier once that is exposed in Blender 4.3
else:
v_id = v.identifier
if v_id in [s.name for s in mod_info.socket_info]:
continue
n = mod_info.socket_info.add()
n.name = v_id
# TODO: clean up old settings
def mark_socket_context_type(mod_info, socket_name, link_type): def mark_socket_context_type(mod_info, socket_name, link_type):
socket_info = mod_info.socket_info.get(socket_name) socket_info = mod_info.socket_info.get(socket_name)