Using the saved script file

 
 
 

You can apply the makeRoll procedure to any geometry quickly by selecting the object to apply makeRoll to, and executing the makeRoll_create_UI global procedure. Before using a script in your scene, you must source it. Sourcing executes all the commands within a script file.

You can only access global procedures declared in the script file from the Script Editor. Any local procedures cannot be accessed from the Script Editor, and must be called from global procedure within the script file.

Note

Global procedures only have access to local procedures declared before them in a script file.

To source and use a script file

Note

If you have not restarted Maya since you saved your script, you need to rehash before you can source your script. For more information about the rehash command, see rehash in the Commands documentation.

  1. Create a new scene.
  2. In the Script Editor, select File > Source Script.
  3. In the Source Script dialogue box that opens, select, from the GettingStartedMaya2013LessonData\MEL directory:
    makeRoll_create_UI.mel
    
  4. Create geometry to test the makeRoll procedure on by creating a new scene and typing the following:
    polyPyramid;
    
  5. Execute the makeRoll_create_UI global procedure to create the user interface by typing the following in the Script Editor:
    makeRoll_create_UI;
    

    The user interface you created opens.

  6. Set the frame to greater than one to view the effects of the makeRoll procedure.
  7. Set the following values in the makeRoll user interface:
    • Ground Plane = 0
    • Diameter = 1.0
    • Box Simulation = checked
    • Sphere Simulation = unchecked
  8. Click the “Execute” button to setup the makeRoll expressions.
  9. Move the pyramid in X and Z to view the results of the makeRoll procedure.

Explore different results that occur when you apply the makeRoll procedure with different user interface control values. Since you cannot undo the makeRoll procedure, you will have to create new geometry every time to apply the makeRoll procedure.

When you open a new Maya session, the makeRoll user interface procedure is no longer defined and must be sourced to use it.