Go to: Synopsis. Notes. Return value. Flags. MEL examples.
rename [-ignoreShape]
[object] string
rename is undoable, NOT queryable, and NOT editable.
Renames the given object to have the new name. If only one
argument is supplied the command will rename the (first) selected
object. If the new name conflicts with an existing name, the
object will be given a unique name based on the supplied name.
It is not legal to rename an object to the empty string.
When a transform is renamed then any shape nodes beneath the
transform that have the same prefix as the old transform name
are renamed. For example, "rename nurbsSphere1 ball" would
rename "nurbsSphere1|nurbsSphereShape1" to "ball|ballShape".
If the new name ends in a single '#' then the rename command
will replace the trailing '#' with a number that ensures
the new name is unique.
When explicitly supplying the name of the object to rename,
this name is defined relative to the root namespace. However,
the new name is defined relative to the current namespace.
(see example below).
string | The new name. When undone returns original name. |
ignoreShape
Long name (short name) |
Argument types |
Properties |
-ignoreShape(-is)
|
|
|
|
Indicates that renaming of shape nodes below
transform nodes should be prevented.
|
|
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 two namespaces under the root namespace and create
// a sphere under the root namespace and a sphere under one
// of the new namespaces.
namespace -set ":";
sphere -n sphere1;
namespace -add nsA;
namespace -add nsB;
namespace -set nsA;
sphere -n sphere2;
namespace -set ":";
// change name of sphere1
rename sphere1 spinning_ball;
// result: spinning_ball //
// change name of spinning_ball back to sphere1
select -r spinning_ball;
rename sphere1;
// Result: sphere1 //
// move sphere2 to namespace nsB
rename nsA:sphere2 nsB:sphere2;
// Result: nsB:sphere2 //
// move sphere2 back to namespace nsA when not in the root namespace
// Note the ":" appearing in front of the new name to indicate
// we want to move the object to namespace nsA under the root namespace.
namespace -set nsB;
rename nsB:sphere2 :nsA:sphere2;
// Result: nsA:sphere2 //
// Let's try this without the leading ":" in the new name.
// Since we are namespace nsA, in affect, what we are trying to do
// is rename :nsB:sphere2 to :nsA:nsB:sphere3. Since there isn't a
// nsB namespace under the namespace nsA, the namespace specification
// on new name is ignored and a warning is issued.
namespace -set ":nsA";
rename nsA:sphere2 nsB:sphere3;
// Warning: Removing invalid characters from name. //
// Result: nsA:sphere3 //
// rename an object when not in the root namespace
// and move the object to current namespace
namespace -set ":nsB";
rename nsA:sphere3 sphere4;
// Result: nsB:sphere4 //