From 2f4844613e2e8051bc54a76154e2a7abf211306d Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Thu, 26 Oct 2023 13:13:17 +0100 Subject: [PATCH] Use constant to define Asset path --- openpype/hosts/unreal/api/pipeline.py | 1 + openpype/hosts/unreal/plugins/load/load_alembic_animation.py | 2 +- openpype/hosts/unreal/plugins/load/load_geometrycache_abc.py | 3 ++- openpype/hosts/unreal/plugins/load/load_skeletalmesh_abc.py | 3 ++- openpype/hosts/unreal/plugins/load/load_skeletalmesh_fbx.py | 3 ++- openpype/hosts/unreal/plugins/load/load_staticmesh_abc.py | 3 ++- openpype/hosts/unreal/plugins/load/load_staticmesh_fbx.py | 3 ++- openpype/hosts/unreal/plugins/load/load_uasset.py | 2 +- openpype/hosts/unreal/plugins/load/load_yeticache.py | 2 +- 9 files changed, 14 insertions(+), 8 deletions(-) diff --git a/openpype/hosts/unreal/api/pipeline.py b/openpype/hosts/unreal/api/pipeline.py index 0bb19ec6013..f2d7b5f73e6 100644 --- a/openpype/hosts/unreal/api/pipeline.py +++ b/openpype/hosts/unreal/api/pipeline.py @@ -30,6 +30,7 @@ logger = logging.getLogger("openpype.hosts.unreal") AYON_CONTAINERS = "AyonContainers" +AYON_ASSET_DIR = "/Game/Ayon/Assets" CONTEXT_CONTAINER = "Ayon/context.json" UNREAL_VERSION = semver.VersionInfo( *os.getenv("AYON_UNREAL_VERSION").split(".") diff --git a/openpype/hosts/unreal/plugins/load/load_alembic_animation.py b/openpype/hosts/unreal/plugins/load/load_alembic_animation.py index 1d60b63f9ac..0328d2ae9fa 100644 --- a/openpype/hosts/unreal/plugins/load/load_alembic_animation.py +++ b/openpype/hosts/unreal/plugins/load/load_alembic_animation.py @@ -69,7 +69,7 @@ def load(self, context, name, namespace, data): """ # Create directory for asset and ayon container - root = "/Game/Ayon/Assets" + root = unreal_pipeline.AYON_ASSET_DIR asset = context.get('asset').get('name') suffix = "_CON" if asset: diff --git a/openpype/hosts/unreal/plugins/load/load_geometrycache_abc.py b/openpype/hosts/unreal/plugins/load/load_geometrycache_abc.py index e64a5654a1e..ec9c52b9fbb 100644 --- a/openpype/hosts/unreal/plugins/load/load_geometrycache_abc.py +++ b/openpype/hosts/unreal/plugins/load/load_geometrycache_abc.py @@ -8,6 +8,7 @@ ) from openpype.hosts.unreal.api import plugin from openpype.hosts.unreal.api.pipeline import ( + AYON_ASSET_DIR, create_container, imprint, ) @@ -24,7 +25,7 @@ class PointCacheAlembicLoader(plugin.Loader): icon = "cube" color = "orange" - root = "/Game/Ayon/Assets" + root = AYON_ASSET_DIR @staticmethod def get_task( diff --git a/openpype/hosts/unreal/plugins/load/load_skeletalmesh_abc.py b/openpype/hosts/unreal/plugins/load/load_skeletalmesh_abc.py index 03695bb93b0..8ebd9a82b65 100644 --- a/openpype/hosts/unreal/plugins/load/load_skeletalmesh_abc.py +++ b/openpype/hosts/unreal/plugins/load/load_skeletalmesh_abc.py @@ -8,6 +8,7 @@ ) from openpype.hosts.unreal.api import plugin from openpype.hosts.unreal.api.pipeline import ( + AYON_ASSET_DIR, create_container, imprint, ) @@ -23,7 +24,7 @@ class SkeletalMeshAlembicLoader(plugin.Loader): icon = "cube" color = "orange" - root = "/Game/Ayon/Assets" + root = AYON_ASSET_DIR @staticmethod def get_task(filename, asset_dir, asset_name, replace, default_conversion): diff --git a/openpype/hosts/unreal/plugins/load/load_skeletalmesh_fbx.py b/openpype/hosts/unreal/plugins/load/load_skeletalmesh_fbx.py index 7640ecfa9ec..a5a8730732b 100644 --- a/openpype/hosts/unreal/plugins/load/load_skeletalmesh_fbx.py +++ b/openpype/hosts/unreal/plugins/load/load_skeletalmesh_fbx.py @@ -8,6 +8,7 @@ ) from openpype.hosts.unreal.api import plugin from openpype.hosts.unreal.api.pipeline import ( + AYON_ASSET_DIR, create_container, imprint, ) @@ -23,7 +24,7 @@ class SkeletalMeshFBXLoader(plugin.Loader): icon = "cube" color = "orange" - root = "/Game/Ayon/Assets" + root = AYON_ASSET_DIR @staticmethod def get_task(filename, asset_dir, asset_name, replace): diff --git a/openpype/hosts/unreal/plugins/load/load_staticmesh_abc.py b/openpype/hosts/unreal/plugins/load/load_staticmesh_abc.py index a3ea2a2231b..019a95a9bf1 100644 --- a/openpype/hosts/unreal/plugins/load/load_staticmesh_abc.py +++ b/openpype/hosts/unreal/plugins/load/load_staticmesh_abc.py @@ -8,6 +8,7 @@ ) from openpype.hosts.unreal.api import plugin from openpype.hosts.unreal.api.pipeline import ( + AYON_ASSET_DIR, create_container, imprint, ) @@ -23,7 +24,7 @@ class StaticMeshAlembicLoader(plugin.Loader): icon = "cube" color = "orange" - root = "/Game/Ayon/Assets" + root = AYON_ASSET_DIR @staticmethod def get_task(filename, asset_dir, asset_name, replace, default_conversion): diff --git a/openpype/hosts/unreal/plugins/load/load_staticmesh_fbx.py b/openpype/hosts/unreal/plugins/load/load_staticmesh_fbx.py index 44d7ca631ed..66088d793cf 100644 --- a/openpype/hosts/unreal/plugins/load/load_staticmesh_fbx.py +++ b/openpype/hosts/unreal/plugins/load/load_staticmesh_fbx.py @@ -8,6 +8,7 @@ ) from openpype.hosts.unreal.api import plugin from openpype.hosts.unreal.api.pipeline import ( + AYON_ASSET_DIR, create_container, imprint, ) @@ -23,7 +24,7 @@ class StaticMeshFBXLoader(plugin.Loader): icon = "cube" color = "orange" - root = "/Game/Ayon/Assets" + root = AYON_ASSET_DIR @staticmethod def get_task(filename, asset_dir, asset_name, replace): diff --git a/openpype/hosts/unreal/plugins/load/load_uasset.py b/openpype/hosts/unreal/plugins/load/load_uasset.py index 88aaac41e8b..dfd92d2fe54 100644 --- a/openpype/hosts/unreal/plugins/load/load_uasset.py +++ b/openpype/hosts/unreal/plugins/load/load_uasset.py @@ -41,7 +41,7 @@ def load(self, context, name, namespace, options): """ # Create directory for asset and Ayon container - root = "/Game/Ayon/Assets" + root = unreal_pipeline.AYON_ASSET_DIR asset = context.get('asset').get('name') suffix = "_CON" asset_name = f"{asset}_{name}" if asset else f"{name}" diff --git a/openpype/hosts/unreal/plugins/load/load_yeticache.py b/openpype/hosts/unreal/plugins/load/load_yeticache.py index 22f5029bacd..780ed7c484a 100644 --- a/openpype/hosts/unreal/plugins/load/load_yeticache.py +++ b/openpype/hosts/unreal/plugins/load/load_yeticache.py @@ -86,7 +86,7 @@ def load(self, context, name, namespace, options): raise RuntimeError("Groom plugin is not activated.") # Create directory for asset and Ayon container - root = "/Game/Ayon/Assets" + root = unreal_pipeline.AYON_ASSET_DIR asset = context.get('asset').get('name') suffix = "_CON" asset_name = f"{asset}_{name}" if asset else f"{name}"