From 2c7c10a404400903089ab561e85661d2f84fb0bd Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 21 Jun 2022 12:03:31 +0200 Subject: [PATCH 1/3] vray device aspect ratio fix Vray has different attribute name for device aspect ratio from other renderers. (.aspectRatio instead of .deviceAspectRatio) Testing - open/create a maya scene with vray renderer set - run OpenPype -> Set Resolution resolution should be set without an error message about nonexistent vray attribute --- openpype/hosts/maya/api/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index bce03a648b..d5763160bc 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2141,7 +2141,7 @@ def set_scene_resolution(width, height, pixelAspect): cmds.setAttr("%s.height" % control_node, height) deviceAspectRatio = ((float(width) / float(height)) * float(pixelAspect)) - cmds.setAttr("%s.deviceAspectRatio" % control_node, deviceAspectRatio) + cmds.setAttr("%s.aspectRatio" % control_node, deviceAspectRatio) cmds.setAttr("%s.pixelAspect" % control_node, pixelAspect) From 861fbee46c36762f50bffbe9aa00a9a60af30cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Tue, 21 Jun 2022 14:14:39 +0200 Subject: [PATCH 2/3] :ambulance: limit attribute name only to vray --- openpype/hosts/maya/api/lib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index d5763160bc..3e239d5361 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2126,9 +2126,11 @@ def set_scene_resolution(width, height, pixelAspect): control_node = "defaultResolution" current_renderer = cmds.getAttr("defaultRenderGlobals.currentRenderer") + aspect_ration_attr = "deviceAspectRatio" # Give VRay a helping hand as it is slightly different from the rest if current_renderer == "vray": + aspect_ration_attr = "aspectRatio" vray_node = "vraySettings" if cmds.objExists(vray_node): control_node = vray_node @@ -2141,7 +2143,8 @@ def set_scene_resolution(width, height, pixelAspect): cmds.setAttr("%s.height" % control_node, height) deviceAspectRatio = ((float(width) / float(height)) * float(pixelAspect)) - cmds.setAttr("%s.aspectRatio" % control_node, deviceAspectRatio) + cmds.setAttr( + "{}.{}".format(control_node, aspect_ration_attr), deviceAspectRatio) cmds.setAttr("%s.pixelAspect" % control_node, pixelAspect) From 94af9cdcc949ee4b84cb2cedc4d35cec9e47af11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Tue, 21 Jun 2022 14:16:00 +0200 Subject: [PATCH 3/3] :pencil2: fix typo in variable name --- openpype/hosts/maya/api/lib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 3e239d5361..92a3efcd1f 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2126,11 +2126,11 @@ def set_scene_resolution(width, height, pixelAspect): control_node = "defaultResolution" current_renderer = cmds.getAttr("defaultRenderGlobals.currentRenderer") - aspect_ration_attr = "deviceAspectRatio" + aspect_ratio_attr = "deviceAspectRatio" # Give VRay a helping hand as it is slightly different from the rest if current_renderer == "vray": - aspect_ration_attr = "aspectRatio" + aspect_ratio_attr = "aspectRatio" vray_node = "vraySettings" if cmds.objExists(vray_node): control_node = vray_node @@ -2144,7 +2144,7 @@ def set_scene_resolution(width, height, pixelAspect): deviceAspectRatio = ((float(width) / float(height)) * float(pixelAspect)) cmds.setAttr( - "{}.{}".format(control_node, aspect_ration_attr), deviceAspectRatio) + "{}.{}".format(control_node, aspect_ratio_attr), deviceAspectRatio) cmds.setAttr("%s.pixelAspect" % control_node, pixelAspect)