Modifying object attributes
 
 
 

When performing any actions in Maya, you are executing Maya commands. When

Note

The Maya commands executed when moving an object using the move tool are very different from those executed when setting attributes through the Attribute Editor or the Channel Box.

Next, you translate the cube using the Channel Box to observe the Script Editor history and compare it to the Script Editor history created by using the move tool.

To observe the Script Editor history created when using the Channel Box

  1. Clear the Script Editor history by clicking the Clear History button on the toolbar of the Script Editor
  2. Open the Channel Box by clicking on the Channel Box icon on the far right hand side of the Status Line.
  3. In the Channel Box, set the Translate X attribute to 5 to move the sphere 5 units along X.

    The following script history appears in the upper section of the Script Editor

    setAttr "nurbsSphere1.translateX" 5;
    

    When using the Channel Box to move objects, you are using the setAttr command to set the attributes of the selected object.

To observe the history created with the Move Tool

  1. Select the Move Tool by clicking the Move icon in the Toolbox.
  2. Move the sphere back to the origin with the move tool in the perspective view.

    The following script history appears in the history section of the Script Editor:

    move -r -5 0 0;
    

    Do not be concerned if your values are not be the same for this example.

    The move command modifies the translate attributes for all selected objects.

    The move command was executed with the relative flag. Flags have short forms and long forms: -r is the short form of the -relative flag.

    The move command with the relative flag adds the values after the flag to the current XYZ co-ordinates of the object.

  3. Delete the sphere by typing the following:
    delete;
    

    Pressing the delete key on your keyboard has the same functionality as the delete command in most situations.

    Note

    When the Attribute Editor or the Channel Box is used to modify the attributes of the selected object, the recorded script contains the setAttr command referring to the initially selected object. The move tool or the move command must be used to modify the attributes of an object if the script is to be reused on another object.