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
3 changed files with 13 additions and 6 deletions
Showing only changes of commit 90fd62a89b - Show all commits

View File

@ -147,7 +147,7 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
if not settings.preset_object:
bpy.ops.brushstroke_tools.init_preset()
# transfer preset modifiers to new brushstrokes
# transfer preset modifiers to new brushstrokes TODO: refactor to deduplicate
for mod in settings.preset_object.modifiers:
utils.transfer_modifier(mod.name, brushstrokes_object, settings.preset_object)
@ -165,8 +165,11 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
elif link_context_type=='MATERIAL':
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = settings.context_material
elif link_context_type=='UVMAP':
brushstrokes_object.modifiers[mod.name][f'{v.identifier}_use_attribute'] = True
brushstrokes_object.modifiers[mod.name][f'{v.identifier}_attribute_name'] = surface_object.data.uv_layers.active.name
if type(brushstrokes_object.modifiers[mod.name][f'{v.identifier}']) == str:
brushstrokes_object.modifiers[mod.name][f'{v.identifier}'] = surface_object.data.uv_layers.active.name
else:
brushstrokes_object.modifiers[mod.name][f'{v.identifier}_use_attribute'] = True
brushstrokes_object.modifiers[mod.name][f'{v.identifier}_attribute_name'] = surface_object.data.uv_layers.active.name
elif link_context_type=='RANDOM':
vmin = v.min_value
vmax = v.max_value
@ -389,7 +392,7 @@ class BSBST_OT_copy_brushstrokes(bpy.types.Operator):
new_bs = list(set(bpy.data.objects[:]) - all_obj)
del all_obj
# remap surface pointers and context linked data
# remap surface pointers and context linked data TODO: refactor to deduplicate
for ob in new_bs:
ob.parent = surface_object
utils.set_surface_object(ob, surface_object)
@ -412,8 +415,11 @@ class BSBST_OT_copy_brushstrokes(bpy.types.Operator):
if link_context_type=='SURFACE_OBJECT':
ob.modifiers[mod.name][f'{v.identifier}'] = surface_object
elif link_context_type=='UVMAP':
ob.modifiers[mod.name][f'{v.identifier}_use_attribute'] = True
ob.modifiers[mod.name][f'{v.identifier}_attribute_name'] = surface_object.data.uv_layers.active.name
if type(ob.modifiers[mod.name][f'{v.identifier}']) == str:
ob.modifiers[mod.name][f'{v.identifier}'] = surface_object.data.uv_layers.active.name
else:
ob.modifiers[mod.name][f'{v.identifier}_use_attribute'] = True
ob.modifiers[mod.name][f'{v.identifier}_attribute_name'] = surface_object.data.uv_layers.active.name
elif link_context_type=='RANDOM':
vmin = v.min_value
vmax = v.max_value

View File

@ -18,6 +18,7 @@ linkable_sockets = [
bpy.types.NodeTreeInterfaceSocketVector,
bpy.types.NodeTreeInterfaceSocketFloat,
bpy.types.NodeTreeInterfaceSocketInt,
bpy.types.NodeTreeInterfaceSocketString,
]
asset_lib_name = 'Brushstroke Tools Library'