This command traverses backwards or forwards in the graph from the specified node and returns all of the nodes whose construction history it passes through. The construction history consists of connections to specific attributes of a node defined as the creators and results of the node’s main data, eg. the curve for a Nurbs Curve node. For information on history connections through specific plugs use the “listConnections” command first to find where the history begins then use this command on the resulting node.
returns an empty list when the result is None
added a much needed ‘type’ filter
added an ‘exactType’ filter (if both ‘exactType’ and ‘type’ are present, ‘type’ is ignored)
rtype: | DependNode list |
---|
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
allConnections (ac) | bool | ||
If specified, the traversal that searches for the history or future will not restrict its traversal across nodes to only dependent plugs. Thus it will reach all upstream nodes (or all downstream nodes for f/future). |
|||
allFuture (af) | bool | ||
If listing the future, list all of it. Otherwise if a shape has an attribute that represents its output geometry data, and that plug is connected, only list the future history downstream from that connection. |
|||
allGraphs (ag) | bool | ||
|
|||
breadthFirst (bf) | bool | ||
The breadth first traversal will return the closest nodes in the traversal first. The depth first traversal will follow a complete path away from the node, then return to any other paths from the node. Default is depth first. |
|||
future (f) | bool | ||
|
|||
futureLocalAttr (fl) | bool | ||
This flag allows querying of the local-space future-related attribute(s) on shape nodes.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
futureWorldAttr (fw) | bool | ||
|
|||
groupLevels (gl) | bool | ||
|
|||
historyAttr (ha) | bool | ||
|
|||
interestLevel (il) | int | ||
If this flag is set, only nodes whose historicallyInteresting attribute value is not less than the value will be listed. The historicallyInteresting attribute is 0 on nodes which are not of interest to non-programmers. 1 for the TDs, 2 for the users. |
|||
leaf (lf) | bool | ||
|
|||
levels (lv) | int | ||
|
|||
pruneDagObjects (pdo) | bool | ||
|
Derived from mel command maya.cmds.listHistory
Example:
import pymel.core as pm
import maya.cmds as cmds
pm.curve( d=3, p=[(-3, 0, 0),(-1, 0, 6),(6, 0, 8),(8, 0, 2)], k=[0,0,0,1,1,1], n="snake" )
# Result: nt.Transform(u'snake') #
pm.instance( n="rattler" )
# Result: [nt.Transform(u'rattler')] #
pm.revolve( 'rattler', ch=True, n="charmer" )
# Result: [nt.Transform(u'charmer'), nt.Revolve(u'revolve1')] #
pm.revolve( 'snake', ch=True, n="medusa" )
# Result: [nt.Transform(u'medusa'), nt.Revolve(u'revolve2')] #
pm.listHistory()
# Result: [nt.NurbsSurface(u'medusaShape'), nt.Revolve(u'revolve2'), nt.NurbsCurve(u'snake|snakeShape')] #
pm.listHistory( 'charmer' )
# Result: [nt.NurbsSurface(u'charmerShape'), nt.Revolve(u'revolve1'), nt.NurbsCurve(u'rattler|snakeShape')] #
pm.listHistory( 'medusa', lv=1 )
# Result: [nt.NurbsSurface(u'medusaShape'), nt.Revolve(u'revolve2')] #
pm.listHistory( 'medusa', future=True )
# Result: [nt.NurbsSurface(u'medusaShape'), nt.ShadingEngine(u'initialShadingGroup')] #
# If you just list the curve's future you get both directions
pm.listHistory( 'curveShape1', future=True )
[u'snake|curveShape1', u'revolve2', u'medusaShape', u'revolve1', u'charmerShape']
# To follow only one history you'll need to follow the path you
# want first, then add the node you started at if so desired since
# it will not be included (here snake|curveShape1 won't list).
# List the future of the first curve
hist = pm.listConnections('curveShape1.ws[0]',c=1)
pm.listHistory( hist[1], future=True )
[u'revolve2', u'medusaShape']
# List the future of the second curve
hist = pm.listConnections('curveShape1.ws[1]',c=1)
pm.listHistory( hist[1], future=True )
[u'revolve1', u'charmerShape']
pm.listHistory( leaf=0 )
[u'medusa']