From c3649e0a571048cb0660656ce9dcf10176399b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Thu, 14 Jul 2022 16:31:32 +0200 Subject: [PATCH 1/3] :bug: fix rfm api context for getting displays and multipart flag --- openpype/hosts/maya/api/lib_renderproducts.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/maya/api/lib_renderproducts.py b/openpype/hosts/maya/api/lib_renderproducts.py index 2d3bda5245..a8337ccf4d 100644 --- a/openpype/hosts/maya/api/lib_renderproducts.py +++ b/openpype/hosts/maya/api/lib_renderproducts.py @@ -1087,7 +1087,7 @@ class RenderProductsRenderman(ARenderProducts): "d_tiff": "tif" } - displays = get_displays()["displays"] + displays = get_displays(override_dst="render")["displays"] for name, display in displays.items(): enabled = display["params"]["enable"]["value"] if not enabled: @@ -1106,9 +1106,16 @@ class RenderProductsRenderman(ARenderProducts): display["driverNode"]["type"], "exr") for camera in cameras: - product = RenderProduct(productName=aov_name, - ext=extensions, - camera=camera) + # Create render product and set it as multipart only on + # display types supporting it. In all other cases, Renderman + # will create separate output per channel. + product = RenderProduct( + productName=aov_name, + ext=extensions, + camera=camera, + multipart=display["driverNode"]["type"] in ["d_openexr", "d_deepexr", "d_tiff"] # noqa + ) + products.append(product) return products From fbd239299f70105486db3276c218adfcccdf1e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Thu, 14 Jul 2022 17:00:26 +0200 Subject: [PATCH 2/3] :recycle: comment on non-multipart code and raise exception --- openpype/hosts/maya/api/lib_renderproducts.py | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/maya/api/lib_renderproducts.py b/openpype/hosts/maya/api/lib_renderproducts.py index a8337ccf4d..0bc8682290 100644 --- a/openpype/hosts/maya/api/lib_renderproducts.py +++ b/openpype/hosts/maya/api/lib_renderproducts.py @@ -1109,12 +1109,28 @@ class RenderProductsRenderman(ARenderProducts): # Create render product and set it as multipart only on # display types supporting it. In all other cases, Renderman # will create separate output per channel. - product = RenderProduct( - productName=aov_name, - ext=extensions, - camera=camera, - multipart=display["driverNode"]["type"] in ["d_openexr", "d_deepexr", "d_tiff"] # noqa - ) + if display["driverNode"]["type"] in ["d_openexr", "d_deepexr", "d_tiff"]: # noqa + product = RenderProduct( + productName=aov_name, + ext=extensions, + camera=camera, + multipart=True + ) + else: + # this code should handle the case where no multipart + # capable format is selected. But since it involves + # shady logic to determine what channel become what + # lets not do that as all productions will use exr anyway. + """ + for channel in display['params']['displayChannels']['value']: # noqa + product = RenderProduct( + productName="{}_{}".format(aov_name, channel), + ext=extensions, + camera=camera, + multipart=False + ) + """ + raise UnsupportedImageFormatException("Only exr, deep exr and tiff formats are supported.") products.append(product) @@ -1208,3 +1224,7 @@ class UnsupportedRendererException(Exception): Raised when requesting data from unsupported renderer. """ + + +class UnsupportedImageFormatException(Exception): + """Custom exception to report unsupported output image format.""" From ef5b571ea6dbfae4df12a18f8412a4e90a88cf1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Thu, 14 Jul 2022 17:17:25 +0200 Subject: [PATCH 3/3] :dog: hound fix --- openpype/hosts/maya/api/lib_renderproducts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/maya/api/lib_renderproducts.py b/openpype/hosts/maya/api/lib_renderproducts.py index 0bc8682290..123b934428 100644 --- a/openpype/hosts/maya/api/lib_renderproducts.py +++ b/openpype/hosts/maya/api/lib_renderproducts.py @@ -1130,7 +1130,8 @@ class RenderProductsRenderman(ARenderProducts): multipart=False ) """ - raise UnsupportedImageFormatException("Only exr, deep exr and tiff formats are supported.") + raise UnsupportedImageFormatException( + "Only exr, deep exr and tiff formats are supported.") products.append(product)