diff --git a/colorbleed/maya/lib.py b/colorbleed/maya/lib.py index f5ca8396b5..b20d329778 100644 --- a/colorbleed/maya/lib.py +++ b/colorbleed/maya/lib.py @@ -828,7 +828,6 @@ def assign_look_by_version(nodes, version_id): else: log.info("Reusing existing lookdev '{}'".format(reference_node)) shader_nodes = cmds.referenceQuery(reference_node, nodes=True) - namespace = cmds.referenceQuery(reference_node, namespace=True) # Assign relationships with open(shader_relation, "r") as f: diff --git a/colorbleed/plugins/maya/publish/_validate_look_members_node_ids.py b/colorbleed/plugins/maya/publish/_validate_look_members_node_ids.py new file mode 100644 index 0000000000..805fcdf207 --- /dev/null +++ b/colorbleed/plugins/maya/publish/_validate_look_members_node_ids.py @@ -0,0 +1,39 @@ +import pyblish.api +import colorbleed.api + + +class ValidateLookMembers(pyblish.api.InstancePlugin): + """Validate look members have colorbleed id attributes + + Looks up all relationship members and check if all the members have the + cbId (colorbleed id) and return all the nodes who fail the test. + + """ + + order = colorbleed.api.ValidatePipelineOrder + families = ['colorbleed.lookdev'] + hosts = ['maya'] + label = 'Look Members (ID)' + actions = [colorbleed.api.SelectInvalidAction, + colorbleed.api.GenerateUUIDsOnInvalidAction] + + def process(self, instance): + """Process all meshes""" + + invalid_ids = self.get_invalid(instance) + if invalid_ids: + raise RuntimeError("Found invalid nodes.\nNo ID : " + "{}".format(invalid_ids)) + + @classmethod + def get_invalid(cls, instance): + + relationships = instance.data["lookData"]["relationships"] + members = [] + for relationship in relationships.values(): + members.extend(relationship["members"]) + + # get the name of the node when there is no UUID + invalid = [m["name"] for m in members if not m["uuid"]] + + return invalid