Experimental Scripting for Animation in Maya
Arts Col 694, 5 credits
Professor Alan Price


Assignment #3 - Create a script with GUI for interactively generating event(s)

Save your script(s) to an external file ("your_user_name_project3.mel") and put a copy in "Y:\Courses\AC694_Price_Fall_2005\project_3"

This exercise is designed to gain experience with creating and formatting your own custom user interface, making use of windows and the various control gadgets available in MEL.

The "event" is broadly defined. It can include the creation of objects and relationships between them or connecting relationships between existing objects. The event could include control of lights or textures, etc. The event can be anything that effectively alters the dependency graph for acheiving your objective.

You may consider re-using components of scripts you have already done, e.g., your first project that built a model, or building new models to which you will attach expressions from the second project, but now create a UI in which the user can pre-determine "how many?", "how big?", "how fast?", etc.

In many cases, MEL scripts that create a GUI may have two stages: the GUI for creating the event and then a different GUI for adjusting attributes for continued control of the event. You may want to consider these stages for projects later in the course. In this project, your first-stage GUI may create attributes on nodes for additional control once the event is generated. Creation of a "second-stage" GUI is the objective of the next project, so you might think ahead at how aspects of this project may
integrate with the next one.

Use procedures to structure your script. Commonly, the last procedure in the script will be the one to build the user interface. The main rule is to be sure no procedure is called before it is declared. Your needs for structure in your script may vary, but consider the following approach:

  • UI procedure: Define the window, control gadgets and placement. Limited execution of commands might include the "-command" argument for a button. This procedure could be global. Commonly it is the last procedure in the script.
  • Value-passing procedure: The UI may have many values to pass to the main procedure, perhaps with one button to execute everything. This procedure could work to collect all the values from the controls and format them for passing as arguments to the main procedure. This procedure may occur above the UI procedure.
  • Main procedure: Performs the actual functions of the script, operating on arguments passed to it from the procedure above, or perhaps on the command line. In the latter case, you would also make this procedure global. This procedure commonly appears first in the script.
  • Other procedures: These may include error-checking user input using regular expressions, chunks of code used often by different parts of your script(s), or intermediate operations you prefer to separate for purpose of organization.The procedures may appear in different places, most likely after the main procedure.

Handle naming conflicts:
If your script generates new nodes in the scene, use appropriate methods in your script to track the names of the nodes and/or nodes withing hierarchies. Your script should be able to execute more than once to build two or more of the intended results without having naming conflicts.

Handle user selection lists:
If your script requires that the user pre-select objects in the scene, use appropriate methods to track the names of those objects throughout your script. Also, do error checking to make sure the user has the correct type of objects selected.

Handle windows:
Make sure only one instance of your window can be opened, or if there is a need for multiple windows you need to manage the naming of windows and controls appropriately. Should the window close automatically when the operation is complete?

Evaluation will be based on:
-- Successful completion.
Does the script do what it is supposed to do without errors?
-- Creative application. Was attention given to a creative approach for user control of the event? Does the idea have applications relative to the creator's interests?
-- Structure. Is the script properly structured using procedures and methods for passing values between them?