TL,DR: What are the differences in behavior between history()
and inputs()
in PyMEL?
Hey all, this is my first post, and a long one at it! trying to be thourough for posterity.
I have been using the PyNode.history()
function all over the place over the past semester without too much issues. But lately I have run into issues with it.
Here’s what I gather so far:
history()
is a PyNode function, and until recently seems to be an easy way to recursively access nodes in the graph.
inputs()
is a DependNode function, and seems to give first level graph connections (so technically, should be the equivalent of history(levels=1)
)
Recently, I was using history()
as a quick way to access shading nodes by starting from a Shading Engine
eg, to find the closest file node:
fileNode = None
sgHistory = shadingEngine.history(breadthFirst=True)
for figure in sgHistory:
if figure.nodeType() == 'file':
fileNode = figure
break
return fileNode
This seemed to work marvelously for a time.
But today I wrote a UV-linking script using this method, meaning now Mesh objects are connected to the Shading Engine (through the UvChooser Node created by a UV link).
This seems to have broken history()
:
It now only returns mesh nodes.
However inputs()
returns the correct nodes (including the Material) but for my purposes isn’t as handy because non-recursive.
So that’s the context. I’m assuming this is just a PyMEL bug, but I figured this was a good occasion to try to settle which function suits which situation.
Thanks all, let me know if this needs clearing up!