Rename an object
 
 
 

If you rename an object whose attributes were used in an expression, the Expression Editor continues to read or set the attributes. Maya doesn’t disconnect the attribute from the expression. The Expression Editor converts to the new name of the object the next time you click the Reload button in the Expression Editor.

When you reload an expression, the Expression Editor converts any short attribute names to their long attribute name equivalents. For example, if you originally type the attribute name Ball.ty, reloading the expression renames it as Ball.translateY.

If you rename an object and the name is used in a MEL command within an expression (see the following section), you must change the name manually in the expression. The Expression Editor doesn’t convert object names that exist in MEL statements. For example, suppose you use the following statements in an expression successfully:

Cube.translateX = 'getAttr Ball.translateX';
setAttr Ball.translateX 0;

If you later rename Ball as Sphere, the Expression Editor won’t change the name Ball to Sphere, and the expression will fail. You must change the name manually in the expression.

In the following statements, the Expression Editor will change the name Ball to Sphere and the expression will execute without error. This occurs because the statements use standard expression syntax rather than MEL command syntax.

Cube.translateX = Ball.translateX;
Ball.translateX = 0;