Asset Pipeline v2 #145
@ -51,7 +51,7 @@ def copy_driver(
|
|||||||
|
|
||||||
|
|
||||||
def find_drivers(
|
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]:
|
) -> list[bpy.types.FCurve]:
|
||||||
"""_summary_
|
"""_summary_
|
||||||
|
|
||||||
@ -64,6 +64,9 @@ def find_drivers(
|
|||||||
list[bpy.types.FCurve]: List of FCurves containing drivers that match type & name
|
list[bpy.types.FCurve]: List of FCurves containing drivers that match type & name
|
||||||
"""
|
"""
|
||||||
found_drivers = []
|
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:
|
for driver in drivers:
|
||||||
if f'{target_type}["{target_name}"]' in driver.data_path:
|
if f'{target_type}["{target_name}"]' in driver.data_path:
|
||||||
found_drivers.append(driver)
|
found_drivers.append(driver)
|
||||||
|
@ -259,9 +259,7 @@ def transfer_modifier(modifier_name, target_obj, source_obj):
|
|||||||
)
|
)
|
||||||
if source_obj.animation_data is None:
|
if source_obj.animation_data is None:
|
||||||
return
|
return
|
||||||
fcurves = find_drivers(
|
fcurves = find_drivers(source_obj, 'modifiers', modifier_name)
|
||||||
source_obj.animation_data.drivers, 'modifiers', modifier_name
|
|
||||||
)
|
|
||||||
for fcurve in fcurves:
|
for fcurve in fcurves:
|
||||||
copy_driver(from_fcurve=fcurve, target=target_obj)
|
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:
|
if source_obj.animation_data is None:
|
||||||
return
|
return
|
||||||
fcurves = find_drivers(
|
fcurves = find_drivers(source_obj, 'constraints', constraint_name)
|
||||||
source_obj.animation_data.drivers, 'constraints', constraint_name
|
|
||||||
)
|
|
||||||
|
|
||||||
for fcurve in fcurves:
|
for fcurve in fcurves:
|
||||||
copy_driver(from_fcurve=fcurve, target=target_obj)
|
copy_driver(from_fcurve=fcurve, target=target_obj)
|
||||||
@ -573,7 +569,7 @@ def transfer_shape_key(
|
|||||||
val = mathutils.Vector(sum(np.array(vals_weighted)))
|
val = mathutils.Vector(sum(np.array(vals_weighted)))
|
||||||
sk_target.data[i].co = vert.co + val
|
sk_target.data[i].co = vert.co + val
|
||||||
fcurves = find_drivers(
|
fcurves = find_drivers(
|
||||||
source_obj.data.shape_keys.animation_data.drivers,
|
source_obj.data.shape_keys,
|
||||||
'key_blocks',
|
'key_blocks',
|
||||||
shape_key_name,
|
shape_key_name,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user