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 13 additions and 15 deletions
Showing only changes of commit 4578dc67df - Show all commits

View File

@ -346,15 +346,15 @@ def import_data_from_lib(
## DRIVERS
def copy_driver(from_fcurve, obj, data_path=None, index=None):
def copy_driver(from_fcurve, target, data_path=None, index=None):
if not data_path:
data_path = from_fcurve.data_path
new_fc = None
if index:
new_fc = obj.driver_add(data_path, index)
new_fc = target.driver_add(data_path, index)
else:
new_fc = obj.driver_add(data_path)
new_fc = target.driver_add(data_path)
copy_attributes(from_fcurve, new_fc)
copy_attributes(from_fcurve.driver, new_fc.driver)
@ -380,15 +380,9 @@ def copy_driver(from_fcurve, obj, data_path=None, index=None):
return new_fc
def find_drivers(obj, target_type, target_name):
drivers = []
for driver in obj.animation_data.drivers:
def find_drivers(drivers, target_type, target_name):
found_drivers = []
for driver in drivers:
if f'{target_type}["{target_name}"]' in driver.data_path:
drivers.append(driver)
return drivers
def copy_all_drivers(source_obj, target_obj, driver_target_type, driver_target_name):
fcurves = find_drivers(source_obj, driver_target_type, driver_target_name)
for fcurve in fcurves:
copy_driver(from_fcurve=fcurve, obj=target_obj)
found_drivers.append(driver)
return found_drivers

View File

@ -224,7 +224,11 @@ def transfer_modifier(modifier_name, target_obj, source_obj):
{"object": target_obj, "active_object": target_obj},
modifier=mod.name,
)
core.copy_all_drivers(source_obj, target_obj, 'modifiers', modifier_name)
fcurves = core.find_drivers(
source_obj.animation_data.drivers, 'modifiers', modifier_name
)
for fcurve in fcurves:
core.copy_driver(from_fcurve=fcurve, target=target_obj)
# CONSTRAINTS