From 39b2945e09ce9f0970ea2bd4ba280a5df90005b9 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 1 Nov 2022 16:44:28 +0100 Subject: [PATCH] OP-3909 - refactor - move get_asset_settings to lib It makes more sense there than in pipeline.py --- openpype/hosts/aftereffects/api/__init__.py | 6 ++--- openpype/hosts/aftereffects/api/lib.py | 30 +++++++++++++++++++++ openpype/hosts/aftereffects/api/pipeline.py | 29 -------------------- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/openpype/hosts/aftereffects/api/__init__.py b/openpype/hosts/aftereffects/api/__init__.py index 7b7590abc9..a7137ba8fb 100644 --- a/openpype/hosts/aftereffects/api/__init__.py +++ b/openpype/hosts/aftereffects/api/__init__.py @@ -12,13 +12,13 @@ from .launch_logic import ( from .pipeline import ( AfterEffectsHost, ls, - get_asset_settings, containerise ) from .lib import ( maintained_selection, - get_extension_manifest_path + get_extension_manifest_path, + get_asset_settings ) from .plugin import ( @@ -33,12 +33,12 @@ __all__ = [ # pipeline "ls", - "get_asset_settings", "containerise", # lib "maintained_selection", "get_extension_manifest_path", + "get_asset_settings", # plugin "AfterEffectsLoader" diff --git a/openpype/hosts/aftereffects/api/lib.py b/openpype/hosts/aftereffects/api/lib.py index 7a73986633..4f336a07f2 100644 --- a/openpype/hosts/aftereffects/api/lib.py +++ b/openpype/hosts/aftereffects/api/lib.py @@ -134,3 +134,33 @@ def get_background_layers(file_url): layer.get("filename")). replace("\\", "/")) return layers + + +def get_asset_settings(asset_doc): + """Get settings on current asset from database. + + Returns: + dict: Scene data. + + """ + asset_data = asset_doc["data"] + fps = asset_data.get("fps") + frame_start = asset_data.get("frameStart") + frame_end = asset_data.get("frameEnd") + handle_start = asset_data.get("handleStart") + handle_end = asset_data.get("handleEnd") + resolution_width = asset_data.get("resolutionWidth") + resolution_height = asset_data.get("resolutionHeight") + duration = (frame_end - frame_start + 1) + handle_start + handle_end + + return { + "fps": fps, + "frameStart": frame_start, + "frameEnd": frame_end, + "handleStart": handle_start, + "handleEnd": handle_end, + "resolutionWidth": resolution_width, + "resolutionHeight": resolution_height, + "duration": duration + } + diff --git a/openpype/hosts/aftereffects/api/pipeline.py b/openpype/hosts/aftereffects/api/pipeline.py index e3ea3d45fa..8c3781c72a 100644 --- a/openpype/hosts/aftereffects/api/pipeline.py +++ b/openpype/hosts/aftereffects/api/pipeline.py @@ -197,35 +197,6 @@ def on_pyblish_instance_toggled(instance, old_value, new_value): instance[0].Visible = new_value -def get_asset_settings(asset_doc): - """Get settings on current asset from database. - - Returns: - dict: Scene data. - - """ - asset_data = asset_doc["data"] - fps = asset_data.get("fps") - frame_start = asset_data.get("frameStart") - frame_end = asset_data.get("frameEnd") - handle_start = asset_data.get("handleStart") - handle_end = asset_data.get("handleEnd") - resolution_width = asset_data.get("resolutionWidth") - resolution_height = asset_data.get("resolutionHeight") - duration = (frame_end - frame_start + 1) + handle_start + handle_end - - return { - "fps": fps, - "frameStart": frame_start, - "frameEnd": frame_end, - "handleStart": handle_start, - "handleEnd": handle_end, - "resolutionWidth": resolution_width, - "resolutionHeight": resolution_height, - "duration": duration - } - - def ls(): """Yields containers from active AfterEffects document.