pymel.util.arguments.expandArgs

static arguments.expandArgs(*args, **kwargs)

‘Flattens’ the arguments list: recursively replaces any iterable argument in *args by a tuple of its elements that will be inserted at its place in the returned arguments.

By default will return elements depth first, from root to leaves. Set postorder or breadth to control order.

Keywords :
depth : int

will specify the nested depth limit after which iterables are returned as they are

type

for type=’list’ will only expand lists, by default type=’all’ expands any iterable sequence

postorder : bool

will return elements depth first, from leaves to roots

breadth : bool

will return elements breadth first, roots, then first depth level, etc.

For a nested list represent trees:

a____b____c
|    |____d
e____f
|____g

preorder(default) :

>>> expandArgs( 'a', ['b', ['c', 'd']], 'e', ['f', 'g'], limit=1 )
('a', 'b', ['c', 'd'], 'e', 'f', 'g')
>>> expandArgs( 'a', ['b', ['c', 'd']], 'e', ['f', 'g'] )
('a', 'b', 'c', 'd', 'e', 'f', 'g')

postorder :

>>> expandArgs( 'a', ['b', ['c', 'd']], 'e', ['f', 'g'], postorder=True, limit=1)
('b', ['c', 'd'], 'a', 'f', 'g', 'e')
>>> expandArgs( 'a', ['b', ['c', 'd']], 'e', ['f', 'g'], postorder=True)
('c', 'd', 'b', 'a', 'f', 'g', 'e')

breadth :

>>> expandArgs( 'a', ['b', ['c', 'd']], 'e', ['f', 'g'], limit=1, breadth=True)
('a', 'e', 'b', ['c', 'd'], 'f', 'g')
>>> expandArgs( 'a', ['b', ['c', 'd']], 'e', ['f', 'g'], breadth=True)
('a', 'e', 'b', 'f', 'g', 'c', 'd')

Note that with default depth (unlimited) and order (preorder), if passed a pymel Tree result will be the equivalent of doing a preorder traversal : [k for k in iter(theTree)]

Previous topic

pymel.util.arguments.convertListArgs

Next topic

pymel.util.arguments.getCascadingDictItem

Core

Core Modules

Other Modules

This Page