From 4d44a374ae1ced9f03c95006e614e08982d452c8 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Tue, 22 Feb 2022 15:15:12 +0100 Subject: [PATCH] Preserve comment on reset --- openpype/tools/pyblish_pype/control.py | 8 ++++++++ openpype/tools/pyblish_pype/window.py | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/openpype/tools/pyblish_pype/control.py b/openpype/tools/pyblish_pype/control.py index 455a338499..d479124be1 100644 --- a/openpype/tools/pyblish_pype/control.py +++ b/openpype/tools/pyblish_pype/control.py @@ -228,6 +228,10 @@ 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"): + comment = self.context.data["comment"] + self.context = pyblish.api.Context() self.context._publish_states = InstanceStates.ContextType @@ -249,6 +253,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..ef9be8093c 100644 --- a/openpype/tools/pyblish_pype/window.py +++ b/openpype/tools/pyblish_pype/window.py @@ -1138,8 +1138,9 @@ class Window(QtWidgets.QDialog): if self.intent_model.has_items: self.intent_box.setCurrentIndex(self.intent_model.default_index) - self.comment_box.placeholder.setVisible(False) - self.comment_box.placeholder.setVisible(True) + if self.comment_box.text(): + self.comment_box.placeholder.setVisible(False) + self.comment_box.placeholder.setVisible(True) # Launch controller reset self.controller.reset()