diff --git a/openpype/tools/pyblish_pype/app.py b/openpype/tools/pyblish_pype/app.py index d15d586103..a252b96427 100644 --- a/openpype/tools/pyblish_pype/app.py +++ b/openpype/tools/pyblish_pype/app.py @@ -90,9 +90,8 @@ def show(parent=None): install_fonts() install_translator(app) - ctrl = control.Controller() - if self._window is None: + ctrl = control.Controller() self._window = window.Window(ctrl, parent) self._window.destroyed.connect(on_destroyed) diff --git a/openpype/tools/pyblish_pype/control.py b/openpype/tools/pyblish_pype/control.py index 455a338499..6f89952c22 100644 --- a/openpype/tools/pyblish_pype/control.py +++ b/openpype/tools/pyblish_pype/control.py @@ -228,6 +228,16 @@ class Controller(QtCore.QObject): def reset_context(self): self.log.debug("Resetting pyblish context object") + comment = None + if ( + self.context is not None and + self.context.data.get("comment") and + # We only preserve the user typed comment if we are *not* + # resetting from a successful publish without errors + self._current_state != "Published" + ): + comment = self.context.data["comment"] + self.context = pyblish.api.Context() self.context._publish_states = InstanceStates.ContextType @@ -249,6 +259,10 @@ class Controller(QtCore.QObject): self.context.families = ("__context__",) + if comment: + # Preserve comment on reset if user previously had a comment + self.context.data["comment"] = comment + self.log.debug("Reset of pyblish context object done") def reset(self): diff --git a/openpype/tools/pyblish_pype/window.py b/openpype/tools/pyblish_pype/window.py index 38907c1a52..d27ec34345 100644 --- a/openpype/tools/pyblish_pype/window.py +++ b/openpype/tools/pyblish_pype/window.py @@ -1139,9 +1139,10 @@ class Window(QtWidgets.QDialog): self.intent_box.setCurrentIndex(self.intent_model.default_index) self.comment_box.placeholder.setVisible(False) - self.comment_box.placeholder.setVisible(True) # Launch controller reset self.controller.reset() + if not self.comment_box.text(): + self.comment_box.placeholder.setVisible(True) def validate(self): self.info(self.tr("Preparing validate.."))