From 12a1e9e520641e1e3e700d77576c5d0d036f5879 Mon Sep 17 00:00:00 2001 From: Allan Ihsan Date: Fri, 13 May 2022 10:53:11 +0300 Subject: [PATCH] Handle additional attributes for MtoA --- openpype/hosts/maya/api/lib_rendersettings.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/maya/api/lib_rendersettings.py b/openpype/hosts/maya/api/lib_rendersettings.py index c6afbfa19c..38f493a4a8 100644 --- a/openpype/hosts/maya/api/lib_rendersettings.py +++ b/openpype/hosts/maya/api/lib_rendersettings.py @@ -140,10 +140,17 @@ class RenderSettings(object): "defaultArnoldDriver.mergeAOVs", multi_exr) # Passes additional options in from the schema as a list # but converts it to a dictionary because ftrack doesn't - # allow fullstops in custom attributes. - additional_options_dict = dict(additional_options) - for attr in additional_options_dict.keys(): - cmds.setAttr(attr, additional_options_dict.get(attr, None)) + # allow fullstops in custom attributes. Then checks for + # type of MtoA attribute passed to adjust the `setAttr` + # command accordingly. + for item in additional_options: + attribute, value = item + if (cmds.setAttr(str(attribute), type=True)) == "long": + cmds.setAttr(str(attribute), int(value)) + elif (cmds.setAttr(str(attribute), type=True)) == "bool": + cmds.setAttr(str(attribute), int(value), type = "Boolean") # noqa + elif (cmds.setAttr(str(attribute), type=True)) == "string": + cmds.setAttr(str(attribute), str(value), type = "string") # noqa def _set_redshift_settings(self, width, height): """Sets settings for Redshift."""