From 3dd02cec71ceeac49d52a3f85652548aef68e21f Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Tue, 17 Jan 2023 22:49:33 +0800 Subject: [PATCH] update the validator --- .../publish/validate_gltf_textures_names.py | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_gltf_textures_names.py b/openpype/hosts/maya/plugins/publish/validate_gltf_textures_names.py index ed0ae9c6d5..635a59a4be 100644 --- a/openpype/hosts/maya/plugins/publish/validate_gltf_textures_names.py +++ b/openpype/hosts/maya/plugins/publish/validate_gltf_textures_names.py @@ -47,8 +47,8 @@ class ValidateGLTFTexturesNames(pyblish.api.InstancePlugin): "{0}".format(invalid)) invalid = self.get_texture_node_invalid(instance) if invalid: - raise RuntimeError("Related texture file " - "nodes not connected") + raise RuntimeError("At least a Albedo texture file" + "nodes need to be connected") invalid = self.get_texture_name_invalid(instance) if invalid: raise RuntimeError("Invalid texture name(s) found: " @@ -74,17 +74,19 @@ class ValidateGLTFTexturesNames(pyblish.api.InstancePlugin): if not dif.endswith("_D"): invalid.add(dif_path) orm_packed = cmds.listConnections(shader + ".TEX_ao_mapX")[0] - # "_ORM" - orm_path = cmds.getAttr(orm_packed + ".fileTextureName") - orm = orm_path.split(".")[0] - if not orm.endswith("_ORM"): - invalid.add(orm_path) + if orm_packed: + # "_ORM" + orm_path = cmds.getAttr(orm_packed + ".fileTextureName") + orm = orm_path.split(".")[0] + if not orm.endswith("_ORM"): + invalid.add(orm_path) nrm = cmds.listConnections(shader + ".TEX_normal_map")[0] - nrm_path = cmds.getAttr(nrm + ".fileTextureName") - nrm_map = nrm_path.split(".")[0] - # "_N" - if not nrm_map.endswith("_N"): - invalid.add(nrm_path) + if nrm: + nrm_path = cmds.getAttr(nrm + ".fileTextureName") + nrm_map = nrm_path.split(".")[0] + # "_N" + if not nrm_map.endswith("_N"): + invalid.add(nrm_path) return list(invalid) @@ -100,12 +102,6 @@ class ValidateGLTFTexturesNames(pyblish.api.InstancePlugin): albedo = cmds.listConnections(shader + ".TEX_color_map") if not albedo: invalid.add(albedo) - orm_packed = cmds.listConnections(shader + ".TEX_ao_mapX") - if not orm_packed: - invalid.add(orm_packed) - nrm = cmds.listConnections(shader + ".TEX_normal_map") - if not nrm: - invalid.add(nrm) return list(invalid) def get_texture_shader_invalid(self, instance):