Brushstroke Tools: Initial Version #328
@ -100,28 +100,25 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
|
|||||||
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)
|
|
||||||
|
|
||||||
for v in mod.node_group.interface.items_tree.values():
|
# transfer preset modifiers to new brushstrokes
|
||||||
if type(v) not in utils.linkable_sockets:
|
for mod in settings.preset_object.modifiers:
|
||||||
continue
|
utils.transfer_modifier(mod.name, brushstrokes_object, settings.preset_object)
|
||||||
if not settings.preset_object.modifier_info[mod.name].socket_info[v.identifier].link_context:
|
|
||||||
continue
|
for v in mod.node_group.interface.items_tree.values():
|
||||||
if type(v) == bpy.types.NodeTreeInterfaceSocketObject:
|
if type(v) not in utils.linkable_sockets:
|
||||||
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = surface_object
|
continue
|
||||||
elif type(v) == bpy.types.NodeTreeInterfaceSocketMaterial:
|
if not settings.preset_object.modifier_info[mod.name].socket_info[v.identifier].link_context:
|
||||||
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = settings.preset_material
|
continue
|
||||||
# refresh UI
|
if type(v) == bpy.types.NodeTreeInterfaceSocketObject:
|
||||||
for mod in brushstrokes_object.modifiers:
|
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = surface_object
|
||||||
mod.node_group.interface_update(context)
|
elif type(v) == bpy.types.NodeTreeInterfaceSocketMaterial:
|
||||||
else:
|
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = settings.preset_material
|
||||||
# add deformation modifier
|
# refresh UI
|
||||||
mod = brushstrokes_object.modifiers.new('Brushstrokes Deformation', 'NODES')
|
for mod in brushstrokes_object.modifiers:
|
||||||
mod.node_group = bpy.data.node_groups['.brushstroke_tools.deformation']
|
mod.node_group.interface_update(context)
|
||||||
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user