Asset Pipeline: Improve Performance #235
@ -191,9 +191,6 @@ def merge_task_layer(
|
|||||||
appended_col = import_data_from_lib(external_file, "collections", col_base_name)
|
appended_col = import_data_from_lib(external_file, "collections", col_base_name)
|
||||||
merge_add_suffix_to_hierarchy(appended_col, external_suffix)
|
merge_add_suffix_to_hierarchy(appended_col, external_suffix)
|
||||||
imported_time = time.time()
|
imported_time = time.time()
|
||||||
logger.debug(
|
|
||||||
f"{imported_time - start_time} sec: Imported Collection from Publish & Add Suffixes"
|
|
||||||
)
|
|
||||||
|
|
||||||
local_col = bpy.data.collections[f"{col_base_name}.{local_suffix}"]
|
local_col = bpy.data.collections[f"{col_base_name}.{local_suffix}"]
|
||||||
external_col = bpy.data.collections[f"{col_base_name}.{external_suffix}"]
|
external_col = bpy.data.collections[f"{col_base_name}.{external_suffix}"]
|
||||||
@ -214,7 +211,6 @@ def merge_task_layer(
|
|||||||
error_msg += f"Ownership conflict found for {type_name}: '{conflict_obj.name}'\n"
|
error_msg += f"Ownership conflict found for {type_name}: '{conflict_obj.name}'\n"
|
||||||
return error_msg
|
return error_msg
|
||||||
mapped_time = time.time()
|
mapped_time = time.time()
|
||||||
logger.debug(f"{mapped_time - imported_time} sec: To Create Asset Mapping")
|
|
||||||
|
|
||||||
# Remove all Transferable Data from target objects
|
# Remove all Transferable Data from target objects
|
||||||
for source_obj in map.object_map:
|
for source_obj in map.object_map:
|
||||||
@ -223,14 +219,12 @@ def merge_task_layer(
|
|||||||
|
|
||||||
apply_transfer_data(context, map.transfer_data_map)
|
apply_transfer_data(context, map.transfer_data_map)
|
||||||
apply_td_time = time.time()
|
apply_td_time = time.time()
|
||||||
logger.debug(f"{apply_td_time - mapped_time} sec: To Apply all Transferable Data")
|
|
||||||
|
|
||||||
for source_obj in map.object_map:
|
for source_obj in map.object_map:
|
||||||
target_obj = map.object_map[source_obj]
|
target_obj = map.object_map[source_obj]
|
||||||
remap_user(source_obj, target_obj)
|
remap_user(source_obj, target_obj)
|
||||||
transfer_data_clean(target_obj)
|
transfer_data_clean(target_obj)
|
||||||
obj_remap_time = time.time()
|
obj_remap_time = time.time()
|
||||||
logger.debug(f"{obj_remap_time - apply_td_time} sec: To remap all objects")
|
|
||||||
|
|
||||||
# Restore Active UV Layer and Active Color Attributes
|
# Restore Active UV Layer and Active Color Attributes
|
||||||
for _, index_map_item in map.index_map.items():
|
for _, index_map_item in map.index_map.items():
|
||||||
@ -240,7 +234,6 @@ def merge_task_layer(
|
|||||||
target_obj, index_map_item.get('active_color_attribute_name')
|
target_obj, index_map_item.get('active_color_attribute_name')
|
||||||
)
|
)
|
||||||
index_time = time.time()
|
index_time = time.time()
|
||||||
logger.debug(f"{index_time - obj_remap_time} sec: To restore active indexes on all objects")
|
|
||||||
|
|
||||||
for col in map.collection_map:
|
for col in map.collection_map:
|
||||||
remap_user(col, map.collection_map[col])
|
remap_user(col, map.collection_map[col])
|
||||||
@ -251,15 +244,20 @@ def merge_task_layer(
|
|||||||
for col in map.external_col_to_remove:
|
for col in map.external_col_to_remove:
|
||||||
local_col.children.unlink(col)
|
local_col.children.unlink(col)
|
||||||
col_remap_time = time.time()
|
col_remap_time = time.time()
|
||||||
logger.debug(f"{col_remap_time - index_time} sec: To remap all collections")
|
|
||||||
|
|
||||||
for id in map.shared_id_map:
|
for id in map.shared_id_map:
|
||||||
remap_user(id, map.shared_id_map[id])
|
remap_user(id, map.shared_id_map[id])
|
||||||
shared_id_remap_time = time.time()
|
shared_id_remap_time = time.time()
|
||||||
logger.debug(f"{shared_id_remap_time - col_remap_time} sec: To remap all shared ids")
|
|
||||||
|
|
||||||
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=False, do_recursive=True)
|
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=False, do_recursive=True)
|
||||||
merge_remove_suffix_from_hierarchy(local_col)
|
merge_remove_suffix_from_hierarchy(local_col)
|
||||||
|
logger.debug(f"{imported_time - start_time} sec: To import Collection & add suffixes")
|
||||||
|
logger.debug(f"{shared_id_remap_time - col_remap_time} sec: To remap all Shared Ids")
|
||||||
|
logger.debug(f"{mapped_time - imported_time} sec: To create Asset Mapping")
|
||||||
|
logger.debug(f"{apply_td_time - mapped_time} sec: To apply all Transferable Data")
|
||||||
|
logger.debug(f"{obj_remap_time - apply_td_time} sec: To remap all Objects")
|
||||||
|
logger.debug(f"{index_time - obj_remap_time} sec: To restore Active Indexes on all Objects")
|
||||||
|
logger.debug(f"{col_remap_time - index_time} sec: To remap all Collections")
|
||||||
logger.info(f"{time.time() - start_time} sec: To complete entire merge process")
|
logger.info(f"{time.time() - start_time} sec: To complete entire merge process")
|
||||||
|
|
||||||
def import_data_from_lib(
|
def import_data_from_lib(
|
||||||
|
Loading…
Reference in New Issue
Block a user