Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Created July 23, 2015 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BigRoy/b1f676190d9820039f93 to your computer and use it in GitHub Desktop.
Save BigRoy/b1f676190d9820039f93 to your computer and use it in GitHub Desktop.
"""
maya.cmds.listHistory() will always include the node itself when history is returned.
Here we're testing whether it's always the first node returned, if not a RuntimeError is raised.
We're also checking whether all nodes in the scene will return a valid history list, which isn't True.
The 'defaultColorMgtGlobals' node returns None instead of an empty list.
"""
from maya import cmds
node_histories = {}
weird_non_listing_nodes = []
for node in mc.ls():
history = cmds.listHistory(node, leaf=False)
if history is None:
weird_non_listing_nodes.append(node)
else:
if history[0] != node:
raise RuntimeError()
history = history[1:] # remove the node itself from history
node_histories[node] = history
import pprint
pprint.pprint(node_histories)
pprint.pprint(weird_non_listing_nodes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment