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 d54a7d5039 - Show all commits

View File

@ -100,28 +100,25 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
bpy.ops.object.material_slot_add()
brushstrokes_object.material_slots[0].material = settings.preset_material
if settings.preset_object:
# transfer preset modifiers to new brushstrokes
for mod in settings.preset_object.modifiers:
utils.transfer_modifier(mod.name, brushstrokes_object, settings.preset_object)
if not settings.preset_object:
bpy.ops.brushstroke_tools.init_preset()
for v in mod.node_group.interface.items_tree.values():
if type(v) not in utils.linkable_sockets:
continue
if not settings.preset_object.modifier_info[mod.name].socket_info[v.identifier].link_context:
continue
if type(v) == bpy.types.NodeTreeInterfaceSocketObject:
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = surface_object
elif type(v) == bpy.types.NodeTreeInterfaceSocketMaterial:
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = settings.preset_material
# refresh UI
for mod in brushstrokes_object.modifiers:
mod.node_group.interface_update(context)
else:
# add deformation modifier
mod = brushstrokes_object.modifiers.new('Brushstrokes Deformation', 'NODES')
mod.node_group = bpy.data.node_groups['.brushstroke_tools.deformation']
mod['Socket_2'] = surface_object
# transfer preset modifiers to new brushstrokes
for mod in settings.preset_object.modifiers:
utils.transfer_modifier(mod.name, brushstrokes_object, settings.preset_object)
for v in mod.node_group.interface.items_tree.values():
if type(v) not in utils.linkable_sockets:
continue
if not settings.preset_object.modifier_info[mod.name].socket_info[v.identifier].link_context:
continue
if type(v) == bpy.types.NodeTreeInterfaceSocketObject:
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = surface_object
elif type(v) == bpy.types.NodeTreeInterfaceSocketMaterial:
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = settings.preset_material
# refresh UI
for mod in brushstrokes_object.modifiers:
mod.node_group.interface_update(context)
if settings.assign_materials:
for mod in brushstrokes_object.modifiers: