The Shelf Editor lets you add icon names as well as icons to make it easier to identify scripts. To add an icon name and icon: 1. | Click the downward pointing arrow next the Shelf and select Shelf Editor from the pull-down menu that appears (Figure 17.22).
Figure 17.22. Click the arrow next to the Shelf and select Shelf Editor from the menu. The Shelves dialog box opens with the current shelf automatically selected (Figure 17.23).
Figure 17.23. The Shelves dialog box appears with the current shelf selected for editing. | 2. | Click the script to which you'd like to add a text note (Figure 17.24).
Figure 17.24. Select the script that you would like to edit in the upper portion of the shelf editor. | 3. | In the Icon Name field, type CS1 to enable cast shadows and press .
The icon name updates in the Shelf (Figure 17.25). Keep the name short so that it can fit into the space provided.
Figure 17.25. The icon name updates in the Shelf after you press . | 4. | Click Change Image to change the icon from the default MEL icon.
The Open dialog box appears (Figure 17.26).
Figure 17.26. By default, the Open dialog box displays the location where Maya stores icons. | 5. | Select an icon and click Open.
The icon appears next to the Change Image button and updates in the Shelf (Figure 17.27).
Figure 17.27. Select the icon and click Open. The icon updates next to the Change Image button and updates in the Shelf. | 7. | In the Label & Tooltips field, add a comment and press .
When you roll your mouse over the script's icon in the Shelf, this comment will appear as the Tooltip.
| 8. | Click Save All Shelves. The shelves are saved to the Shelves folder in your user/prefs/maya directory. On Windows, the path will look like this:
C:\Documents and Settings\adrian\ My Documents\maya\6.0\prefs\shelves On Mac, the path will look like this:
OSX\Users\gregb\Library\Preferences\ Alias\maya\scripts | Tip Now that you have learned a little bit about creating your own MEL scripts, it is important to know how to use other people's MEL scripts. You'll find a wealth of free MEL scripts for Maya at Web sites such as www.highend3d.com. Many scripts will have information about how to install and use the script in the header (or beginning) of the script itself. They may also include a readme.txt file or even an html file. Some scripts are simply a single MEL script file, while others may have several files that need to go into several locations, as well as icons or shelves. The scripts with several parts will often be stored in zip files, a common file archive format. Many scripts will work regardless of which platform you are using (Windows, Mac, Linux, or Irix). Most of the scripts available at www.highend3d.com indicate which platforms they have been tested with and which version of Maya they were created for, though most will work with any version of Maya. For this next task, download a basic script called MEX from www.gmaskfx.com/mel. To install a MEL script: 1. | Open the script to read the usage instructions.
// MEX (MultiEXtrude) by Adrian Dimond www.gmask.com 2001 // Select a curve to extrude along multiple paths. // Then add the curves that you want to use as paths. // Then type mex into the commandline global proc mex( ) { string $select[ ] = `ls -sl`; string $profile; string $path; $profile = $select[0]; $path = $select[1]; for ( $node in $select ) // process each selection { extrude -ch true -rn false -po 0 -et 2 -ucp 1 -fpt 1 -upn 1 -rotation 0 -scale 1 -rsp 1 $profile $node; } } | 2. | Download the mex script to the script's directory located in C:\Documents and Settings\gmask\My Documents\maya\6.0\scripts\ (Windows) or OSX\Users\username\Library\Preferences\Alias\maya\scripts (Mac).
Each time Maya is launched, it will scan this directory for scripts. If Maya is already open when you add the script, you will need to source the script in the Script Editor in order to use the script right away.
| 3. | Launch Maya and create a primitive NURBS circle and several CV curves (Figure 17.28).
Figure 17.28. Create a primitive NURBS circle and several CV curves. | 4. | Select the circle and -select the curves.
| 5. | Type mex; into the Command Line and press (Figure 17.29).
Figure 17.29. Type mex; and press . The script extrudes the circle over both curves (Figure 17.30).
Figure 17.30. The script extrudes the circle over both curves. | 6. | Type mex; into the Script Editor, then select the script and drag it to the Shelf for later use.
| |