Created
July 23, 2015 09:44
-
-
Save BigRoy/b1f676190d9820039f93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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