mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge branch 'develop' into enhancement/simplify_ExtractOIIOTranscode_settings
This commit is contained in:
commit
d1363a8dd1
13 changed files with 108 additions and 27 deletions
|
|
@ -94,4 +94,4 @@ class GlobalHostDataHook(PreLaunchHook):
|
|||
task_entity = get_task_by_name(
|
||||
project_name, folder_entity["id"], task_name
|
||||
)
|
||||
self.data["task_entity"] = task_entity
|
||||
self.data["task_entity"] = task_entity
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ class FormattingPart:
|
|||
# ensure key is properly formed [({})] properly closed.
|
||||
if not self.validate_key_is_matched(key):
|
||||
result.add_missing_key(key)
|
||||
result.add_output(self.template)
|
||||
result.add_output(self.template)
|
||||
return result
|
||||
|
||||
# check if key expects subdictionary keys (e.g. project[name])
|
||||
|
|
|
|||
|
|
@ -859,7 +859,7 @@ class AbstractTemplateBuilder(ABC):
|
|||
"Settings\\Profiles"
|
||||
).format(host_name.title()))
|
||||
|
||||
# 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
|
||||
|
|
@ -872,9 +872,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))
|
||||
|
|
@ -914,6 +912,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)
|
||||
|
||||
|
|
@ -1519,9 +1538,10 @@ class PlaceholderLoadMixin(object):
|
|||
if "asset" in placeholder.data:
|
||||
return []
|
||||
|
||||
representation_name = placeholder.data["representation"]
|
||||
if not representation_name:
|
||||
return []
|
||||
representation_names = None
|
||||
representation_name: str = placeholder.data["representation"]
|
||||
if representation_name:
|
||||
representation_names = [representation_name]
|
||||
|
||||
project_name = self.builder.project_name
|
||||
current_folder_entity = self.builder.current_folder_entity
|
||||
|
|
@ -1578,7 +1598,7 @@ class PlaceholderLoadMixin(object):
|
|||
)
|
||||
return list(get_representations(
|
||||
project_name,
|
||||
representation_names={representation_name},
|
||||
representation_names=representation_names,
|
||||
version_ids=version_ids
|
||||
))
|
||||
|
||||
|
|
|
|||
|
|
@ -217,9 +217,8 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin):
|
|||
joined_paths = ", ".join(
|
||||
["\"{}\"".format(path) for path in not_found_task_paths]
|
||||
)
|
||||
self.log.warning((
|
||||
"Not found task entities with paths \"{}\"."
|
||||
).format(joined_paths))
|
||||
self.log.warning(
|
||||
f"Not found task entities with paths {joined_paths}.")
|
||||
|
||||
def fill_latest_versions(self, context, project_name):
|
||||
"""Try to find latest version for each instance's product name.
|
||||
|
|
@ -321,7 +320,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin):
|
|||
use_context_version = instance.data["followWorkfileVersion"]
|
||||
|
||||
if use_context_version:
|
||||
version_number = context.data("version")
|
||||
version_number = context.data.get("version")
|
||||
|
||||
# Even if 'follow_workfile_version' is enabled, it may not be set
|
||||
# because workfile version was not collected to 'context.data'
|
||||
|
|
|
|||
|
|
@ -113,4 +113,4 @@ class CollectContextEntities(pyblish.api.ContextPlugin):
|
|||
"Task '{}' was not found in project '{}'.".format(
|
||||
task_path, project_name)
|
||||
)
|
||||
return task_entity
|
||||
return task_entity
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ class CollectSceneVersion(pyblish.api.ContextPlugin):
|
|||
return
|
||||
|
||||
if not context.data.get('currentFile'):
|
||||
raise KnownPublishError("Cannot get current workfile path. "
|
||||
"Make sure your scene is saved.")
|
||||
self.log.error("Cannot get current workfile path. "
|
||||
"Make sure your scene is saved.")
|
||||
return
|
||||
|
||||
filename = os.path.basename(context.data.get('currentFile'))
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ class ExtractOTIOReview(publish.Extractor):
|
|||
hosts = ["resolve", "hiero", "flame"]
|
||||
|
||||
# plugin default attributes
|
||||
temp_file_head = "tempFile."
|
||||
to_width = 1280
|
||||
to_height = 720
|
||||
output_ext = ".jpg"
|
||||
|
|
@ -62,6 +61,9 @@ class ExtractOTIOReview(publish.Extractor):
|
|||
make_sequence_collection
|
||||
)
|
||||
|
||||
# TODO refactore from using instance variable
|
||||
self.temp_file_head = self._get_folder_name_based_prefix(instance)
|
||||
|
||||
# TODO: convert resulting image sequence to mp4
|
||||
|
||||
# get otio clip and other time info from instance clip
|
||||
|
|
@ -491,3 +493,21 @@ class ExtractOTIOReview(publish.Extractor):
|
|||
out_frame_start = self.used_frames[-1]
|
||||
|
||||
return output_path, out_frame_start
|
||||
|
||||
def _get_folder_name_based_prefix(self, instance):
|
||||
"""Creates 'unique' human readable file prefix to differentiate.
|
||||
|
||||
Multiple instances might share same temp folder, but each instance
|
||||
would be differentiated by asset, eg. folder name.
|
||||
|
||||
It ix expected that there won't be multiple instances for same asset.
|
||||
"""
|
||||
folder_path = instance.data["folderPath"]
|
||||
folder_name = folder_path.split("/")[-1]
|
||||
folder_path = folder_path.replace("/", "_").lstrip("_")
|
||||
|
||||
file_prefix = f"{folder_path}_{folder_name}."
|
||||
self.log.debug(f"file_prefix::{file_prefix}")
|
||||
|
||||
return file_prefix
|
||||
|
||||
|
|
|
|||
|
|
@ -1900,7 +1900,7 @@ class OverscanCrop:
|
|||
string_value = re.sub(r"([ ]+)?px", " ", string_value)
|
||||
string_value = re.sub(r"([ ]+)%", "%", string_value)
|
||||
# Make sure +/- sign at the beginning of string is next to number
|
||||
string_value = re.sub(r"^([\+\-])[ ]+", "\g<1>", string_value)
|
||||
string_value = re.sub(r"^([\+\-])[ ]+", r"\g<1>", string_value)
|
||||
# Make sure +/- sign in the middle has zero spaces before number under
|
||||
# which belongs
|
||||
string_value = re.sub(
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ def get_representation_path_in_publish_context(
|
|||
|
||||
Allow resolving 'latest' paths from a publishing context's instances
|
||||
as if they will exist after publishing without them being integrated yet.
|
||||
|
||||
|
||||
Use first instance that has same folder path and product name,
|
||||
and contains representation with passed name.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,59 @@
|
|||
import inspect
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline.publish import PublishValidationError
|
||||
from ayon_core.tools.utils.host_tools import show_workfiles
|
||||
from ayon_core.pipeline.context_tools import version_up_current_workfile
|
||||
|
||||
|
||||
class SaveByVersionUpAction(pyblish.api.Action):
|
||||
"""Save Workfile."""
|
||||
label = "Save Workfile"
|
||||
on = "failed"
|
||||
icon = "save"
|
||||
|
||||
def process(self, context, plugin):
|
||||
version_up_current_workfile()
|
||||
|
||||
|
||||
class ShowWorkfilesAction(pyblish.api.Action):
|
||||
"""Save Workfile."""
|
||||
label = "Show Workfiles Tool..."
|
||||
on = "failed"
|
||||
icon = "files-o"
|
||||
|
||||
def process(self, context, plugin):
|
||||
show_workfiles()
|
||||
|
||||
|
||||
class ValidateCurrentSaveFile(pyblish.api.ContextPlugin):
|
||||
"""File must be saved before publishing"""
|
||||
"""File must be saved before publishing
|
||||
|
||||
This does not validate for unsaved changes. It only validates whether
|
||||
the current context was able to identify any 'currentFile'.
|
||||
"""
|
||||
|
||||
label = "Validate File Saved"
|
||||
order = pyblish.api.ValidatorOrder - 0.1
|
||||
hosts = ["maya", "houdini", "nuke"]
|
||||
hosts = ["fusion", "houdini", "max", "maya", "nuke", "substancepainter"]
|
||||
actions = [SaveByVersionUpAction, ShowWorkfilesAction]
|
||||
|
||||
def process(self, context):
|
||||
|
||||
current_file = context.data["currentFile"]
|
||||
if not current_file:
|
||||
raise PublishValidationError("File not saved")
|
||||
raise PublishValidationError(
|
||||
"Workfile is not saved. Please save your scene to continue.",
|
||||
title="File not saved",
|
||||
description=self.get_description())
|
||||
|
||||
def get_description(self):
|
||||
return inspect.cleandoc("""
|
||||
### File not saved
|
||||
|
||||
Your workfile must be saved to continue publishing.
|
||||
|
||||
The **Save Workfile** action will save it for you with the first
|
||||
available workfile version number in your current context.
|
||||
""")
|
||||
|
|
|
|||
|
|
@ -578,7 +578,7 @@ def make_sure_tray_is_running(
|
|||
args = get_ayon_launcher_args("tray", "--force")
|
||||
if env is None:
|
||||
env = os.environ.copy()
|
||||
|
||||
|
||||
# Make sure 'QT_API' is not set
|
||||
env.pop("QT_API", None)
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ def main(title="Scripts", parent=None, objectName=None):
|
|||
|
||||
# Register control + shift callback to add to shelf (maya behavior)
|
||||
modifiers = QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier
|
||||
if int(cmds.about(version=True)) <= 2025:
|
||||
if int(cmds.about(version=True)) < 2025:
|
||||
modifiers = int(modifiers)
|
||||
|
||||
menu.register_callback(modifiers, to_shelf)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ target-version = "py39"
|
|||
|
||||
[tool.ruff.lint]
|
||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||
select = ["E4", "E7", "E9", "F"]
|
||||
select = ["E4", "E7", "E9", "F", "W"]
|
||||
ignore = []
|
||||
|
||||
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||
|
|
@ -84,7 +84,6 @@ exclude = [
|
|||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"client/ayon_core/lib/__init__.py" = ["E402"]
|
||||
"client/ayon_core/hosts/max/startup/startup.py" = ["E402"]
|
||||
|
||||
[tool.ruff.format]
|
||||
# Like Black, use double quotes for strings.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue