Bases: MayaInstancePlugin
Collect user defined attributes for nodes in instance.
Source code in client/ayon_maya/plugins/publish/collect_user_defined_attributes.py
6
7
8
9
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 | class CollectUserDefinedAttributes(plugin.MayaInstancePlugin):
"""Collect user defined attributes for nodes in instance."""
order = pyblish.api.CollectorOrder + 0.45
families = ["pointcache", "animation", "usd"]
label = "Collect User Defined Attributes"
def process(self, instance):
# Collect user defined attributes.
if not instance.data.get("creator_attributes", {}).get(
"includeUserDefinedAttributes"
):
return
if "out_hierarchy" in instance.data:
# animation family
nodes = instance.data["out_hierarchy"]
else:
nodes = instance[:]
if not nodes:
return
shapes = cmds.listRelatives(nodes, shapes=True, fullPath=True) or []
nodes = set(nodes).union(shapes)
attrs = cmds.listAttr(list(nodes), userDefined=True) or []
user_defined_attributes = list(sorted(set(attrs)))
instance.data["userDefinedAttributes"] = user_defined_attributes
self.log.debug(
"Collected user defined attributes: {}".format(
", ".join(user_defined_attributes)
)
)
|