From caf3682e87bc3f4356f5ed8a9d54d0c040282588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A0=20Serra=20Arrizabalaga?= Date: Tue, 21 May 2024 22:22:33 +0200 Subject: [PATCH 1/8] Make sure actions in Launcher are sorted so they don't keep changing order randomly --- client/ayon_core/tools/launcher/models/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/launcher/models/actions.py b/client/ayon_core/tools/launcher/models/actions.py index 32df600c87..c27f0cd757 100644 --- a/client/ayon_core/tools/launcher/models/actions.py +++ b/client/ayon_core/tools/launcher/models/actions.py @@ -332,7 +332,7 @@ class ActionsModel: selection = self._prepare_selection(project_name, folder_id, task_id) output = [] action_items = self._get_action_items(project_name) - for identifier, action in self._get_action_objects().items(): + for identifier, action in sorted(self._get_action_objects().items()): if not action.is_compatible(selection): continue From 6c461eb21c981ebb70c19d40013f63fcefbd1a5f Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 22 May 2024 09:54:27 +0200 Subject: [PATCH 2/8] add addon name to version.py --- server_addon/create_ayon_addons.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server_addon/create_ayon_addons.py b/server_addon/create_ayon_addons.py index f0a36d4740..749077d2a8 100644 --- a/server_addon/create_ayon_addons.py +++ b/server_addon/create_ayon_addons.py @@ -47,7 +47,7 @@ plugin_for = ["ayon_server"] """ CLIENT_VERSION_CONTENT = '''# -*- coding: utf-8 -*- -"""Package declaring AYON core addon version.""" +"""Package declaring AYON addon '{}' version.""" __version__ = "{}" ''' @@ -183,6 +183,7 @@ def create_addon_zip( def prepare_client_code( + addon_name: str, addon_dir: Path, addon_output_dir: Path, addon_version: str @@ -211,7 +212,9 @@ def prepare_client_code( version_path = subpath / "version.py" if version_path.exists(): with open(version_path, "w") as stream: - stream.write(CLIENT_VERSION_CONTENT.format(addon_version)) + stream.write( + CLIENT_VERSION_CONTENT.format(addon_name, addon_version) + ) zip_filepath = private_dir / "client.zip" with ZipFileLongPaths(zip_filepath, "w", zipfile.ZIP_DEFLATED) as zipf: @@ -262,7 +265,9 @@ def create_addon_package( server_dir, addon_output_dir / "server", dirs_exist_ok=True ) - prepare_client_code(addon_dir, addon_output_dir, addon_version) + prepare_client_code( + package.name, addon_dir, addon_output_dir, addon_version + ) if create_zip: create_addon_zip( From dd29bd8fa8f88853fb8cf4ea4ec496ec8e2a41cf Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Wed, 22 May 2024 15:46:03 +0300 Subject: [PATCH 3/8] remove original render instance --- .../ayon_core/hosts/houdini/plugins/publish/extract_render.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py b/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py index 7b4762a25f..651df15c10 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py @@ -72,3 +72,6 @@ class ExtractRender(publish.Extractor): raise RuntimeError("Failed to complete render extraction. " "Missing output files: {}".format( missing_frames)) + + # Remove original render instance + instance.context.remove(instance) From 60a76239bf254406eb19eef3096e3b94a40d0060 Mon Sep 17 00:00:00 2001 From: Mustafa Taher Date: Wed, 22 May 2024 18:32:28 +0300 Subject: [PATCH 4/8] disable integration for the original render instance Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- .../ayon_core/hosts/houdini/plugins/publish/extract_render.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py b/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py index 651df15c10..20e9341ebd 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py @@ -74,4 +74,4 @@ class ExtractRender(publish.Extractor): missing_frames)) # Remove original render instance - instance.context.remove(instance) + instance.data["integrate"] = False From ab8d5186b9f9c9a9fc885272dc398b579aa8225e Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Wed, 22 May 2024 18:42:19 +0300 Subject: [PATCH 5/8] update comment about skipping integration --- .../ayon_core/hosts/houdini/plugins/publish/extract_render.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py b/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py index 20e9341ebd..267280ad9f 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py @@ -73,5 +73,5 @@ class ExtractRender(publish.Extractor): "Missing output files: {}".format( missing_frames)) - # Remove original render instance + # Skip integrating original render instance instance.data["integrate"] = False From 48167e23c79baf4510d514426139f07f9ec86a9b Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 22 May 2024 17:43:31 +0200 Subject: [PATCH 6/8] Implement sorting proxy model --- .../tools/launcher/ui/actions_widget.py | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/tools/launcher/ui/actions_widget.py b/client/ayon_core/tools/launcher/ui/actions_widget.py index a225827418..3e4dfaf6e4 100644 --- a/client/ayon_core/tools/launcher/ui/actions_widget.py +++ b/client/ayon_core/tools/launcher/ui/actions_widget.py @@ -290,6 +290,34 @@ class ActionDelegate(QtWidgets.QStyledItemDelegate): painter.drawPixmap(extender_x, extender_y, pix) +class ActionsProxyModel(QtCore.QSortFilterProxyModel): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + self.setSortCaseSensitivity(QtCore.Qt.CaseInsensitive) + + def lessThan(self, left, right): + # Sort by action order and then by label + left_value = left.data(ACTION_SORT_ROLE) + right_value = right.data(ACTION_SORT_ROLE) + + # Values are same -> use super sorting + if left_value == right_value: + # Default behavior is using DisplayRole + return super().lessThan(left, right) + + # Validate 'None' values + if right_value is None: + return True + if left_value is None: + return False + # Sort values and handle incompatible types + try: + return left_value < right_value + except TypeError: + return True + + class ActionsWidget(QtWidgets.QWidget): def __init__(self, controller, parent): super(ActionsWidget, self).__init__(parent) @@ -316,10 +344,7 @@ class ActionsWidget(QtWidgets.QWidget): model = ActionsQtModel(controller) - proxy_model = QtCore.QSortFilterProxyModel() - proxy_model.setSortCaseSensitivity(QtCore.Qt.CaseInsensitive) - proxy_model.setSortRole(ACTION_SORT_ROLE) - + proxy_model = ActionsProxyModel() proxy_model.setSourceModel(model) view.setModel(proxy_model) From 88cae86ee67a0cedd2e0635dd1fe1f6a2a45f4d9 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 22 May 2024 17:43:42 +0200 Subject: [PATCH 7/8] reverse sorting in actions model --- client/ayon_core/tools/launcher/models/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/tools/launcher/models/actions.py b/client/ayon_core/tools/launcher/models/actions.py index c27f0cd757..32df600c87 100644 --- a/client/ayon_core/tools/launcher/models/actions.py +++ b/client/ayon_core/tools/launcher/models/actions.py @@ -332,7 +332,7 @@ class ActionsModel: selection = self._prepare_selection(project_name, folder_id, task_id) output = [] action_items = self._get_action_items(project_name) - for identifier, action in sorted(self._get_action_objects().items()): + for identifier, action in self._get_action_objects().items(): if not action.is_compatible(selection): continue From 7f586576415493f0c49bdb497fb70c9921b038ed Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Wed, 22 May 2024 18:46:39 +0300 Subject: [PATCH 8/8] move code to a dedicated place --- .../plugins/publish/collect_local_render_instances.py | 6 +++--- .../hosts/houdini/plugins/publish/extract_render.py | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/client/ayon_core/hosts/houdini/plugins/publish/collect_local_render_instances.py b/client/ayon_core/hosts/houdini/plugins/publish/collect_local_render_instances.py index 5a446fa0d3..474002e1ee 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/collect_local_render_instances.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/collect_local_render_instances.py @@ -132,6 +132,6 @@ class CollectLocalRenderInstances(pyblish.api.InstancePlugin): ] }) - # Remove original render instance - # I can't remove it here as I still need it to trigger the render. - # context.remove(instance) + # Skip integrating original render instance. + # We are not removing it because it's used to trigger the render. + instance.data["integrate"] = False diff --git a/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py b/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py index 267280ad9f..7b4762a25f 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/extract_render.py @@ -72,6 +72,3 @@ class ExtractRender(publish.Extractor): raise RuntimeError("Failed to complete render extraction. " "Missing output files: {}".format( missing_frames)) - - # Skip integrating original render instance - instance.data["integrate"] = False