• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

The User Interface

For our Parking Spot project, we realized that not only would we be getting our project done, but we also would eventually have thousands of other Maya users looking over our figurative shoulders. To not disorient users too much, we have opted to keep to a minimum the number of obvious UI alterations. However, in the interests of educating users about the substantial flexibility of the Maya interface, in this section we'll look at a few of the useful changes that someone might make to it.

In other words, very little of the following will leak out of this section into other aspects of our book, but you might find it quite helpful to apply it to your Maya work—unless you'll have a crowd looking over your shoulder, too.

UI Elements

Maya refers to the many sections of its main window (such as the Help Line, Shelf, and Status Line) as its UI elements. You can do many things with these elements, such as show or hide them, rearrange them, or even completely redefine them.

On Again, Off Again

Any of these elements can be hidden or displayed with the UI Elements check boxes on the Display menu. Commands with hotkeys also are available for closing and opening all the UI elements (Hide UI Elements and Restore UI Elements), but use them with care.

When you hide the UI elements this way (which leaves just the workspace open), Maya takes note of what's already open, for later use when restoring them. If you use the hide only once, everything is fine and the restore command does the right thing. However, if you hide it twice in a row, Maya notes the now-closed state and uses that as the state for restoring the UI elements—which forces you to go back to the Display menu to turn back on the elements you need.

Of course, with a script that turns on just the set of UI elements that you need, you can avoid any hassle. The UI element commands shown in the following silly MEL procedure can be recombined in your own procedure to turn on or off any set of UI elements you'd like:

global proc UI_Off()
{
setStatusLineVisible 0;
setShelfVisible 0;
setPlaybackRangeVisible 0;
setCommandLineVisible 0;
setHelpLineVisible 0;
setToolboxVisible 0;
setAttributeEditorVisible 0;
setToolSettingsVisible 0;
setChannelsLayersVisible 0;
};

Placing such UI scripts on a shelf or marking menu can give you one-click access to the UI element combinations that you typically want, such as a minimal UI for modeling and a full set for complex animation work. I use a few scripts such as this for my own modeling work and put them on a shelf along with other UI-related scripts.

This Way or That Way

Not only can you turn the UI elements on or off, but you also can reorder most of them.

Why would you bother to do this?

Well, comfort, for starters. If you're making extensive use of shelves, you might find that tilting your head up an extra bit to see them, day after day, is a literal pain in the neck. A slight downward gaze is more natural and more comfortable, so adjusting the UI elements to suit your usage can be a wise move.

Another good reason to consider rearranging UI elements is to put related information areas closer together. When I mouse over a shelf command, the aforementioned annotation text is displayed on the Help Line. Unfortunately, the default position of the Shelf is at the top of the screen, while the Help Line is at the bottom. By moving the Shelf near the bottom (see Figure 4.6), these related items are brought together. Also notice that rearranging the elements doesn't alter the order of the Display, UI Elements menu—so if you use a reordered UI like this, you'll probably want to edit the buildPreferenceMenu.mel file to make the menu match the displayed order.

Figure 4.6. A rearranged set of UI elements.


Yet another reason might be to put items in view based on their frequency of access. Because I hardly ever need to set selection masks or modes the old-fashioned way, and because I use hotkeys for snaps, I usually only need the Status Line to verify snap modes or to key in a name or move. Thus, I might want to move it somewhere easier to glance at.

