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

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