mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
use more suitable functions to get context data
This commit is contained in:
parent
bfcfdeb674
commit
394186bfb8
3 changed files with 27 additions and 4 deletions
|
|
@ -41,7 +41,7 @@ from ayon_core.pipeline import (
|
|||
AVALON_INSTANCE_ID,
|
||||
)
|
||||
from ayon_core.pipeline.context_tools import (
|
||||
get_custom_workfile_template_from_session
|
||||
get_current_context_custom_workfile_template
|
||||
)
|
||||
from ayon_core.pipeline.colorspace import get_imageio_config
|
||||
from ayon_core.pipeline.workfile import BuildWorkfile
|
||||
|
|
@ -2458,7 +2458,7 @@ def process_workfile_builder():
|
|||
# generate first version in file not existing and feature is enabled
|
||||
if create_fv_on and not os.path.exists(last_workfile_path):
|
||||
# get custom template path if any
|
||||
custom_template_path = get_custom_workfile_template_from_session(
|
||||
custom_template_path = get_current_context_custom_workfile_template(
|
||||
project_settings=project_settings
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -774,8 +774,8 @@ def get_imageio_config(
|
|||
|
||||
if not anatomy_data:
|
||||
from ayon_core.pipeline.context_tools import (
|
||||
get_template_data_from_session)
|
||||
anatomy_data = get_template_data_from_session()
|
||||
get_current_context_template_data)
|
||||
anatomy_data = get_current_context_template_data()
|
||||
|
||||
formatting_data = deepcopy(anatomy_data)
|
||||
|
||||
|
|
|
|||
|
|
@ -590,6 +590,29 @@ def get_custom_workfile_template_from_session(
|
|||
)
|
||||
|
||||
|
||||
def get_current_context_custom_workfile_template(project_settings=None):
|
||||
"""Filter and fill workfile template profiles by current context.
|
||||
|
||||
This function can be used only inside host where context is set.
|
||||
|
||||
Args:
|
||||
project_settings(Optional[Dict[str, Any]]): Project settings.
|
||||
|
||||
Returns:
|
||||
str: Path to template or None if none of profiles match current
|
||||
context. (Existence of formatted path is not validated.)
|
||||
|
||||
"""
|
||||
context = get_current_context()
|
||||
return get_custom_workfile_template_by_string_context(
|
||||
context["project_name"],
|
||||
context["folder_path"],
|
||||
context["task_name"],
|
||||
get_current_host_name(),
|
||||
project_settings=project_settings
|
||||
)
|
||||
|
||||
|
||||
def change_current_context(folder_entity, task_entity, template_key=None):
|
||||
"""Update active Session to a new task work area.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue