Saving the script
 
 
 

To use your script in other scenes, you must save it. To execute the MEL commands in a script file without having to open it every time you want to use it, you must use global procedures.

Once you’ve saved a MEL script file that contains a global procedure in the default script folder of Maya, you can access it whenever you type MEL commands. Other procedures in the script file can only be called by the global procedure(s) defined in the script file or other local procedures.

Maya automatically sources procedures in its default scripts folders at start up. A script in the default Maya script folder has the same name as a global procedure defined in the script file, when you type the name of the script file, the global procedure within the script file will be executed. This allows you to create scripts that operate similar to built-in Maya commands.

  1. Type the following in the MEL2 tab, one line above select -allDagObjects:
    global proc makeRoll_create_UI() {
    
  2. At the bottom of MEL2, type the following:
    }
    

    Your entire user interface script should be between the curly braces.

  3. Highlight the entire script by selecting Edit > Select All from the Script Editor menu bar.
  4. With the script highlighted, save the script by selecting File > Save Script from the Script Editor.

    The Script Editor only saves the highlighted commands when saving a script.

  5. Save the script as makeRoll_create_UI.mel in the GettingStartedMaya2012LessonData\MEL folder.
    Note

    When saving a script, you must have the .mel extension appended to the script file name in the Save Script dialogue box.