Asset Pipeline: Improve Performance #235

Merged
2 changed files with 9 additions and 1 deletions
Showing only changes of commit 38652eb458 - Show all commits

View File

@ -56,9 +56,10 @@ PROFILE_KEYS = {
"COLLECTIONS": "To remap all Collections", "COLLECTIONS": "To remap all Collections",
"SHARED_IDS": "To remap all Shared IDs", "SHARED_IDS": "To remap all Shared IDs",
"MERGE": "To complete entire merge process", "MERGE": "To complete entire merge process",
"TOTAL": "Total time to sync this direction",
} }
INFO_KEYS = ["MERGE"] # Profile Keys to print in the logger's info mode INFO_KEYS = ["TOTAL"] # Profile Keys to print in the logger's info mode
_profiler_instance = None _profiler_instance = None

View File

@ -1,4 +1,5 @@
import bpy import bpy
import time
from pathlib import Path from pathlib import Path
from .merge.publish import ( from .merge.publish import (
find_sync_target, find_sync_target,
@ -135,6 +136,8 @@ def update_temp_file_paths(self, context, temp_file_path):
def sync_execute_pull(self, context): def sync_execute_pull(self, context):
start_time = time.time()
profiler = logging.get_profiler()
logger = logging.get_logger() logger = logging.get_logger()
logger.info("Pulling Asset") logger.info("Pulling Asset")
temp_file_path = create_temp_file_backup(self, context) temp_file_path = create_temp_file_backup(self, context)
@ -161,9 +164,12 @@ def sync_execute_pull(self, context):
context.scene.asset_pipeline.sync_error = True context.scene.asset_pipeline.sync_error = True
self.report({'ERROR'}, error_msg) self.report({'ERROR'}, error_msg)
return {'CANCELLED'} return {'CANCELLED'}
profiler.add(time.time() - start_time, "TOTAL")
def sync_execute_push(self, context): def sync_execute_push(self, context):
start_time = time.time()
profiler = logging.get_profiler()
logger = logging.get_logger() logger = logging.get_logger()
logger.info("Pushing Asset") logger.info("Pushing Asset")
_catalog_id = None _catalog_id = None
@ -204,3 +210,4 @@ def sync_execute_push(self, context):
bpy.ops.wm.save_as_mainfile(filepath=file_path) bpy.ops.wm.save_as_mainfile(filepath=file_path)
bpy.ops.wm.open_mainfile(filepath=self._current_file.__str__()) bpy.ops.wm.open_mainfile(filepath=self._current_file.__str__())
profiler.add(time.time() - start_time, "TOTAL")