Bases: MayaInstancePlugin
Collect history for instances from the Maya scene
Note
This removes render layers collected in the history
This is separate from Collect Instances so we can target it towards only specific product types.
Source code in client/ayon_maya/plugins/publish/collect_history.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
41
42
43
44
45
46 | class CollectMayaHistory(plugin.MayaInstancePlugin):
"""Collect history for instances from the Maya scene
Note:
This removes render layers collected in the history
This is separate from Collect Instances so we can target it towards only
specific product types.
"""
order = pyblish.api.CollectorOrder + 0.1
hosts = ["maya"]
label = "Maya History"
families = ["rig"]
def process(self, instance):
kwargs = {}
if int(cmds.about(version=True)) >= 2020:
# New flag since Maya 2020 which makes cmds.listHistory faster
kwargs = {"fastIteration": True}
else:
self.log.debug("Ignoring `fastIteration` flag before Maya 2020..")
# Collect the history with long names
history = set(cmds.listHistory(instance, leaf=False, **kwargs) or [])
history = cmds.ls(list(history), long=True)
# Exclude invalid nodes (like renderlayers)
exclude = cmds.ls(type="renderLayer", long=True)
if exclude:
exclude = set(exclude) # optimize lookup
history = [x for x in history if x not in exclude]
# Combine members with history
members = instance[:] + history
members = list(set(members)) # ensure unique
# Update the instance
instance[:] = members
|