mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
replaced rootless kwarg with template_key
This commit is contained in:
parent
01cec68dea
commit
675aa28eac
1 changed files with 17 additions and 9 deletions
|
|
@ -276,7 +276,7 @@ def get_workdir_data(project_doc, asset_doc, task_name, host_name):
|
|||
|
||||
|
||||
def get_workdir_with_workdir_data(
|
||||
workdir_data, anatomy=None, project_name=None, rootless=False
|
||||
workdir_data, anatomy=None, project_name=None, template_key=None
|
||||
):
|
||||
"""Fill workdir path from entered data and project's anatomy.
|
||||
|
||||
|
|
@ -290,7 +290,8 @@ def get_workdir_with_workdir_data(
|
|||
`project_name` is entered.
|
||||
project_name (str): Project's name. Optional if `anatomy` is entered
|
||||
otherwise Anatomy object is created with using the project name.
|
||||
rootless (bool): Return workdir without filled root key when `True`.
|
||||
template_key (str): Key of work templates in anatomy templates. By
|
||||
default is seto to `"work"`.
|
||||
|
||||
Returns:
|
||||
str: Workdir path.
|
||||
|
|
@ -306,15 +307,21 @@ def get_workdir_with_workdir_data(
|
|||
|
||||
if not anatomy:
|
||||
anatomy = Anatomy(project_name)
|
||||
|
||||
if not template_key:
|
||||
template_key = "work"
|
||||
|
||||
anatomy_filled = anatomy.format(workdir_data)
|
||||
result = anatomy_filled["work"]["folder"]
|
||||
if rootless:
|
||||
result = result.rootless
|
||||
return os.path.normpath(result)
|
||||
return anatomy_filled[template_key]["folder"]
|
||||
|
||||
|
||||
def get_workdir(
|
||||
project_doc, asset_doc, task_name, host_name, anatomy=None, rootless=False
|
||||
project_doc,
|
||||
asset_doc,
|
||||
task_name,
|
||||
host_name,
|
||||
anatomy=None,
|
||||
template_key=None
|
||||
):
|
||||
"""Fill workdir path from entered data and project's anatomy.
|
||||
|
||||
|
|
@ -329,7 +336,8 @@ def get_workdir(
|
|||
project name from `project_doc`. It is preffered to pass this
|
||||
argument as initialization of a new Anatomy object may be time
|
||||
consuming.
|
||||
rootless (bool): Return workdir without filled root key when `True`.
|
||||
template_key (str): Key of work templates in anatomy templates. Default
|
||||
value is defined in `get_workdir_with_workdir_data`.
|
||||
|
||||
Returns:
|
||||
str: Workdir path.
|
||||
|
|
@ -340,7 +348,7 @@ def get_workdir(
|
|||
workdir_data = get_workdir_data(
|
||||
project_doc, asset_doc, task_name, host_name
|
||||
)
|
||||
return get_workdir_with_workdir_data(workdir_data, anatomy, rootless)
|
||||
return get_workdir_with_workdir_data(workdir_data, anatomy, template_key)
|
||||
|
||||
|
||||
class BuildWorkfile:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue