diff --git a/openpype/tools/new_publisher/control.py b/openpype/tools/new_publisher/control.py index 672f6fd01b..e6f642dbba 100644 --- a/openpype/tools/new_publisher/control.py +++ b/openpype/tools/new_publisher/control.py @@ -333,6 +333,7 @@ class PublisherController: self._publish_finished = False self._publish_max_progress = 0 self._publish_progress = 0 + self._publish_comment_is_set = False # Validation order # - plugin with order same or higher than this value is extractor or @@ -621,6 +622,10 @@ class PublisherController: def publish_progress(self): return self._publish_progress + @property + def publish_comment_is_set(self): + return self._publish_comment_is_set + def get_publish_crash_error(self): return self._publish_error @@ -635,9 +640,12 @@ class PublisherController: self._publish_validated = False self._publish_up_validation = False self._publish_finished = False + self._publish_comment_is_set = False self._main_thread_processor.clear() self._main_thread_iter = self._publish_iterator() self._publish_context = pyblish.api.Context() + # Make sure "comment" is set on publish context + self._publish_context.data["comment"] = "" self._publish_report.reset( self._publish_context, @@ -652,6 +660,10 @@ class PublisherController: self._trigger_callbacks(self._publish_reset_callback_refs) + def set_comment(self, comment): + self._publish_context.data["comment"] = comment + self._publish_comment_is_set = True + def publish(self): """Run publishing.""" self._publish_up_validation = False diff --git a/openpype/tools/new_publisher/window.py b/openpype/tools/new_publisher/window.py index 1a5f0fa826..b65a0f9094 100644 --- a/openpype/tools/new_publisher/window.py +++ b/openpype/tools/new_publisher/window.py @@ -343,11 +343,20 @@ class PublisherWindow(QtWidgets.QDialog): def _on_stop_clicked(self): self.controller.stop_publish() + def _set_publish_comment(self): + if self.controller.publish_comment_is_set: + return + + comment = self.comment_input.text() + self.controller.context.data["comment"] = comment + def _on_validate_clicked(self): + self._set_publish_comment() self._set_publish_visibility(True) self.controller.validate() def _on_publish_clicked(self): + self._set_publish_comment() self._set_publish_visibility(True) self.controller.publish()