Bases: MayaInstancePlugin
Validate nodes have a Colorbleed Id.
When IDs are missing from nodes save your scene and they should be automatically generated because IDs are created on non-referenced nodes in Maya upon scene save.
Source code in client/ayon_maya/plugins/publish/validate_node_ids.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 | class ValidateNodeIDs(plugin.MayaInstancePlugin):
"""Validate nodes have a Colorbleed Id.
When IDs are missing from nodes *save your scene* and they should be
automatically generated because IDs are created on non-referenced nodes
in Maya upon scene save.
"""
order = ValidatePipelineOrder
label = 'Instance Nodes Have ID'
families = ["model",
"look",
"rig",
"pointcache",
"animation",
"yetiRig",
"assembly"]
actions = [ayon_maya.api.action.SelectInvalidAction,
ayon_maya.api.action.GenerateUUIDsOnInvalidAction]
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
"""Process all meshes"""
# Ensure all nodes have a cbId
invalid = self.get_invalid(instance)
if invalid:
names = "\n".join(
"- {}".format(node) for node in sorted(invalid)
)
raise PublishXmlValidationError(
plugin=self,
message="Nodes found without IDs:\n{}".format(names)
)
@classmethod
def get_invalid(cls, instance):
"""Return the member nodes that are invalid"""
# We do want to check the referenced nodes as it might be
# part of the end product.
id_nodes = lib.get_id_required_nodes(referenced_nodes=True,
nodes=instance[:],
# Exclude those with already
# existing ids
existing_ids=False)
return list(id_nodes)
|
get_invalid(instance)
classmethod
Return the member nodes that are invalid
Source code in client/ayon_maya/plugins/publish/validate_node_ids.py
53
54
55
56
57
58
59
60
61
62
63
64 | @classmethod
def get_invalid(cls, instance):
"""Return the member nodes that are invalid"""
# We do want to check the referenced nodes as it might be
# part of the end product.
id_nodes = lib.get_id_required_nodes(referenced_nodes=True,
nodes=instance[:],
# Exclude those with already
# existing ids
existing_ids=False)
return list(id_nodes)
|
process(instance)
Process all meshes
Source code in client/ayon_maya/plugins/publish/validate_node_ids.py
39
40
41
42
43
44
45
46
47
48
49
50
51 | def process(self, instance):
"""Process all meshes"""
# Ensure all nodes have a cbId
invalid = self.get_invalid(instance)
if invalid:
names = "\n".join(
"- {}".format(node) for node in sorted(invalid)
)
raise PublishXmlValidationError(
plugin=self,
message="Nodes found without IDs:\n{}".format(names)
)
|