From 997b11399ee783d759c38e438c8695208e42d58d Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 24 Sep 2020 16:25:41 +0200 Subject: [PATCH 1/5] implemented `_add_intent_to_context` for adding intent to context data --- pype/tools/pyblish_pype/window.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pype/tools/pyblish_pype/window.py b/pype/tools/pyblish_pype/window.py index 2a037ba4bc..e4593d85ad 100644 --- a/pype/tools/pyblish_pype/window.py +++ b/pype/tools/pyblish_pype/window.py @@ -563,6 +563,20 @@ class Window(QtWidgets.QDialog): ): instance_item.setData(enable_value, Roles.IsEnabledRole) + def _add_intent_to_context(self): + if ( + self.intent_model.has_items + and "intent" not in self.controller.context.data + ): + idx = self.intent_model.index(self.intent_box.currentIndex(), 0) + intent_value = self.intent_model.data(idx, Roles.IntentItemValue) + intent_label = self.intent_model.data(idx, QtCore.Qt.DisplayRole) + + self.controller.context.data["intent"] = { + "value": intent_value, + "label": intent_label + } + def on_instance_toggle(self, index, state=None): """An item is requesting to be toggled""" if not index.data(Roles.IsOptionalRole): From dc4220e4745dbcaae8c9112c67b9e95bd739ffb1 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 24 Sep 2020 16:26:07 +0200 Subject: [PATCH 2/5] removed `on_intent_changed` since it's not helpful --- pype/tools/pyblish_pype/window.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/pype/tools/pyblish_pype/window.py b/pype/tools/pyblish_pype/window.py index e4593d85ad..5b4e806271 100644 --- a/pype/tools/pyblish_pype/window.py +++ b/pype/tools/pyblish_pype/window.py @@ -225,7 +225,6 @@ class Window(QtWidgets.QDialog): intent_model = model.IntentModel() intent_box.setModel(intent_model) - intent_box.currentIndexChanged.connect(self.on_intent_changed) comment_intent_widget = QtWidgets.QWidget() comment_intent_layout = QtWidgets.QHBoxLayout(comment_intent_widget) @@ -666,18 +665,6 @@ class Window(QtWidgets.QDialog): """The user has typed a comment.""" self.controller.context.data["comment"] = self.comment_box.text() - def on_intent_changed(self): - idx = self.intent_model.index(self.intent_box.currentIndex(), 0) - intent_value = self.intent_model.data(idx, Roles.IntentItemValue) - intent_label = self.intent_model.data(idx, QtCore.Qt.DisplayRole) - - # TODO move to play - if self.controller.context: - self.controller.context.data["intent"] = { - "value": intent_value, - "label": intent_label - } - def on_about_to_process(self, plugin, instance): """Reflect currently running pair in GUI""" if instance is None: @@ -768,8 +755,6 @@ class Window(QtWidgets.QDialog): self.comment_box.setText(comment or None) self.comment_box.setEnabled(True) - if self.intent_model.has_items: - self.on_intent_changed() self.intent_box.setEnabled(True) # Refresh tab From 16e52ccff289b28875c20f24022e444280c87174 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 24 Sep 2020 16:26:25 +0200 Subject: [PATCH 3/5] `_add_intent_to_context` is executed on play or validate button --- pype/tools/pyblish_pype/window.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pype/tools/pyblish_pype/window.py b/pype/tools/pyblish_pype/window.py index 5b4e806271..b7aada5ff7 100644 --- a/pype/tools/pyblish_pype/window.py +++ b/pype/tools/pyblish_pype/window.py @@ -631,12 +631,16 @@ class Window(QtWidgets.QDialog): self.comment_box.setEnabled(False) self.intent_box.setEnabled(False) + self._add_intent_to_context() + self.validate() def on_play_clicked(self): self.comment_box.setEnabled(False) self.intent_box.setEnabled(False) + self._add_intent_to_context() + self.publish() def on_reset_clicked(self): From 8627a9613e72ef2fb501cebfa22fc4b08d370f66 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 24 Sep 2020 16:26:45 +0200 Subject: [PATCH 4/5] extract burnin checks if intent value is valid before adding label --- pype/plugins/global/publish/extract_burnin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pype/plugins/global/publish/extract_burnin.py b/pype/plugins/global/publish/extract_burnin.py index 6e8da1b054..b81cfbc050 100644 --- a/pype/plugins/global/publish/extract_burnin.py +++ b/pype/plugins/global/publish/extract_burnin.py @@ -316,7 +316,9 @@ class ExtractBurnin(pype.api.Extractor): intent_label = context.data.get("intent") if intent_label and isinstance(intent_label, dict): - intent_label = intent_label.get("label") + value = intent_label.get("value") + if value: + intent_label = intent_label.get("label") if intent_label: burnin_data["intent"] = intent_label From add97d828c252860d17e6fa542a652abba2ace1b Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 2 Oct 2020 15:53:09 +0200 Subject: [PATCH 5/5] fixed bad intent values in burnins --- pype/plugins/global/publish/extract_burnin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pype/plugins/global/publish/extract_burnin.py b/pype/plugins/global/publish/extract_burnin.py index b81cfbc050..5649c9aef2 100644 --- a/pype/plugins/global/publish/extract_burnin.py +++ b/pype/plugins/global/publish/extract_burnin.py @@ -314,14 +314,15 @@ class ExtractBurnin(pype.api.Extractor): "comment": context.data.get("comment") or "" }) - intent_label = context.data.get("intent") + intent_label = context.data.get("intent") or "" if intent_label and isinstance(intent_label, dict): value = intent_label.get("value") if value: - intent_label = intent_label.get("label") + intent_label = intent_label["label"] + else: + intent_label = "" - if intent_label: - burnin_data["intent"] = intent_label + burnin_data["intent"] = intent_label temp_data = { "frame_start": frame_start,