From 2c7da1a6de01c0d7821475c600950bd0626cde65 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 9 Feb 2024 15:09:04 +0100 Subject: [PATCH] dirmap settings are using AYON settings --- client/ayon_core/host/dirmap.py | 24 ++++++++++----------- client/ayon_core/hosts/maya/api/plugin.py | 2 +- client/ayon_core/hosts/nuke/api/pipeline.py | 2 +- client/ayon_core/settings/ayon_settings.py | 20 ----------------- 4 files changed, 14 insertions(+), 34 deletions(-) diff --git a/client/ayon_core/host/dirmap.py b/client/ayon_core/host/dirmap.py index cecd689a4c..9756657386 100644 --- a/client/ayon_core/host/dirmap.py +++ b/client/ayon_core/host/dirmap.py @@ -92,8 +92,8 @@ class HostDirmap(object): self.on_enable_dirmap() - for k, sp in enumerate(mapping["source-path"]): - dst = mapping["destination-path"][k] + for k, sp in enumerate(mapping["source_path"]): + dst = mapping["destination_path"][k] try: # add trailing slash if missing sp = os.path.join(sp, '') @@ -116,7 +116,7 @@ class HostDirmap(object): continue def get_mappings(self): - """Get translation from source-path to destination-path. + """Get translation from source_path to destination_path. It checks if Site Sync is enabled and user chose to use local site, in that case configuration in Local Settings takes precedence @@ -138,8 +138,8 @@ class HostDirmap(object): if ( not mapping - or not mapping.get("destination-path") - or not mapping.get("source-path") + or not mapping.get("destination_path") + or not mapping.get("source_path") ): return {} self.log.info("Processing directory mapping ...") @@ -154,7 +154,7 @@ class HostDirmap(object): in Local Settings. Returns: - dict : { "source-path": [XXX], "destination-path": [YYYY]} + dict : { "source_path": [XXX], "destination_path": [YYYY]} """ project_name = self.project_name @@ -210,13 +210,13 @@ class HostDirmap(object): continue if os.path.isdir(active_site_dir): - if "destination-path" not in mapping: - mapping["destination-path"] = [] - mapping["destination-path"].append(active_site_dir) + if "destination_path" not in mapping: + mapping["destination_path"] = [] + mapping["destination_path"].append(active_site_dir) - if "source-path" not in mapping: - mapping["source-path"] = [] - mapping["source-path"].append(remote_site_dir) + if "source_path" not in mapping: + mapping["source_path"] = [] + mapping["source_path"].append(remote_site_dir) self.log.debug("local sync mapping:: {}".format(mapping)) return mapping diff --git a/client/ayon_core/hosts/maya/api/plugin.py b/client/ayon_core/hosts/maya/api/plugin.py index c5e3f42d10..e0ff900c01 100644 --- a/client/ayon_core/hosts/maya/api/plugin.py +++ b/client/ayon_core/hosts/maya/api/plugin.py @@ -937,7 +937,7 @@ class ReferenceLoader(Loader): """ settings = get_project_settings(project_name) use_env_var_as_root = (settings["maya"] - ["maya-dirmap"] + ["maya_dirmap"] ["use_env_var_as_root"]) if use_env_var_as_root: anatomy = Anatomy(project_name) diff --git a/client/ayon_core/hosts/nuke/api/pipeline.py b/client/ayon_core/hosts/nuke/api/pipeline.py index bdba0757b6..99bd5616cb 100644 --- a/client/ayon_core/hosts/nuke/api/pipeline.py +++ b/client/ayon_core/hosts/nuke/api/pipeline.py @@ -176,7 +176,7 @@ def add_nuke_callbacks(): nuke.addOnScriptLoad(WorkfileSettings().set_context_settings) - if nuke_settings["nuke-dirmap"]["enabled"]: + if nuke_settings["nuke_dirmap"]["enabled"]: log.info("Added Nuke's dir-mapping callback ...") # Add dirmap for file paths. nuke.addFilenameFilter(dirmap_file_name_filter) diff --git a/client/ayon_core/settings/ayon_settings.py b/client/ayon_core/settings/ayon_settings.py index 14af455d5b..6114b5767c 100644 --- a/client/ayon_core/settings/ayon_settings.py +++ b/client/ayon_core/settings/ayon_settings.py @@ -333,17 +333,6 @@ def _convert_maya_project_settings(ayon_settings, output): ayon_maya = ayon_settings["maya"] - # Maya dirmap - ayon_maya_dirmap = ayon_maya.pop("maya_dirmap") - ayon_maya_dirmap_path = ayon_maya_dirmap["paths"] - ayon_maya_dirmap_path["source-path"] = ( - ayon_maya_dirmap_path.pop("source_path") - ) - ayon_maya_dirmap_path["destination-path"] = ( - ayon_maya_dirmap_path.pop("destination_path") - ) - ayon_maya["maya-dirmap"] = ayon_maya_dirmap - # Create plugins ayon_create = ayon_maya["create"] ayon_create_static_mesh = ayon_create["CreateUnrealStaticMesh"] @@ -580,15 +569,6 @@ def _convert_nuke_project_settings(ayon_settings, output): ayon_nuke = ayon_settings["nuke"] - # --- Dirmap --- - dirmap = ayon_nuke.pop("dirmap") - for src_key, dst_key in ( - ("source_path", "source-path"), - ("destination_path", "destination-path"), - ): - dirmap["paths"][dst_key] = dirmap["paths"].pop(src_key) - ayon_nuke["nuke-dirmap"] = dirmap - # --- Load --- ayon_load = ayon_nuke["load"] ayon_load["LoadClip"]["_representations"] = (