From 7ea1e54c201551dcc95155c75c5bb014590feceb Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Thu, 6 Jun 2024 15:21:48 +0100 Subject: [PATCH] Align abc animation loader to other abc loaders for import conversion --- .../plugins/load/load_alembic_animation.py | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/client/ayon_core/hosts/unreal/plugins/load/load_alembic_animation.py b/client/ayon_core/hosts/unreal/plugins/load/load_alembic_animation.py index 77065b0abd..5f06d2c024 100644 --- a/client/ayon_core/hosts/unreal/plugins/load/load_alembic_animation.py +++ b/client/ayon_core/hosts/unreal/plugins/load/load_alembic_animation.py @@ -24,14 +24,19 @@ class AnimationAlembicLoader(UnrealBaseLoader): @staticmethod def _import_abc_task( - filename, destination_path, destination_name, replace + filename, destination_path, destination_name, replace, + default_conversion ): - conversion = { - "flip_u": False, - "flip_v": False, - "rotation": [0.0, 0.0, 0.0], - "scale": [1.0, 1.0, -1.0], - } + conversion = ( + None + if default_conversion + else { + "flip_u": False, + "flip_v": False, + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, -1.0], + } + ) params = { "filename": filename, @@ -82,13 +87,15 @@ class AnimationAlembicLoader(UnrealBaseLoader): "name": name, "version": version}) + default_conversion = options.get("default_conversion") or False + if not send_request( "does_directory_exist", params={"directory_path": asset_dir}): send_request( "make_directory", params={"directory_path": asset_dir}) self._import_abc_task( - self.fname, asset_dir, asset_name, False) + self.fname, asset_dir, asset_name, False, default_conversion) data = { "schema": "ayon:container-2.0", @@ -100,6 +107,7 @@ class AnimationAlembicLoader(UnrealBaseLoader): "loader": self.__class__.__name__, "representation_id": str(context["representation"]["id"]), "version_id": str(context["representation"]["versionId"]), + "default_conversion": default_conversion, "product_type": product_type, # TODO these should be probably removed "asset": folder_path, @@ -120,6 +128,9 @@ class AnimationAlembicLoader(UnrealBaseLoader): asset_dir = container["namespace"] asset_name = container["asset_name"] - self._import_abc_task(filename, asset_dir, asset_name, True) + default_conversion = container["default_conversion"] + + self._import_abc_task( + filename, asset_dir, asset_name, True, default_conversion) super(UnrealBaseLoader, self).update(container, context)