mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
get_workfile_build_presets method implemented to load workfile variants per host and current task
This commit is contained in:
parent
cf43bbb18e
commit
116a16eb4c
1 changed files with 27 additions and 0 deletions
27
pype/lib.py
27
pype/lib.py
|
|
@ -643,3 +643,30 @@ class CustomNone:
|
|||
def __repr__(self):
|
||||
"""Representation of custom None."""
|
||||
return "<CustomNone-{}>".format(str(self.identifier))
|
||||
|
||||
|
||||
def get_workfile_build_presets(task_name):
|
||||
host_name = avalon.api.registered_host().__name__.rsplit(".", 1)[-1]
|
||||
presets = config.get_presets(io.Session["AVALON_PROJECT"])
|
||||
# Get presets for host
|
||||
workfile_presets = presets["plugins"].get(host_name, {}).get(
|
||||
"workfile_build"
|
||||
)
|
||||
if not workfile_presets:
|
||||
return
|
||||
|
||||
task_name_low = task_name.lower()
|
||||
per_task_preset = None
|
||||
for variant in workfile_presets:
|
||||
variant_tasks = variant.get("tasks")
|
||||
if not variant_tasks:
|
||||
continue
|
||||
|
||||
variant_tasks_low = [task.lower() for task in variant_tasks]
|
||||
if task_name_low not in variant_tasks_low:
|
||||
continue
|
||||
|
||||
per_task_preset = variant
|
||||
break
|
||||
|
||||
return per_task_preset
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue