From 32b4fc5f645c638a9d11b3e00a4283a80a865b17 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 4 Oct 2023 16:10:19 +0800 Subject: [PATCH 01/18] add resolution validator for render instance in maya --- .../plugins/publish/validate_resolution.py | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 openpype/hosts/maya/plugins/publish/validate_resolution.py diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py new file mode 100644 index 0000000000..4c350388e2 --- /dev/null +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -0,0 +1,54 @@ +import pyblish.api +from openpype.pipeline import ( + PublishValidationError, + OptionalPyblishPluginMixin +) +from maya import cmds +from openpype.hosts.maya.api.lib import reset_scene_resolution + + +class ValidateResolution(pyblish.api.InstancePlugin, + OptionalPyblishPluginMixin): + """Validate the resolution setting aligned with DB""" + + order = pyblish.api.ValidatorOrder - 0.01 + families = ["renderlayer"] + hosts = ["maya"] + label = "Validate Resolution" + optional = True + + def process(self, instance): + if not self.is_active(instance.data): + return + width, height = self.get_db_resolution(instance) + current_width = cmds.getAttr("defaultResolution.width") + current_height = cmds.getAttr("defaultResolution.height") + if current_width != width and current_height != height: + raise PublishValidationError("Resolution Setting " + "not matching resolution " + "set on asset or shot.") + if current_width != width: + raise PublishValidationError("Width in Resolution Setting " + "not matching resolution set " + "on asset or shot.") + + if current_height != height: + raise PublishValidationError("Height in Resolution Setting " + "not matching resolution set " + "on asset or shot.") + + def get_db_resolution(self, instance): + asset_doc = instance.data["assetEntity"] + project_doc = instance.context.data["projectEntity"] + for data in [asset_doc["data"], project_doc["data"]]: + if "resolutionWidth" in data and "resolutionHeight" in data: + width = data["resolutionWidth"] + height = data["resolutionHeight"] + return int(width), int(height) + + # Defaults if not found in asset document or project document + return 1920, 1080 + + @classmethod + def repair(cls, instance): + return reset_scene_resolution() From 664c27ced2688894ddef217f0fbe423119d68c4d Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 5 Oct 2023 15:21:12 +0800 Subject: [PATCH 02/18] make sure it also validates resolution for vray renderer --- .../plugins/publish/validate_resolution.py | 70 +++++++++++++------ 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 4c350388e2..7b89e9a3e6 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -4,50 +4,76 @@ from openpype.pipeline import ( OptionalPyblishPluginMixin ) from maya import cmds +from openpype.pipeline.publish import RepairAction +from openpype.hosts.maya.api import lib from openpype.hosts.maya.api.lib import reset_scene_resolution -class ValidateResolution(pyblish.api.InstancePlugin, - OptionalPyblishPluginMixin): - """Validate the resolution setting aligned with DB""" +class ValidateSceneResolution(pyblish.api.InstancePlugin, + OptionalPyblishPluginMixin): + """Validate the scene resolution setting aligned with DB""" order = pyblish.api.ValidatorOrder - 0.01 families = ["renderlayer"] hosts = ["maya"] label = "Validate Resolution" + actions = [RepairAction] optional = True def process(self, instance): if not self.is_active(instance.data): return - width, height = self.get_db_resolution(instance) - current_width = cmds.getAttr("defaultResolution.width") - current_height = cmds.getAttr("defaultResolution.height") - if current_width != width and current_height != height: - raise PublishValidationError("Resolution Setting " - "not matching resolution " - "set on asset or shot.") - if current_width != width: - raise PublishValidationError("Width in Resolution Setting " - "not matching resolution set " - "on asset or shot.") - - if current_height != height: - raise PublishValidationError("Height in Resolution Setting " - "not matching resolution set " - "on asset or shot.") + width, height, pixelAspect = self.get_db_resolution(instance) + current_renderer = cmds.getAttr( + "defaultRenderGlobals.currentRenderer") + layer = instance.data["renderlayer"] + if current_renderer == "vray": + vray_node = "vraySettings" + if cmds.objExists(vray_node): + control_node = vray_node + current_width = lib.get_attr_in_layer( + "{}.width".format(control_node), layer=layer) + current_height = lib.get_attr_in_layer( + "{}.height".format(control_node), layer=layer) + current_pixelAspect = lib.get_attr_in_layer( + "{}.pixelAspect".format(control_node), layer=layer + ) + else: + raise PublishValidationError( + "Can't set VRay resolution because there is no node " + "named: `%s`" % vray_node) + else: + current_width = lib.get_attr_in_layer( + "defaultResolution.width", layer=layer) + current_height = lib.get_attr_in_layer( + "defaultResolution.height", layer=layer) + current_pixelAspect = lib.get_attr_in_layer( + "defaultResolution.pixelAspect", layer=layer + ) + if current_width != width or current_height != height: + raise PublishValidationError( + "Render resolution is {}x{} does not match asset resolution is {}x{}".format( + current_width, current_height, width, height + )) + if current_pixelAspect != pixelAspect: + raise PublishValidationError( + "Render pixel aspect is {} does not match asset pixel aspect is {}".format( + current_pixelAspect, pixelAspect + )) def get_db_resolution(self, instance): asset_doc = instance.data["assetEntity"] project_doc = instance.context.data["projectEntity"] for data in [asset_doc["data"], project_doc["data"]]: - if "resolutionWidth" in data and "resolutionHeight" in data: + if "resolutionWidth" in data and "resolutionHeight" in data \ + and "pixelAspect" in data: width = data["resolutionWidth"] height = data["resolutionHeight"] - return int(width), int(height) + pixelAspect = data["pixelAspect"] + return int(width), int(height), int(pixelAspect) # Defaults if not found in asset document or project document - return 1920, 1080 + return 1920, 1080, 1 @classmethod def repair(cls, instance): From c81b0af8390a97fb86befae0aa8a310b8864d716 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 5 Oct 2023 15:24:33 +0800 Subject: [PATCH 03/18] hound --- .../hosts/maya/plugins/publish/validate_resolution.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 7b89e9a3e6..856c2811ea 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -52,12 +52,12 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, ) if current_width != width or current_height != height: raise PublishValidationError( - "Render resolution is {}x{} does not match asset resolution is {}x{}".format( + "Render resolution {}x{} does not match asset resolution {}x{}".format( # noqa:E501 current_width, current_height, width, height )) if current_pixelAspect != pixelAspect: - raise PublishValidationError( - "Render pixel aspect is {} does not match asset pixel aspect is {}".format( + raise PublishValidationError( + "Render pixel aspect {} does not match asset pixel aspect {}".format( # noqa:E501 current_pixelAspect, pixelAspect )) @@ -66,7 +66,7 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, project_doc = instance.context.data["projectEntity"] for data in [asset_doc["data"], project_doc["data"]]: if "resolutionWidth" in data and "resolutionHeight" in data \ - and "pixelAspect" in data: + and "pixelAspect" in data: width = data["resolutionWidth"] height = data["resolutionHeight"] pixelAspect = data["pixelAspect"] From d1f5f6eb4a1bfa5f55907eb0bccb9591855914fb Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 5 Oct 2023 15:28:30 +0800 Subject: [PATCH 04/18] hound --- openpype/hosts/maya/plugins/publish/validate_resolution.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 856c2811ea..578c99e006 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -65,8 +65,9 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, asset_doc = instance.data["assetEntity"] project_doc = instance.context.data["projectEntity"] for data in [asset_doc["data"], project_doc["data"]]: - if "resolutionWidth" in data and "resolutionHeight" in data \ - and "pixelAspect" in data: + if "resolutionWidth" in data and ( + "resolutionHeight" in data and "pixelAspect" in data + ): width = data["resolutionWidth"] height = data["resolutionHeight"] pixelAspect = data["pixelAspect"] From 69c8d1985b58b2e5151cb00ec102f81c26d9d93b Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 19:46:49 +0800 Subject: [PATCH 05/18] tweaks on the validation report & repair action --- .../plugins/publish/validate_resolution.py | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 578c99e006..b1752aa4bd 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -11,7 +11,7 @@ from openpype.hosts.maya.api.lib import reset_scene_resolution class ValidateSceneResolution(pyblish.api.InstancePlugin, OptionalPyblishPluginMixin): - """Validate the scene resolution setting aligned with DB""" + """Validate the render resolution setting aligned with DB""" order = pyblish.api.ValidatorOrder - 0.01 families = ["renderlayer"] @@ -23,25 +23,34 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, def process(self, instance): if not self.is_active(instance.data): return + invalid = self.get_invalid_resolution(instance) + if invalid: + raise PublishValidationError("issues occurred", description=( + "Wrong render resolution setting. Please use repair button to fix it.\n" + "If current renderer is vray, make sure vraySettings node has been created" + )) + + def get_invalid_resolution(self, instance): width, height, pixelAspect = self.get_db_resolution(instance) current_renderer = cmds.getAttr( "defaultRenderGlobals.currentRenderer") layer = instance.data["renderlayer"] + invalids = [] if current_renderer == "vray": vray_node = "vraySettings" if cmds.objExists(vray_node): - control_node = vray_node current_width = lib.get_attr_in_layer( - "{}.width".format(control_node), layer=layer) + "{}.width".format(vray_node), layer=layer) current_height = lib.get_attr_in_layer( - "{}.height".format(control_node), layer=layer) + "{}.height".format(vray_node), layer=layer) current_pixelAspect = lib.get_attr_in_layer( - "{}.pixelAspect".format(control_node), layer=layer + "{}.pixelAspect".format(vray_node), layer=layer ) else: - raise PublishValidationError( - "Can't set VRay resolution because there is no node " - "named: `%s`" % vray_node) + invalid = self.log.error( + "Can't detect VRay resolution because there is no node " + "named: `{}`".format(vray_node)) + invalids.append(invalid) else: current_width = lib.get_attr_in_layer( "defaultResolution.width", layer=layer) @@ -51,15 +60,18 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, "defaultResolution.pixelAspect", layer=layer ) if current_width != width or current_height != height: - raise PublishValidationError( + invalid = self.log.error( "Render resolution {}x{} does not match asset resolution {}x{}".format( # noqa:E501 current_width, current_height, width, height )) + invalids.append("{0}\n".format(invalid)) if current_pixelAspect != pixelAspect: - raise PublishValidationError( + invalid = self.log.error( "Render pixel aspect {} does not match asset pixel aspect {}".format( # noqa:E501 current_pixelAspect, pixelAspect )) + invalids.append("{0}\n".format(invalid)) + return invalids def get_db_resolution(self, instance): asset_doc = instance.data["assetEntity"] @@ -71,11 +83,13 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, width = data["resolutionWidth"] height = data["resolutionHeight"] pixelAspect = data["pixelAspect"] - return int(width), int(height), int(pixelAspect) + return int(width), int(height), float(pixelAspect) # Defaults if not found in asset document or project document - return 1920, 1080, 1 + return 1920, 1080, 1.0 @classmethod def repair(cls, instance): - return reset_scene_resolution() + layer = instance.data["renderlayer"] + with lib.renderlayer(layer): + reset_scene_resolution() From 8d7664420fdabdf3fed6f0f572d627f12ac29551 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 19:50:33 +0800 Subject: [PATCH 06/18] hound --- .../maya/plugins/publish/validate_resolution.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index b1752aa4bd..8e761d8958 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -25,9 +25,12 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, return invalid = self.get_invalid_resolution(instance) if invalid: - raise PublishValidationError("issues occurred", description=( - "Wrong render resolution setting. Please use repair button to fix it.\n" - "If current renderer is vray, make sure vraySettings node has been created" + raise PublishValidationError( + "issues occurred", description=( + "Wrong render resolution setting. " + "Please use repair button to fix it.\n" + "If current renderer is V-Ray, " + "make sure vraySettings node has been created" )) def get_invalid_resolution(self, instance): @@ -62,7 +65,8 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, if current_width != width or current_height != height: invalid = self.log.error( "Render resolution {}x{} does not match asset resolution {}x{}".format( # noqa:E501 - current_width, current_height, width, height + current_width, current_height, + width, height )) invalids.append("{0}\n".format(invalid)) if current_pixelAspect != pixelAspect: From 8fc0c3b81f1e8bfa786e0fa9f71c6da5c9bc57e7 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 19:54:15 +0800 Subject: [PATCH 07/18] hound --- .../maya/plugins/publish/validate_resolution.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 8e761d8958..f00b2329ed 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -27,10 +27,10 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, if invalid: raise PublishValidationError( "issues occurred", description=( - "Wrong render resolution setting. " - "Please use repair button to fix it.\n" - "If current renderer is V-Ray, " - "make sure vraySettings node has been created" + "Wrong render resolution setting. " + "Please use repair button to fix it.\n" + "If current renderer is V-Ray, " + "make sure vraySettings node has been created" )) def get_invalid_resolution(self, instance): @@ -52,7 +52,8 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, else: invalid = self.log.error( "Can't detect VRay resolution because there is no node " - "named: `{}`".format(vray_node)) + "named: `{}`".format(vray_node) + ) invalids.append(invalid) else: current_width = lib.get_attr_in_layer( @@ -63,12 +64,12 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, "defaultResolution.pixelAspect", layer=layer ) if current_width != width or current_height != height: - invalid = self.log.error( + invalid = self.log.error( "Render resolution {}x{} does not match asset resolution {}x{}".format( # noqa:E501 current_width, current_height, width, height )) - invalids.append("{0}\n".format(invalid)) + invalids.append("{0}\n".format(invalid)) if current_pixelAspect != pixelAspect: invalid = self.log.error( "Render pixel aspect {} does not match asset pixel aspect {}".format( # noqa:E501 From 145716211d6c04fea0d0eb3c422b07c2d3edd300 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 19:55:32 +0800 Subject: [PATCH 08/18] hound --- .../hosts/maya/plugins/publish/validate_resolution.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index f00b2329ed..c920be4602 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -27,10 +27,10 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, if invalid: raise PublishValidationError( "issues occurred", description=( - "Wrong render resolution setting. " - "Please use repair button to fix it.\n" - "If current renderer is V-Ray, " - "make sure vraySettings node has been created" + "Wrong render resolution setting. " + "Please use repair button to fix it.\n" + "If current renderer is V-Ray, " + "make sure vraySettings node has been created" )) def get_invalid_resolution(self, instance): From 4dc4d665b05c77aa2bc69a517aae0389522bc4b4 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 19:56:34 +0800 Subject: [PATCH 09/18] hound --- openpype/hosts/maya/plugins/publish/validate_resolution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index c920be4602..237a0fa186 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -31,7 +31,7 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, "Please use repair button to fix it.\n" "If current renderer is V-Ray, " "make sure vraySettings node has been created" - )) + )) def get_invalid_resolution(self, instance): width, height, pixelAspect = self.get_db_resolution(instance) From 91d41c86c5310d5239ce5638dcb01c1c66b600b9 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 19:57:35 +0800 Subject: [PATCH 10/18] hound --- openpype/hosts/maya/plugins/publish/validate_resolution.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 237a0fa186..fadb41302c 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -30,8 +30,7 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, "Wrong render resolution setting. " "Please use repair button to fix it.\n" "If current renderer is V-Ray, " - "make sure vraySettings node has been created" - )) + "make sure vraySettings node has been created")) def get_invalid_resolution(self, instance): width, height, pixelAspect = self.get_db_resolution(instance) From 5262c0c7acab605ccecbd13357e58b8666d0f2f9 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 20:29:56 +0800 Subject: [PATCH 11/18] tweaks on get_invalid_resolution --- .../plugins/publish/validate_resolution.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index fadb41302c..38deca9ecf 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -34,10 +34,9 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, def get_invalid_resolution(self, instance): width, height, pixelAspect = self.get_db_resolution(instance) - current_renderer = cmds.getAttr( - "defaultRenderGlobals.currentRenderer") + current_renderer = instance.data["renderer"] layer = instance.data["renderlayer"] - invalids = [] + invalid = False if current_renderer == "vray": vray_node = "vraySettings" if cmds.objExists(vray_node): @@ -49,11 +48,11 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, "{}.pixelAspect".format(vray_node), layer=layer ) else: - invalid = self.log.error( + self.log.error( "Can't detect VRay resolution because there is no node " "named: `{}`".format(vray_node) ) - invalids.append(invalid) + invalid = True else: current_width = lib.get_attr_in_layer( "defaultResolution.width", layer=layer) @@ -63,19 +62,21 @@ class ValidateSceneResolution(pyblish.api.InstancePlugin, "defaultResolution.pixelAspect", layer=layer ) if current_width != width or current_height != height: - invalid = self.log.error( - "Render resolution {}x{} does not match asset resolution {}x{}".format( # noqa:E501 + self.log.error( + "Render resolution {}x{} does not match " + "asset resolution {}x{}".format( current_width, current_height, width, height )) - invalids.append("{0}\n".format(invalid)) + invalid = True if current_pixelAspect != pixelAspect: - invalid = self.log.error( - "Render pixel aspect {} does not match asset pixel aspect {}".format( # noqa:E501 + self.log.error( + "Render pixel aspect {} does not match " + "asset pixel aspect {}".format( current_pixelAspect, pixelAspect )) - invalids.append("{0}\n".format(invalid)) - return invalids + invalid = True + return invalid def get_db_resolution(self, instance): asset_doc = instance.data["assetEntity"] From b4c0f2880a32f5e9e7a56597307894bbe63f24c0 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 20:35:38 +0800 Subject: [PATCH 12/18] add validate resolution as parts of maya settings --- .../deadline/plugins/publish/submit_publish_job.py | 2 +- openpype/settings/defaults/project_settings/maya.json | 5 +++++ .../projects_schema/schemas/schema_maya_publish.json | 4 ++++ server_addon/maya/server/settings/publishers.py | 9 +++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_publish_job.py b/openpype/modules/deadline/plugins/publish/submit_publish_job.py index 6ed5819f2b..57ce8c438f 100644 --- a/openpype/modules/deadline/plugins/publish/submit_publish_job.py +++ b/openpype/modules/deadline/plugins/publish/submit_publish_job.py @@ -321,7 +321,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin, self.log.debug("Submitting Deadline publish job ...") url = "{}/api/jobs".format(self.deadline_url) - response = requests.post(url, json=payload, timeout=10) + response = requests.post(url, json=payload, timeout=10, verify=False) if not response.ok: raise Exception(response.text) diff --git a/openpype/settings/defaults/project_settings/maya.json b/openpype/settings/defaults/project_settings/maya.json index 300d63985b..7719a5e255 100644 --- a/openpype/settings/defaults/project_settings/maya.json +++ b/openpype/settings/defaults/project_settings/maya.json @@ -829,6 +829,11 @@ "redshift_render_attributes": [], "renderman_render_attributes": [] }, + "ValidateResolution": { + "enabled": true, + "optional": true, + "active": true + }, "ValidateCurrentRenderLayerIsRenderable": { "enabled": true, "optional": false, diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json index 8a0815c185..d2e7c51e24 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json @@ -431,6 +431,10 @@ "type": "schema_template", "name": "template_publish_plugin", "template_data": [ + { + "key": "ValidateResolution", + "label": "Validate Resolution Settings" + }, { "key": "ValidateCurrentRenderLayerIsRenderable", "label": "Validate Current Render Layer Has Renderable Camera" diff --git a/server_addon/maya/server/settings/publishers.py b/server_addon/maya/server/settings/publishers.py index 6c5baa3900..dd8d4a0a37 100644 --- a/server_addon/maya/server/settings/publishers.py +++ b/server_addon/maya/server/settings/publishers.py @@ -433,6 +433,10 @@ class PublishersModel(BaseSettingsModel): default_factory=ValidateRenderSettingsModel, title="Validate Render Settings" ) + ValidateResolution: BasicValidateModel = Field( + default_factory=BasicValidateModel, + title="Validate Resolution Setting" + ) ValidateCurrentRenderLayerIsRenderable: BasicValidateModel = Field( default_factory=BasicValidateModel, title="Validate Current Render Layer Has Renderable Camera" @@ -902,6 +906,11 @@ DEFAULT_PUBLISH_SETTINGS = { "redshift_render_attributes": [], "renderman_render_attributes": [] }, + "ValidateResolution": { + "enabled": True, + "optional": True, + "active": True + }, "ValidateCurrentRenderLayerIsRenderable": { "enabled": True, "optional": False, From 13c9aec4a7b8a58e4f03bd6fa20462c051aaaf3c Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 20:59:40 +0800 Subject: [PATCH 13/18] Rename ValidateSceneResolution to ValidateResolution --- openpype/hosts/maya/plugins/publish/validate_resolution.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 38deca9ecf..66962afce5 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -9,8 +9,8 @@ from openpype.hosts.maya.api import lib from openpype.hosts.maya.api.lib import reset_scene_resolution -class ValidateSceneResolution(pyblish.api.InstancePlugin, - OptionalPyblishPluginMixin): +class ValidateResolution(pyblish.api.InstancePlugin, + OptionalPyblishPluginMixin): """Validate the render resolution setting aligned with DB""" order = pyblish.api.ValidatorOrder - 0.01 From 64b03447f128b3b564441050edfed23bf2926cd5 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 21:01:46 +0800 Subject: [PATCH 14/18] restore unrelated code --- openpype/modules/deadline/plugins/publish/submit_publish_job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_publish_job.py b/openpype/modules/deadline/plugins/publish/submit_publish_job.py index 57ce8c438f..6ed5819f2b 100644 --- a/openpype/modules/deadline/plugins/publish/submit_publish_job.py +++ b/openpype/modules/deadline/plugins/publish/submit_publish_job.py @@ -321,7 +321,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin, self.log.debug("Submitting Deadline publish job ...") url = "{}/api/jobs".format(self.deadline_url) - response = requests.post(url, json=payload, timeout=10, verify=False) + response = requests.post(url, json=payload, timeout=10) if not response.ok: raise Exception(response.text) From dd46d48ffc1fcec9116d27b4aa7ce437db5e3ac2 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 22:50:16 +0800 Subject: [PATCH 15/18] upversion for maya server addon & fix on repair action in validate resolution --- .../plugins/publish/validate_resolution.py | 46 +++++++++++++------ server_addon/maya/server/version.py | 2 +- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 66962afce5..092860164f 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -13,7 +13,7 @@ class ValidateResolution(pyblish.api.InstancePlugin, OptionalPyblishPluginMixin): """Validate the render resolution setting aligned with DB""" - order = pyblish.api.ValidatorOrder - 0.01 + order = pyblish.api.ValidatorOrder families = ["renderlayer"] hosts = ["maya"] label = "Validate Resolution" @@ -26,14 +26,17 @@ class ValidateResolution(pyblish.api.InstancePlugin, invalid = self.get_invalid_resolution(instance) if invalid: raise PublishValidationError( - "issues occurred", description=( + "Render resolution is invalid. See log for details.", + description=( "Wrong render resolution setting. " "Please use repair button to fix it.\n" "If current renderer is V-Ray, " - "make sure vraySettings node has been created")) - - def get_invalid_resolution(self, instance): - width, height, pixelAspect = self.get_db_resolution(instance) + "make sure vraySettings node has been created" + ) + ) + @classmethod + def get_invalid_resolution(cls, instance): + width, height, pixelAspect = cls.get_db_resolution(instance) current_renderer = instance.data["renderer"] layer = instance.data["renderlayer"] invalid = False @@ -48,11 +51,11 @@ class ValidateResolution(pyblish.api.InstancePlugin, "{}.pixelAspect".format(vray_node), layer=layer ) else: - self.log.error( + cls.log.error( "Can't detect VRay resolution because there is no node " "named: `{}`".format(vray_node) ) - invalid = True + return True else: current_width = lib.get_attr_in_layer( "defaultResolution.width", layer=layer) @@ -62,7 +65,7 @@ class ValidateResolution(pyblish.api.InstancePlugin, "defaultResolution.pixelAspect", layer=layer ) if current_width != width or current_height != height: - self.log.error( + cls.log.error( "Render resolution {}x{} does not match " "asset resolution {}x{}".format( current_width, current_height, @@ -70,7 +73,7 @@ class ValidateResolution(pyblish.api.InstancePlugin, )) invalid = True if current_pixelAspect != pixelAspect: - self.log.error( + cls.log.error( "Render pixel aspect {} does not match " "asset pixel aspect {}".format( current_pixelAspect, pixelAspect @@ -78,12 +81,15 @@ class ValidateResolution(pyblish.api.InstancePlugin, invalid = True return invalid - def get_db_resolution(self, instance): + @classmethod + def get_db_resolution(cls, instance): asset_doc = instance.data["assetEntity"] project_doc = instance.context.data["projectEntity"] for data in [asset_doc["data"], project_doc["data"]]: - if "resolutionWidth" in data and ( - "resolutionHeight" in data and "pixelAspect" in data + if ( + "resolutionWidth" in data and + "resolutionHeight" in data and + "pixelAspect" in data ): width = data["resolutionWidth"] height = data["resolutionHeight"] @@ -95,6 +101,16 @@ class ValidateResolution(pyblish.api.InstancePlugin, @classmethod def repair(cls, instance): - layer = instance.data["renderlayer"] - with lib.renderlayer(layer): + # Usually without renderlayer overrides the renderlayers + # all share the same resolution value - so fixing the first + # will have fixed all the others too. It's much faster to + # check whether it's invalid first instead of switching + # into all layers individually + if not cls.get_invalid_resolution(instance): + cls.log.debug( + "Nothing to repair on instance: {}".format(instance) + ) + return + layer_node = instance.data['setMembers'] + with lib.renderlayer(layer_node): reset_scene_resolution() diff --git a/server_addon/maya/server/version.py b/server_addon/maya/server/version.py index de699158fd..90ce344d3e 100644 --- a/server_addon/maya/server/version.py +++ b/server_addon/maya/server/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring addon version.""" -__version__ = "0.1.4" +__version__ = "0.1.5" From 1d531b1ad5c94e4843c0d245fd61fa8372473ee1 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 6 Oct 2023 22:54:16 +0800 Subject: [PATCH 16/18] hound --- openpype/hosts/maya/plugins/publish/validate_resolution.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 092860164f..b214f87906 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -34,6 +34,7 @@ class ValidateResolution(pyblish.api.InstancePlugin, "make sure vraySettings node has been created" ) ) + @classmethod def get_invalid_resolution(cls, instance): width, height, pixelAspect = cls.get_db_resolution(instance) From 548ca106ad6ab8021f1c326ac375dd1dc42a3482 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 9 Oct 2023 17:14:21 +0800 Subject: [PATCH 17/18] paragraph tweaks on description for validator --- openpype/hosts/maya/plugins/publish/validate_resolution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index b214f87906..4c3fbcddf0 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -29,7 +29,7 @@ class ValidateResolution(pyblish.api.InstancePlugin, "Render resolution is invalid. See log for details.", description=( "Wrong render resolution setting. " - "Please use repair button to fix it.\n" + "Please use repair button to fix it.\n\n" "If current renderer is V-Ray, " "make sure vraySettings node has been created" ) From 60834f6997247823c2d1d0463809207cb39cffed Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 9 Oct 2023 17:18:34 +0800 Subject: [PATCH 18/18] hound --- openpype/hosts/maya/plugins/publish/validate_resolution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_resolution.py b/openpype/hosts/maya/plugins/publish/validate_resolution.py index 4c3fbcddf0..91b473b250 100644 --- a/openpype/hosts/maya/plugins/publish/validate_resolution.py +++ b/openpype/hosts/maya/plugins/publish/validate_resolution.py @@ -31,7 +31,7 @@ class ValidateResolution(pyblish.api.InstancePlugin, "Wrong render resolution setting. " "Please use repair button to fix it.\n\n" "If current renderer is V-Ray, " - "make sure vraySettings node has been created" + "make sure vraySettings node has been created." ) )