Asset Pipeline v2 #145

Closed
Nick Alberelli wants to merge 431 commits from (deleted):feature/asset-pipeline-v2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 7 additions and 8 deletions
Showing only changes of commit 9cc346d8c2 - Show all commits

View File

@ -51,7 +51,7 @@ def copy_driver(
def find_drivers(
drivers: list[bpy.types.FCurve], target_type: str, target_name: str
id: bpy.types.ID, target_type: str, target_name: str
) -> list[bpy.types.FCurve]:
"""_summary_
@ -64,6 +64,9 @@ def find_drivers(
list[bpy.types.FCurve]: List of FCurves containing drivers that match type & name
"""
found_drivers = []
if id.animation_data is None or id.animation_data.drivers is None:
return found_drivers
drivers = id.animation_data.drivers
for driver in drivers:
if f'{target_type}["{target_name}"]' in driver.data_path:
found_drivers.append(driver)

View File

@ -259,9 +259,7 @@ def transfer_modifier(modifier_name, target_obj, source_obj):
)
if source_obj.animation_data is None:
return
fcurves = find_drivers(
source_obj.animation_data.drivers, 'modifiers', modifier_name
)
fcurves = find_drivers(source_obj, 'modifiers', modifier_name)
for fcurve in fcurves:
copy_driver(from_fcurve=fcurve, target=target_obj)
@ -332,9 +330,7 @@ def transfer_constraint(constraint_name, target_obj, source_obj):
if source_obj.animation_data is None:
return
fcurves = find_drivers(
source_obj.animation_data.drivers, 'constraints', constraint_name
)
fcurves = find_drivers(source_obj, 'constraints', constraint_name)
for fcurve in fcurves:
copy_driver(from_fcurve=fcurve, target=target_obj)
@ -573,7 +569,7 @@ def transfer_shape_key(
val = mathutils.Vector(sum(np.array(vals_weighted)))
sk_target.data[i].co = vert.co + val
fcurves = find_drivers(
source_obj.data.shape_keys.animation_data.drivers,
source_obj.data.shape_keys,
'key_blocks',
shape_key_name,
)