Go to: Synopsis. Return value. Flags. Python examples.
listRelatives(
[objects]
, [allDescendents=boolean], [allParents=boolean], [children=boolean], [fullPath=boolean], [noIntermediate=boolean], [parent=boolean], [path=boolean], [shapes=boolean], [type=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
listRelatives is undoable, NOT queryable, and NOT editable.
This command lists parents and children of DAG objects. The flags -c/children, -ad/allDescendents, -s/shapes, -p/parent and -ap/allParents are mutually exclusive. Only one can be used in a command.
Unlike ls, this command does not return a unique path but simply returns the object's name by default. To get a unique path the -path flag must be used.
When listing parents of objects directly under the world, the command will return an empty parent list. Listing parents of objects directly under a shape (underworld objects) will return their containing shape node in the list of parents. Listing parents of components of objects will return the object.
When listing children, shape nodes will return their underworld objects in the list of children. Listing children of components of objects returns nothing.
The -ni/noIntermediate flag works with the -s/shapes flag. It causes any intermediate shapes among the descendents to be ignored.
string[] | Command result |
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
allDescendents(ad)
|
boolean
|
![]() |
||
|
||||
allParents(ap)
|
boolean
|
![]() |
||
|
||||
children(c)
|
boolean
|
![]() |
||
|
||||
fullPath(f)
|
boolean
|
![]() |
||
|
||||
noIntermediate(ni)
|
boolean
|
![]() |
||
|
||||
parent(p)
|
boolean
|
![]() |
||
|
||||
path(pa)
|
boolean
|
![]() |
||
|
||||
shapes(s)
|
boolean
|
![]() |
||
|
||||
type(typ)
|
string
|
![]() ![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds # create an object and an instance for queries cmds.sphere( n='nexus' ) cmds.instance( n='ball' ) # List the name of the shape below the transform node. shapes = cmds.listRelatives('nexus') # list all parents of shape # (The result of the command is shown) cmds.listRelatives( shapes[0], allParents=True ) # Result:[u'nexus', u'ball'] #