Go to: Synopsis. Return value. Related. Flags. Python examples.
parent(
[dagObject...] [dagObject]
, [absolute=boolean], [addObject=boolean], [noConnections=boolean], [relative=boolean], [removeObject=boolean], [shape=boolean], [world=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
parent is undoable, NOT queryable, and NOT editable.
This command parents (moves) objects under a new group, removes objects from an existing group, or adds/removes parents.If the -w flag is specified all the selected or specified objects are parented to the world (unparented first).
If the -rm flag is specified then all the selected or specified instances are removed.
If there are more than two objects specified all the objects are parented to the last object specified.
If the -add flag is specified, the objects are not reparented but also become children of the last object specified.
If there is only a single object specified then the selected objects are parented to that object.
If an object is parented under a different group and there is an object in that group with the same name then this command will rename the parented object.
string[] | Names of the objects parented (possibly renamed) |
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
world(w)
|
boolean
|
![]() |
||
|
||||
relative(r)
|
boolean
|
![]() |
||
|
||||
absolute(a)
|
boolean
|
![]() |
||
|
||||
addObject(add)
|
boolean
|
![]() |
||
|
||||
removeObject(rm)
|
boolean
|
![]() |
||
|
||||
shape(s)
|
boolean
|
![]() |
||
|
||||
noConnections(nc)
|
boolean
|
![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds # Create some objects cmds.circle( name='circle1' ) cmds.move( 5, 0, 0 ) cmds.group( n='group1' ) cmds.move( -5, 0, 0 ) cmds.group( em=True, n='group2' ) # Move the circle under group2. # Note that the circle remains where it is. cmds.parent( 'circle1', 'group2' ) # Let's try that again with the -relative flag. This time # the circle will move. cmds.undo() cmds.parent( 'circle1', 'group2', relative=True ) # Create an instance of the circle using the parent command. # This makes circle1 a child of group1 and group2. cmds.undo() cmds.parent( 'circle1', 'group2', add=True ) # Remove group1 as a parent of the circle cmds.parent( 'group1|circle1', removeObject=True ) # Move the circle to the top of the hierarchy cmds.parent( 'group2|circle1', world=True )