Merge branch 'develop' into bugfix/workfile_builder_on_start

This commit is contained in:
Mustafa Jafar 2024-09-10 18:07:42 +03:00 committed by GitHub
commit 5fd48156fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -849,7 +849,7 @@ class AbstractTemplateBuilder(ABC):
)
return
# Try fill path with environments and anatomy roots
# Try to fill path with environments and anatomy roots
anatomy = Anatomy(project_name)
fill_data = {
key: value
@ -862,9 +862,7 @@ class AbstractTemplateBuilder(ABC):
"code": anatomy.project_code,
}
result = StringTemplate.format_template(path, fill_data)
if result.solved:
path = result.normalized()
path = self.resolve_template_path(path, fill_data)
if path and os.path.exists(path):
self.log.info("Found template at: '{}'".format(path))
@ -904,6 +902,27 @@ class AbstractTemplateBuilder(ABC):
"create_first_version": create_first_version
}
def resolve_template_path(self, path, fill_data) -> str:
"""Resolve the template path.
By default, this does nothing except returning the path directly.
This can be overridden in host integrations to perform additional
resolving over the template. Like, `hou.text.expandString` in Houdini.
Arguments:
path (str): The input path.
fill_data (dict[str, str]): Data to use for template formatting.
Returns:
str: The resolved path.
"""
result = StringTemplate.format_template(path, fill_data)
if result.solved:
path = result.normalized()
return path
def emit_event(self, topic, data=None, source=None) -> Event:
return self._event_system.emit(topic, data, source)