Asset Pipeline v2 #145
@ -64,20 +64,7 @@ def merge_task_layer(
|
||||
|
||||
map = AssetTransferMapping(local_col, external_col, local_tls)
|
||||
|
||||
# Find Transfer Data
|
||||
transfer_data_items = []
|
||||
for obj in external_col.all_objects:
|
||||
for item in obj.transfer_data_ownership:
|
||||
if item.owner not in local_tls:
|
||||
transfer_data_items.append(item)
|
||||
|
||||
for obj in local_col.all_objects:
|
||||
for item in obj.transfer_data_ownership:
|
||||
if item.owner in local_tls:
|
||||
transfer_data_items.append(item)
|
||||
|
||||
target_objs = [map.object_map[obj] for obj in map.object_map]
|
||||
transfer_core.apply_transfer_data(context, transfer_data_items, target_objs)
|
||||
transfer_core.apply_transfer_data(context, map.transfer_data_map)
|
||||
|
||||
for source_obj in map.object_map:
|
||||
target_obj = map.object_map[source_obj]
|
||||
|
@ -18,31 +18,29 @@ def update_transfer_data_ownership(transfer_data_item, target_obj: bpy.types.Obj
|
||||
)
|
||||
|
||||
|
||||
def apply_transfer_data(
|
||||
context: bpy.types.Context,
|
||||
transfer_data_list,
|
||||
target_objs: set[bpy.types.Object],
|
||||
):
|
||||
for item in transfer_data_list:
|
||||
for target_obj in target_objs:
|
||||
if asset_suffix.get_basename(target_obj.name) == asset_suffix.get_basename(
|
||||
item.id_data.name
|
||||
):
|
||||
if item.type == constants.VERTEX_GROUP_KEY:
|
||||
transfer_functions.transfer_vertex_group(
|
||||
context=context,
|
||||
vertex_group_name=item.name,
|
||||
obj_target=target_obj,
|
||||
obj_source=item.id_data,
|
||||
)
|
||||
if item.type == constants.MODIFIER_KEY:
|
||||
transfer_functions.transfer_modifier(item, target_obj)
|
||||
if item.type == constants.MATERIAL_SLOT_KEY:
|
||||
transfer_functions.transfer_material_slot(item, target_obj)
|
||||
update_transfer_data_ownership(
|
||||
transfer_data_item=item,
|
||||
target_obj=target_obj,
|
||||
)
|
||||
def apply_transfer_data(context, transfer_data_map):
|
||||
for name in transfer_data_map:
|
||||
transfer_data = transfer_data_map[name]
|
||||
item = transfer_data[0]
|
||||
target_obj = transfer_data[1]
|
||||
if item.type == constants.VERTEX_GROUP_KEY:
|
||||
print(f"Transfering Data {constants.VERTEX_GROUP_KEY}: {name}")
|
||||
transfer_functions.transfer_vertex_group(
|
||||
context=context,
|
||||
vertex_group_name=item.name,
|
||||
obj_target=target_obj,
|
||||
obj_source=item.id_data,
|
||||
)
|
||||
if item.type == constants.MODIFIER_KEY:
|
||||
print(f"Transfering Data {constants.MODIFIER_KEY}: {name}")
|
||||
transfer_functions.transfer_modifier(item, target_obj)
|
||||
if item.type == constants.MATERIAL_SLOT_KEY:
|
||||
print(f"Transfering Data {constants.MATERIAL_SLOT_KEY}: {name}")
|
||||
transfer_functions.transfer_material_slot(item, target_obj)
|
||||
update_transfer_data_ownership(
|
||||
transfer_data_item=item,
|
||||
target_obj=target_obj,
|
||||
)
|
||||
|
||||
|
||||
def check_transfer_data_entry(ownership, key, td_type):
|
||||
|
Loading…
Reference in New Issue
Block a user