From a0e5f7d899249e38976e24c19c76bd4c6a79d0ed Mon Sep 17 00:00:00 2001 From: BenoitConnan Date: Mon, 28 Feb 2022 15:39:50 +0100 Subject: [PATCH] Squashed commits of pyblish-gui-sanity-mode: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit bf31458faf550ee5a8074c549ce2875dbb303f07 Author: Jérôme LORRAIN Date: Fri Oct 8 10:50:44 2021 +0200 change button name and add tooltip commit da42cbffdfaeb9b54e5985a758590ae5182cd3a1 Author: Jérôme LORRAIN Date: Thu Oct 7 17:35:17 2021 +0200 Fix syntax for linter commit fc4f98b9bc413563a72362fc581c0838de7dc7cb Author: Jérôme LORRAIN Date: Thu Oct 7 16:54:52 2021 +0200 Implement sanity mode to pyblish openpype GUI commit 6f792511a47cee78fd89d0675369ec0da02c7b3c Merge: ecae9f623 646875117 Author: Petr Kalis Date: Mon Feb 7 10:05:55 2022 +0100 Merge pull request #2634 from Ellipsanime/fix-photoshop-environement-workfiles-on-launch Fix open workfile on launch in photoshop commit ecae9f6238c887e0abfeb7a27aaca468d9357b69 Merge: 4b3834ea5 3160199b0 Author: Milan Kolar Date: Mon Feb 7 09:52:39 2022 +0100 Merge pull request #2556 from pypeclub/feature/OP-2429_Publisher-Preparations-before-standalone-publisher commit 4b3834ea50de824dcdb653d5c4bad1afa797c48c Merge: ccea53538 604a590fe Author: pypebot <82967070+pypebot@users.noreply.github.com> Date: Mon Feb 7 09:38:20 2022 +0100 [Automated] Merged release main into develop commit ccea535384555e2eca0730da8d5a4f7a448d8aeb Merge: f2a954371 a11700e1e Author: pypebot <82967070+pypebot@users.noreply.github.com> Date: Sat Feb 5 04:34:51 2022 +0100 [Automated] Merged main into develop commit 6468751179d2fa1002efa5927acaf04549bb8d6e Author: clement.hector Date: Fri Feb 4 12:11:05 2022 +0100 use env_value_to_bool instead of ast.literal_eval + os.getenv commit fe46093ada0494b745b1e8e7263bd9489dd665bd Author: clement.hector Date: Wed Feb 2 19:36:49 2022 +0100 fix test on string to boolean commit 3160199b044d63ffbc4b4d8bb3c7a852578dd355 Author: Jakub Trllo Date: Tue Jan 25 14:15:19 2022 +0100 fix grammar commit d7393646a3a084e3502dec720abbf51aba1385ac Author: Jakub Trllo Date: Tue Jan 25 13:48:18 2022 +0100 handle default value of 'is_label_horizontal' commit 7ec4d501802135fd725e5f37682bc351ca38483f Author: Jakub Trllo Date: Tue Jan 25 13:48:03 2022 +0100 precreate widget is separated from create dialog completely commit f8be5763b57af0e94b85af74ae95ba1579578349 Author: iLLiCiTiT Date: Tue Jan 18 18:05:32 2022 +0100 renamed method 'get_attribute_defs' to 'get_instance_attr_defs' commit 20f5e8fc1b2263882adec624e1b961a0308a3fda Author: iLLiCiTiT Date: Tue Jan 18 17:51:25 2022 +0100 hound fixes commit 95176b6e345e8d70a6e24c78e9bd052382b35481 Author: iLLiCiTiT Date: Tue Jan 18 17:26:16 2022 +0100 modified example creator commit 23c3bc8d0a31875da642aee0ea1298ee34e73831 Author: iLLiCiTiT Date: Tue Jan 18 17:26:09 2022 +0100 style changes of header view nad checkbox commit 2d7521289a088e4bf3f15f573be42b78ee1dd81c Author: iLLiCiTiT Date: Tue Jan 18 17:25:51 2022 +0100 ui attribute definitions are skipped for storing data commit f0b7f72325ff51a9f7cf4681c2fa81c44562d18c Author: iLLiCiTiT Date: Tue Jan 18 17:25:34 2022 +0100 creator dialog has context widget and creator's attributes commit 9c6a57aa587fe7577d9214e55311029d36e34039 Author: iLLiCiTiT Date: Tue Jan 18 17:23:37 2022 +0100 creator can define precreate attribute definitions and allowing context change commit 3878c5262a5293ed250c85a15be6aa5531da1da2 Author: iLLiCiTiT Date: Tue Jan 18 17:22:57 2022 +0100 added widgett for pre create attributes commit fffdef5030f74cb0c0428cfb657234465d2d3a09 Author: iLLiCiTiT Date: Tue Jan 18 17:22:41 2022 +0100 added publisher specific asset and task widgets commit fbdd1d8ab5cc43c5bf00ff6122e68c5aaac5f739 Author: iLLiCiTiT Date: Tue Jan 18 17:22:08 2022 +0100 moved few widgets to tools/utils and modified asset/task widgets to easily change source model commit 396bdfde8a05d37be283f4ba411debc500ee4328 Author: iLLiCiTiT Date: Tue Jan 18 17:16:32 2022 +0100 added few new attribute definitions and their widgets --- openpype/tools/pyblish_pype/control.py | 27 +++++++++++++++++++++ openpype/tools/pyblish_pype/window.py | 33 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/openpype/tools/pyblish_pype/control.py b/openpype/tools/pyblish_pype/control.py index 64a7f193b45..d47ecd53c1c 100644 --- a/openpype/tools/pyblish_pype/control.py +++ b/openpype/tools/pyblish_pype/control.py @@ -99,6 +99,9 @@ def _stop_if_empty(self): class Controller(QtCore.QObject): log = logging.getLogger("PyblishController") + + sanity_mode = False + last_active_plugin = {} # Emitted when the GUI is about to start processing; # e.g. resetting, validating or publishing. about_to_process = QtCore.Signal(object, object) @@ -136,6 +139,10 @@ class Controller(QtCore.QObject): def __init__(self, parent=None): super(Controller, self).__init__(parent) + + if os.getenv("PYBLISH_SANITY_MODE", "") == "true": + self.sanity_mode = True + self.context = None self.plugins = {} self.optional_default = {} @@ -239,6 +246,8 @@ def reset_context(self): def reset(self): """Discover plug-ins and run collection.""" + self.last_active_plugin = {x.__name__: x.active for x in self.plugins} + self._main_thread_processor.clear() self._main_thread_processor.process(self._reset) self._main_thread_processor.start() @@ -277,9 +286,27 @@ def load_plugins(self): and not getattr(plugin, "active", True) ): continue + + if self.sanity_mode: + order = getattr(plugin, "order", 100) + if order >= pyblish.api.ExtractorOrder - 0.5: + continue + elif order >= pyblish.api.ValidatorOrder - 0.5: + plugin.optional = True + plugin.active = False + if self.last_active_plugin.get(plugin.__name__, False): + plugin.active = True + _plugins.append(plugin) self.plugins = _plugins + def deactivate_validator_plugins(self): + for plugin in self.plugins: + if getattr(plugin, "order", 100) >= \ + pyblish.api.ValidatorOrder - 0.5: + plugin.active = False + + def on_published(self): if self.is_running: self.is_running = False diff --git a/openpype/tools/pyblish_pype/window.py b/openpype/tools/pyblish_pype/window.py index edcf6f53b6b..83e50bfff07 100644 --- a/openpype/tools/pyblish_pype/window.py +++ b/openpype/tools/pyblish_pype/window.py @@ -119,6 +119,13 @@ def __init__(self, controller, parent=None): presets_button = widgets.ButtonWithMenu(awesome["filter"]) presets_button.setEnabled(False) + + self.change_mode_btn = QtWidgets.QPushButton() + if self.controller.sanity_mode: + self.set_publish_mode_btn() + else: + self.set_validation_mode_btn() + aditional_btns_layout.addWidget(self.change_mode_btn) aditional_btns_layout.addWidget(presets_button) layout_tab = QtWidgets.QHBoxLayout(header_tab_widget) @@ -435,6 +442,7 @@ def __init__(self, controller, parent=None): footer_button_reset.clicked.connect(self.on_reset_clicked) footer_button_validate.clicked.connect(self.on_validate_clicked) footer_button_play.clicked.connect(self.on_play_clicked) + self.change_mode_btn.clicked.connect(self.on_change_mode_clicked) comment_box.textChanged.connect(self.on_comment_entered) comment_box.returnPressed.connect(self.on_play_clicked) @@ -873,6 +881,12 @@ def on_stop_clicked(self): def on_suspend_clicked(self, value=None): self.apply_log_suspend_value(not self._suspend_logs) + def on_change_mode_clicked(self): + if self.controller.sanity_mode: + self.change_to_classic_mode() + else: + self.change_to_sanity_mode() + def apply_log_suspend_value(self, value): self._suspend_logs = value if self.state["current_page"] == "terminal": @@ -1126,6 +1140,25 @@ def on_was_processed(self, result): # # ------------------------------------------------------------------------- + def set_validation_mode_btn(self): + self.change_mode_btn.setText("V") + self.change_mode_btn.setToolTip("Switch to Validation mode.") + + def set_publish_mode_btn(self): + self.change_mode_btn.setText("P") + self.change_mode_btn.setToolTip("Switch to Publish mode.") + + def change_to_sanity_mode(self): + self.set_publish_mode_btn() + self.controller.sanity_mode = True + self.controller.deactivate_validator_plugins() + self.reset() + + def change_to_classic_mode(self): + self.set_validation_mode_btn() + self.controller.sanity_mode = False + self.reset() + def reset(self): """Prepare GUI for reset""" self.info(self.tr("About to reset.."))