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
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
# show settings for nodes modifiers

View File

@ -78,30 +78,32 @@ def find_context_brushstrokes(dummy):
@persistent
def refresh_preset(dummy):
settings = bpy.context.scene.BSBST_settings
context = bpy.context
settings = context.scene.BSBST_settings
if not settings:
return
if not settings.preset_object:
return
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':
for ob in [settings.preset_object, get_active_context_brushstrokes_object(context)]:
if not ob:
continue
if not mod.node_group:
continue
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]:
for mod in ob.modifiers:
mod_info = ob.modifier_info.get(mod.name)
if not mod_info:
mod_info = ob.modifier_info.add()
mod_info.name = mod.name
if not mod.type == 'NODES':
continue
n = mod_info.socket_info.add()
n.name = v_id
# TODO: clean up old settings
if not mod.node_group:
continue
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):
socket_info = mod_info.socket_info.get(socket_name)