diff --git a/client/ayon_core/hosts/substancepainter/api/pipeline.py b/client/ayon_core/hosts/substancepainter/api/pipeline.py index 2bbcf2aded..03cb22136c 100644 --- a/client/ayon_core/hosts/substancepainter/api/pipeline.py +++ b/client/ayon_core/hosts/substancepainter/api/pipeline.py @@ -240,33 +240,34 @@ class SubstanceHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost): def _install_shelves(self, project_settings): - shelves = project_settings["substancepainter"].get("shelves", {}) + shelves = project_settings["substancepainter"].get("shelves", []) if not shelves: return # Prepare formatting data if we detect any path which might have # template tokens like {asset} in there. formatting_data = {} - has_formatting_entries = any("{" in path for path in shelves.values()) + has_formatting_entries = any("{" in item["value"] for item in shelves) if has_formatting_entries: project_name = self.get_current_project_name() asset_name = self.get_current_asset_name() task_name = self.get_current_asset_name() system_settings = get_system_settings() - formatting_data = get_template_data_with_names(project_name, - asset_name, - task_name, - system_settings) + formatting_data = get_template_data_with_names( + project_name, asset_name, task_name, system_settings + ) anatomy = Anatomy(project_name) formatting_data["root"] = anatomy.roots - for name, path in shelves.items(): - shelf_name = None + for shelve_item in shelves: # Allow formatting with anatomy for the paths + path = shelve_item["value"] if "{" in path: path = StringTemplate.format_template(path, formatting_data) + name = shelve_item["name"] + shelf_name = None try: shelf_name = lib.load_shelf(path, name=name) except ValueError as exc: diff --git a/client/ayon_core/settings/ayon_settings.py b/client/ayon_core/settings/ayon_settings.py index b90de7946b..726b2147cd 100644 --- a/client/ayon_core/settings/ayon_settings.py +++ b/client/ayon_core/settings/ayon_settings.py @@ -817,14 +817,6 @@ def _convert_substancepainter_project_settings(ayon_settings, output): ayon_substance_painter = ayon_settings["substancepainter"] _convert_host_imageio(ayon_substance_painter) - if "shelves" in ayon_substance_painter: - shelves_items = ayon_substance_painter["shelves"] - new_shelves_items = { - item["name"]: item["value"] - for item in shelves_items - } - ayon_substance_painter["shelves"] = new_shelves_items - output["substancepainter"] = ayon_substance_painter