mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
substance can read shelves from AYON settings
This commit is contained in:
parent
94b50b2d96
commit
f6f09ce43b
2 changed files with 9 additions and 16 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue