From dda5ddaa98537b60d02e5ca80a48b5208af9a788 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Dec 2021 14:09:09 +0100 Subject: [PATCH 1/7] Implemented change of validators to new publisher style for AE --- .../publish/help/validate_instance_asset.xml | 21 +++++++++++ .../publish/help/validate_scene_settings.xml | 36 +++++++++++++++++++ .../publish/validate_instance_asset.py | 12 +++---- .../publish/validate_scene_settings.py | 27 +++++++++++--- 4 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 openpype/hosts/aftereffects/plugins/publish/help/validate_instance_asset.xml create mode 100644 openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml diff --git a/openpype/hosts/aftereffects/plugins/publish/help/validate_instance_asset.xml b/openpype/hosts/aftereffects/plugins/publish/help/validate_instance_asset.xml new file mode 100644 index 00000000000..580b0e552df --- /dev/null +++ b/openpype/hosts/aftereffects/plugins/publish/help/validate_instance_asset.xml @@ -0,0 +1,21 @@ + + + +Subset context + +## Invalid subset context + +Context of the given subset doesn't match your current scene. + +### How to repair? + +You can fix this with "repair" button on the right. + + +### __Detailed Info__ (optional) + +This might happen if you are reuse old workfile and open it in different context. + (Eg. you created subset "renderCompositingDefault" from asset "Robot' in "your_project_Robot_compositing.aep", now you opened this workfile in a context "Sloth" but existing subset for "Robot" asset stayed in the workfile.) + + + \ No newline at end of file diff --git a/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml b/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml new file mode 100644 index 00000000000..603ab4805d3 --- /dev/null +++ b/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml @@ -0,0 +1,36 @@ + + + +Scene setting + +## Invalid scene setting found + +One of the settings in a scene doesn't match to asset settings in database. + + Invalid setting: + {invalid_setting_str} + +### How to repair? + +Change {invalid_keys_str} in the scene OR change them in asset database if they are wrong there. + + +### __Detailed Info__ (optional) + +This error is shown when for example resolution in the scene doesn't match to resolution set on the asset in the database. + Either value in the database or in the scene is wrong. + + + +Scene file doesn't exist + +## Scene file doesn't exist + +Collected scene {scene_url} doesn't exist. + +### How to repair? + +Re-save file, start publish from the beginning again. + + + \ No newline at end of file diff --git a/openpype/hosts/aftereffects/plugins/publish/validate_instance_asset.py b/openpype/hosts/aftereffects/plugins/publish/validate_instance_asset.py index eff89adcb3b..2c8c1b43129 100644 --- a/openpype/hosts/aftereffects/plugins/publish/validate_instance_asset.py +++ b/openpype/hosts/aftereffects/plugins/publish/validate_instance_asset.py @@ -2,6 +2,7 @@ import pyblish.api import openpype.api from avalon import aftereffects +from openpype.pipeline import PublishValidationError class ValidateInstanceAssetRepair(pyblish.api.Action): @@ -29,7 +30,6 @@ def process(self, context, plugin): data["asset"] = api.Session["AVALON_ASSET"] stub.imprint(instance[0], data) - class ValidateInstanceAsset(pyblish.api.InstancePlugin): """Validate the instance asset is the current selected context asset. @@ -53,9 +53,9 @@ def process(self, instance): current_asset = api.Session["AVALON_ASSET"] msg = ( f"Instance asset {instance_asset} is not the same " - f"as current context {current_asset}. PLEASE DO:\n" - f"Repair with 'A' action to use '{current_asset}'.\n" - f"If that's not correct value, close workfile and " - f"reopen via Workfiles!" + f"as current context {current_asset}." ) - assert instance_asset == current_asset, msg + + # assert instance_asset == current_asset, msg + if instance_asset != current_asset: + raise PublishValidationError(msg, "Subset context", DESCRIPTION) \ No newline at end of file diff --git a/openpype/hosts/aftereffects/plugins/publish/validate_scene_settings.py b/openpype/hosts/aftereffects/plugins/publish/validate_scene_settings.py index 7fba11957c9..50e55599e27 100644 --- a/openpype/hosts/aftereffects/plugins/publish/validate_scene_settings.py +++ b/openpype/hosts/aftereffects/plugins/publish/validate_scene_settings.py @@ -7,6 +7,7 @@ from avalon import aftereffects +from openpype.pipeline import PublishXmlValidationError import openpype.hosts.aftereffects.api as api stub = aftereffects.stub() @@ -103,12 +104,14 @@ def process(self, instance): self.log.info("current_settings:: {}".format(current_settings)) invalid_settings = [] + invalid_keys = set() for key, value in expected_settings.items(): if value != current_settings[key]: invalid_settings.append( "{} expected: {} found: {}".format(key, value, current_settings[key]) ) + invalid_keys.add(key) if ((expected_settings.get("handleStart") or expected_settings.get("handleEnd")) @@ -120,7 +123,23 @@ def process(self, instance): msg = "Found invalid settings:\n{}".format( "\n".join(invalid_settings) ) - assert not invalid_settings, msg - assert os.path.exists(instance.data.get("source")), ( - "Scene file not found (saved under wrong name)" - ) + + if invalid_settings: + invalid_keys_str = ",".join(invalid_keys) + formatting_data = { + "invalid_setting_str": msg, + "invalid_keys_str": invalid_keys_str + } + raise PublishXmlValidationError(self, msg, + formatting_data=formatting_data) + + if not os.path.exists(instance.data.get("source")): + scene_url = instance.data.get("source") + msg = "Scene file {} not found (saved under wrong name)".format( + scene_url + ) + formatting_data = { + "scene_url": scene_url + } + raise PublishXmlValidationError(self, msg, + formatting_data=formatting_data) From 8a67dba15d67ecc8092b9e53efd65a0f4d79b143 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Dec 2021 14:18:26 +0100 Subject: [PATCH 2/7] Fix formatting --- .../plugins/publish/help/validate_instance_asset.xml | 2 +- .../plugins/publish/help/validate_scene_settings.xml | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openpype/hosts/aftereffects/plugins/publish/help/validate_instance_asset.xml b/openpype/hosts/aftereffects/plugins/publish/help/validate_instance_asset.xml index 580b0e552df..13f03a9b9ae 100644 --- a/openpype/hosts/aftereffects/plugins/publish/help/validate_instance_asset.xml +++ b/openpype/hosts/aftereffects/plugins/publish/help/validate_instance_asset.xml @@ -15,7 +15,7 @@ You can fix this with "repair" button on the right. ### __Detailed Info__ (optional) This might happen if you are reuse old workfile and open it in different context. - (Eg. you created subset "renderCompositingDefault" from asset "Robot' in "your_project_Robot_compositing.aep", now you opened this workfile in a context "Sloth" but existing subset for "Robot" asset stayed in the workfile.) +(Eg. you created subset "renderCompositingDefault" from asset "Robot' in "your_project_Robot_compositing.aep", now you opened this workfile in a context "Sloth" but existing subset for "Robot" asset stayed in the workfile.) \ No newline at end of file diff --git a/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml b/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml index 603ab4805d3..983dde42ce4 100644 --- a/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml +++ b/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml @@ -6,22 +6,21 @@ ## Invalid scene setting found One of the settings in a scene doesn't match to asset settings in database. - - Invalid setting: - {invalid_setting_str} +Invalid setting: +{invalid_setting_str} ### How to repair? -Change {invalid_keys_str} in the scene OR change them in asset database if they are wrong there. +Change {invalid_keys_str} setting in the scene OR change them in asset database if they are wrong there. ### __Detailed Info__ (optional) This error is shown when for example resolution in the scene doesn't match to resolution set on the asset in the database. - Either value in the database or in the scene is wrong. +Either value in the database or in the scene is wrong. - + Scene file doesn't exist ## Scene file doesn't exist From 3e195d58ccc16c33498159a364ca758ad604d9cf Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Dec 2021 14:37:41 +0100 Subject: [PATCH 3/7] Fix formatting --- .../plugins/publish/help/validate_scene_settings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml b/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml index 983dde42ce4..6dc51d99533 100644 --- a/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml +++ b/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml @@ -6,12 +6,12 @@ ## Invalid scene setting found One of the settings in a scene doesn't match to asset settings in database. -Invalid setting: + {invalid_setting_str} ### How to repair? -Change {invalid_keys_str} setting in the scene OR change them in asset database if they are wrong there. +Change values for {invalid_keys_str} in the scene OR change them in the asset database if they are wrong there. ### __Detailed Info__ (optional) From a14aaaf9b8e4feb4245bae8a4e07aa7a91043d33 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Dec 2021 14:48:08 +0100 Subject: [PATCH 4/7] Fix formatting --- .../plugins/publish/help/validate_scene_settings.xml | 2 +- .../plugins/publish/validate_instance_asset.py | 5 ++--- .../plugins/publish/validate_scene_settings.py | 8 ++++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml b/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml index 6dc51d99533..36fa90456ed 100644 --- a/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml +++ b/openpype/hosts/aftereffects/plugins/publish/help/validate_scene_settings.xml @@ -20,7 +20,7 @@ This error is shown when for example resolution in the scene doesn't match to re Either value in the database or in the scene is wrong. - + Scene file doesn't exist ## Scene file doesn't exist diff --git a/openpype/hosts/aftereffects/plugins/publish/validate_instance_asset.py b/openpype/hosts/aftereffects/plugins/publish/validate_instance_asset.py index 2c8c1b43129..491e07b6c46 100644 --- a/openpype/hosts/aftereffects/plugins/publish/validate_instance_asset.py +++ b/openpype/hosts/aftereffects/plugins/publish/validate_instance_asset.py @@ -2,7 +2,7 @@ import pyblish.api import openpype.api from avalon import aftereffects -from openpype.pipeline import PublishValidationError +from openpype.pipeline import PublishXmlValidationError class ValidateInstanceAssetRepair(pyblish.api.Action): @@ -56,6 +56,5 @@ def process(self, instance): f"as current context {current_asset}." ) - # assert instance_asset == current_asset, msg if instance_asset != current_asset: - raise PublishValidationError(msg, "Subset context", DESCRIPTION) \ No newline at end of file + raise PublishXmlValidationError(self, msg) diff --git a/openpype/hosts/aftereffects/plugins/publish/validate_scene_settings.py b/openpype/hosts/aftereffects/plugins/publish/validate_scene_settings.py index 50e55599e27..0e7a54005ab 100644 --- a/openpype/hosts/aftereffects/plugins/publish/validate_scene_settings.py +++ b/openpype/hosts/aftereffects/plugins/publish/validate_scene_settings.py @@ -126,8 +126,12 @@ def process(self, instance): if invalid_settings: invalid_keys_str = ",".join(invalid_keys) + break_str = "
" + invalid_setting_str = "Found invalid settings:
{}".\ + format(break_str.join(invalid_settings)) + formatting_data = { - "invalid_setting_str": msg, + "invalid_setting_str": invalid_setting_str, "invalid_keys_str": invalid_keys_str } raise PublishXmlValidationError(self, msg, @@ -141,5 +145,5 @@ def process(self, instance): formatting_data = { "scene_url": scene_url } - raise PublishXmlValidationError(self, msg, + raise PublishXmlValidationError(self, msg, key="file_not_found", formatting_data=formatting_data) From 99feae84f28926a175eea31e1006705704314835 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 22 Dec 2021 16:00:03 +0100 Subject: [PATCH 5/7] make sure all previous widget stay hidden --- openpype/tools/publisher/widgets/validations_widget.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openpype/tools/publisher/widgets/validations_widget.py b/openpype/tools/publisher/widgets/validations_widget.py index ba4df2eb8e5..90bb4b062b9 100644 --- a/openpype/tools/publisher/widgets/validations_widget.py +++ b/openpype/tools/publisher/widgets/validations_widget.py @@ -272,6 +272,7 @@ def clear(self): item = self._content_layout.takeAt(0) widget = item.widget() if widget: + widget.setVisible(False) widget.deleteLater() self._actions_mapping = {} From f6a7d3f51ab8b8f275615c4ac277c6813891a898 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 22 Dec 2021 16:00:15 +0100 Subject: [PATCH 6/7] action icon is optional --- openpype/tools/publisher/widgets/validations_widget.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openpype/tools/publisher/widgets/validations_widget.py b/openpype/tools/publisher/widgets/validations_widget.py index 90bb4b062b9..003d78fa569 100644 --- a/openpype/tools/publisher/widgets/validations_widget.py +++ b/openpype/tools/publisher/widgets/validations_widget.py @@ -226,13 +226,15 @@ def __init__(self, action, parent): action_label = action.label or action.__name__ action_icon = getattr(action, "icon", None) label_widget = QtWidgets.QLabel(action_label, self) + icon_label = None if action_icon: icon_label = IconValuePixmapLabel(action_icon, self) layout = QtWidgets.QHBoxLayout(self) layout.setContentsMargins(5, 0, 5, 0) layout.addWidget(label_widget, 1) - layout.addWidget(icon_label, 0) + if icon_label is not None: + layout.addWidget(icon_label, 0) self.setSizePolicy( QtWidgets.QSizePolicy.Minimum, From 2813317a17587a0d290547ec68d2af98132de5ba Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 20 Dec 2021 19:25:20 +0100 Subject: [PATCH 7/7] remove check of attr_plugins --- openpype/pipeline/create/context.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openpype/pipeline/create/context.py b/openpype/pipeline/create/context.py index 7b0f50b1dce..2d748dd74f7 100644 --- a/openpype/pipeline/create/context.py +++ b/openpype/pipeline/create/context.py @@ -306,8 +306,6 @@ def set_publish_plugins(self, attr_plugins): self._plugin_names_order = [] self._missing_plugins = [] self.attr_plugins = attr_plugins or [] - if not attr_plugins: - return origin_data = self._origin_data data = self._data