From bdbdaf53a6438d3bf6bb9a052b12898b3677d84e Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Tue, 23 Nov 2021 13:56:58 +0100 Subject: [PATCH] fix plugin order and op autodetection --- .../publish/collect_default_rr_path.py | 2 +- .../publish/collect_rr_path_from_instance.py | 6 ++-- .../perjob/m50__openpype_publish_render.py | 29 +++++++++---------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/openpype/modules/default_modules/royal_render/plugins/publish/collect_default_rr_path.py b/openpype/modules/default_modules/royal_render/plugins/publish/collect_default_rr_path.py index cdca03bef0..3ce95e0c50 100644 --- a/openpype/modules/default_modules/royal_render/plugins/publish/collect_default_rr_path.py +++ b/openpype/modules/default_modules/royal_render/plugins/publish/collect_default_rr_path.py @@ -6,7 +6,7 @@ import pyblish.api class CollectDefaultRRPath(pyblish.api.ContextPlugin): """Collect default Royal Render path.""" - order = pyblish.api.CollectorOrder + 0.01 + order = pyblish.api.CollectorOrder label = "Default Royal Render Path" def process(self, context): diff --git a/openpype/modules/default_modules/royal_render/plugins/publish/collect_rr_path_from_instance.py b/openpype/modules/default_modules/royal_render/plugins/publish/collect_rr_path_from_instance.py index fb27a76d11..6a3dc276f3 100644 --- a/openpype/modules/default_modules/royal_render/plugins/publish/collect_rr_path_from_instance.py +++ b/openpype/modules/default_modules/royal_render/plugins/publish/collect_rr_path_from_instance.py @@ -5,7 +5,7 @@ import pyblish.api class CollectRRPathFromInstance(pyblish.api.InstancePlugin): """Collect RR Path from instance.""" - order = pyblish.api.CollectorOrder + order = pyblish.api.CollectorOrder + 0.01 label = "Royal Render Path from the Instance" families = ["rendering"] @@ -38,8 +38,8 @@ class CollectRRPathFromInstance(pyblish.api.InstancePlugin): if k in default_servers } - except AttributeError: - # Handle situation were we had only one url for deadline. + except (AttributeError, KeyError): + # Handle situation were we had only one url for royal render. return render_instance.context.data["defaultRRPath"] return rr_servers[ diff --git a/openpype/modules/default_modules/royal_render/rr_root/plugins/control_job/perjob/m50__openpype_publish_render.py b/openpype/modules/default_modules/royal_render/rr_root/plugins/control_job/perjob/m50__openpype_publish_render.py index 290f26a44a..7fedb51410 100644 --- a/openpype/modules/default_modules/royal_render/rr_root/plugins/control_job/perjob/m50__openpype_publish_render.py +++ b/openpype/modules/default_modules/royal_render/rr_root/plugins/control_job/perjob/m50__openpype_publish_render.py @@ -38,28 +38,20 @@ class OpenPypeContextSelector: os.environ.get("PROGRAMFILES"), "OpenPype", "openpype_console.exe" ) - if os.path.exists(op_path): - print(" - found OpenPype installation {}".format(op_path)) - else: + if not os.path.exists(op_path): # try to find in user local context op_path = os.path.join( os.environ.get("LOCALAPPDATA"), "Programs", "OpenPype", "openpype_console.exe" ) - if os.path.exists(op_path): - print( - " - found OpenPype installation {}".format( - op_path)) - else: + if not os.path.exists(op_path): raise Exception("Error: OpenPype was not found.") - self.openpype_root = op_path + op_path = os.path.dirname(op_path) + print(" - found OpenPype installation {}".format(op_path)) - # TODO: this should try to find metadata file. Either using - # jobs custom attributes or using environment variable - # or just using plain existence of file. - # self.context = self._process_metadata_file() + self.openpype_root = op_path def _process_metadata_file(self): """Find and process metadata file. @@ -86,8 +78,8 @@ class OpenPypeContextSelector: automatically, no UI will be show and publishing will directly proceed. """ - if not self.context: - self.show() + if not self.context and not self.show(): + return self.context["user"] = self.job.userName self.run_publish() @@ -120,10 +112,15 @@ class OpenPypeContextSelector: not self.context.get("asset") or \ not self.context.get("task"): self._show_rr_warning("Context selection failed.") - return + return False # self.context["app_name"] = self.job.renderer.name + # there should be mapping between OpenPype and Royal Render + # app names and versions, but since app_name is not used + # currently down the line (but it is required by OP publish command + # right now). self.context["app_name"] = "maya/2020" + return True @staticmethod def _show_rr_warning(text):