To rearrange UI elements, the initMainWindow.mel script must be edited (remember, edit Maya product scripts in a copy that you've placed in your personal scripts directory, never in the original script file). Near the bottom of the file, the user interface elements are arranged and related to each other. The MEL code is actually fairly easy to follow, with blocks of code for each element that describe what's attached to what.

For example, to switch the position of the Range slider and the Time slider, take these lines:

-attachNone     $mayaLive       "top"
-attachForm     $mayaLive       "left"   0
-attachForm     $mayaLive       "right"  0
-attachControl  $mayaLive       "bottom" 0 $timeSlider

-attachNone     $timeSlider     "top"
-attachForm     $timeSlider     "left"   0
-attachForm     $timeSlider     "right"  0
-attachControl  $timeSlider     "bottom" 0 $playbackRange

-attachNone     $playbackRange  "top"
-attachForm     $playbackRange  "left"   0
-attachForm     $playbackRange  "right"  0
-attachControl  $playbackRange  "bottom" 0 $commandLine

and switch them around, and reconnect the associations to produce these lines:

-attachNone     $mayaLive       "top"
-attachForm     $mayaLive       "left"   0
-attachForm     $mayaLive       "right"  0
-attachControl  $mayaLive       "bottom" 0 $playbackRange

-attachNone     $playbackRange  "top"
-attachForm     $playbackRange  "left"   0
-attachForm     $playbackRange  "right"  0
-attachControl  $playbackRange  "bottom" 0 $timeSlider

-attachNone     $timeSlider     "top"
-attachForm     $timeSlider     "left"   0
-attachForm     $timeSlider     "right"  0
-attachControl  $timeSlider     "bottom" 0 $commandLine

Save the file and restart Maya; the Time slider will now be positioned above the Range slider. Because the UI is constructed at startup, a restart is essential.

Of course, if these simple changes aren't enough to suit your tastes, you can completely overhaul the interface by setting the environment variable MAYA_OVERRIDE_UI and doing it all yourself. Naturally, the creation of an entire user interface is beyond the scope of this book, but it is possible.

As before, although I prefer some of the UI elements in different positions than the defaults, for reasons such as described previously, we'll generally stick to the default arrangement for the Parking Spot project's screen shots.

Menus

My typical workflow is a dense combination of hotkeys, marking menu selections, shelf item picks, and mouse moves. Only occasionally do I need to venture up into the menus for something unusual. When I do, however, I like to find commands easily and efficiently.

Just like the UI, menus can be modified because each menu is created with MEL, typically in a single file per menu. Any menu file can be copied to your local scripts directory and changed as desired to make it easy to navigate. Although each time you do this you add some overhead for updating future Maya releases, it can be worthwhile to make some simple changes that make frequent minor annoyances go away.

You might first want to consider changing command arrangements, moving the most often-used commands up to the top. Or, you might move commonly used commands buried in submenus to the top level, where they're easier to access. You can even add a menu from one set (such as Deform from the Animation set) to another set (such as Modeling, where the Deform menu can be very useful) (see Figure 4.7).

Figure 4.7. Modified menu example.


Even the Tool Box is created in a file (toolbox.mel) and can be rearranged, although you'll probably want to do this only if you do crazy stuff like reassign the sacred keys.

Menus aren't inviolable, so don't be afraid to do a little surgery and put your favorite tools where they're easy to reach. The MEL involved is fairly simple and usually involves only one file at a time, plucked from Maya's scripts/startup or scripts/others directories and dropped into your personal scripts directory for editing. As always, undoing these modifications is as easy as removing the edited file and restarting Maya.

The menus shown in Figure 4.7 actually have several of these kinds of changes. First, initMainMenuBar.mel was edited to add the Deform menu from Animation mode to Modeling mode. Also in that file, the Edit NURBS menu was renamed back to Edit Surfaces (because that's what those commands really do) and the Create menu was scooted over to be next to the Edit Curves menu. Then the Window menu (WindowMenu.mel) was rearranged to put the most frequently used commands at the top. Finally, the icons in the tool box for the sacred keys were rearranged to correspond to my very personal preferences for transformation tool hotkeys.

Let your workflow and awareness of inefficiency guide you as to what you might want to change. If you access most of your commands via the Hotbox, you'll probably benefit more from menu editing than someone who relies heavily on hotkeys, shelves, and marking menus (although it didn't stop me).

It's your time, so save it and spend it as you see fit.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint