Go to: Synopsis. Return value. Related. Flags. MEL examples.
parent [-absolute] [-addObject] [-noConnections] [-relative] [-removeObject] [-shape] [-world]
[objects...] [parent]
parent is undoable, queryable, and 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)
In query mode, return type is based on queried flag.
group, listRelatives
absolute, addObject, noConnections, relative, removeObject, shape, world
Long name (short name) |
argument types |
Properties |
-world(-w)
|
|
|
|
unparent given object(s) (parent to world)
|
|
-relative(-r)
|
|
|
|
preserve existing local object transformations
(relative to the parent node)
|
|
-absolute(-a)
|
|
|
|
preserve existing world object transformations
(overall object transformation is preserved
by modifying the objects local transformation)
If the object to parent is a joint, it will
alter the translation and joint orientation of
the joint to preserve the world object
transformation if this suffices. Otherwise, a
transform will be inserted between the joint
and the parent for this purpose. In this case,
the transformation inside the joint is not
altered.
[default]
|
|
-addObject(-add)
|
|
|
|
preserve existing local object transformations
but don't reparent, just add the object(s) under
the parent. Use -world to add the world as
a parent of the given objects.
|
|
-removeObject(-rm)
|
|
|
|
remove an instance of an object from under the
parent. (Note: if there is a single parent
then the object is effectively deleted from
the scene) Use -world to remove the world
as a parent of the given object.
|
|
-shape(-s)
|
|
|
|
The parent command usually only operates on
transforms. Using this flags allows a shape
that is specified to be directly parented under
the given transform. This is used to instance
a shape node. (ie. "parent -add -shape" is
equivalent to the "instance" command).
This flag is primarily used by the file format.
|
|
-noConnections(-nc)
|
|
|
|
The parent command will normally generate
new instanced set connections when adding instances.
(ie. make a connection to the shading engine for
new instances) This flag supresses this behaviour
and is primarily used by the file format.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can be used more than once in a command
|
// Create some objects
circle -name circle1; move 5 0 0;
group -n group1; move -5 0 0;
group -em -n group2;
// Move the circle under group2.
// Note that the circle remains where it is.
parent circle1 group2;
// Let's try that again with the -relative flag. This time
// the circle will move.
undo;
parent -relative circle1 group2;
// Create an instance of the circle using the parent command.
// This makes circle1 a child of group1 and group2.
undo;
parent -add circle1 group2;
// Remove group1 as a parent of the circle
parent -removeObject group1|circle1;
// Move the circle to the top of the hierarchy
parent -world group2|circle1;