2009

Table Of Contents
Linking the user interface
Currently the user interface in the window doesnt do anything: moving the
sliders and clicking the check boxes has no effect. In this section you learn
how to link the user interface to the makeRoll procedure you used earlier:
The textField in the user interface will display the currently selected
object.
The check boxes in the window will be linked so that only one check box
can be selected at once.
The button will execute the makeRoll procedure with the arguments
specified in the window.
In the following steps you modify the user interface script.
A completed version of the user interface script named Mel_UI_Final.mel is
available in the GettingStarted project directory, within the mel sub-directory.
Displaying the currently selected object
The makeRoll procedure does not act upon the currently selected object. You
will modify the script so that the textField control will display the name of
the currently selected object.
To return the name of the currently selected object, use the ls command (list)
with the selection. Since you can select multiple objects in Maya, the return
from the ls command is not a string, it is a string array, even if only one
object is selected. An array is an ordered list of values used to store multiple
items of the same data type within one variable. The makeRoll procedure
cannot accept a string array as an argument, so you must modify the data
returned by ls -selection.
NOTE For more information on the ls command, see ls in the MEL Command
Reference.
For more information on arrays, see Arrays in the MEL and Expressions guide.
In this next section, well also create a new tempMEL tab so youll have a place
to test commands as you learn them.
636 | Chapter 13 Scripting in Maya