Chapter 10: Creating Tools in Maya


 Download CD Content

Overview

click to expand

There is perhaps no single thing that adds more polish and usability to a script than a graphical user interface (GUI). Using a subset of MEL called the Extended Layer Framework , or ELF, these commands allow a scripter to create or access nearly every aspect of the Maya interface, including but not limited to:

  • Modifying such standard Maya elements as the Channel Box and Menus

  • Adding heads-up displays

  • Building full windows for your scripts

It is important to note that some things cannot be done to the user interface with scripting. Most notably, it is not possible to create custom manipulators without using the API. There are also some elements of the user interface that cannot be accessed with scripting commands. Finally, while it is possible to build incredibly complex windows that combine and optimize existing editors, you cannot create new editor types without the API. What we mean by a new editor is a new class of editor. You could, for example, build a new interface, using existing interface elements, to edit shading nodes, but you could not implement a totally new editor like the Hypershade (if we imagine for a moment that the Hypershade does not exist).

When it comes to building user interfaces (UIs), there are some positives and negatives to the way they are implemented in Maya. Perhaps their biggest advantage is that because almost every aspect of the Maya interface is created with MEL, they are available to be modified by the MEL-savvy user. In addition, this makes it quite easy to appropriate existing Maya windows for your own use. Moreover, because the user interfaces are created with scripting, they truly are dynamic. For example, you can create a window that has a separate section for each object selected, or displays different options based on what type of geometry is selected. All is not perfect in the world of MEL UI building, however. First and foremost, the syntax rules for building UIs is somewhat more demanding and involved than that of simple MEL scripts. In addition, the scripts that create user interfaces, especially for very complex windows, tend to be very long and therefore slow to execute. Finally, and perhaps where the following pages will be most useful, is that building UI windows that look exactly as we want can be difficult, even for experienced scripters. In fact, many scripters and programmers consider building UIs to be the most frustrating part of working with MEL.

So, as we delve into the exciting world of Maya interfaces, we need to keep a few things in mind. First, as with MEL scripting, it will take some time before we are able to build the incredibly complex windows some Maya tools create. In addition, remember that the look of Maya windows is often an odd mixture on such user variables as operating system, operating system colors, Maya user colors, and screen resolution. Therefore, if your results do not look identical to those presented in the figures in the following pages, please account for all these variables before panicking.




The MEL Companion
The MEL Companion: Maya Scripting for 3D Artists (Charles River Media Graphics)
ISBN: 1584502754
EAN: 2147483647
Year: 2003
Pages: 101

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net