From edc451c916c4776dcea216e6362d56b1e1bde330 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Tue, 15 Apr 2025 18:24:19 +0200 Subject: [PATCH 001/109] add optional `aov` key to render template profile name --- server/settings/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/settings/tools.py b/server/settings/tools.py index 32c72e7a98..ed23cee69c 100644 --- a/server/settings/tools.py +++ b/server/settings/tools.py @@ -414,7 +414,7 @@ DEFAULT_TOOLS_VALUES = { "hosts": [], "task_types": [], "tasks": [], - "template": "{product[type]}{Task[name]}{Variant}" + "template": "{product[type]}{Task[name]}{Variant}<_{Aov}>" }, { "product_types": [ From afb0b082fd847c2e160f13798a00c0dfb0a608b9 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 10 Oct 2025 13:29:35 +0200 Subject: [PATCH 002/109] just set minimum size --- client/ayon_core/tools/utils/dialogs.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/client/ayon_core/tools/utils/dialogs.py b/client/ayon_core/tools/utils/dialogs.py index 5dd0ddd54e..e6df68c168 100644 --- a/client/ayon_core/tools/utils/dialogs.py +++ b/client/ayon_core/tools/utils/dialogs.py @@ -49,8 +49,6 @@ class ScrollMessageBox(QtWidgets.QDialog): self.setWindowFlags(QtCore.Qt.WindowTitleHint) - layout = QtWidgets.QVBoxLayout(self) - scroll_widget = QtWidgets.QScrollArea(self) scroll_widget.setWidgetResizable(True) content_widget = QtWidgets.QWidget(self) @@ -63,14 +61,8 @@ class ScrollMessageBox(QtWidgets.QDialog): content_layout.addWidget(label_widget) message_len = max(message_len, len(message)) - # guess size of scrollable area - # WARNING: 'desktop' method probably won't work in PySide6 - desktop = QtWidgets.QApplication.desktop() - max_width = desktop.availableGeometry().width() - scroll_widget.setMinimumWidth( - min(max_width, message_len * 6) - ) - layout.addWidget(scroll_widget) + # Set minimum width + scroll_widget.setMinimumWidth(360) buttons = QtWidgets.QDialogButtonBox.Ok if cancelable: @@ -86,7 +78,9 @@ class ScrollMessageBox(QtWidgets.QDialog): btn.clicked.connect(self._on_copy_click) btn_box.addButton(btn, QtWidgets.QDialogButtonBox.NoRole) - layout.addWidget(btn_box) + main_layout = QtWidgets.QVBoxLayout(self) + main_layout.addWidget(scroll_widget, 1) + main_layout.addWidget(btn_box, 0) def _on_copy_click(self): clipboard = QtWidgets.QApplication.clipboard() From abcb4fe3e42270bc30082f3ce138948f1852922a Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 10 Oct 2025 13:29:42 +0200 Subject: [PATCH 003/109] use py3 super --- client/ayon_core/tools/utils/dialogs.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/client/ayon_core/tools/utils/dialogs.py b/client/ayon_core/tools/utils/dialogs.py index e6df68c168..6dc3cf1d8b 100644 --- a/client/ayon_core/tools/utils/dialogs.py +++ b/client/ayon_core/tools/utils/dialogs.py @@ -41,7 +41,7 @@ class ScrollMessageBox(QtWidgets.QDialog): """ def __init__(self, icon, title, messages, cancelable=False): - super(ScrollMessageBox, self).__init__() + super().__init__() self.setWindowTitle(title) self.icon = icon @@ -98,7 +98,7 @@ class SimplePopup(QtWidgets.QDialog): on_clicked = QtCore.Signal() def __init__(self, parent=None, *args, **kwargs): - super(SimplePopup, self).__init__(parent=parent, *args, **kwargs) + super().__init__(parent=parent, *args, **kwargs) # Set default title self.setWindowTitle("Popup") @@ -155,7 +155,7 @@ class SimplePopup(QtWidgets.QDialog): geo = self._calculate_window_geometry() self.setGeometry(geo) - return super(SimplePopup, self).showEvent(event) + return super().showEvent(event) def _on_clicked(self): """Callback for when the 'show' button is clicked. @@ -222,9 +222,7 @@ class PopupUpdateKeys(SimplePopup): on_clicked_state = QtCore.Signal(bool) def __init__(self, parent=None, *args, **kwargs): - super(PopupUpdateKeys, self).__init__( - parent=parent, *args, **kwargs - ) + super().__init__(parent=parent, *args, **kwargs) layout = self.layout() From b7822123289e789776c91b19a0a69b4fa3757a5c Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 10 Oct 2025 16:04:20 +0200 Subject: [PATCH 004/109] Extracted gap filling from last version --- client/ayon_core/lib/plugin_tools.py | 97 +++++++++++++++++++ .../plugins/publish/extract_review.py | 91 +---------------- 2 files changed, 99 insertions(+), 89 deletions(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index 654bc7ac4a..1bc5824b86 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -4,6 +4,15 @@ import os import logging import re import collections +from typing import Optional, Any, Tuple +import clique +import speedcopy + +import ayon_api +import pyblish.api + +from ayon_api import get_last_version_by_product_name, get_representations + log = logging.getLogger(__name__) @@ -151,3 +160,91 @@ def source_hash(filepath, *args): time = str(os.path.getmtime(filepath)) size = str(os.path.getsize(filepath)) return "|".join([file_name, time, size] + list(args)).replace(".", ",") + + +def fill_sequence_gaps_with_previous( + collection: str, + staging_dir: str, + instance: pyblish.plugin.Instance, + current_repre_name: str, + start_frame: int, + end_frame: int +) -> Tuple[dict[str, Any], Optional[dict[int, str]]]: + """Tries to replace missing frames from ones from last version""" + used_version_entity, repre_file_paths = _get_last_version_files( + instance, current_repre_name + ) + if repre_file_paths is None: + # issues in getting last version files + return (None, None) + + prev_collection = clique.assemble( + repre_file_paths, + patterns=[clique.PATTERNS["frames"]], + minimum_items=1 + )[0][0] + prev_col_format = prev_collection.format("{head}{padding}{tail}") + + added_files = {} + anatomy = instance.context.data["anatomy"] + col_format = collection.format("{head}{padding}{tail}") + for frame in range(start_frame, end_frame + 1): + if frame in collection.indexes: + continue + hole_fpath = os.path.join(staging_dir, col_format % frame) + + previous_version_path = prev_col_format % frame + previous_version_path = anatomy.fill_root(previous_version_path) + if not os.path.exists(previous_version_path): + log.warning( + "Missing frame should be replaced from " + f"'{previous_version_path}' but that doesn't exist. " + "Falling back to filling from currently last rendered." + ) + return (None, None) + + log.warning( + f"Replacing missing '{hole_fpath}' with " + f"'{previous_version_path}'" + ) + speedcopy.copyfile(previous_version_path, hole_fpath) + added_files[frame] = hole_fpath + + return (used_version_entity, added_files) + + +def _get_last_version_files( + instance: pyblish.plugin.Instance, + current_repre_name: str, +): + product_name = instance.data["productName"] + project_name = instance.data["projectEntity"]["name"] + folder_entity = instance.data["folderEntity"] + + version_entity = get_last_version_by_product_name( + project_name, + product_name, + folder_entity["id"], + fields={"id"} + ) + + if not version_entity: + return (None, None) + + matching_repres = get_representations( + project_name, + version_ids=[version_entity["id"]], + representation_names=[current_repre_name], + fields={"files"} + ) + + if not matching_repres: + return None + matching_repre = list(matching_repres)[0] + + repre_file_paths = [ + file_info["path"] + for file_info in matching_repre["files"] + ] + + return (version_entity, repre_file_paths) diff --git a/client/ayon_core/plugins/publish/extract_review.py b/client/ayon_core/plugins/publish/extract_review.py index 04e534054e..535f8ab6cf 100644 --- a/client/ayon_core/plugins/publish/extract_review.py +++ b/client/ayon_core/plugins/publish/extract_review.py @@ -13,14 +13,13 @@ import clique import speedcopy import pyblish.api -from ayon_api import get_last_version_by_product_name, get_representations - from ayon_core.lib import ( get_ffmpeg_tool_args, filter_profiles, path_to_subprocess_arg, run_subprocess, ) +from ayon_core.lib.plugin_tools import fill_sequence_gaps_with_previous from ayon_core.lib.transcoding import ( IMAGE_EXTENSIONS, get_ffprobe_streams, @@ -511,7 +510,7 @@ class ExtractReview(pyblish.api.InstancePlugin): temp_data=temp_data ) elif fill_missing_frames == "previous_version": - new_frame_files = self.fill_sequence_gaps_with_previous( + _, new_frame_files = fill_sequence_gaps_with_previous( collection=collection, staging_dir=new_repre["stagingDir"], instance=instance, @@ -1050,92 +1049,6 @@ class ExtractReview(pyblish.api.InstancePlugin): return all_args - def fill_sequence_gaps_with_previous( - self, - collection: str, - staging_dir: str, - instance: pyblish.plugin.Instance, - current_repre_name: str, - start_frame: int, - end_frame: int - ) -> Optional[dict[int, str]]: - """Tries to replace missing frames from ones from last version""" - repre_file_paths = self._get_last_version_files( - instance, current_repre_name) - if repre_file_paths is None: - # issues in getting last version files, falling back - return None - - prev_collection = clique.assemble( - repre_file_paths, - patterns=[clique.PATTERNS["frames"]], - minimum_items=1 - )[0][0] - prev_col_format = prev_collection.format("{head}{padding}{tail}") - - added_files = {} - anatomy = instance.context.data["anatomy"] - col_format = collection.format("{head}{padding}{tail}") - for frame in range(start_frame, end_frame + 1): - if frame in collection.indexes: - continue - hole_fpath = os.path.join(staging_dir, col_format % frame) - - previous_version_path = prev_col_format % frame - previous_version_path = anatomy.fill_root(previous_version_path) - if not os.path.exists(previous_version_path): - self.log.warning( - "Missing frame should be replaced from " - f"'{previous_version_path}' but that doesn't exist. " - "Falling back to filling from currently last rendered." - ) - return None - - self.log.warning( - f"Replacing missing '{hole_fpath}' with " - f"'{previous_version_path}'" - ) - speedcopy.copyfile(previous_version_path, hole_fpath) - added_files[frame] = hole_fpath - - return added_files - - def _get_last_version_files( - self, - instance: pyblish.plugin.Instance, - current_repre_name: str, - ): - product_name = instance.data["productName"] - project_name = instance.data["projectEntity"]["name"] - folder_entity = instance.data["folderEntity"] - - version_entity = get_last_version_by_product_name( - project_name, - product_name, - folder_entity["id"], - fields={"id"} - ) - if not version_entity: - return None - - matching_repres = get_representations( - project_name, - version_ids=[version_entity["id"]], - representation_names=[current_repre_name], - fields={"files"} - ) - - if not matching_repres: - return None - matching_repre = list(matching_repres)[0] - - repre_file_paths = [ - file_info["path"] - for file_info in matching_repre["files"] - ] - - return repre_file_paths - def fill_sequence_gaps_with_blanks( self, collection: str, From a7209e68f0b0142d138f18e88656470354f8ad0b Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 10 Oct 2025 16:05:04 +0200 Subject: [PATCH 005/109] Push through reuseLastVersion value to deadline metadata --- client/ayon_core/pipeline/farm/pyblish_functions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/pipeline/farm/pyblish_functions.py b/client/ayon_core/pipeline/farm/pyblish_functions.py index 0d8e70f9d2..4e9f9ed601 100644 --- a/client/ayon_core/pipeline/farm/pyblish_functions.py +++ b/client/ayon_core/pipeline/farm/pyblish_functions.py @@ -249,7 +249,8 @@ def create_skeleton_instance( # map inputVersions `ObjectId` -> `str` so json supports it "inputVersions": list(map(str, data.get("inputVersions", []))), "colorspace": data.get("colorspace"), - "hasExplicitFrames": data.get("hasExplicitFrames") + "hasExplicitFrames": data.get("hasExplicitFrames") or False, + "reuseLastVersion": data.get("reuseLastVersion") or False } if data.get("renderlayer"): From 3a0ba21117d53fc8120f29a6c5a90f7da3df6e9c Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 10 Oct 2025 16:17:31 +0200 Subject: [PATCH 006/109] Return attrib for frameStart query --- client/ayon_core/lib/plugin_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index 1bc5824b86..1ee8f673e0 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -225,7 +225,7 @@ def _get_last_version_files( project_name, product_name, folder_entity["id"], - fields={"id"} + fields={"id", "attrib"} ) if not version_entity: From 98d8417c737ba5faaecab2dd5adfb78c4300af35 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 10 Oct 2025 16:36:44 +0200 Subject: [PATCH 007/109] Removed confusing message --- client/ayon_core/lib/plugin_tools.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index 1ee8f673e0..ec7668bdbf 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -199,7 +199,6 @@ def fill_sequence_gaps_with_previous( log.warning( "Missing frame should be replaced from " f"'{previous_version_path}' but that doesn't exist. " - "Falling back to filling from currently last rendered." ) return (None, None) From 29baac0d306969973226f7e20a20682a6e86b8b4 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 10 Oct 2025 16:38:43 +0200 Subject: [PATCH 008/109] Moved message where it makes sense --- client/ayon_core/plugins/publish/extract_review.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/ayon_core/plugins/publish/extract_review.py b/client/ayon_core/plugins/publish/extract_review.py index 535f8ab6cf..fac68a511a 100644 --- a/client/ayon_core/plugins/publish/extract_review.py +++ b/client/ayon_core/plugins/publish/extract_review.py @@ -520,6 +520,10 @@ class ExtractReview(pyblish.api.InstancePlugin): ) # fallback to original workflow if new_frame_files is None: + self.log.warning( + "Falling back to filling from currently " + "last rendered." + ) new_frame_files = ( self.fill_sequence_gaps_from_existing( collection=collection, From c046588ea8e6a1caf9d610ae6569bda3e3cd4e6d Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 10 Oct 2025 16:40:38 +0200 Subject: [PATCH 009/109] Ruff --- client/ayon_core/lib/plugin_tools.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index ec7668bdbf..117083a9c9 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -8,7 +8,6 @@ from typing import Optional, Any, Tuple import clique import speedcopy -import ayon_api import pyblish.api from ayon_api import get_last_version_by_product_name, get_representations From ef0af72632b74170f1bf7b381dac093b234f4f9b Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:33:12 +0200 Subject: [PATCH 010/109] Updated typin Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/lib/plugin_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index 117083a9c9..122d61c726 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -168,7 +168,7 @@ def fill_sequence_gaps_with_previous( current_repre_name: str, start_frame: int, end_frame: int -) -> Tuple[dict[str, Any], Optional[dict[int, str]]]: +) -> tuple[Optional[dict[str, Any]], Optional[dict[int, str]]]: """Tries to replace missing frames from ones from last version""" used_version_entity, repre_file_paths = _get_last_version_files( instance, current_repre_name From 951ea6286b1babfef3ab46e28fa88d8a574e1273 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:33:32 +0200 Subject: [PATCH 011/109] Removed unneeded import Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/lib/plugin_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index 122d61c726..3931e98777 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -4,7 +4,7 @@ import os import logging import re import collections -from typing import Optional, Any, Tuple +from typing import Optional, Any import clique import speedcopy From afe863e36b0d86b60676b226badc7e23e88cac73 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:34:07 +0200 Subject: [PATCH 012/109] Removed unnecessary parentheses Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/lib/plugin_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index 3931e98777..eff66fecfe 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -227,7 +227,7 @@ def _get_last_version_files( ) if not version_entity: - return (None, None) + return None, None matching_repres = get_representations( project_name, From 9a0f4b72e3e7fe2220202c4236fa848314bd89cb Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:34:53 +0200 Subject: [PATCH 013/109] Formatting change Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/pipeline/farm/pyblish_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/pipeline/farm/pyblish_functions.py b/client/ayon_core/pipeline/farm/pyblish_functions.py index 4e9f9ed601..a5053844b9 100644 --- a/client/ayon_core/pipeline/farm/pyblish_functions.py +++ b/client/ayon_core/pipeline/farm/pyblish_functions.py @@ -249,8 +249,8 @@ def create_skeleton_instance( # map inputVersions `ObjectId` -> `str` so json supports it "inputVersions": list(map(str, data.get("inputVersions", []))), "colorspace": data.get("colorspace"), - "hasExplicitFrames": data.get("hasExplicitFrames") or False, - "reuseLastVersion": data.get("reuseLastVersion") or False + "hasExplicitFrames": data.get("hasExplicitFrames", False), + "reuseLastVersion": data.get("reuseLastVersion", False), } if data.get("renderlayer"): From c3de53ae5e85a367487dc7a9d0cda3ab699589e7 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:35:09 +0200 Subject: [PATCH 014/109] Removed import Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/lib/plugin_tools.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index eff66fecfe..3b39567207 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -8,8 +8,6 @@ from typing import Optional, Any import clique import speedcopy -import pyblish.api - from ayon_api import get_last_version_by_product_name, get_representations From 1f88b90cbabbcaaaa53392a9c1ad40a3e9ceddd0 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:35:28 +0200 Subject: [PATCH 015/109] Added return type Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/lib/plugin_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index 3b39567207..dc371a9ed1 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -212,7 +212,7 @@ def fill_sequence_gaps_with_previous( def _get_last_version_files( instance: pyblish.plugin.Instance, current_repre_name: str, -): +) -> tuple[Optional[dict[str, Any], Optional[list[str]]]: product_name = instance.data["productName"] project_name = instance.data["projectEntity"]["name"] folder_entity = instance.data["folderEntity"] From 1da4abc9bd87aefed1fadd2cb5a219c9c86a56fc Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:35:46 +0200 Subject: [PATCH 016/109] Fixed return Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/lib/plugin_tools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index dc371a9ed1..676d3e43b5 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -234,9 +234,10 @@ def _get_last_version_files( fields={"files"} ) - if not matching_repres: - return None - matching_repre = list(matching_repres)[0] + matching_repre = next(matching_repres, None) + if not matching_repre: + return None, None + repre_file_paths = [ file_info["path"] From bd4381fe9b22ede0b70bbb4b0343c9e19caa3d73 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:45:24 +0200 Subject: [PATCH 017/109] Moved fill_sequence_gaps_with_previous --- client/ayon_core/lib/plugin_tools.py | 96 ------------------------ client/ayon_core/pipeline/publish/lib.py | 95 ++++++++++++++++++++++- 2 files changed, 94 insertions(+), 97 deletions(-) diff --git a/client/ayon_core/lib/plugin_tools.py b/client/ayon_core/lib/plugin_tools.py index 676d3e43b5..b19fe1e200 100644 --- a/client/ayon_core/lib/plugin_tools.py +++ b/client/ayon_core/lib/plugin_tools.py @@ -1,17 +1,9 @@ # -*- coding: utf-8 -*- """AYON plugin tools.""" import os -import logging import re import collections -from typing import Optional, Any -import clique -import speedcopy -from ayon_api import get_last_version_by_product_name, get_representations - - -log = logging.getLogger(__name__) CAPITALIZE_REGEX = re.compile(r"[a-zA-Z0-9]") @@ -157,91 +149,3 @@ def source_hash(filepath, *args): time = str(os.path.getmtime(filepath)) size = str(os.path.getsize(filepath)) return "|".join([file_name, time, size] + list(args)).replace(".", ",") - - -def fill_sequence_gaps_with_previous( - collection: str, - staging_dir: str, - instance: pyblish.plugin.Instance, - current_repre_name: str, - start_frame: int, - end_frame: int -) -> tuple[Optional[dict[str, Any]], Optional[dict[int, str]]]: - """Tries to replace missing frames from ones from last version""" - used_version_entity, repre_file_paths = _get_last_version_files( - instance, current_repre_name - ) - if repre_file_paths is None: - # issues in getting last version files - return (None, None) - - prev_collection = clique.assemble( - repre_file_paths, - patterns=[clique.PATTERNS["frames"]], - minimum_items=1 - )[0][0] - prev_col_format = prev_collection.format("{head}{padding}{tail}") - - added_files = {} - anatomy = instance.context.data["anatomy"] - col_format = collection.format("{head}{padding}{tail}") - for frame in range(start_frame, end_frame + 1): - if frame in collection.indexes: - continue - hole_fpath = os.path.join(staging_dir, col_format % frame) - - previous_version_path = prev_col_format % frame - previous_version_path = anatomy.fill_root(previous_version_path) - if not os.path.exists(previous_version_path): - log.warning( - "Missing frame should be replaced from " - f"'{previous_version_path}' but that doesn't exist. " - ) - return (None, None) - - log.warning( - f"Replacing missing '{hole_fpath}' with " - f"'{previous_version_path}'" - ) - speedcopy.copyfile(previous_version_path, hole_fpath) - added_files[frame] = hole_fpath - - return (used_version_entity, added_files) - - -def _get_last_version_files( - instance: pyblish.plugin.Instance, - current_repre_name: str, -) -> tuple[Optional[dict[str, Any], Optional[list[str]]]: - product_name = instance.data["productName"] - project_name = instance.data["projectEntity"]["name"] - folder_entity = instance.data["folderEntity"] - - version_entity = get_last_version_by_product_name( - project_name, - product_name, - folder_entity["id"], - fields={"id", "attrib"} - ) - - if not version_entity: - return None, None - - matching_repres = get_representations( - project_name, - version_ids=[version_entity["id"]], - representation_names=[current_repre_name], - fields={"files"} - ) - - matching_repre = next(matching_repres, None) - if not matching_repre: - return None, None - - - repre_file_paths = [ - file_info["path"] - for file_info in matching_repre["files"] - ] - - return (version_entity, repre_file_paths) diff --git a/client/ayon_core/pipeline/publish/lib.py b/client/ayon_core/pipeline/publish/lib.py index 3b82d961f8..4d555ae48b 100644 --- a/client/ayon_core/pipeline/publish/lib.py +++ b/client/ayon_core/pipeline/publish/lib.py @@ -7,7 +7,10 @@ import copy import warnings import hashlib import xml.etree.ElementTree -from typing import TYPE_CHECKING, Optional, Union, List +from typing import TYPE_CHECKING, Optional, Union, List, Any +import clique +import speedcopy +import logging import ayon_api import pyblish.util @@ -27,6 +30,7 @@ from .constants import ( DEFAULT_PUBLISH_TEMPLATE, DEFAULT_HERO_PUBLISH_TEMPLATE, ) +from ayon_api import get_last_version_by_product_name, get_representations if TYPE_CHECKING: from ayon_core.pipeline.traits import Representation @@ -34,6 +38,8 @@ if TYPE_CHECKING: TRAIT_INSTANCE_KEY: str = "representations_with_traits" +log = logging.getLogger(__name__) + def get_template_name_profiles( project_name, project_settings=None, logger=None @@ -1143,3 +1149,90 @@ def get_trait_representations( """ return instance.data.get(TRAIT_INSTANCE_KEY, []) + + +def fill_sequence_gaps_with_previous( + collection: str, + staging_dir: str, + instance: pyblish.plugin.Instance, + current_repre_name: str, + start_frame: int, + end_frame: int +) -> tuple[Optional[dict[str, Any]], Optional[dict[int, str]]]: + """Tries to replace missing frames from ones from last version""" + used_version_entity, repre_file_paths = _get_last_version_files( + instance, current_repre_name + ) + if repre_file_paths is None: + # issues in getting last version files + return (None, None) + + prev_collection = clique.assemble( + repre_file_paths, + patterns=[clique.PATTERNS["frames"]], + minimum_items=1 + )[0][0] + prev_col_format = prev_collection.format("{head}{padding}{tail}") + + added_files = {} + anatomy = instance.context.data["anatomy"] + col_format = collection.format("{head}{padding}{tail}") + for frame in range(start_frame, end_frame + 1): + if frame in collection.indexes: + continue + hole_fpath = os.path.join(staging_dir, col_format % frame) + + previous_version_path = prev_col_format % frame + previous_version_path = anatomy.fill_root(previous_version_path) + if not os.path.exists(previous_version_path): + log.warning( + "Missing frame should be replaced from " + f"'{previous_version_path}' but that doesn't exist. " + ) + return (None, None) + + log.warning( + f"Replacing missing '{hole_fpath}' with " + f"'{previous_version_path}'" + ) + speedcopy.copyfile(previous_version_path, hole_fpath) + added_files[frame] = hole_fpath + + return (used_version_entity, added_files) + + +def _get_last_version_files( + instance: pyblish.plugin.Instance, + current_repre_name: str, +) -> tuple[Optional[dict[str, Any]], Optional[list[str]]]: + product_name = instance.data["productName"] + project_name = instance.data["projectEntity"]["name"] + folder_entity = instance.data["folderEntity"] + + version_entity = get_last_version_by_product_name( + project_name, + product_name, + folder_entity["id"], + fields={"id", "attrib"} + ) + + if not version_entity: + return None, None + + matching_repres = get_representations( + project_name, + version_ids=[version_entity["id"]], + representation_names=[current_repre_name], + fields={"files"} + ) + + matching_repre = next(matching_repres, None) + if not matching_repre: + return None, None + + repre_file_paths = [ + file_info["path"] + for file_info in matching_repre["files"] + ] + + return (version_entity, repre_file_paths) From 949cfc75a61b5a1c14eeec40d9153e56c7da4331 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 13:47:14 +0200 Subject: [PATCH 018/109] Renamed fill_sequence_gaps_with_previous --- client/ayon_core/pipeline/publish/lib.py | 2 +- client/ayon_core/plugins/publish/extract_review.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/pipeline/publish/lib.py b/client/ayon_core/pipeline/publish/lib.py index 4d555ae48b..657a57226d 100644 --- a/client/ayon_core/pipeline/publish/lib.py +++ b/client/ayon_core/pipeline/publish/lib.py @@ -1151,7 +1151,7 @@ def get_trait_representations( return instance.data.get(TRAIT_INSTANCE_KEY, []) -def fill_sequence_gaps_with_previous( +def fill_sequence_gaps_with_previous_version( collection: str, staging_dir: str, instance: pyblish.plugin.Instance, diff --git a/client/ayon_core/plugins/publish/extract_review.py b/client/ayon_core/plugins/publish/extract_review.py index fac68a511a..fe0e7d4e3b 100644 --- a/client/ayon_core/plugins/publish/extract_review.py +++ b/client/ayon_core/plugins/publish/extract_review.py @@ -19,7 +19,7 @@ from ayon_core.lib import ( path_to_subprocess_arg, run_subprocess, ) -from ayon_core.lib.plugin_tools import fill_sequence_gaps_with_previous +from ayon_core.pipeline.publish.lib import fill_sequence_gaps_with_previous_version from ayon_core.lib.transcoding import ( IMAGE_EXTENSIONS, get_ffprobe_streams, @@ -510,7 +510,7 @@ class ExtractReview(pyblish.api.InstancePlugin): temp_data=temp_data ) elif fill_missing_frames == "previous_version": - _, new_frame_files = fill_sequence_gaps_with_previous( + _, new_frame_files = fill_sequence_gaps_with_previous_version( collection=collection, staging_dir=new_repre["stagingDir"], instance=instance, From f3300a67e42dac2698ca2a153f1e2cd220f88a85 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 13 Oct 2025 15:51:35 +0200 Subject: [PATCH 019/109] Formatting change Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/plugins/publish/extract_review.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/extract_review.py b/client/ayon_core/plugins/publish/extract_review.py index fe0e7d4e3b..89926d2235 100644 --- a/client/ayon_core/plugins/publish/extract_review.py +++ b/client/ayon_core/plugins/publish/extract_review.py @@ -19,7 +19,9 @@ from ayon_core.lib import ( path_to_subprocess_arg, run_subprocess, ) -from ayon_core.pipeline.publish.lib import fill_sequence_gaps_with_previous_version +from ayon_core.pipeline.publish.lib import ( + fill_sequence_gaps_with_previous_version, +) from ayon_core.lib.transcoding import ( IMAGE_EXTENSIONS, get_ffprobe_streams, From 0dc8bbe0a651f5c9a783163b7b43e2239f4005b3 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 14 Oct 2025 14:13:50 +0200 Subject: [PATCH 020/109] Reorder imports Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/pipeline/publish/lib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/pipeline/publish/lib.py b/client/ayon_core/pipeline/publish/lib.py index 657a57226d..96ab76f963 100644 --- a/client/ayon_core/pipeline/publish/lib.py +++ b/client/ayon_core/pipeline/publish/lib.py @@ -7,12 +7,13 @@ import copy import warnings import hashlib import xml.etree.ElementTree +import logging from typing import TYPE_CHECKING, Optional, Union, List, Any + import clique import speedcopy -import logging - import ayon_api +from ayon_api import get_last_version_by_product_name, get_representations import pyblish.util import pyblish.plugin import pyblish.api From 0d96e40d4075695c47905fbbf69268793388eaeb Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 14 Oct 2025 15:14:07 +0200 Subject: [PATCH 021/109] Ruff --- client/ayon_core/plugins/publish/extract_review.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/plugins/publish/extract_review.py b/client/ayon_core/plugins/publish/extract_review.py index fe0e7d4e3b..8a46b93060 100644 --- a/client/ayon_core/plugins/publish/extract_review.py +++ b/client/ayon_core/plugins/publish/extract_review.py @@ -507,10 +507,10 @@ class ExtractReview(pyblish.api.InstancePlugin): resolution_width=temp_data.resolution_width, resolution_height=temp_data.resolution_height, extension=temp_data.input_ext, - temp_data=temp_data + temp_data=temp_data, ) elif fill_missing_frames == "previous_version": - _, new_frame_files = fill_sequence_gaps_with_previous_version( + fill_output = fill_sequence_gaps_with_previous_version( collection=collection, staging_dir=new_repre["stagingDir"], instance=instance, @@ -518,6 +518,7 @@ class ExtractReview(pyblish.api.InstancePlugin): start_frame=temp_data.frame_start, end_frame=temp_data.frame_end, ) + _, new_frame_files = fill_output # fallback to original workflow if new_frame_files is None: self.log.warning( From bb1fed3dbc59eb5f226656c8b934323fa7373c3c Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 14 Oct 2025 15:16:49 +0200 Subject: [PATCH 022/109] Ruff --- client/ayon_core/pipeline/publish/lib.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/pipeline/publish/lib.py b/client/ayon_core/pipeline/publish/lib.py index 657a57226d..7152ec78fa 100644 --- a/client/ayon_core/pipeline/publish/lib.py +++ b/client/ayon_core/pipeline/publish/lib.py @@ -12,11 +12,15 @@ import clique import speedcopy import logging -import ayon_api import pyblish.util import pyblish.plugin import pyblish.api +from ayon_api import ( + get_server_api_connection, + get_representations, + get_last_version_by_product_name +) from ayon_core.lib import ( import_filepath, Logger, @@ -30,7 +34,6 @@ from .constants import ( DEFAULT_PUBLISH_TEMPLATE, DEFAULT_HERO_PUBLISH_TEMPLATE, ) -from ayon_api import get_last_version_by_product_name, get_representations if TYPE_CHECKING: from ayon_core.pipeline.traits import Representation @@ -1036,7 +1039,7 @@ def main_cli_publish( # NOTE: ayon-python-api does not have public api function to find # out if is used service user. So we need to have try > except # block. - con = ayon_api.get_server_api_connection() + con = get_server_api_connection() try: con.set_default_service_username(username) except ValueError: From 0aaac3e0d5769718960f362e1391fa7d7406e568 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 16 Oct 2025 10:38:12 +0200 Subject: [PATCH 023/109] Updates review extraction process. Refactors review extraction to remove Ftrack-specific elements. - Removes redundant data related to frame starts in Ftrack. - Simplifies review representation. - Streamlines the audio input processing. --- client/ayon_core/plugins/publish/extract_review.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/client/ayon_core/plugins/publish/extract_review.py b/client/ayon_core/plugins/publish/extract_review.py index 04e534054e..25c4c817ff 100644 --- a/client/ayon_core/plugins/publish/extract_review.py +++ b/client/ayon_core/plugins/publish/extract_review.py @@ -130,7 +130,7 @@ def frame_to_timecode(frame: int, fps: float) -> str: class ExtractReview(pyblish.api.InstancePlugin): - """Extracting Review mov file for Ftrack + """Extracting Reviewable medias Compulsory attribute of representation is tags list with "review", otherwise the representation is ignored. @@ -612,8 +612,6 @@ class ExtractReview(pyblish.api.InstancePlugin): "name": "{}_{}".format(output_name, output_ext), "outputName": output_name, "outputDef": output_def, - "frameStartFtrack": temp_data.output_frame_start, - "frameEndFtrack": temp_data.output_frame_end, "ffmpeg_cmd": subprcs_cmd }) @@ -1384,15 +1382,7 @@ class ExtractReview(pyblish.api.InstancePlugin): return audio_in_args, audio_filters, audio_out_args for audio in audio_inputs: - # NOTE modified, always was expected "frameStartFtrack" which is - # STRANGE?!!! There should be different key, right? - # TODO use different frame start! offset_seconds = 0 - frame_start_ftrack = instance.data.get("frameStartFtrack") - if frame_start_ftrack is not None: - offset_frames = frame_start_ftrack - audio["offset"] - offset_seconds = offset_frames / temp_data.fps - if offset_seconds > 0: audio_in_args.append( "-ss {}".format(offset_seconds) From 16d5fe45fc1ad21c6a9a548ffcdef528badd2fb7 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Thu, 16 Oct 2025 12:44:35 +0200 Subject: [PATCH 024/109] use settings summary to resolve which addon versions are used --- client/ayon_core/addon/base.py | 81 ++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/client/ayon_core/addon/base.py b/client/ayon_core/addon/base.py index 1d1562f543..9207bb74c0 100644 --- a/client/ayon_core/addon/base.py +++ b/client/ayon_core/addon/base.py @@ -2,7 +2,6 @@ """Base class for AYON addons.""" from __future__ import annotations -import copy import os import sys import time @@ -13,6 +12,7 @@ import collections import warnings from uuid import uuid4 from abc import ABC, abstractmethod +from urllib.parse import urlencode from types import ModuleType import typing from typing import Optional, Any, Union @@ -136,39 +136,47 @@ def load_addons(force: bool = False) -> None: time.sleep(0.1) -def _get_ayon_bundle_data() -> Optional[dict[str, Any]]: +def _get_ayon_bundle_data() -> tuple[ + dict[str, Any], Optional[dict[str, Any]] +]: studio_bundle_name = os.environ.get("AYON_STUDIO_BUNDLE_NAME") project_bundle_name = os.getenv("AYON_BUNDLE_NAME") bundles = ayon_api.get_bundles()["bundles"] - project_bundle = next( + studio_bundle = next( ( bundle for bundle in bundles - if bundle["name"] == project_bundle_name + if bundle["name"] == studio_bundle_name ), None ) - studio_bundle = None - if studio_bundle_name and project_bundle_name != studio_bundle_name: - studio_bundle = next( + + if studio_bundle is None: + raise RuntimeError(f"Failed to find bundle '{studio_bundle_name}'.") + + project_bundle = None + if project_bundle_name and project_bundle_name != studio_bundle_name: + project_bundle = next( ( bundle for bundle in bundles - if bundle["name"] == studio_bundle_name + if bundle["name"] == project_bundle_name ), None ) - if project_bundle and studio_bundle: - addons = copy.deepcopy(studio_bundle["addons"]) - addons.update(project_bundle["addons"]) - project_bundle["addons"] = addons - return project_bundle + if project_bundle is None: + raise RuntimeError( + f"Failed to find project bundle '{project_bundle_name}'." + ) + + return studio_bundle, project_bundle def _get_ayon_addons_information( - bundle_info: dict[str, Any] -) -> list[dict[str, Any]]: + studio_bundle: dict[str, Any], + project_bundle: Optional[dict[str, Any]], +) -> dict[str, str]: """Receive information about addons to use from server. Todos: @@ -181,22 +189,20 @@ def _get_ayon_addons_information( list[dict[str, Any]]: List of addon information to use. """ - output = [] - bundle_addons = bundle_info["addons"] - addons = ayon_api.get_addons_info()["addons"] - for addon in addons: - name = addon["name"] - versions = addon.get("versions") - addon_version = bundle_addons.get(name) - if addon_version is None or not versions: - continue - version = versions.get(addon_version) - if version: - version = copy.deepcopy(version) - version["name"] = name - version["version"] = addon_version - output.append(version) - return output + key_values = { + "summary": "true", + "bundle_name": studio_bundle["name"], + } + if project_bundle: + key_values["project_bundle_name"] = project_bundle["name"] + + query = urlencode(key_values) + + response = ayon_api.get(f"settings?{query}") + return { + addon["name"]: addon["version"] + for addon in response.data["addons"] + } def _load_ayon_addons(log: logging.Logger) -> list[ModuleType]: @@ -214,8 +220,8 @@ def _load_ayon_addons(log: logging.Logger) -> list[ModuleType]: """ all_addon_modules = [] - bundle_info = _get_ayon_bundle_data() - addons_info = _get_ayon_addons_information(bundle_info) + studio_bundle, project_bundle = _get_ayon_bundle_data() + addons_info = _get_ayon_addons_information(studio_bundle, project_bundle) if not addons_info: return all_addon_modules @@ -227,17 +233,16 @@ def _load_ayon_addons(log: logging.Logger) -> list[ModuleType]: dev_addons_info = {} if dev_mode_enabled: # Get dev addons info only when dev mode is enabled - dev_addons_info = bundle_info.get("addonDevelopment", dev_addons_info) + dev_addons_info = studio_bundle.get( + "addonDevelopment", dev_addons_info + ) addons_dir_exists = os.path.exists(addons_dir) if not addons_dir_exists: log.warning( f"Addons directory does not exists. Path \"{addons_dir}\"") - for addon_info in addons_info: - addon_name = addon_info["name"] - addon_version = addon_info["version"] - + for addon_name, addon_version in addons_info.items(): # core addon does not have any addon object if addon_name == "core": continue From e356630f4d94428828f14898a70ecc3c70619b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Thu, 16 Oct 2025 17:19:41 +0200 Subject: [PATCH 025/109] =?UTF-8?q?=F0=9F=AA=B2=20get=20the=20correct=20te?= =?UTF-8?q?mplate=20for=20resources?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/publish/collect_resources_path.py | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/client/ayon_core/plugins/publish/collect_resources_path.py b/client/ayon_core/plugins/publish/collect_resources_path.py index 2e5b296228..e410303a2a 100644 --- a/client/ayon_core/plugins/publish/collect_resources_path.py +++ b/client/ayon_core/plugins/publish/collect_resources_path.py @@ -13,6 +13,9 @@ import copy import pyblish.api +from ayon_core.pipeline.publish import get_publish_template_name +from ayon_core.pipeline.context_tools import get_current_host_name + class CollectResourcesPath(pyblish.api.InstancePlugin): """Generate directory path where the files and resources will be stored. @@ -77,16 +80,24 @@ class CollectResourcesPath(pyblish.api.InstancePlugin): # This is for cases of Deprecated anatomy without `folder` # TODO remove when all clients have solved this issue - template_data.update({ - "frame": "FRAME_TEMP", - "representation": "TEMP" - }) + template_data.update({"frame": "FRAME_TEMP", "representation": "TEMP"}) - publish_templates = anatomy.get_template_item( - "publish", "default", "directory" + + template_name = get_publish_template_name( + project_name=template_data["project"]["name"], + host_name=get_current_host_name(), + product_type=template_data["product"]["type"], + task_name=template_data["product"]["name"], + task_type=template_data["product"]["type"], + project_settings=instance.context.data["project_settings"], + logger=self.log, ) + + publish_template = anatomy.get_template_item( + "publish", template_name, "directory") + publish_folder = os.path.normpath( - publish_templates.format_strict(template_data) + publish_template.format_strict(template_data) ) resources_folder = os.path.join(publish_folder, "resources") From 68e19f4184dd9835df1dda49417da2bd8118a64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Thu, 16 Oct 2025 18:55:04 +0200 Subject: [PATCH 026/109] =?UTF-8?q?=F0=9F=90=95=20fix=20linting=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ayon_core/plugins/publish/collect_resources_path.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/collect_resources_path.py b/client/ayon_core/plugins/publish/collect_resources_path.py index e410303a2a..11e378ce52 100644 --- a/client/ayon_core/plugins/publish/collect_resources_path.py +++ b/client/ayon_core/plugins/publish/collect_resources_path.py @@ -82,7 +82,6 @@ class CollectResourcesPath(pyblish.api.InstancePlugin): # TODO remove when all clients have solved this issue template_data.update({"frame": "FRAME_TEMP", "representation": "TEMP"}) - template_name = get_publish_template_name( project_name=template_data["project"]["name"], host_name=get_current_host_name(), From d99075fed6e2186326aa8eb772b9480c8490a00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Fri, 17 Oct 2025 11:39:42 +0200 Subject: [PATCH 027/109] =?UTF-8?q?=E2=99=BB=EF=B8=8Fuse=20collected=20dat?= =?UTF-8?q?a=20instead?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ayon_core/plugins/publish/collect_resources_path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/collect_resources_path.py b/client/ayon_core/plugins/publish/collect_resources_path.py index 11e378ce52..2ef3ffe61d 100644 --- a/client/ayon_core/plugins/publish/collect_resources_path.py +++ b/client/ayon_core/plugins/publish/collect_resources_path.py @@ -84,7 +84,7 @@ class CollectResourcesPath(pyblish.api.InstancePlugin): template_name = get_publish_template_name( project_name=template_data["project"]["name"], - host_name=get_current_host_name(), + host_name=instance.context.data["hostName"], product_type=template_data["product"]["type"], task_name=template_data["product"]["name"], task_type=template_data["product"]["type"], From fd5a5a2142437d264d404456ff990951876ff69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Fri, 17 Oct 2025 11:40:18 +0200 Subject: [PATCH 028/109] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20and=20remove=20unn?= =?UTF-8?q?ecessary=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ayon_core/plugins/publish/collect_resources_path.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/collect_resources_path.py b/client/ayon_core/plugins/publish/collect_resources_path.py index 2ef3ffe61d..fc8d3d15cd 100644 --- a/client/ayon_core/plugins/publish/collect_resources_path.py +++ b/client/ayon_core/plugins/publish/collect_resources_path.py @@ -14,7 +14,6 @@ import copy import pyblish.api from ayon_core.pipeline.publish import get_publish_template_name -from ayon_core.pipeline.context_tools import get_current_host_name class CollectResourcesPath(pyblish.api.InstancePlugin): From fe7adf36e689b4fcc87544d91f3987f6ad63e929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Fri, 17 Oct 2025 11:44:33 +0200 Subject: [PATCH 029/109] =?UTF-8?q?=F0=9F=AA=B2=20fix=20task=20and=20produ?= =?UTF-8?q?ct=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/publish/collect_resources_path.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/plugins/publish/collect_resources_path.py b/client/ayon_core/plugins/publish/collect_resources_path.py index fc8d3d15cd..30fe5c0c80 100644 --- a/client/ayon_core/plugins/publish/collect_resources_path.py +++ b/client/ayon_core/plugins/publish/collect_resources_path.py @@ -81,12 +81,18 @@ class CollectResourcesPath(pyblish.api.InstancePlugin): # TODO remove when all clients have solved this issue template_data.update({"frame": "FRAME_TEMP", "representation": "TEMP"}) + task_name = task_type = None + task_entity = instance.data.get("taskEntity") + if task_entity: + task_name = task_entity.name + task_type = task_entity.type + template_name = get_publish_template_name( project_name=template_data["project"]["name"], host_name=instance.context.data["hostName"], - product_type=template_data["product"]["type"], - task_name=template_data["product"]["name"], - task_type=template_data["product"]["type"], + product_type=instance.data["productType"], + task_name=task_name, + task_type=task_type, project_settings=instance.context.data["project_settings"], logger=self.log, ) From c49d92c30668df40a620218fce2c8991973d1d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Fri, 17 Oct 2025 11:46:48 +0200 Subject: [PATCH 030/109] =?UTF-8?q?=F0=9F=A6=97=20fix=20data=20access?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ayon_core/plugins/publish/collect_resources_path.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/plugins/publish/collect_resources_path.py b/client/ayon_core/plugins/publish/collect_resources_path.py index 30fe5c0c80..927e358ea7 100644 --- a/client/ayon_core/plugins/publish/collect_resources_path.py +++ b/client/ayon_core/plugins/publish/collect_resources_path.py @@ -84,8 +84,8 @@ class CollectResourcesPath(pyblish.api.InstancePlugin): task_name = task_type = None task_entity = instance.data.get("taskEntity") if task_entity: - task_name = task_entity.name - task_type = task_entity.type + task_name = task_entity["name"] + task_type = task_entity["task_type"] template_name = get_publish_template_name( project_name=template_data["project"]["name"], From df8459bbabf81d26c6b15d47dce3a66eb22c7de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Fri, 17 Oct 2025 11:47:57 +0200 Subject: [PATCH 031/109] =?UTF-8?q?=F0=9F=A6=97=20fix=20key=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ayon_core/plugins/publish/collect_resources_path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/collect_resources_path.py b/client/ayon_core/plugins/publish/collect_resources_path.py index 927e358ea7..07cae07a3f 100644 --- a/client/ayon_core/plugins/publish/collect_resources_path.py +++ b/client/ayon_core/plugins/publish/collect_resources_path.py @@ -85,7 +85,7 @@ class CollectResourcesPath(pyblish.api.InstancePlugin): task_entity = instance.data.get("taskEntity") if task_entity: task_name = task_entity["name"] - task_type = task_entity["task_type"] + task_type = task_entity["taskType"] template_name = get_publish_template_name( project_name=template_data["project"]["name"], From 34594f7ee4deddcf7cb58efab05311b8c66d14b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= <33513211+antirotor@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:12:58 +0200 Subject: [PATCH 032/109] Apply suggestion from @iLLiCiTiT Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/plugins/publish/collect_resources_path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/collect_resources_path.py b/client/ayon_core/plugins/publish/collect_resources_path.py index 07cae07a3f..704c69a6ab 100644 --- a/client/ayon_core/plugins/publish/collect_resources_path.py +++ b/client/ayon_core/plugins/publish/collect_resources_path.py @@ -88,7 +88,7 @@ class CollectResourcesPath(pyblish.api.InstancePlugin): task_type = task_entity["taskType"] template_name = get_publish_template_name( - project_name=template_data["project"]["name"], + project_name=instance.context.data["projectName"], host_name=instance.context.data["hostName"], product_type=instance.data["productType"], task_name=task_name, From 4a1755c7c58f60706f048e628e6005017406aaef Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 17 Oct 2025 16:06:37 +0200 Subject: [PATCH 033/109] Fixes source metadata key in OTIO review extraction The change corrects the metadata key prefixes used when extracting source width and height information for OTIO reviewable representations. It removes the trailing period from the prefixes "ayon.source." and "openpype.source." to ensure accurate retrieval of resolution data. This resolves an issue where incorrect or missing resolution information could lead to squished reviewables. --- client/ayon_core/plugins/publish/extract_otio_review.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/extract_otio_review.py b/client/ayon_core/plugins/publish/extract_otio_review.py index 90215bd2c9..f338fba746 100644 --- a/client/ayon_core/plugins/publish/extract_otio_review.py +++ b/client/ayon_core/plugins/publish/extract_otio_review.py @@ -130,7 +130,7 @@ class ExtractOTIOReview( # NOTE it looks like it is set only in hiero integration res_data = {"width": self.to_width, "height": self.to_height} for key in res_data: - for meta_prefix in ("ayon.source.", "openpype.source."): + for meta_prefix in ("ayon.source", "openpype.source"): meta_key = f"{meta_prefix}.{key}" value = media_metadata.get(meta_key) if value is not None: From 99a9541f27cf6c26117cae17b6129be20d5397c5 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 20 Oct 2025 14:55:03 +0200 Subject: [PATCH 034/109] Ruff --- client/ayon_core/plugins/publish/extract_review.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/extract_review.py b/client/ayon_core/plugins/publish/extract_review.py index 8a46b93060..0111d02cb3 100644 --- a/client/ayon_core/plugins/publish/extract_review.py +++ b/client/ayon_core/plugins/publish/extract_review.py @@ -19,7 +19,9 @@ from ayon_core.lib import ( path_to_subprocess_arg, run_subprocess, ) -from ayon_core.pipeline.publish.lib import fill_sequence_gaps_with_previous_version +from ayon_core.pipeline.publish.lib import ( + fill_sequence_gaps_with_previous_version +) from ayon_core.lib.transcoding import ( IMAGE_EXTENSIONS, get_ffprobe_streams, From 0dd5620de61614e90efe0632bc54cc0e99089347 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 20 Oct 2025 16:27:23 +0200 Subject: [PATCH 035/109] better typehints --- client/ayon_core/lib/path_templates.py | 93 +++++++++++++------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/client/ayon_core/lib/path_templates.py b/client/ayon_core/lib/path_templates.py index c6e9e14eac..ccbea01fa6 100644 --- a/client/ayon_core/lib/path_templates.py +++ b/client/ayon_core/lib/path_templates.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import os import re import copy @@ -5,11 +7,7 @@ import numbers import warnings import platform from string import Formatter -import typing -from typing import List, Dict, Any, Set - -if typing.TYPE_CHECKING: - from typing import Union +from typing import Any, Union SUB_DICT_PATTERN = re.compile(r"([^\[\]]+)") OPTIONAL_PATTERN = re.compile(r"(<.*?[^{0]*>)[^0-9]*?") @@ -84,7 +82,7 @@ class StringTemplate: if substr: new_parts.append(substr) - self._parts: List["Union[str, OptionalPart, FormattingPart]"] = ( + self._parts: list[Union[str, OptionalPart, FormattingPart]] = ( self.find_optional_parts(new_parts) ) @@ -105,7 +103,7 @@ class StringTemplate: def template(self) -> str: return self._template - def format(self, data: Dict[str, Any]) -> "TemplateResult": + def format(self, data: dict[str, Any]) -> "TemplateResult": """ Figure out with whole formatting. Separate advanced keys (*Like '{project[name]}') from string which must @@ -145,29 +143,29 @@ class StringTemplate: invalid_types ) - def format_strict(self, data: Dict[str, Any]) -> "TemplateResult": + def format_strict(self, data: dict[str, Any]) -> "TemplateResult": result = self.format(data) result.validate() return result @classmethod def format_template( - cls, template: str, data: Dict[str, Any] + cls, template: str, data: dict[str, Any] ) -> "TemplateResult": objected_template = cls(template) return objected_template.format(data) @classmethod def format_strict_template( - cls, template: str, data: Dict[str, Any] + cls, template: str, data: dict[str, Any] ) -> "TemplateResult": objected_template = cls(template) return objected_template.format_strict(data) @staticmethod def find_optional_parts( - parts: List["Union[str, FormattingPart]"] - ) -> List["Union[str, OptionalPart, FormattingPart]"]: + parts: list[Union[str, FormattingPart]] + ) -> list[Union[str, OptionalPart, FormattingPart]]: new_parts = [] tmp_parts = {} counted_symb = -1 @@ -192,7 +190,7 @@ class StringTemplate: len(parts) == 1 and isinstance(parts[0], str) ): - value = "<{}>".format(parts[0]) + value = f"<{parts[0]}>" else: value = OptionalPart(parts) @@ -223,7 +221,7 @@ class TemplateResult(str): only used keys. solved (bool): For check if all required keys were filled. template (str): Original template. - missing_keys (Iterable[str]): Missing keys that were not in the data. + missing_keys (list[str]): Missing keys that were not in the data. Include missing optional keys. invalid_types (dict): When key was found in data, but value had not allowed DataType. Allowed data types are `numbers`, @@ -232,11 +230,11 @@ class TemplateResult(str): of number. """ - used_values: Dict[str, Any] = None + used_values: dict[str, Any] = None solved: bool = None template: str = None - missing_keys: List[str] = None - invalid_types: Dict[str, Any] = None + missing_keys: list[str] = None + invalid_types: dict[str, Any] = None def __new__( cls, filled_template, template, solved, @@ -296,21 +294,21 @@ class TemplatePartResult: """Result to store result of template parts.""" def __init__(self, optional: bool = False): # Missing keys or invalid value types of required keys - self._missing_keys: Set[str] = set() - self._invalid_types: Dict[str, Any] = {} + self._missing_keys: set[str] = set() + self._invalid_types: dict[str, Any] = {} # Missing keys or invalid value types of optional keys - self._missing_optional_keys: Set[str] = set() - self._invalid_optional_types: Dict[str, Any] = {} + self._missing_optional_keys: set[str] = set() + self._invalid_optional_types: dict[str, Any] = {} # Used values stored by key with origin type # - key without any padding or key modifiers # - value from filling data # Example: {"version": 1} - self._used_values: Dict[str, Any] = {} + self._used_values: dict[str, Any] = {} # Used values stored by key with all modifirs # - value is already formatted string # Example: {"version:0>3": "001"} - self._really_used_values: Dict[str, Any] = {} + self._really_used_values: dict[str, Any] = {} # Concatenated string output after formatting self._output: str = "" # Is this result from optional part @@ -336,8 +334,9 @@ class TemplatePartResult: self._really_used_values.update(other.really_used_values) else: - raise TypeError("Cannot add data from \"{}\" to \"{}\"".format( - str(type(other)), self.__class__.__name__) + raise TypeError( + f"Cannot add data from \"{type(other)}\"" + f" to \"{self.__class__.__name__}\"" ) @property @@ -362,40 +361,41 @@ class TemplatePartResult: return self._output @property - def missing_keys(self) -> Set[str]: + def missing_keys(self) -> set[str]: return self._missing_keys @property - def missing_optional_keys(self) -> Set[str]: + def missing_optional_keys(self) -> set[str]: return self._missing_optional_keys @property - def invalid_types(self) -> Dict[str, Any]: + def invalid_types(self) -> dict[str, Any]: return self._invalid_types @property - def invalid_optional_types(self) -> Dict[str, Any]: + def invalid_optional_types(self) -> dict[str, Any]: return self._invalid_optional_types @property - def really_used_values(self) -> Dict[str, Any]: + def really_used_values(self) -> dict[str, Any]: return self._really_used_values @property - def realy_used_values(self) -> Dict[str, Any]: + def realy_used_values(self) -> dict[str, Any]: warnings.warn( "Property 'realy_used_values' is deprecated." " Use 'really_used_values' instead.", - DeprecationWarning + DeprecationWarning, + stacklevel=2, ) return self._really_used_values @property - def used_values(self) -> Dict[str, Any]: + def used_values(self) -> dict[str, Any]: return self._used_values @staticmethod - def split_keys_to_subdicts(values: Dict[str, Any]) -> Dict[str, Any]: + def split_keys_to_subdicts(values: dict[str, Any]) -> dict[str, Any]: output = {} formatter = Formatter() for key, value in values.items(): @@ -410,7 +410,7 @@ class TemplatePartResult: data[last_key] = value return output - def get_clean_used_values(self) -> Dict[str, Any]: + def get_clean_used_values(self) -> dict[str, Any]: new_used_values = {} for key, value in self.used_values.items(): if isinstance(value, FormatObject): @@ -426,7 +426,8 @@ class TemplatePartResult: warnings.warn( "Method 'add_realy_used_value' is deprecated." " Use 'add_really_used_value' instead.", - DeprecationWarning + DeprecationWarning, + stacklevel=2, ) self.add_really_used_value(key, value) @@ -479,7 +480,7 @@ class FormattingPart: self, field_name: str, format_spec: str, - conversion: "Union[str, None]", + conversion: Union[str, None], ): format_spec_v = "" if format_spec: @@ -546,7 +547,7 @@ class FormattingPart: return not queue @staticmethod - def keys_to_template_base(keys: List[str]): + def keys_to_template_base(keys: list[str]): if not keys: return None # Create copy of keys @@ -556,7 +557,7 @@ class FormattingPart: return f"{template_base}{joined_keys}" def format( - self, data: Dict[str, Any], result: TemplatePartResult + self, data: dict[str, Any], result: TemplatePartResult ) -> TemplatePartResult: """Format the formattings string. @@ -687,23 +688,25 @@ class OptionalPart: def __init__( self, - parts: List["Union[str, OptionalPart, FormattingPart]"] + parts: list[Union[str, OptionalPart, FormattingPart]] ): - self._parts: List["Union[str, OptionalPart, FormattingPart]"] = parts + self._parts: list[Union[str, OptionalPart, FormattingPart]] = parts @property - def parts(self) -> List["Union[str, OptionalPart, FormattingPart]"]: + def parts(self) -> list[Union[str, OptionalPart, FormattingPart]]: return self._parts def __str__(self) -> str: - return "<{}>".format("".join([str(p) for p in self._parts])) + joined_parts = "".join([str(p) for p in self._parts]) + return f"<{joined_parts}>" def __repr__(self) -> str: - return "".format("".join([str(p) for p in self._parts])) + joined_parts = "".join([str(p) for p in self._parts]) + return f"" def format( self, - data: Dict[str, Any], + data: dict[str, Any], result: TemplatePartResult, ) -> TemplatePartResult: new_result = TemplatePartResult(True) From 4fca5bcde5f086cc37ea3a961cd0b872276fb438 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 20 Oct 2025 17:04:56 +0200 Subject: [PATCH 036/109] Implemented helper dict to handle str -> dict conversion --- client/ayon_core/lib/path_templates.py | 68 +++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/lib/path_templates.py b/client/ayon_core/lib/path_templates.py index ccbea01fa6..131a2efaa4 100644 --- a/client/ayon_core/lib/path_templates.py +++ b/client/ayon_core/lib/path_templates.py @@ -7,7 +7,7 @@ import numbers import warnings import platform from string import Formatter -from typing import Any, Union +from typing import Any, Union, Iterable SUB_DICT_PATTERN = re.compile(r"([^\[\]]+)") OPTIONAL_PATTERN = re.compile(r"(<.*?[^{0]*>)[^0-9]*?") @@ -42,6 +42,66 @@ class TemplateUnsolved(Exception): ) +class DefaultValueDict(dict): + """Dictionary that supports the default key to use for str conversion. + + Is helpful for changes of a key in a template from string to dictionary + for example '{folder}' -> '{folder[name]}'. + >>> data = DefaultValueDict( + >>> "name", + >>> {"folder": {"name": "FolderName"}} + >>> ) + >>> print("{folder[name]}".format_map(data)) + FolderName + >>> print("{folder}".format_map(data)) + FolderName + + Args: + default_key (Union[str, Iterable[str]]): Default key to use for str + conversion. Can also expect multiple keys for more nested + dictionary. + + """ + def __init__( + self, default_keys: Union[str, Iterable[str]], *args, **kwargs + ) -> None: + if isinstance(default_keys, str): + default_keys = [default_keys] + else: + default_keys = list(default_keys) + if not default_keys: + raise ValueError( + "Default key must be set. Got empty default keys." + ) + + self._default_keys = default_keys + super().__init__(*args, **kwargs) + + def __str__(self) -> str: + return str(self.get_default_value()) + + def __copy__(self) -> "DefaultValueDict": + return DefaultValueDict( + self.get_default_keys(), dict(self.items()) + ) + + def __deepcopy__(self) -> "DefaultValueDict": + data_copy = { + key: copy.deepcopy(value) + for key, value in self.items() + } + return DefaultValueDict(self.get_default_keys(), data_copy) + + def get_default_keys(self) -> list[str]: + return list(self._default_keys) + + def get_default_value(self) -> Any: + value = self + for key in self._default_keys: + value = value[key] + return value + + class StringTemplate: """String that can be formatted.""" def __init__(self, template: str): @@ -636,6 +696,12 @@ class FormattingPart: result.add_output(self.template) return result + if isinstance(value, DefaultValueDict): + try: + value = value.get_default_value() + except KeyError: + pass + if not self.validate_value_type(value): result.add_invalid_type(key, value) result.add_output(self.template) From f35521a943b14ae0d38e2b2bb005b7ace2fc25cd Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 20 Oct 2025 18:00:00 +0200 Subject: [PATCH 037/109] rename 'DefaultValueDict' to 'DefaultKeysDict' --- client/ayon_core/lib/__init__.py | 2 ++ client/ayon_core/lib/path_templates.py | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/client/ayon_core/lib/__init__.py b/client/ayon_core/lib/__init__.py index 5ccc8d03e5..2a25e949a5 100644 --- a/client/ayon_core/lib/__init__.py +++ b/client/ayon_core/lib/__init__.py @@ -73,6 +73,7 @@ from .log import ( ) from .path_templates import ( + DefaultKeysDict, TemplateUnsolved, StringTemplate, FormatObject, @@ -228,6 +229,7 @@ __all__ = [ "get_version_from_path", "get_last_version_from_path", + "DefaultKeysDict", "TemplateUnsolved", "StringTemplate", "FormatObject", diff --git a/client/ayon_core/lib/path_templates.py b/client/ayon_core/lib/path_templates.py index 131a2efaa4..c01de6f1a6 100644 --- a/client/ayon_core/lib/path_templates.py +++ b/client/ayon_core/lib/path_templates.py @@ -42,12 +42,12 @@ class TemplateUnsolved(Exception): ) -class DefaultValueDict(dict): +class DefaultKeysDict(dict): """Dictionary that supports the default key to use for str conversion. Is helpful for changes of a key in a template from string to dictionary for example '{folder}' -> '{folder[name]}'. - >>> data = DefaultValueDict( + >>> data = DefaultKeysDict( >>> "name", >>> {"folder": {"name": "FolderName"}} >>> ) @@ -80,17 +80,17 @@ class DefaultValueDict(dict): def __str__(self) -> str: return str(self.get_default_value()) - def __copy__(self) -> "DefaultValueDict": - return DefaultValueDict( + def __copy__(self) -> "DefaultKeysDict": + return DefaultKeysDict( self.get_default_keys(), dict(self.items()) ) - def __deepcopy__(self) -> "DefaultValueDict": + def __deepcopy__(self) -> "DefaultKeysDict": data_copy = { key: copy.deepcopy(value) for key, value in self.items() } - return DefaultValueDict(self.get_default_keys(), data_copy) + return DefaultKeysDict(self.get_default_keys(), data_copy) def get_default_keys(self) -> list[str]: return list(self._default_keys) @@ -696,7 +696,7 @@ class FormattingPart: result.add_output(self.template) return result - if isinstance(value, DefaultValueDict): + if isinstance(value, DefaultKeysDict): try: value = value.get_default_value() except KeyError: From a798d9b92ba957959b483c3ed28c116e9d2df22c Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 20 Oct 2025 18:01:40 +0200 Subject: [PATCH 038/109] added helper function to get ayon user data --- client/ayon_core/lib/__init__.py | 2 + client/ayon_core/lib/local_settings.py | 73 ++++++++++++++++++++------ 2 files changed, 58 insertions(+), 17 deletions(-) diff --git a/client/ayon_core/lib/__init__.py b/client/ayon_core/lib/__init__.py index 2a25e949a5..d5629cbf3d 100644 --- a/client/ayon_core/lib/__init__.py +++ b/client/ayon_core/lib/__init__.py @@ -11,6 +11,7 @@ from .local_settings import ( get_launcher_storage_dir, get_addons_resources_dir, get_local_site_id, + get_ayon_user_entity, get_ayon_username, ) from .ayon_connection import initialize_ayon_connection @@ -149,6 +150,7 @@ __all__ = [ "get_launcher_storage_dir", "get_addons_resources_dir", "get_local_site_id", + "get_ayon_user_entity", "get_ayon_username", "initialize_ayon_connection", diff --git a/client/ayon_core/lib/local_settings.py b/client/ayon_core/lib/local_settings.py index 1edfc3c1b6..4402e3c8a1 100644 --- a/client/ayon_core/lib/local_settings.py +++ b/client/ayon_core/lib/local_settings.py @@ -5,6 +5,7 @@ import json import platform import configparser import warnings +import copy from datetime import datetime from abc import ABC, abstractmethod from functools import lru_cache @@ -13,6 +14,8 @@ from typing import Optional, Any import platformdirs import ayon_api +from .cache import NestedCacheItem, CacheItem + _PLACEHOLDER = object() @@ -23,6 +26,7 @@ class RegistryItemNotFound(ValueError): class _Cache: username = None + user_entities_by_name = NestedCacheItem() def _get_ayon_appdirs(*args: str) -> str: @@ -569,6 +573,56 @@ def get_local_site_id(): return site_id +def _get_ayon_service_username() -> Optional[str]: + # TODO @iLLiCiTiT - do not use private attribute of 'ServerAPI', rather + # use public method to get username from connection stack. + con = ayon_api.get_server_api_connection() + user_stack = getattr(con, "_as_user_stack", None) + if user_stack is None: + return None + return user_stack.username + + +def get_ayon_user_entity(username: Optional[str] = None) -> dict[str, Any]: + """AYON user entity used for templates and publishing.""" + service_username = _get_ayon_service_username() + # Handle service user handling first + if service_username: + if username is None: + username = service_username + cache: CacheItem = _Cache.user_entities_by_name[username] + if not cache.is_valid: + if username == service_username: + user = ayon_api.get_user() + else: + user = ayon_api.get_user(username) + cache.update_data(user) + return copy.deepcopy(cache.get_data()) + + # Cache current user + current_user = None + if _Cache.username is None: + current_user = ayon_api.get_user() + _Cache.username = current_user["name"] + + if username is None: + username = _Cache.username + + cache: CacheItem = _Cache.user_entities_by_name[username] + if not cache.is_valid: + user = None + if username == _Cache.username: + if current_user is None: + current_user = ayon_api.get_user() + user = current_user + + if user is None: + user = ayon_api.get_user(username) + cache.update_data(user) + + return copy.deepcopy(cache.get_data()) + + def get_ayon_username(): """AYON username used for templates and publishing. @@ -578,20 +632,5 @@ def get_ayon_username(): str: Username. """ - # Look for username in the connection stack - # - this is used when service is working as other user - # (e.g. in background sync) - # TODO @iLLiCiTiT - do not use private attribute of 'ServerAPI', rather - # use public method to get username from connection stack. - con = ayon_api.get_server_api_connection() - user_stack = getattr(con, "_as_user_stack", None) - if user_stack is not None: - username = user_stack.username - if username is not None: - return username - - # Cache the username to avoid multiple API calls - # - it is not expected that user would change - if _Cache.username is None: - _Cache.username = ayon_api.get_user()["name"] - return _Cache.username + user = get_ayon_user_entity() + return user["name"] From d7f913d00478bc5b29f0e54c32ac0a548e9aa870 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 20 Oct 2025 18:03:46 +0200 Subject: [PATCH 039/109] fill user data as dictionary --- client/ayon_core/pipeline/template_data.py | 41 +++++++++++++++++----- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/client/ayon_core/pipeline/template_data.py b/client/ayon_core/pipeline/template_data.py index 0a95a98be8..2f9a7e3421 100644 --- a/client/ayon_core/pipeline/template_data.py +++ b/client/ayon_core/pipeline/template_data.py @@ -1,27 +1,50 @@ +from __future__ import annotations + +from typing import Optional, Any + import ayon_api from ayon_core.settings import get_studio_settings -from ayon_core.lib.local_settings import get_ayon_username +from ayon_core.lib import DefaultKeysDict +from ayon_core.lib.local_settings import get_ayon_user_entity -def get_general_template_data(settings=None, username=None): +def get_general_template_data( + settings: Optional[dict[str, Any]] = None, + username: Optional[str] = None, + user_entity: Optional[dict[str, Any]] = None, +): """General template data based on system settings or machine. Output contains formatting keys: - - 'studio[name]' - Studio name filled from system settings - - 'studio[code]' - Studio code filled from system settings - - 'user' - User's name using 'get_ayon_username' + - 'studio[name]' - Studio name filled from system settings + - 'studio[code]' - Studio code filled from system settings + - 'user[name]' - User's name + - 'user[attrib][...]' - User's attributes + - 'user[data][...]' - User's data Args: settings (Dict[str, Any]): Studio or project settings. username (Optional[str]): AYON Username. - """ + user_entity (Optional[dict[str, Any]]): User entity. + """ if not settings: settings = get_studio_settings() - if username is None: - username = get_ayon_username() + if user_entity is None: + user_entity = get_ayon_user_entity(username) + + # Use dictionary with default value for backwards compatibility + # - we did support '{user}' now it should be '{user[name]}' + user_data = DefaultKeysDict( + "name", + { + "name": user_entity["name"], + "attrib": user_entity["attrib"], + "data": user_entity["data"], + } + ) core_settings = settings["core"] return { @@ -29,7 +52,7 @@ def get_general_template_data(settings=None, username=None): "name": core_settings["studio_name"], "code": core_settings["studio_code"] }, - "user": username + "user": user_data, } From 1487c30f06655e43757650160a151c2b38951002 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Mon, 20 Oct 2025 20:27:40 +0300 Subject: [PATCH 040/109] Revert changes in `pyproject.toml` from #1215 --- pyproject.toml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 44c6a9d73c..be3e82cc67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,17 +27,6 @@ codespell = "^2.2.6" semver = "^3.0.2" mypy = "^1.14.0" mock = "^5.0.0" -tomlkit = "^0.13.2" -requests = "^2.32.3" -mkdocs-material = "^9.6.7" -mkdocs-autoapi = "^0.4.0" -mkdocstrings-python = "^1.16.2" -mkdocs-minify-plugin = "^0.8.0" -markdown-checklist = "^0.4.4" -mdx-gh-links = "^0.4" -pymdown-extensions = "^10.14.3" -mike = "^2.1.3" -mkdocstrings-shell = "^1.0.2" nxtools = "^1.6" [tool.poetry.group.test.dependencies] From 5b8d92fb9c6528d0fdb8f81ae81045f9c38979e9 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Tue, 21 Oct 2025 08:31:10 +0000 Subject: [PATCH 041/109] [Automated] Add generated package files from main --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index bbced6b641..bbe6ee01a8 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.6.4+dev" +__version__ = "1.6.5" diff --git a/package.py b/package.py index 114f7d12ef..4a2cd6d568 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.6.4+dev" +version = "1.6.5" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index be3e82cc67..d603c9dc04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.6.4+dev" +version = "1.6.5" description = "" authors = ["Ynput Team "] readme = "README.md" From fc5199c70f8712697874a2c52af89461c8eb5024 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Tue, 21 Oct 2025 08:31:51 +0000 Subject: [PATCH 042/109] [Automated] Update version in package.py for develop --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index bbe6ee01a8..d3b3454fd1 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.6.5" +__version__ = "1.6.5+dev" diff --git a/package.py b/package.py index 4a2cd6d568..2889039502 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.6.5" +version = "1.6.5+dev" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index d603c9dc04..f43846ec2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.6.5" +version = "1.6.5+dev" description = "" authors = ["Ynput Team "] readme = "README.md" From afee12cd7ad8b6623e338ee6f9fd579a77aaffea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 21 Oct 2025 08:33:00 +0000 Subject: [PATCH 043/109] chore(): update bug report / version --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 27ed2217dd..646a2dd1ee 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,6 +35,7 @@ body: label: Version description: What version are you running? Look to AYON Tray options: + - 1.6.5 - 1.6.4 - 1.6.3 - 1.6.2 From 0d49f5a8dfda7b2b3b5189befbdf4ac34388c5e4 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 21 Oct 2025 11:14:10 +0200 Subject: [PATCH 044/109] Fixes: Corrects file sequence frame offset Corrects the calculation of the frame offset for file sequences in editorial workflows. - Ensures accurate frame mapping. - Resolves issues with incorrect frame ranges. --- client/ayon_core/pipeline/editorial.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/pipeline/editorial.py b/client/ayon_core/pipeline/editorial.py index b553fae3fb..716035aa1c 100644 --- a/client/ayon_core/pipeline/editorial.py +++ b/client/ayon_core/pipeline/editorial.py @@ -202,7 +202,8 @@ def is_clip_from_media_sequence(otio_clip): def remap_range_on_file_sequence(otio_clip, otio_range): - """ + """ Remap the provided range on a file sequence clip. + Args: otio_clip (otio.schema.Clip): The OTIO clip to check. otio_range (otio.schema.TimeRange): The trim range to apply. @@ -256,10 +257,14 @@ def remap_range_on_file_sequence(otio_clip, otio_range): ) src_offset_in = otio_range.start_time - media_in - frame_in = otio.opentime.RationalTime.from_frames( - media_ref.start_frame + src_offset_in.to_frames(), + # make sure that only if any offset is present + if media_ref.start_frame == src_offset_in.to_frames(): + frame_in = src_offset_in.to_frames() + else: + frame_in = otio.opentime.RationalTime.from_frames( + media_ref.start_frame + src_offset_in.to_frames(), rate=available_range_rate, - ).to_frames() + ).to_frames() # e.g.: # duration = 10 frames at 24fps From 9494472a7dbc1726b3fbe1face11feff2c8b4c9e Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 21 Oct 2025 14:18:31 +0200 Subject: [PATCH 045/109] Fixes: Corrects reviewable output resolution. Updates the expected resolution in the ffmpeg commands used in reviewable extraction tests to match the intended output. This resolves a squashed reviewables issue where the output resolution was incorrect. --- .../editorial/test_extract_otio_review.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/client/ayon_core/pipeline/editorial/test_extract_otio_review.py b/tests/client/ayon_core/pipeline/editorial/test_extract_otio_review.py index 6a74df7f43..ed441edc63 100644 --- a/tests/client/ayon_core/pipeline/editorial/test_extract_otio_review.py +++ b/tests/client/ayon_core/pipeline/editorial/test_extract_otio_review.py @@ -246,75 +246,75 @@ def test_multiple_review_clips_no_gap(): expected = [ # 10 head black frames generated from gap (991-1000) '/path/to/ffmpeg -t 0.4 -r 25.0 -f lavfi' - ' -i color=c=black:s=1280x720 -tune ' + ' -i color=c=black:s=1920x1080 -tune ' 'stillimage -start_number 991 -pix_fmt rgba C:/result/output.%04d.png', # Alternance 25fps tiff sequence and 24fps exr sequence # for 100 frames each '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1001 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 24.0 -i ' f'C:\\with_tc{os.sep}output.%04d.exr ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1102 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1198 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 24.0 -i ' f'C:\\with_tc{os.sep}output.%04d.exr ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1299 -pix_fmt rgba C:/result/output.%04d.png', # Repeated 25fps tiff sequence multiple times till the end '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1395 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1496 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1597 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1698 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1799 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1900 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 2001 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 2102 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 25.0 -i ' f'C:\\no_tc{os.sep}output.%04d.tif ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 2203 -pix_fmt rgba C:/result/output.%04d.png' ] @@ -348,12 +348,12 @@ def test_multiple_review_clips_with_gap(): '/path/to/ffmpeg -start_number 1000 -framerate 24.0 -i ' f'C:\\with_tc{os.sep}output.%04d.exr ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1003 -pix_fmt rgba C:/result/output.%04d.png', '/path/to/ffmpeg -start_number 1000 -framerate 24.0 -i ' f'C:\\with_tc{os.sep}output.%04d.exr ' - '-vf scale=1280:720:flags=lanczos -compression_level 5 ' + '-vf scale=1920:1080:flags=lanczos -compression_level 5 ' '-start_number 1091 -pix_fmt rgba C:/result/output.%04d.png' ] From 363e338a613331750036d8691ac3c3252f3fa3ba Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 21 Oct 2025 15:01:47 +0200 Subject: [PATCH 046/109] pass studio bundle name to farm --- client/ayon_core/plugins/publish/collect_farm_env_variables.py | 1 + 1 file changed, 1 insertion(+) diff --git a/client/ayon_core/plugins/publish/collect_farm_env_variables.py b/client/ayon_core/plugins/publish/collect_farm_env_variables.py index 39c421381d..d35f02b9df 100644 --- a/client/ayon_core/plugins/publish/collect_farm_env_variables.py +++ b/client/ayon_core/plugins/publish/collect_farm_env_variables.py @@ -32,6 +32,7 @@ class CollectCoreJobEnvVars(pyblish.api.ContextPlugin): for key in [ "AYON_BUNDLE_NAME", + "AYON_STUDIO_BUNDLE_NAME", "AYON_USE_STAGING", "AYON_IN_TESTS", # NOTE Not sure why workdir is needed? From 54aedc84263fb2adc838cbaf40e59bce6aa84a24 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:31:34 +0200 Subject: [PATCH 047/109] use user entity when getting template data during publishing --- .../plugins/publish/collect_anatomy_context_data.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/plugins/publish/collect_anatomy_context_data.py b/client/ayon_core/plugins/publish/collect_anatomy_context_data.py index cccf392e40..5d2ecec433 100644 --- a/client/ayon_core/plugins/publish/collect_anatomy_context_data.py +++ b/client/ayon_core/plugins/publish/collect_anatomy_context_data.py @@ -16,6 +16,7 @@ Provides: import json import pyblish.api +from ayon_core.lib import get_ayon_user_entity from ayon_core.pipeline.template_data import get_template_data @@ -55,17 +56,18 @@ class CollectAnatomyContextData(pyblish.api.ContextPlugin): if folder_entity: task_entity = context.data["taskEntity"] + username = context.data["user"] + user_entity = get_ayon_user_entity(username) anatomy_data = get_template_data( project_entity, folder_entity, task_entity, - host_name, - project_settings + host_name=host_name, + settings=project_settings, + user_entity=user_entity, ) anatomy_data.update(context.data.get("datetimeData") or {}) - username = context.data["user"] - anatomy_data["user"] = username # Backwards compatibility for 'username' key anatomy_data["username"] = username From 2e2d67c2438b53f12354f32b46c2cfb57ecf5ab8 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:31:57 +0200 Subject: [PATCH 048/109] allow to pass user entity to get_template_data --- client/ayon_core/pipeline/template_data.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/pipeline/template_data.py b/client/ayon_core/pipeline/template_data.py index 2f9a7e3421..dc7e95c788 100644 --- a/client/ayon_core/pipeline/template_data.py +++ b/client/ayon_core/pipeline/template_data.py @@ -173,7 +173,8 @@ def get_template_data( task_entity=None, host_name=None, settings=None, - username=None + username=None, + user_entity=None, ): """Prepare data for templates filling from entered documents and info. @@ -196,13 +197,18 @@ def get_template_data( host_name (Optional[str]): Used to fill '{app}' key. settings (Union[Dict, None]): Prepared studio or project settings. They're queried if not passed (may be slower). - username (Optional[str]): AYON Username. + username (Optional[str]): DEPRECATED AYON Username. + user_entity (Optional[dict[str, Any]): AYON user entity. Returns: Dict[str, Any]: Data prepared for filling workdir template. """ - template_data = get_general_template_data(settings, username=username) + template_data = get_general_template_data( + settings, + username=username, + user_entity=user_entity, + ) template_data.update(get_project_template_data(project_entity)) if folder_entity: template_data.update(get_folder_template_data( From d700f9f09b307243ef7c30ad5096e3beb8b97d9b Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:32:12 +0200 Subject: [PATCH 049/109] custom handling of 'user' data used for template --- client/ayon_core/plugins/publish/integrate.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/integrate.py b/client/ayon_core/plugins/publish/integrate.py index f1e066018c..d18e546392 100644 --- a/client/ayon_core/plugins/publish/integrate.py +++ b/client/ayon_core/plugins/publish/integrate.py @@ -121,7 +121,6 @@ class IntegrateAsset(pyblish.api.InstancePlugin): "version", "representation", "username", - "user", "output", # OpenPype keys - should be removed "asset", # folder[name] @@ -796,6 +795,14 @@ class IntegrateAsset(pyblish.api.InstancePlugin): if value is not None: repre_context[key] = value + # Keep only username + # NOTE This is to avoid storing all user attributes and data + # to representation + if "user" not in repre_context: + repre_context["user"] = { + "name": template_data["user"]["name"] + } + # Use previous representation's id if there is a name match existing = existing_repres_by_name.get(repre["name"].lower()) repre_id = None From b094cbd0cb17ba0216867503c9d87eef81e112f3 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:33:48 +0200 Subject: [PATCH 050/109] use same logic in integrate hero as in integrate --- .../ayon_core/plugins/publish/integrate_hero_version.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/integrate_hero_version.py b/client/ayon_core/plugins/publish/integrate_hero_version.py index 90e6f15568..a591cfe880 100644 --- a/client/ayon_core/plugins/publish/integrate_hero_version.py +++ b/client/ayon_core/plugins/publish/integrate_hero_version.py @@ -89,7 +89,6 @@ class IntegrateHeroVersion( "family", "representation", "username", - "user", "output" ] # QUESTION/TODO this process should happen on server if crashed due to @@ -364,6 +363,14 @@ class IntegrateHeroVersion( if value is not None: repre_context[key] = value + # Keep only username + # NOTE This is to avoid storing all user attributes and data + # to representation + if "user" not in repre_context: + repre_context["user"] = { + "name": anatomy_data["user"]["name"] + } + # Prepare new repre repre_entity = copy.deepcopy(repre_info["representation"]) repre_entity.pop("id", None) From db11ba743708d9550357f3129b7be9356c09b4c2 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:59:30 +0200 Subject: [PATCH 051/109] add docstring --- client/ayon_core/lib/local_settings.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/lib/local_settings.py b/client/ayon_core/lib/local_settings.py index 4402e3c8a1..8a17b7af38 100644 --- a/client/ayon_core/lib/local_settings.py +++ b/client/ayon_core/lib/local_settings.py @@ -584,7 +584,19 @@ def _get_ayon_service_username() -> Optional[str]: def get_ayon_user_entity(username: Optional[str] = None) -> dict[str, Any]: - """AYON user entity used for templates and publishing.""" + """AYON user entity used for templates and publishing. + + Note: + Usually only service and admin users can receive the full user entity. + + Args: + username (Optional[str]): Username of the user. If not passed, then + the current user in 'ayon_api' is used. + + Returns: + dict[str, Any]: User entity. + + """ service_username = _get_ayon_service_username() # Handle service user handling first if service_username: From 062f756413ec17332005d59ce7039cedf76cff21 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 22 Oct 2025 16:07:26 +0200 Subject: [PATCH 052/109] Typing At least some, dont know how to import NewFolderDict --- .../tools/push_to_project/models/integrate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index ef49838152..472500a55d 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -5,7 +5,7 @@ import itertools import sys import traceback import uuid -from typing import Optional, Dict +from typing import Optional, Dict, Any import ayon_api from ayon_api.utils import create_entity_id @@ -650,10 +650,10 @@ class ProjectPushItemProcess: def _create_folder( self, - src_folder_entity, - project_entity, - parent_folder_entity, - folder_name + src_folder_entity: Dict[str, Any], + project_entity: Dict[str, Any], + parent_folder_entity: Dict[str, Any], + folder_name: str ): parent_id = None if parent_folder_entity: From 475d4800a2e86f83ed508e0b33c425a7d6ab9eb7 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 22 Oct 2025 16:13:44 +0200 Subject: [PATCH 053/109] Check that source folder type could be pushed to destination --- .../tools/push_to_project/models/integrate.py | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 472500a55d..bd309d935f 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -702,7 +702,11 @@ class ProjectPushItemProcess: if new_folder_name != folder_name: folder_label = folder_name - # TODO find out how to define folder type + src_folder_type = src_folder_entity["folderType"] + self._check_src_folder_type( + project_entity, + src_folder_type + ) folder_entity = new_folder_entity( folder_name, "Folder", @@ -727,6 +731,24 @@ class ProjectPushItemProcess: folder_entity["path"] = "/".join([parent_path, folder_name]) return folder_entity + def _check_src_folder_type( + self, + project_entity: Dict[str, Any], + src_folder_type: str + ): + """Confirm that folder type exists in destination project""" + folder_types = [ + folder_type["name"].lower() + for folder_type in project_entity["folderTypes"] + ] + + if src_folder_type.lower() not in folder_types: + self._status.set_failed( + f"'{src_folder_type}' folder type is not configured in " + f"project Anatomy." + ) + raise PushToProjectError(self._status.fail_reason) + def _fill_or_create_destination_folder(self): dst_project_name = self._item.dst_project_name dst_folder_id = self._item.dst_folder_id @@ -1205,7 +1227,7 @@ class ProjectPushItemProcess: value_to_update = formatting_data.get(context_key) if value_to_update: repre_context[context_key] = value_to_update - if "task" not in formatting_data: + if "task" not in formatting_data and "task" in repre_context: repre_context.pop("task") return repre_context From 9340df7a250543658d673d95716047931ea981fa Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 22 Oct 2025 16:14:01 +0200 Subject: [PATCH 054/109] Copy source folder type to destination --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index bd309d935f..22fcb5cf9f 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -709,7 +709,7 @@ class ProjectPushItemProcess: ) folder_entity = new_folder_entity( folder_name, - "Folder", + src_folder_type, parent_id=parent_id, attribs=new_folder_attrib ) From a077c57eee066f2c38082ea3d023451bde66a487 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 22 Oct 2025 14:50:25 +0000 Subject: [PATCH 055/109] [Automated] Add generated package files from main --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index d3b3454fd1..4aeeb94ea8 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.6.5+dev" +__version__ = "1.6.6" diff --git a/package.py b/package.py index 2889039502..ced8763100 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.6.5+dev" +version = "1.6.6" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index f43846ec2b..7460ddc831 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.6.5+dev" +version = "1.6.6" description = "" authors = ["Ynput Team "] readme = "README.md" From 45ddec53d30a50d169c33cea530fde83cd5a7821 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 22 Oct 2025 14:51:09 +0000 Subject: [PATCH 056/109] [Automated] Update version in package.py for develop --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 4aeeb94ea8..8e0834b8da 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.6.6" +__version__ = "1.6.6+dev" diff --git a/package.py b/package.py index ced8763100..5fa4d165d2 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.6.6" +version = "1.6.6+dev" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index 7460ddc831..73b9a4a916 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.6.6" +version = "1.6.6+dev" description = "" authors = ["Ynput Team "] readme = "README.md" From 110018487f15f9a49156d1947592bf8541c12bc4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 22 Oct 2025 14:52:19 +0000 Subject: [PATCH 057/109] chore(): update bug report / version --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 646a2dd1ee..60693f088d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,6 +35,7 @@ body: label: Version description: What version are you running? Look to AYON Tray options: + - 1.6.6 - 1.6.5 - 1.6.4 - 1.6.3 From 0d235ed8cacffb9196a54e1b3cf40fbcc36fd57e Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 22 Oct 2025 18:58:20 +0200 Subject: [PATCH 058/109] Create destination task if no task selected --- .../tools/push_to_project/models/integrate.py | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index ef49838152..a7cb1de95a 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -762,8 +762,11 @@ class ProjectPushItemProcess: ) self._folder_entity = folder_entity if not dst_task_name: - self._task_info = {} - return + dst_task_name = self._make_sure_task_exists(folder_entity) + + if not dst_task_name: # really no task selected nor on source + self._task_info = {} + return folder_path = folder_entity["path"] folder_tasks = { @@ -962,6 +965,28 @@ class ProjectPushItemProcess: ) self._version_entity = version_entity + def _make_sure_task_exists(self, folder_entity: Dict[str, Any]) -> str: + """Creates destination task from source task information""" + project_name = self._item.dst_project_name + src_version_entity = self._src_version_entity + src_task = ayon_api.get_task_by_id( + self._item.src_project_name, src_version_entity["taskId"] + ) + if not src_task: + self._status.set_failed( + f"No task selected and couldn't find source task" + ) + raise PushToProjectError(self._status.fail_reason) + _task_id = ayon_api.create_task( + project_name, + src_task["name"], + folder_id=folder_entity["id"], + task_type=src_task["taskType"], + attrib=src_task["attrib"], + ) + + return src_task["name"] + def _integrate_representations(self): try: self._real_integrate_representations() From 0ebbd0a23224e4fd539f8b1a479892de38af96dc Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 10:55:37 +0200 Subject: [PATCH 059/109] Extracted logic to methods --- .../tools/push_to_project/models/integrate.py | 52 +++++++++++++------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index a7cb1de95a..9365379148 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -482,6 +482,8 @@ class ProjectPushItemProcess: self._log_info("Destination project was found") self._fill_or_create_destination_folder() self._log_info("Destination folder was determined") + self._fill_or_create_destination_task() + self._log_info("Destination task was determined") self._determine_product_type() self._determine_publish_template_name() self._determine_product_name() @@ -730,7 +732,6 @@ class ProjectPushItemProcess: def _fill_or_create_destination_folder(self): dst_project_name = self._item.dst_project_name dst_folder_id = self._item.dst_folder_id - dst_task_name = self._item.dst_task_name new_folder_name = self._item.new_folder_name if not dst_folder_id and not new_folder_name: self._status.set_failed( @@ -761,12 +762,11 @@ class ProjectPushItemProcess: new_folder_name ) self._folder_entity = folder_entity - if not dst_task_name: - dst_task_name = self._make_sure_task_exists(folder_entity) - if not dst_task_name: # really no task selected nor on source - self._task_info = {} - return + def _fill_or_create_destination_task(self): + folder_entity = self._folder_entity + dst_task_name = self._item.dst_task_name + dst_project_name = self._item.dst_project_name folder_path = folder_entity["path"] folder_tasks = { @@ -775,6 +775,21 @@ class ProjectPushItemProcess: dst_project_name, folder_ids=[folder_entity["id"]] ) } + + if not dst_task_name: + src_task_info = self._get_src_task_info() + if not src_task_info: # really no task selected nor on source + self._task_info = {} + return + + dst_task_name = src_task_info["name"].lower() + if dst_task_name not in folder_tasks: + self._make_sure_task_exists( + folder_entity, src_task_info + ) + task_info = copy.deepcopy(src_task_info) + folder_tasks[dst_task_name] = task_info + task_info = folder_tasks.get(dst_task_name.lower()) if not task_info: self._status.set_failed( @@ -965,9 +980,22 @@ class ProjectPushItemProcess: ) self._version_entity = version_entity - def _make_sure_task_exists(self, folder_entity: Dict[str, Any]) -> str: + def _make_sure_task_exists( + self, + folder_entity: Dict[str, Any], + task_info: Dict[str, Any], + ): """Creates destination task from source task information""" project_name = self._item.dst_project_name + _task_id = ayon_api.create_task( + project_name, + task_info["name"], + folder_id=folder_entity["id"], + task_type=task_info["taskType"], + attrib=task_info["attrib"], + ) + + def _get_src_task_info(self): src_version_entity = self._src_version_entity src_task = ayon_api.get_task_by_id( self._item.src_project_name, src_version_entity["taskId"] @@ -977,15 +1005,7 @@ class ProjectPushItemProcess: f"No task selected and couldn't find source task" ) raise PushToProjectError(self._status.fail_reason) - _task_id = ayon_api.create_task( - project_name, - src_task["name"], - folder_id=folder_entity["id"], - task_type=src_task["taskType"], - attrib=src_task["attrib"], - ) - - return src_task["name"] + return src_task def _integrate_representations(self): try: From d8dd2a23a895b06a45ec27a1c24842729aaa7189 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 10:55:48 +0200 Subject: [PATCH 060/109] Typing --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 9365379148..b2475ac7d1 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -5,7 +5,7 @@ import itertools import sys import traceback import uuid -from typing import Optional, Dict +from typing import Optional, Dict, Any import ayon_api from ayon_api.utils import create_entity_id From ef0f5ac023ebf463567d52074ba10f33caa5936c Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Thu, 23 Oct 2025 11:06:35 +0200 Subject: [PATCH 061/109] remove custom copy and deepcopy implementation --- client/ayon_core/lib/path_templates.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/client/ayon_core/lib/path_templates.py b/client/ayon_core/lib/path_templates.py index c01de6f1a6..aba2f296e3 100644 --- a/client/ayon_core/lib/path_templates.py +++ b/client/ayon_core/lib/path_templates.py @@ -80,18 +80,6 @@ class DefaultKeysDict(dict): def __str__(self) -> str: return str(self.get_default_value()) - def __copy__(self) -> "DefaultKeysDict": - return DefaultKeysDict( - self.get_default_keys(), dict(self.items()) - ) - - def __deepcopy__(self) -> "DefaultKeysDict": - data_copy = { - key: copy.deepcopy(value) - for key, value in self.items() - } - return DefaultKeysDict(self.get_default_keys(), data_copy) - def get_default_keys(self) -> list[str]: return list(self._default_keys) From f0230e24a7bc3a2e321caeb14bf7e33acd523eab Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 11:20:03 +0200 Subject: [PATCH 062/109] Fix use operations instead of ayon_api Must be in same session as create folder if 'Create New Folder' --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index b2475ac7d1..027416922b 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -987,7 +987,7 @@ class ProjectPushItemProcess: ): """Creates destination task from source task information""" project_name = self._item.dst_project_name - _task_id = ayon_api.create_task( + _task_id = self._operations.create_task( project_name, task_info["name"], folder_id=folder_entity["id"], From f13a40aa73b740e4cc715cd54acadf564fdb750a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 11:24:41 +0200 Subject: [PATCH 063/109] Fix typing Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/tools/push_to_project/models/integrate.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 22fcb5cf9f..6871936e2c 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -650,9 +650,9 @@ class ProjectPushItemProcess: def _create_folder( self, - src_folder_entity: Dict[str, Any], - project_entity: Dict[str, Any], - parent_folder_entity: Dict[str, Any], + src_folder_entity: dict[str, Any], + project_entity: dict[str, Any], + parent_folder_entity: dict[str, Any], folder_name: str ): parent_id = None From 87f1d458b8c6cab2195583e0e3beeef8b80e6db1 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 11:25:44 +0200 Subject: [PATCH 064/109] Change return of _check_src_folder_type Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- .../tools/push_to_project/models/integrate.py | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 6871936e2c..bf14034673 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -731,23 +731,21 @@ class ProjectPushItemProcess: folder_entity["path"] = "/".join([parent_path, folder_name]) return folder_entity - def _check_src_folder_type( + def _get_dst_folder_type( self, - project_entity: Dict[str, Any], + project_entity: dict[str, Any], src_folder_type: str - ): - """Confirm that folder type exists in destination project""" - folder_types = [ - folder_type["name"].lower() - for folder_type in project_entity["folderTypes"] - ] + ) -> str: + """Get new folder type.""" + for folder_type in project_entity["folderTypes"]: + if folder_type["name"].lower() == src_folder_type.lower(): + return folder_type["name"] - if src_folder_type.lower() not in folder_types: - self._status.set_failed( - f"'{src_folder_type}' folder type is not configured in " - f"project Anatomy." - ) - raise PushToProjectError(self._status.fail_reason) + self._status.set_failed( + f"'{src_folder_type}' folder type is not configured in " + f"project Anatomy." + ) + raise PushToProjectError(self._status.fail_reason) def _fill_or_create_destination_folder(self): dst_project_name = self._item.dst_project_name From c50406a279b61651ef6f099862dfe6874d7dcb10 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 11:26:09 +0200 Subject: [PATCH 065/109] Simplify pop Co-authored-by: Roy Nieterau --- client/ayon_core/tools/push_to_project/models/integrate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index bf14034673..48e5763345 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -1225,8 +1225,8 @@ class ProjectPushItemProcess: value_to_update = formatting_data.get(context_key) if value_to_update: repre_context[context_key] = value_to_update - if "task" not in formatting_data and "task" in repre_context: - repre_context.pop("task") + if "task" not in formatting_data: + repre_context.pop("task", None) return repre_context From 0bade2d940ced81d27d70240b153a813abf8a6c8 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 11:28:33 +0200 Subject: [PATCH 066/109] Update usage of renamed _get_dst_folder_type --- client/ayon_core/tools/push_to_project/models/integrate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 48e5763345..68a0e2affb 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -703,13 +703,13 @@ class ProjectPushItemProcess: folder_label = folder_name src_folder_type = src_folder_entity["folderType"] - self._check_src_folder_type( + dst_folder_type = self._get_dst_folder_type( project_entity, src_folder_type ) folder_entity = new_folder_entity( folder_name, - src_folder_type, + dst_folder_type, parent_id=parent_id, attribs=new_folder_attrib ) From 1ee701b52fdaafcabe9ce6a726f4d74e9a8a9da5 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 11:32:30 +0200 Subject: [PATCH 067/109] Fix dict typing --- .../tools/push_to_project/models/integrate.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 027416922b..1ecf8a8a59 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -5,7 +5,7 @@ import itertools import sys import traceback import uuid -from typing import Optional, Dict, Any +from typing import Optional, Any import ayon_api from ayon_api.utils import create_entity_id @@ -225,8 +225,8 @@ class ProjectPushRepreItem: but filenames are not template based. Args: - repre_entity (Dict[str, Ant]): Representation entity. - roots (Dict[str, str]): Project roots (based on project anatomy). + repre_entity (dict[str, Ant]): Representation entity. + roots (dict[str, str]): Project roots (based on project anatomy). """ def __init__(self, repre_entity, roots): @@ -982,8 +982,8 @@ class ProjectPushItemProcess: def _make_sure_task_exists( self, - folder_entity: Dict[str, Any], - task_info: Dict[str, Any], + folder_entity: dict[str, Any], + task_info: dict[str, Any], ): """Creates destination task from source task information""" project_name = self._item.dst_project_name @@ -1326,6 +1326,6 @@ class IntegrateModel: return item.integrate() - def get_items(self) -> Dict[str, ProjectPushItemProcess]: + def get_items(self) -> dict[str, ProjectPushItemProcess]: """Returns dict of all ProjectPushItemProcess items """ return self._process_items From 7b5ca16993bbc844d14ca27bc042e23ee58ce9bf Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 17:03:50 +0200 Subject: [PATCH 068/109] Use lower only for comparison Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/tools/push_to_project/models/integrate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 1ecf8a8a59..1cd9e2deaf 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -782,8 +782,8 @@ class ProjectPushItemProcess: self._task_info = {} return - dst_task_name = src_task_info["name"].lower() - if dst_task_name not in folder_tasks: + dst_task_name = src_task_info["name"] + if dst_task_name.lower() not in folder_tasks: self._make_sure_task_exists( folder_entity, src_task_info ) From 67994bb5a3bc8dc527a4fd09f6110049c551238e Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 17:04:07 +0200 Subject: [PATCH 069/109] Remove unnecessary variable Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 1cd9e2deaf..2030027bb0 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -987,7 +987,7 @@ class ProjectPushItemProcess: ): """Creates destination task from source task information""" project_name = self._item.dst_project_name - _task_id = self._operations.create_task( + self._operations.create_task( project_name, task_info["name"], folder_id=folder_entity["id"], From cea56fbe5322075dbdb0826e78d0b2a27069b5ac Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 17:04:32 +0200 Subject: [PATCH 070/109] Formatting change Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 2030027bb0..7e92d82f41 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -1002,7 +1002,7 @@ class ProjectPushItemProcess: ) if not src_task: self._status.set_failed( - f"No task selected and couldn't find source task" + "No task selected and couldn't find source task" ) raise PushToProjectError(self._status.fail_reason) return src_task From 04322ef94d673cd3b4356afb6897ec7d30d8d8bb Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 17:08:35 +0200 Subject: [PATCH 071/109] Removed hard fail, unnecessary --- client/ayon_core/tools/push_to_project/models/integrate.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 5127afd0ee..164b73e0ef 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -1020,11 +1020,7 @@ class ProjectPushItemProcess: src_task = ayon_api.get_task_by_id( self._item.src_project_name, src_version_entity["taskId"] ) - if not src_task: - self._status.set_failed( - f"No task selected and couldn't find source task" - ) - raise PushToProjectError(self._status.fail_reason) + return src_task def _integrate_representations(self): From 42722c08960e528a9e9cfa735aedfd7023533bde Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 23 Oct 2025 17:20:16 +0200 Subject: [PATCH 072/109] Added validation that task type is in destination project --- .../tools/push_to_project/models/integrate.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 164b73e0ef..e80a525204 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -1007,11 +1007,26 @@ class ProjectPushItemProcess: ): """Creates destination task from source task information""" project_name = self._item.dst_project_name + found_task_type = False + src_task_type = task_info["taskType"] + for task_type in self._project_entity["taskTypes"]: + if task_type["name"].lower() == src_task_type.lower(): + found_task_type = True + break + + if not found_task_type: + self._status.set_failed( + f"'{src_task_type}' task type is not configured in " + "project Anatomy." + ) + + raise PushToProjectError(self._status.fail_reason) + _task_id = self._operations.create_task( project_name, task_info["name"], folder_id=folder_entity["id"], - task_type=task_info["taskType"], + task_type=src_task_type, attrib=task_info["attrib"], ) From 7e3e5855b86a31e1206c199478bddeb9829a6c80 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 11:01:24 +0200 Subject: [PATCH 073/109] Fix use of lower task name --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 5370a35c37..a98c045893 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -808,7 +808,7 @@ class ProjectPushItemProcess: folder_entity, src_task_info ) task_info = copy.deepcopy(src_task_info) - folder_tasks[dst_task_name] = task_info + folder_tasks[dst_task_name.lower()] = task_info task_info = folder_tasks.get(dst_task_name.lower()) if not task_info: From f33b13c19449aed3ab9b1aa9fb45716c6418d52e Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 11:22:13 +0200 Subject: [PATCH 074/109] Fix if source version doesn't have task Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index a98c045893..a8cd3be2cc 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -1032,6 +1032,8 @@ class ProjectPushItemProcess: def _get_src_task_info(self): src_version_entity = self._src_version_entity + if not src_version_entity["taskId"]: + return None src_task = ayon_api.get_task_by_id( self._item.src_project_name, src_version_entity["taskId"] ) From f6e4d50137f4dbcbc830639bc6e73efc054d27e1 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 12:19:31 +0200 Subject: [PATCH 075/109] Fix overwriting real task name with name of task type --- client/ayon_core/tools/push_to_project/models/integrate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index a98c045893..5be7dbe2c1 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -828,7 +828,10 @@ class ProjectPushItemProcess: task_type["name"]: task_type for task_type in self._project_entity["taskTypes"] } - task_type_info = task_types_by_name.get(task_type_name, {}) + task_type_info = copy.deepcopy( + task_types_by_name.get(task_type_name, {}) + ) + task_type_info.pop("name") # do not overwrite real task name task_info.update(task_type_info) self._task_info = task_info From efec97fda3938f883b166fa4de26b127fc488920 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 12:20:14 +0200 Subject: [PATCH 076/109] Return task info from created object --- .../ayon_core/tools/push_to_project/models/integrate.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 5be7dbe2c1..2d02316db0 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -804,10 +804,9 @@ class ProjectPushItemProcess: dst_task_name = src_task_info["name"] if dst_task_name.lower() not in folder_tasks: - self._make_sure_task_exists( + task_info = self._make_sure_task_exists( folder_entity, src_task_info ) - task_info = copy.deepcopy(src_task_info) folder_tasks[dst_task_name.lower()] = task_info task_info = folder_tasks.get(dst_task_name.lower()) @@ -1007,7 +1006,7 @@ class ProjectPushItemProcess: self, folder_entity: dict[str, Any], task_info: dict[str, Any], - ): + ) -> dict[str, Any]: """Creates destination task from source task information""" project_name = self._item.dst_project_name found_task_type = False @@ -1025,13 +1024,15 @@ class ProjectPushItemProcess: raise PushToProjectError(self._status.fail_reason) - self._operations.create_task( + task_info = self._operations.create_task( project_name, task_info["name"], folder_id=folder_entity["id"], task_type=src_task_type, attrib=task_info["attrib"], ) + self._task_info = task_info.data + return self._task_info def _get_src_task_info(self): src_version_entity = self._src_version_entity From 636ef024b786dafe45233522aea2d92ecccd8440 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 12:20:34 +0200 Subject: [PATCH 077/109] Task is optional --- client/ayon_core/tools/push_to_project/models/integrate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 2d02316db0..fc61204bf3 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -965,8 +965,8 @@ class ProjectPushItemProcess: version = get_versioning_start( project_name, self.host_name, - task_name=self._task_info["name"], - task_type=self._task_info["taskType"], + task_name=self._task_info.get("name"), + task_type=self._task_info.get("taskType"), product_type=product_type, product_name=product_entity["name"], ) From 49162f228e9cb3bd8ceee2bad8ad54ca665b4c75 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 12:20:54 +0200 Subject: [PATCH 078/109] Fix pushed products not attaching to version --- client/ayon_core/tools/push_to_project/models/integrate.py | 1 + 1 file changed, 1 insertion(+) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index fc61204bf3..45035671b2 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -994,6 +994,7 @@ class ProjectPushItemProcess: version_entity = new_version_entity( version, product_id, + task_id=self._task_info.get("id"), attribs=dst_attrib, thumbnail_id=thumbnail_id, ) From fcc82a8e463388e205aac4460a73fbff16552386 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 14:14:21 +0200 Subject: [PATCH 079/109] Transfer status and tags --- .../tools/push_to_project/models/integrate.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index f8360c520b..8c125dd3dc 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -990,10 +990,15 @@ class ProjectPushItemProcess: existing_version_entity["attrib"].update(dst_attrib) self._version_entity = existing_version_entity return + copied_tags = self._get_transferable_tags(src_version_entity) + copied_status = self._get_transferable_status(src_version_entity) version_entity = new_version_entity( version, product_id, + author=src_version_entity["author"], + status=copied_status, + tags=copied_tags, task_id=self._task_info.get("id"), attribs=dst_attrib, thumbnail_id=thumbnail_id, @@ -1291,6 +1296,30 @@ class ProjectPushItemProcess: repre_context.pop("task", None) return repre_context + def _get_transferable_tags(self, src_version_entity): + """Copy over only tags present in destination project""" + dst_project_tags = [ + tag["name"] for tag in self._project_entity["tags"] + ] + copied_tags = [] + for src_tag in src_version_entity["tags"]: + if src_tag in dst_project_tags: + copied_tags.append(src_tag) + return copied_tags + + def _get_transferable_status(self, src_version_entity): + """Copy over status, first status if not matching found""" + dst_project_statuses = { + status["name"]: status + for status in self._project_entity["statuses"] + } + copied_status = dst_project_statuses.get(src_version_entity["status"]) + if not copied_status: + copied_status = dst_project_statuses[ + dst_project_statuses.keys()[0] + ] + return copied_status["name"] + class IntegrateModel: def __init__(self, controller): From 3104e07c78dd62ff438b122c97dbe63cf1e3b665 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 15:30:52 +0200 Subject: [PATCH 080/109] Fix access to dict keys --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 8c125dd3dc..838bf079ec 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -1316,7 +1316,7 @@ class ProjectPushItemProcess: copied_status = dst_project_statuses.get(src_version_entity["status"]) if not copied_status: copied_status = dst_project_statuses[ - dst_project_statuses.keys()[0] + next(iter(dst_project_statuses)) ] return copied_status["name"] From 542acd0896e1ad266f7764811817212dc4ab6d06 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 15:33:15 +0200 Subject: [PATCH 081/109] Fix access to dict keys --- client/ayon_core/tools/push_to_project/models/integrate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 838bf079ec..e23d2a8eb2 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -1313,8 +1313,13 @@ class ProjectPushItemProcess: status["name"]: status for status in self._project_entity["statuses"] } - copied_status = dst_project_statuses.get(src_version_entity["status"]) + source_status = src_version_entity["status"] + copied_status = dst_project_statuses.get(source_status) if not copied_status: + self._log_warning( + f"'{source_status}' not found in destination project. " + "Used first configured status from there." + ) copied_status = dst_project_statuses[ next(iter(dst_project_statuses)) ] From fcebdaf13006aeeefd2979ceac24304dee9cd618 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 24 Oct 2025 16:00:42 +0200 Subject: [PATCH 082/109] Do not send dummy status if not found --- .../tools/push_to_project/models/integrate.py | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index e23d2a8eb2..2adc708cf3 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -1284,10 +1284,12 @@ class ProjectPushItemProcess: if context_value and isinstance(context_value, dict): for context_sub_key in context_value.keys(): value_to_update = formatting_data.get(context_key, {}).get( - context_sub_key) + context_sub_key + ) if value_to_update: - repre_context[context_key][ - context_sub_key] = value_to_update + repre_context[context_key][context_sub_key] = ( + value_to_update + ) else: value_to_update = formatting_data.get(context_key) if value_to_update: @@ -1313,17 +1315,10 @@ class ProjectPushItemProcess: status["name"]: status for status in self._project_entity["statuses"] } - source_status = src_version_entity["status"] - copied_status = dst_project_statuses.get(source_status) - if not copied_status: - self._log_warning( - f"'{source_status}' not found in destination project. " - "Used first configured status from there." - ) - copied_status = dst_project_statuses[ - next(iter(dst_project_statuses)) - ] - return copied_status["name"] + copied_status = dst_project_statuses.get(src_version_entity["status"]) + if copied_status: + return copied_status["name"] + return None class IntegrateModel: From 3ee7c30cae8b75726875e58970f19fe08af14ee4 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 24 Oct 2025 17:35:28 +0200 Subject: [PATCH 083/109] Handles missing media references in OTIO clips Adds a check for missing media references in OTIO clips during publishing. --- .../ayon_core/plugins/publish/collect_otio_frame_ranges.py | 6 ++++++ .../plugins/publish/collect_otio_subset_resources.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/client/ayon_core/plugins/publish/collect_otio_frame_ranges.py b/client/ayon_core/plugins/publish/collect_otio_frame_ranges.py index d68970d428..543277f37e 100644 --- a/client/ayon_core/plugins/publish/collect_otio_frame_ranges.py +++ b/client/ayon_core/plugins/publish/collect_otio_frame_ranges.py @@ -71,6 +71,12 @@ class CollectOtioRanges(pyblish.api.InstancePlugin): import opentimelineio as otio otio_clip = instance.data["otioClip"] + if isinstance( + otio_clip.media_reference, + otio.schema.MissingReference + ): + self.log.info("Clip has no media reference") + return # Collect timeline ranges if workfile start frame is available if "workfileFrameStart" in instance.data: diff --git a/client/ayon_core/plugins/publish/collect_otio_subset_resources.py b/client/ayon_core/plugins/publish/collect_otio_subset_resources.py index 275b8a7f55..4d3c1cfb13 100644 --- a/client/ayon_core/plugins/publish/collect_otio_subset_resources.py +++ b/client/ayon_core/plugins/publish/collect_otio_subset_resources.py @@ -60,6 +60,13 @@ class CollectOtioSubsetResources( # get basic variables otio_clip = instance.data["otioClip"] + if isinstance( + otio_clip.media_reference, + otio.schema.MissingReference + ): + self.log.info("Clip has no media reference") + return + otio_available_range = otio_clip.available_range() media_fps = otio_available_range.start_time.rate available_duration = otio_available_range.duration.value From 373683890c07ac137df771c5e5d58c82f00fe87d Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Mon, 27 Oct 2025 10:05:30 +0100 Subject: [PATCH 084/109] Use correct publish template in `get_instance_expected_output_path` --- client/ayon_core/pipeline/publish/lib.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/pipeline/publish/lib.py b/client/ayon_core/pipeline/publish/lib.py index fb84417730..f6198bd45e 100644 --- a/client/ayon_core/pipeline/publish/lib.py +++ b/client/ayon_core/pipeline/publish/lib.py @@ -955,7 +955,26 @@ def get_instance_expected_output_path( "version": version }) - path_template_obj = anatomy.get_template_item("publish", "default")["path"] + # Get instance publish template name + task_name = task_type = None + task_entity = instance.data.get("taskEntity") + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] + + template_name = get_publish_template_name( + project_name=instance.context.data["projectName"], + host_name=instance.context.data["hostName"], + product_type=instance.data["productType"], + task_name=task_name, + task_type=task_type, + project_settings=instance.context.data["project_settings"], + ) + + path_template_obj = anatomy.get_template_item( + "publish", + template_name + )["path"] template_filled = path_template_obj.format_strict(template_data) return os.path.normpath(template_filled) From a162d6bce1c4ec9fe20c918d50bc831ffeb54e2f Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:50:13 +0100 Subject: [PATCH 085/109] fix mytasks filtering --- client/ayon_core/tools/workfiles/widgets/window.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/tools/workfiles/widgets/window.py b/client/ayon_core/tools/workfiles/widgets/window.py index 3f96f0bb15..c7ff98f25e 100644 --- a/client/ayon_core/tools/workfiles/widgets/window.py +++ b/client/ayon_core/tools/workfiles/widgets/window.py @@ -358,9 +358,8 @@ class WorkfilesToolWindow(QtWidgets.QWidget): if not self._host_is_valid: return - self._folders_widget.set_project_name( - self._controller.get_current_project_name() - ) + self._project_name = self._controller.get_current_project_name() + self._folders_widget.set_project_name(self._project_name) def _on_save_as_finished(self, event): if event["failed"]: @@ -412,6 +411,7 @@ class WorkfilesToolWindow(QtWidgets.QWidget): entity_ids = self._controller.get_my_tasks_entity_ids( self._project_name ) + print(entity_ids) folder_ids = entity_ids["folder_ids"] task_ids = entity_ids["task_ids"] self._folders_widget.set_folder_ids_filter(folder_ids) From c03fe908a74b0d5e815f94526363980097bbe676 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:57:12 +0100 Subject: [PATCH 086/109] lock pyobjc-core to 11.1 --- client/pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/pyproject.toml b/client/pyproject.toml index 6416d9b8e1..c98591b707 100644 --- a/client/pyproject.toml +++ b/client/pyproject.toml @@ -19,3 +19,6 @@ OpenTimelineIO = "0.16.0" opencolorio = "^2.3.2,<2.4.0" Pillow = "9.5.0" websocket-client = ">=0.40.0,<2" + +[ayon.runtimeDependencies.darwin] +pyobjc-core = "^11.1" From 5d74d9dc514b5ca8b4b4298c1346222c18ac0ca4 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 27 Oct 2025 16:52:18 +0100 Subject: [PATCH 087/109] Remove dev print --- client/ayon_core/tools/workfiles/widgets/window.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_core/tools/workfiles/widgets/window.py b/client/ayon_core/tools/workfiles/widgets/window.py index c7ff98f25e..00362ea866 100644 --- a/client/ayon_core/tools/workfiles/widgets/window.py +++ b/client/ayon_core/tools/workfiles/widgets/window.py @@ -411,7 +411,6 @@ class WorkfilesToolWindow(QtWidgets.QWidget): entity_ids = self._controller.get_my_tasks_entity_ids( self._project_name ) - print(entity_ids) folder_ids = entity_ids["folder_ids"] task_ids = entity_ids["task_ids"] self._folders_widget.set_folder_ids_filter(folder_ids) From 425dbc6db1addf6cb603d0774f5aa6abf4637a01 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 27 Oct 2025 18:07:49 +0100 Subject: [PATCH 088/109] Implemented copy of source folder thumbnail --- .../tools/push_to_project/models/integrate.py | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 2adc708cf3..8a6000122f 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -3,6 +3,7 @@ import re import copy import itertools import sys +import tempfile import traceback import uuid from typing import Optional, Any @@ -709,11 +710,14 @@ class ProjectPushItemProcess: project_entity, src_folder_type ) + new_thumbnail_id = self._get_new_folder_thumbnail_id( + project_entity, src_folder_entity) folder_entity = new_folder_entity( folder_name, dst_folder_type, parent_id=parent_id, - attribs=new_folder_attrib + attribs=new_folder_attrib, + thumbnail_id=new_thumbnail_id ) if folder_label: folder_entity["label"] = folder_label @@ -733,6 +737,36 @@ class ProjectPushItemProcess: folder_entity["path"] = "/".join([parent_path, folder_name]) return folder_entity + def _get_new_folder_thumbnail_id( + self, + project_entity: dict[str, Any], + src_folder_entity: dict[str, Any] + ) -> Optional[str]: + """Copy thumbnail possibly set on folder. + + Could be different from representation thumbnails, and it is only shown + when folder is selected. + """ + new_thumbnail_id = None + if src_folder_entity["thumbnailId"]: + thumbnail = ayon_api.get_thumbnail_by_id( + self._item.src_project_name, src_folder_entity["thumbnailId"] + ) + if not thumbnail.id: + return new_thumbnail_id + + try: + with tempfile.NamedTemporaryFile(delete=False) as tmp_file: + tmp_file.write(thumbnail.content) + temp_file_path = tmp_file.name + + new_thumbnail_id = ayon_api.create_thumbnail( + project_entity["name"], temp_file_path) + finally: + if temp_file_path and os.path.exists(temp_file_path): + os.remove(temp_file_path) + return new_thumbnail_id + def _get_dst_folder_type( self, project_entity: dict[str, Any], From e184c1b3dd5de7fbd95bcf7afe643c1738659e2c Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 29 Oct 2025 14:22:29 +0100 Subject: [PATCH 089/109] don't require 'AYON_STUDIO_BUNDLE_NAME' to be set --- client/ayon_core/addon/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/ayon_core/addon/base.py b/client/ayon_core/addon/base.py index 9207bb74c0..a04aedb8cc 100644 --- a/client/ayon_core/addon/base.py +++ b/client/ayon_core/addon/base.py @@ -141,6 +141,9 @@ def _get_ayon_bundle_data() -> tuple[ ]: studio_bundle_name = os.environ.get("AYON_STUDIO_BUNDLE_NAME") project_bundle_name = os.getenv("AYON_BUNDLE_NAME") + # If AYON launcher <1.4.0 was used + if not studio_bundle_name: + studio_bundle_name = project_bundle_name bundles = ayon_api.get_bundles()["bundles"] studio_bundle = next( ( From 9d3585a0c0d73aae50ab2dd444fa1e0aea3bec71 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 29 Oct 2025 15:12:38 +0100 Subject: [PATCH 090/109] Renamed method Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 8a6000122f..0968b99eb5 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -737,7 +737,7 @@ class ProjectPushItemProcess: folder_entity["path"] = "/".join([parent_path, folder_name]) return folder_entity - def _get_new_folder_thumbnail_id( + def _create_new_folder_thumbnail( self, project_entity: dict[str, Any], src_folder_entity: dict[str, Any] From 6dc68606222c88ffaac871bc25f68e5fe0856a19 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 29 Oct 2025 15:13:35 +0100 Subject: [PATCH 091/109] Reorganized flow Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- .../tools/push_to_project/models/integrate.py | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 0968b99eb5..33eac6c3d6 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -747,24 +747,28 @@ class ProjectPushItemProcess: Could be different from representation thumbnails, and it is only shown when folder is selected. """ + if not src_folder_entity["thumbnailId"]: + return None + + thumbnail = ayon_api.get_folder_thumbnail( + self._item.src_project_name, + src_folder_entity["id"], + src_folder_entity["thumbnailId"] + ) + if not thumbnail.id: + return None + + with tempfile.NamedTemporaryFile(delete=False) as tmp_file: + tmp_file.write(thumbnail.content) + temp_file_path = tmp_file.name + new_thumbnail_id = None - if src_folder_entity["thumbnailId"]: - thumbnail = ayon_api.get_thumbnail_by_id( - self._item.src_project_name, src_folder_entity["thumbnailId"] - ) - if not thumbnail.id: - return new_thumbnail_id - - try: - with tempfile.NamedTemporaryFile(delete=False) as tmp_file: - tmp_file.write(thumbnail.content) - temp_file_path = tmp_file.name - - new_thumbnail_id = ayon_api.create_thumbnail( - project_entity["name"], temp_file_path) - finally: - if temp_file_path and os.path.exists(temp_file_path): - os.remove(temp_file_path) + try: + new_thumbnail_id = ayon_api.create_thumbnail( + project_entity["name"], temp_file_path) + finally: + if os.path.exists(temp_file_path): + os.remove(temp_file_path) return new_thumbnail_id def _get_dst_folder_type( From 35926269a624b8bbde492defa6aaf756e10c8316 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 29 Oct 2025 15:14:38 +0100 Subject: [PATCH 092/109] Used renamed method --- client/ayon_core/tools/push_to_project/models/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 33eac6c3d6..cacce44942 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -710,7 +710,7 @@ class ProjectPushItemProcess: project_entity, src_folder_type ) - new_thumbnail_id = self._get_new_folder_thumbnail_id( + new_thumbnail_id = self._create_new_folder_thumbnail( project_entity, src_folder_entity) folder_entity = new_folder_entity( folder_name, From e5265ccdc01829ee817327368a164778a40ad155 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 29 Oct 2025 15:31:57 +0000 Subject: [PATCH 093/109] [Automated] Add generated package files from main --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 8e0834b8da..e40a2e3663 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.6.6+dev" +__version__ = "1.6.7" diff --git a/package.py b/package.py index 5fa4d165d2..8cd5df8dfc 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.6.6+dev" +version = "1.6.7" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index 73b9a4a916..11e7d4d3c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.6.6+dev" +version = "1.6.7" description = "" authors = ["Ynput Team "] readme = "README.md" From 757d42148e7476f4065fb4418c2d129319236090 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 29 Oct 2025 15:32:36 +0000 Subject: [PATCH 094/109] [Automated] Update version in package.py for develop --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index e40a2e3663..6aa30b935a 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.6.7" +__version__ = "1.6.7+dev" diff --git a/package.py b/package.py index 8cd5df8dfc..ff3fad5b19 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.6.7" +version = "1.6.7+dev" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index 11e7d4d3c2..6656f15249 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.6.7" +version = "1.6.7+dev" description = "" authors = ["Ynput Team "] readme = "README.md" From 5cd46678b473505384fa8b0b1ba061adab671bd3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Oct 2025 15:33:32 +0000 Subject: [PATCH 095/109] chore(): update bug report / version --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 60693f088d..c79ca69fca 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,6 +35,7 @@ body: label: Version description: What version are you running? Look to AYON Tray options: + - 1.6.7 - 1.6.6 - 1.6.5 - 1.6.4 From b3dbee7664f23289f8507a375fe8fae063817800 Mon Sep 17 00:00:00 2001 From: "robin@ynput.io" Date: Wed, 29 Oct 2025 16:43:38 -0400 Subject: [PATCH 096/109] Fix legacy OTIO clips detection on range remap. --- client/ayon_core/pipeline/editorial.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/client/ayon_core/pipeline/editorial.py b/client/ayon_core/pipeline/editorial.py index 716035aa1c..a53f1b5ae5 100644 --- a/client/ayon_core/pipeline/editorial.py +++ b/client/ayon_core/pipeline/editorial.py @@ -250,21 +250,17 @@ def remap_range_on_file_sequence(otio_clip, otio_range): if ( is_clip_from_media_sequence(otio_clip) and available_range_start_frame == media_ref.start_frame - and conformed_src_in.to_frames() < media_ref.start_frame + and round(conformed_src_in.value) < media_ref.start_frame ): media_in = otio.opentime.RationalTime( 0, rate=available_range_rate ) src_offset_in = otio_range.start_time - media_in - # make sure that only if any offset is present - if media_ref.start_frame == src_offset_in.to_frames(): - frame_in = src_offset_in.to_frames() - else: - frame_in = otio.opentime.RationalTime.from_frames( - media_ref.start_frame + src_offset_in.to_frames(), + frame_in = otio.opentime.RationalTime.from_frames( + media_ref.start_frame + src_offset_in.to_frames(), rate=available_range_rate, - ).to_frames() + ).to_frames() # e.g.: # duration = 10 frames at 24fps From 9eef269aafa5d3e79e94b69e4938375b55805f53 Mon Sep 17 00:00:00 2001 From: "robin@ynput.io" Date: Wed, 29 Oct 2025 16:57:49 -0400 Subject: [PATCH 097/109] Add comment. --- client/ayon_core/pipeline/editorial.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/ayon_core/pipeline/editorial.py b/client/ayon_core/pipeline/editorial.py index a53f1b5ae5..21468e6ddd 100644 --- a/client/ayon_core/pipeline/editorial.py +++ b/client/ayon_core/pipeline/editorial.py @@ -250,6 +250,10 @@ def remap_range_on_file_sequence(otio_clip, otio_range): if ( is_clip_from_media_sequence(otio_clip) and available_range_start_frame == media_ref.start_frame + + # source range should be included in available range from media + # using round instead of conformed_src_in.to_frames() to avoid + # any precision issue with frame rate. and round(conformed_src_in.value) < media_ref.start_frame ): media_in = otio.opentime.RationalTime( From 5e877f9b05730ac9bc704d2741614e6fbeef9837 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 15:10:03 +0100 Subject: [PATCH 098/109] Copy over attrib to copy product groupping --- client/ayon_core/tools/push_to_project/models/integrate.py | 1 + 1 file changed, 1 insertion(+) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index cacce44942..761eb175cd 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -952,6 +952,7 @@ class ProjectPushItemProcess: product_name, product_type, folder_id, + attribs=self._src_product_entity["attrib"] ) self._operations.create_entity( project_name, "product", product_entity From 758e232b6c14b872f27b3d5a22bda7fc4db762a0 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 15:35:27 +0100 Subject: [PATCH 099/109] Copy over only limited set of attributes for safety --- client/ayon_core/tools/push_to_project/models/integrate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 761eb175cd..a72a74f805 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -948,11 +948,16 @@ class ProjectPushItemProcess: self._product_entity = product_entity return product_entity + src_attrib = self._src_product_entity["attrib"] + copied_attrib = { + "description": src_attrib.get("description"), + "productGroup": src_attrib.get("productGroup") + } product_entity = new_product_entity( product_name, product_type, folder_id, - attribs=self._src_product_entity["attrib"] + attribs=copied_attrib ) self._operations.create_entity( project_name, "product", product_entity From 43f7ace90e298c59a06983cc4857426ab85c1629 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 15:58:36 +0100 Subject: [PATCH 100/109] Make copy of selected attributes closer to existing --- .../tools/push_to_project/models/integrate.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index a72a74f805..b2a987e121 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -949,15 +949,20 @@ class ProjectPushItemProcess: return product_entity src_attrib = self._src_product_entity["attrib"] - copied_attrib = { - "description": src_attrib.get("description"), - "productGroup": src_attrib.get("productGroup") - } + + dst_attrib = {} + for key in { + "description", + "productGroup", + }: + if key in src_attrib: + dst_attrib[key] = src_attrib[key] + product_entity = new_product_entity( product_name, product_type, folder_id, - attribs=copied_attrib + attribs=dst_attrib ) self._operations.create_entity( project_name, "product", product_entity From 23fd59f23ae728b2eadf143ab938c0bec737441f Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 16:04:23 +0100 Subject: [PATCH 101/109] Added version_up checkbox If selected it creates new version for existing product, otherwise it overwrites the version. --- .../tools/push_to_project/control.py | 1 + .../tools/push_to_project/ui/window.py | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/control.py b/client/ayon_core/tools/push_to_project/control.py index b4e0d56dfd..41cd9bf823 100644 --- a/client/ayon_core/tools/push_to_project/control.py +++ b/client/ayon_core/tools/push_to_project/control.py @@ -41,6 +41,7 @@ class PushToContextController: self._process_item_id = None self._use_original_name = False + self._version_up = False self.set_source(project_name, version_ids) diff --git a/client/ayon_core/tools/push_to_project/ui/window.py b/client/ayon_core/tools/push_to_project/ui/window.py index f382ccce64..c392c6b519 100644 --- a/client/ayon_core/tools/push_to_project/ui/window.py +++ b/client/ayon_core/tools/push_to_project/ui/window.py @@ -153,7 +153,12 @@ class PushToContextSelectWindow(QtWidgets.QWidget): inputs_layout.addRow("New folder name", folder_name_input) inputs_layout.addRow("Variant", variant_input) inputs_layout.addRow( - "Use original product names", original_names_checkbox) + "Use original product names", original_names_checkbox + ) + version_up_checkbox = NiceCheckbox(True, parent=inputs_widget) + inputs_layout.addRow( + "Version up existing Product", version_up_checkbox + ) inputs_layout.addRow("Comment", comment_input) main_splitter.addWidget(context_widget) @@ -209,8 +214,11 @@ class PushToContextSelectWindow(QtWidgets.QWidget): "Show error detail dialog to copy full error." ) original_names_checkbox.setToolTip( - "Required for multi copy, doesn't allow changes " - "variant values." + "Required for multi copy, doesn't allow changes variant values." + ) + version_up_checkbox.setToolTip( + "Version up existing product. If not selected version will be " + "updated." ) overlay_close_btn = QtWidgets.QPushButton( @@ -259,6 +267,8 @@ class PushToContextSelectWindow(QtWidgets.QWidget): library_only_checkbox.stateChanged.connect(self._on_library_only_change) original_names_checkbox.stateChanged.connect( self._on_original_names_change) + version_up_checkbox.stateChanged.connect( + self._on_version_up_checkbox_change) publish_btn.clicked.connect(self._on_select_click) cancel_btn.clicked.connect(self._on_close_click) @@ -328,6 +338,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget): self._new_folder_name_input_text = None self._variant_input_text = None self._comment_input_text = None + self._version_up_checkbox = version_up_checkbox self._first_show = True self._show_timer = show_timer @@ -344,6 +355,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget): show_detail_btn.setVisible(False) overlay_close_btn.setVisible(False) overlay_try_btn.setVisible(False) + version_up_checkbox.setChecked(False) # Support of public api function of controller def set_source(self, project_name, version_ids): @@ -424,6 +436,10 @@ class PushToContextSelectWindow(QtWidgets.QWidget): use_original_name = bool(state) self._invalidate_use_original_names(use_original_name) + def _on_version_up_checkbox_change(self, state: int) -> None: + self._controller._version_up = bool(state) + self._version_up_checkbox.setChecked(bool(state)) + def _on_user_input_timer(self): folder_name_enabled = self._new_folder_name_enabled folder_name = self._new_folder_name_input_text From 8bb4b2096a66cfd678c29c8c4b816c0140ad3295 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 16:04:54 +0100 Subject: [PATCH 102/109] Implemented propagation of version up value --- client/ayon_core/tools/push_to_project/control.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/control.py b/client/ayon_core/tools/push_to_project/control.py index 41cd9bf823..56e587a4e2 100644 --- a/client/ayon_core/tools/push_to_project/control.py +++ b/client/ayon_core/tools/push_to_project/control.py @@ -203,6 +203,9 @@ class PushToContextController: return item_ids = [] + dst_version = 1 + if self._version_up: + dst_version = None for src_version_entity in self._src_version_entities: item_id = self._integrate_model.create_process_item( self._src_project_name, @@ -213,7 +216,7 @@ class PushToContextController: self._user_values.variant, comment=self._user_values.comment, new_folder_name=self._user_values.new_folder_name, - dst_version=1, + dst_version=dst_version, use_original_name=self._use_original_name, ) item_ids.append(item_id) From 23a6578d6fc0235b8ba2ec3b75ddef8695373bc9 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 16:09:59 +0100 Subject: [PATCH 103/109] Formatting change --- .../tools/push_to_project/models/integrate.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index b2a987e121..8dd8d8145c 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -955,8 +955,9 @@ class ProjectPushItemProcess: "description", "productGroup", }: - if key in src_attrib: - dst_attrib[key] = src_attrib[key] + value = src_attrib.get(key) + if value: + dst_attrib[key] = value product_entity = new_product_entity( product_name, @@ -1001,8 +1002,9 @@ class ProjectPushItemProcess: "description", "intent", }: - if key in src_attrib: - dst_attrib[key] = src_attrib[key] + value = src_attrib.get(key) + if value: + dst_attrib[key] = value if version is None: last_version_entity = ayon_api.get_last_version_by_product_id( From 3bc92d88f04db94c9ffb9f7cbf9b2c1bd866a87c Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 16:13:48 +0100 Subject: [PATCH 104/109] Reorganized lines --- client/ayon_core/tools/push_to_project/ui/window.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/ui/window.py b/client/ayon_core/tools/push_to_project/ui/window.py index c392c6b519..7eb90425ab 100644 --- a/client/ayon_core/tools/push_to_project/ui/window.py +++ b/client/ayon_core/tools/push_to_project/ui/window.py @@ -144,6 +144,8 @@ class PushToContextSelectWindow(QtWidgets.QWidget): variant_input.setPlaceholderText("< Variant >") variant_input.setObjectName("ValidatedLineEdit") + version_up_checkbox = NiceCheckbox(True, parent=inputs_widget) + comment_input = PlaceholderLineEdit(inputs_widget) comment_input.setPlaceholderText("< Publish comment >") @@ -155,7 +157,6 @@ class PushToContextSelectWindow(QtWidgets.QWidget): inputs_layout.addRow( "Use original product names", original_names_checkbox ) - version_up_checkbox = NiceCheckbox(True, parent=inputs_widget) inputs_layout.addRow( "Version up existing Product", version_up_checkbox ) From 9713852deb28a5136c54156803723929f4067365 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 16:15:19 +0100 Subject: [PATCH 105/109] Unnecessary and wrong manual set --- client/ayon_core/tools/push_to_project/ui/window.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/ui/window.py b/client/ayon_core/tools/push_to_project/ui/window.py index 7eb90425ab..23aa710cd3 100644 --- a/client/ayon_core/tools/push_to_project/ui/window.py +++ b/client/ayon_core/tools/push_to_project/ui/window.py @@ -439,7 +439,6 @@ class PushToContextSelectWindow(QtWidgets.QWidget): def _on_version_up_checkbox_change(self, state: int) -> None: self._controller._version_up = bool(state) - self._version_up_checkbox.setChecked(bool(state)) def _on_user_input_timer(self): folder_name_enabled = self._new_folder_name_enabled From 23b0378a0e0fffc68f206c7800f1552d9f9e764f Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 16:17:49 +0100 Subject: [PATCH 106/109] Use public method to set private variable --- client/ayon_core/tools/push_to_project/control.py | 3 +++ client/ayon_core/tools/push_to_project/ui/window.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/control.py b/client/ayon_core/tools/push_to_project/control.py index 56e587a4e2..8fd4b6053e 100644 --- a/client/ayon_core/tools/push_to_project/control.py +++ b/client/ayon_core/tools/push_to_project/control.py @@ -233,6 +233,9 @@ class PushToContextController: thread.start() return item_ids + def set_version_up(self, state): + self._version_up = state + def wait_for_process_thread(self): if self._process_thread is None: return diff --git a/client/ayon_core/tools/push_to_project/ui/window.py b/client/ayon_core/tools/push_to_project/ui/window.py index 23aa710cd3..6be4d3c237 100644 --- a/client/ayon_core/tools/push_to_project/ui/window.py +++ b/client/ayon_core/tools/push_to_project/ui/window.py @@ -438,7 +438,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget): self._invalidate_use_original_names(use_original_name) def _on_version_up_checkbox_change(self, state: int) -> None: - self._controller._version_up = bool(state) + self._controller.set_version_up(bool(state)) def _on_user_input_timer(self): folder_name_enabled = self._new_folder_name_enabled From 7229f5d794861e71842fd6c1d20707ea174c02a9 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 16:57:50 +0100 Subject: [PATCH 107/109] Reworked hardcoded version to version_up variable 1 was used as hardcoded version, this way updated will be always last version if exists. Hardcoding 1 doesnt make sense with `get_versioning_start` which should be source of truth. Incoming value of version would make sense if we would like to start/reset specific version, which is unlikely (and currently impossible without updates to UI). --- .../tools/push_to_project/control.py | 5 +- .../tools/push_to_project/models/integrate.py | 49 ++++++++++--------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/control.py b/client/ayon_core/tools/push_to_project/control.py index 8fd4b6053e..a24cedf455 100644 --- a/client/ayon_core/tools/push_to_project/control.py +++ b/client/ayon_core/tools/push_to_project/control.py @@ -203,9 +203,6 @@ class PushToContextController: return item_ids = [] - dst_version = 1 - if self._version_up: - dst_version = None for src_version_entity in self._src_version_entities: item_id = self._integrate_model.create_process_item( self._src_project_name, @@ -216,7 +213,7 @@ class PushToContextController: self._user_values.variant, comment=self._user_values.comment, new_folder_name=self._user_values.new_folder_name, - dst_version=dst_version, + version_up=self._version_up, use_original_name=self._use_original_name, ) item_ids.append(item_id) diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index cacce44942..7130922ba0 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -89,7 +89,7 @@ class ProjectPushItem: variant, comment, new_folder_name, - dst_version, + version_up, item_id=None, use_original_name=False ): @@ -100,7 +100,7 @@ class ProjectPushItem: self.dst_project_name = dst_project_name self.dst_folder_id = dst_folder_id self.dst_task_name = dst_task_name - self.dst_version = dst_version + self.version_up = version_up self.variant = variant self.new_folder_name = new_folder_name self.comment = comment or "" @@ -118,7 +118,7 @@ class ProjectPushItem: str(self.dst_folder_id), str(self.new_folder_name), str(self.dst_task_name), - str(self.dst_version), + str(self.version_up), self.use_original_name ]) return self._repr_value @@ -133,7 +133,7 @@ class ProjectPushItem: "dst_project_name": self.dst_project_name, "dst_folder_id": self.dst_folder_id, "dst_task_name": self.dst_task_name, - "dst_version": self.dst_version, + "version_up": self.version_up, "variant": self.variant, "comment": self.comment, "new_folder_name": self.new_folder_name, @@ -962,7 +962,7 @@ class ProjectPushItemProcess: """Make sure version document exits in database.""" project_name = self._item.dst_project_name - version = self._item.dst_version + version_up = self._item.version_up src_version_entity = self._src_version_entity product_entity = self._product_entity product_id = product_entity["id"] @@ -993,24 +993,25 @@ class ProjectPushItemProcess: if key in src_attrib: dst_attrib[key] = src_attrib[key] - if version is None: - last_version_entity = ayon_api.get_last_version_by_product_id( - project_name, product_id + last_version_entity = ayon_api.get_last_version_by_product_id( + project_name, product_id + ) + if last_version_entity is None: + dst_version = get_versioning_start( + project_name, + self.host_name, + task_name=self._task_info.get("name"), + task_type=self._task_info.get("taskType"), + product_type=product_type, + product_name=product_entity["name"], ) - if last_version_entity: - version = int(last_version_entity["version"]) + 1 - else: - version = get_versioning_start( - project_name, - self.host_name, - task_name=self._task_info.get("name"), - task_type=self._task_info.get("taskType"), - product_type=product_type, - product_name=product_entity["name"], - ) + else: + dst_version = int(last_version_entity["version"]) + if version_up: + dst_version += 1 existing_version_entity = ayon_api.get_version_by_name( - project_name, version, product_id + project_name, dst_version, product_id ) thumbnail_id = self._copy_version_thumbnail() @@ -1032,7 +1033,7 @@ class ProjectPushItemProcess: copied_status = self._get_transferable_status(src_version_entity) version_entity = new_version_entity( - version, + dst_version, product_id, author=src_version_entity["author"], status=copied_status, @@ -1380,7 +1381,7 @@ class IntegrateModel: variant, comment, new_folder_name, - dst_version, + version_up, use_original_name ): """Create new item for integration. @@ -1394,7 +1395,7 @@ class IntegrateModel: variant (str): Variant name. comment (Union[str, None]): Comment. new_folder_name (Union[str, None]): New folder name. - dst_version (int): Destination version number. + version_up (bool): Should destination product be versioned up use_original_name (bool): If original product names should be used Returns: @@ -1411,7 +1412,7 @@ class IntegrateModel: variant, comment=comment, new_folder_name=new_folder_name, - dst_version=dst_version, + version_up=version_up, use_original_name=use_original_name ) process_item = ProjectPushItemProcess(self, item) From 9e6dd82c7477ab10f2c0640b467b863fbf1e705a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 Oct 2025 17:23:18 +0100 Subject: [PATCH 108/109] Removed unnecessary call to private method --- client/ayon_core/tools/push_to_project/ui/window.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_core/tools/push_to_project/ui/window.py b/client/ayon_core/tools/push_to_project/ui/window.py index f382ccce64..c1308cece0 100644 --- a/client/ayon_core/tools/push_to_project/ui/window.py +++ b/client/ayon_core/tools/push_to_project/ui/window.py @@ -376,7 +376,6 @@ class PushToContextSelectWindow(QtWidgets.QWidget): self._invalidate_new_folder_name( new_folder_name, user_values["is_new_folder_name_valid"] ) - self._controller._invalidate() self._projects_combobox.refresh() def _on_first_show(self): From 6b6001dc42e4011da76344a1c161f3eef45f2001 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 4 Nov 2025 14:07:58 +0100 Subject: [PATCH 109/109] Refactored usage of Qt.CheckState --- .../tools/push_to_project/ui/window.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client/ayon_core/tools/push_to_project/ui/window.py b/client/ayon_core/tools/push_to_project/ui/window.py index c19a756bd7..b77cca0e09 100644 --- a/client/ayon_core/tools/push_to_project/ui/window.py +++ b/client/ayon_core/tools/push_to_project/ui/window.py @@ -319,6 +319,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget): self._folder_name_input = folder_name_input self._comment_input = comment_input self._use_original_names_checkbox = original_names_checkbox + self._library_only_checkbox = library_only_checkbox self._publish_btn = publish_btn @@ -427,17 +428,18 @@ class PushToContextSelectWindow(QtWidgets.QWidget): self._comment_input_text = text self._user_input_changed_timer.start() - def _on_library_only_change(self, state: int) -> None: + def _on_library_only_change(self) -> None: """Change toggle state, reset filter, recalculate dropdown""" - state = bool(state) - self._projects_combobox.set_standard_filter_enabled(state) + is_checked = self._library_only_checkbox.isChecked() + self._projects_combobox.set_standard_filter_enabled(is_checked) - def _on_original_names_change(self, state: int) -> None: - use_original_name = bool(state) - self._invalidate_use_original_names(use_original_name) + def _on_original_names_change(self) -> None: + is_checked = self._use_original_names_checkbox.isChecked() + self._invalidate_use_original_names(is_checked) - def _on_version_up_checkbox_change(self, state: int) -> None: - self._controller.set_version_up(bool(state)) + def _on_version_up_checkbox_change(self) -> None: + is_checked = self._version_up_checkbox.isChecked() + self._controller.set_version_up(is_checked) def _on_user_input_timer(self): folder_name_enabled = self._new_folder_name_enabled