diff --git a/openpype/hosts/maya/plugins/publish/validate_rendersettings.py b/openpype/hosts/maya/plugins/publish/validate_rendersettings.py index dd57be445d3..dcaf9903f7e 100644 --- a/openpype/hosts/maya/plugins/publish/validate_rendersettings.py +++ b/openpype/hosts/maya/plugins/publish/validate_rendersettings.py @@ -56,7 +56,7 @@ class ValidateRenderSettings(pyblish.api.InstancePlugin): ImagePrefixTokens = { 'arnold': 'maya///{aov_separator}', # noqa - 'redshift': 'maya///', + 'redshift': 'RENDER///_', 'vray': 'maya///', 'renderman': '{aov_separator}..' # noqa } @@ -89,6 +89,10 @@ class ValidateRenderSettings(pyblish.api.InstancePlugin): VRAY_PREFIX = "maya///" DEFAULT_PREFIX = "maya///_" + aov_separator_custom = "." + aov_extension_check_ignore_list = ["Cryptomatte"] + image_prefix = "RENDER/" + def process(self, instance): invalid = self.get_invalid(instance) @@ -115,16 +119,16 @@ def get_invalid(cls, instance): layer=layer) prefix = prefix.replace( - "{aov_separator}", instance.data.get("aovSeparator", "_")) + "{aov_separator}", cls.aov_separator_custom) if not anim_override: invalid = True cls.log.error("Animation needs to be enabled. Use the same " "frame for start and end to render single frame") - if not prefix.lower().startswith("maya/"): + if not prefix.startswith(cls.image_prefix): invalid = True - cls.log.error("Wrong image prefix [ {} ] - " - "doesn't start with: 'maya/'".format(prefix)) + cls.log.error("Image prefix is '{}'. " + "It should start with '{}'".format(prefix), cls.image_prefix) if not re.search(cls.R_LAYER_TOKEN, prefix): invalid = True @@ -149,13 +153,13 @@ def get_invalid(cls, instance): scene_sep = cmds.getAttr( "{}.fileNameRenderElementSeparator".format(node)) - if scene_sep != instance.data.get("aovSeparator", "_"): + if scene_sep != cls.aov_separator_custom: cls.log.error("AOV separator is not set correctly.") invalid = True if renderer == "redshift": redshift_AOV_prefix = cls.redshift_AOV_prefix.replace( - "{aov_separator}", instance.data.get("aovSeparator", "_") + "{aov_separator}", cls.aov_separator_custom ) if re.search(cls.R_AOV_TOKEN, prefix): invalid = True @@ -168,14 +172,13 @@ def get_invalid(cls, instance): for aov in rs_aovs: aov_prefix = cmds.getAttr("{}.filePrefix".format(aov)) aov_type = cmds.getAttr("{}.aovType".format(aov)) - aov_extension_check_ignore_list = ["Cryptomatte"] # check their image prefix if aov_prefix != redshift_AOV_prefix: cls.log.error(("AOV ({}) image prefix is not set " "correctly {} != {}").format( cmds.getAttr("{}.name".format(aov)), cmds.getAttr("{}.filePrefix".format(aov)), - aov_prefix + redshift_AOV_prefix )) invalid = True # get aov format @@ -185,7 +188,7 @@ def get_invalid(cls, instance): default_ext = cmds.getAttr( "redshiftOptions.imageFormat", asString=True) - if aov_type not in aov_extension_check_ignore_list: + if aov_type not in cls.aov_extension_check_ignore_list: if default_ext != aov_ext: cls.log.error(("AOV file format is not the same " "as the one set globally " @@ -222,11 +225,10 @@ def get_invalid(cls, instance): # prefix check default_prefix = cls.ImagePrefixTokens[renderer] - default_prefix = default_prefix.replace( - "{aov_separator}", instance.data.get("aovSeparator", "_")) - if prefix.lower() != default_prefix.lower(): - cls.log.warning("warning: prefix differs from " - "recommended {}".format( + if prefix != default_prefix: + cls.log.warning("Warning: prefix '{}' differs from " + "recommended '{}'".format( + prefix, default_prefix)) if padding != cls.DEFAULT_PADDING: @@ -278,10 +280,10 @@ def repair(cls, instance): renderer = instance.data['renderer'] layer_node = instance.data['setMembers'] redshift_AOV_prefix = cls.redshift_AOV_prefix.replace( - "{aov_separator}", instance.data.get("aovSeparator", "_") + "{aov_separator}", cls.aov_separator_custom ) default_prefix = cls.ImagePrefixTokens[renderer].replace( - "{aov_separator}", instance.data.get("aovSeparator", "_") + "{aov_separator}", cls.aov_separator_custom ) with lib.renderlayer(layer_node): @@ -318,11 +320,11 @@ def repair(cls, instance): node = vray_settings[0] cmds.optionMenuGrp("vrayRenderElementSeparator", - v=instance.data.get("aovSeparator", "_")) + v=cls.aov_separator_custom) cmds.setAttr( "{}.fileNameRenderElementSeparator".format( node), - instance.data.get("aovSeparator", "_"), + cls.aov_separator_custom, type="string" ) diff --git a/openpype/settings/defaults/project_settings/maya.json b/openpype/settings/defaults/project_settings/maya.json index 52b8db058c5..6b188feadf1 100644 --- a/openpype/settings/defaults/project_settings/maya.json +++ b/openpype/settings/defaults/project_settings/maya.json @@ -201,6 +201,11 @@ "validate_collision": true }, "ValidateRenderSettings": { + "aov_separator_custom": ".", + "image_prefix": "RENDER/", + "aov_extension_check_ignore_list": [ + "Cryptomatte" + ], "arnold_render_attributes": [], "vray_render_attributes": [], "redshift_render_attributes": [], 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 5a47d688b5e..6043ff668f9 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 @@ -187,6 +187,22 @@ "key": "ValidateRenderSettings", "label": "ValidateRenderSettings", "children": [ + { + "type": "text", + "key": "aov_separator_custom", + "label": "AOV Separator Custom" + }, + { + "type": "text", + "key": "image_prefix", + "label": "Image Prefix" + }, + { + "type": "list", + "key": "aov_extension_check_ignore_list", + "label": "AOV Ignore List (Extension Check)", + "object_type": "text" + }, { "type": "dict-modifiable", "store_as_list": true,