mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Merge branch 'develop' into unify-and-speed-up-copying
This commit is contained in:
commit
3119766e21
3 changed files with 37 additions and 2 deletions
|
|
@ -587,8 +587,8 @@ class FormattingPart:
|
|||
if sub_key < 0:
|
||||
sub_key = len(value) + sub_key
|
||||
|
||||
invalid = 0 > sub_key < len(data)
|
||||
if invalid:
|
||||
valid = 0 <= sub_key < len(value)
|
||||
if not valid:
|
||||
used_keys.append(sub_key)
|
||||
missing_key = True
|
||||
break
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ from ayon_core.lib.events import QueuedEventSystem
|
|||
from ayon_core.lib.attribute_definitions import get_default_values
|
||||
from ayon_core.host import IPublishHost, IWorkfileHost
|
||||
from ayon_core.pipeline import Anatomy
|
||||
from ayon_core.pipeline.template_data import get_template_data
|
||||
from ayon_core.pipeline.plugin_discover import DiscoverResult
|
||||
|
||||
from .exceptions import (
|
||||
|
|
@ -480,6 +481,36 @@ class CreateContext:
|
|||
self.get_current_project_name())
|
||||
return self._current_project_settings
|
||||
|
||||
def get_template_data(
|
||||
self, folder_path: Optional[str], task_name: Optional[str]
|
||||
) -> Dict[str, Any]:
|
||||
"""Prepare template data for given context.
|
||||
|
||||
Method is using cached entities and settings to prepare template data.
|
||||
|
||||
Args:
|
||||
folder_path (Optional[str]): Folder path.
|
||||
task_name (Optional[str]): Task name.
|
||||
|
||||
Returns:
|
||||
dict[str, Any]: Template data.
|
||||
|
||||
"""
|
||||
project_entity = self.get_current_project_entity()
|
||||
folder_entity = task_entity = None
|
||||
if folder_path:
|
||||
folder_entity = self.get_folder_entity(folder_path)
|
||||
if task_name and folder_entity:
|
||||
task_entity = self.get_task_entity(folder_path, task_name)
|
||||
|
||||
return get_template_data(
|
||||
project_entity,
|
||||
folder_entity,
|
||||
task_entity,
|
||||
host_name=self.host_name,
|
||||
settings=self.get_current_project_settings(),
|
||||
)
|
||||
|
||||
@property
|
||||
def context_has_changed(self):
|
||||
"""Host context has changed.
|
||||
|
|
|
|||
|
|
@ -562,6 +562,10 @@ class BaseCreator(ABC):
|
|||
instance
|
||||
)
|
||||
|
||||
cur_project_name = self.create_context.get_current_project_name()
|
||||
if not project_entity and project_name == cur_project_name:
|
||||
project_entity = self.create_context.get_current_project_entity()
|
||||
|
||||
return get_product_name(
|
||||
project_name,
|
||||
task_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue