Workflow Enhancements

table of contents

This book has made custom hotkeys and marking menus an integrated part of the tutorials for good reason. Beginners who are not exposed to these workflow enhancements are missing a big part of what makes Maya so efficient. However, our marking menus and hotkeys were created to show you how to determine the tasks you perform most often and set up tools to speed or automate many of them.

Creating Your Own Marking Menu

In Chapter 5, "NURBS Modeling Basics," you started the house project by loading a set of custom marking menus into Maya. Let's go through the steps of creating one of those marking menus so that you can see how it's done. Then you can alter the existing marking menus or create your own.

Tutorial: Building a Marking Menu
  1. Choose Window Settings/Preferences Marking Menus. In the Marking Menus dialog box that opens, click the Create Marking Menu button to open the dialog box shown in Figure 15.3.

    graphics/ch15b_icon.gif
    Figure 15.3. Maya's Create Marking Menu dialog box.

    graphics/15fig03.gif

    Each of the nine light-gray squares represents a location on the marking menu that you attach to a function. You can add information to each block or edit it by right-clicking on one of the squares and choosing Edit Menu Item. This brings up a spot to insert MELscript, but don't panic! You're going to let Maya automatically create the MELscript you need to dump into those little boxes. The MELscript appears in the Script Editor as you use Maya, translating each of your actions into the equivalent MEL code.

  2. Open the Script Editor by clicking the button to the far right of the Command Line.

  3. On the Script Editor's menu, enable the Echo All Commands setting (Script Echo All Commands).

  4. Your screen might be cluttered with all these windows open, so rearrange the Create Marking Menu dialog box and Script Editor so that you can see both. Just drag and resize the windows until you have them arranged to your liking so that you can continue working efficiently .

    The following steps create the CV Curve marking menu you used in this book. For each function you add to the marking menu, you perform the function first, and then MMB-drag the MELscript from the Script Editor to one of the gray squares in the Create Marking Menu dialog box.

    note

    Remember: When you turn on Echo All Commands, you can see every script and action that Maya runs with MEL. By default, the Script Editor echoes only the most significant commands for feedback in Maya's Command Line. Maya is built on MEL, so every action you perform in Maya is carried out in this scripting language. By watching the commands in the Script Editor, you can begin to grasp how Maya works and absorb the MEL syntax.

    tip

    If your Script Editor is filled with information you don't need, you can always clear its display by clicking Edit Clear History on the Script Editor's menu.

  5. First, access the CV Curve tool by clicking Create CV Curve Tool in the Hotbox.

  6. Check the new information in the Script Editor. Each line shows a different command, so you need to figure out which one actually runs the CV Curve tool. In this case, the line is CVCurveTool; , so highlight that line in the Script Editor (see Figure 15.4). Then simply MMB-click over the highlighted text and drag it to the top center gray box in the Create Marking Menu dialog box. Maya automatically copies the necessary information to the box.

    Figure 15.4. Highlighting the correct command in the Script Editor.

    graphics/15fig04.gif

  7. In the Create Marking Menu dialog box, right-click on the top center gray box and choose Edit Menu Item from the shortcut menu. The Edit North dialog box opens; it's called "North" because the gray boxes are named after compass points.

  8. Next , you need to give the menu item a label that appears when you access this marking menu. In the Label text box in the Edit North dialog box, change the name to CV Curve .

  9. Now you need to enable the option box to appear beside the CV Curve item in the marking menu. To do that, select the Option Box check box near the bottom of the dialog box.

  10. Next, you'll tell the option box what to do when clicked. First, copy the code line from the Command(s) section and paste it in the Option Box Command(s) section. For most creation procedures in MELscript, all you have to do is add the word Options to the end of the standard command. In this case, the command name should be CVCurveToolOptions; (see Figure 15.5). The semicolons are critical, so make sure they don't get omitted. Also, remember that you must match the letter case exactly when entering command names because MELscript is case sensitive.

    Figure 15.5. The completed Edit North dialog box.

    graphics/15fig05.gif

    tip

    There's another method for copying the MELscript: Copy the highlighted text (hotkey: Ctrl+c ) in the Script Editor, right-click on one of the gray boxes in the Create Marking Menu dialog box, and click Edit Menu Item on the shortcut menu. In the dialog box that opens, create a new menu item by pasting (hotkey: Ctrl+v ) the code line in the text box right under the label Command(s).

    Here's another method some Mayans prefer: Tear off the Create menu. Ctrl+Alt+Shift+ LMB-click on a command, and it's added to the Shelf, complete with its icon. Finally, MMB-drag the new icon to your marking menu to add it.

  11. You've finished creating the Create CV Curve item for this marking menu. Click the Save and Close button to save your changes and close the Edit North dialog box. Make sure the Create Marking Menu dialog box is still open for the next task.

tip

You can test each menu item after creating it. In the lower-left corner of the Create Marking Menu dialog box, click the box that says Click Here to Test to open the menu. It's not just for show; it actually works! Click the CV Curve item in the marking menu that pops up to test it (see Figure 15.6). Then click the CV Curve option box in the marking menu, and the CV Curve Options dialog box should open.

Figure 15.6. Testing the first marking menu.

graphics/15fig06.gif


Now you can add a few more items to this marking menu. Using the same methods as before, add the following actions as items on your menu:

Name of Tool Menu Action

Pencil Curve

Create Pencil Curve Tool

EP Curve

Create EP Curve Tool

3 PT Arc

Create Arc Tools Three Point Circular Arc

2 PT Arc

Create Arc Tools Two Point Circular Arc

After adding these tools to your marking menu, the Create Marking Menu dialog box should look similar to Figure 15.7.

Figure 15.7. Five entries are used for the CV Curve marking menu.

graphics/15fig07.gif

Now that you have finished adding items to the marking menu, you need to name and save it. In the Create Marking Menu dialog box, type testMM in the Menu Name text box, and click the Save button. This menu is then added to the list of other menus in the Marking Menus dialog box. Select the menu in the list at the top of the dialog box. To make the marking menu accessible in the Hotkey Editor, select Hotkey Editor in the Use Marking Menu In drop-down list box (see Figure 15.8). Click the Apply Settings button, and close this dialog box and the Script Editor.

Figure 15.8. Configuring the testMM marking menu to appear in the Hotkey Editor.

graphics/15fig08.gif

tip

You can fine-tune your marking menus by forcing the option box settings of the objects you create. Instead of just creating an object and copying the code for its creation, open the options box for that object. Configure the options box to the settings you'll use most of the time, and then create the object. In the Script Editor, to the right of the object's creation code, will be several tags, each specifying these option box settings for the object. Highlight the entire line of code and proceed as before. With option boxes for tools, the method is a little different, but you can always experiment until you find the code for the settings you want.


Tutorial: Setting Hotkeys

You've built the marking menu; now you need to set the hotkeys that will activate it:

  1. Open the Hotkey Editor by choosing Windows Settings/Preferences Hotkeys on Maya's main menu.

  2. In the Hotkey Editor, select User Marking Menus in the Categories list. All the menus should be listed under the Commands section (see Figure 15.9). You have probably noticed that each command has two names: one with a Press tag and one with a Release tag at the end of the name. With these commands, you can specify an on/off action so that Maya knows when to enable or disable a particular command action.

    Figure 15.9. Displaying marking menu commands in the Hotkey Editor.

    graphics/15fig09.gif

  3. The next step is to set a hotkey for the testMM marking menu. The Current Hotkeys section to the right lists any hotkeys currently assigned to the selected command. Under that area is the Assign New Hotkey section. In the Key text box, type the letter f . Be sure to use the lowercase f because hotkeys are case sensitive.

  4. Click the Query button to find out whether that key is already in use. In this case, it's already assigned to the Frame Selected action, so you need to add a modifier to the button.

  5. To the right of the Modifier item, select the Ctrl check box. This tells Maya that when you press Ctrl+f, you want to access the testMM marking menu.

  6. Now click the Assign button. Maya opens a message box telling you that the marking menu will not work unless you attach the release hotkey. Click the Yes button in the message box to have Maya set both press and release hotkeys.

  7. Under Current Hotkeys, you should see the Ctrl+f hotkey combination. After you've finished assigning those hotkeys, click the Save button at the bottom of the Hotkey Editor, and then click the Close button.

  8. Try the hotkeyed marking menu in a 3D view panel. Press Ctrl+f, and then LMB-click and hold in the panel. The marking menu you made should appear.

You've built a complete marking menu from scratch. The MMB drag-and-drop function from the Script Editor works for automating other tasks as well, as you'll see in the next section.

Automating Single or Multiple Tasks: Hotkey, Marking Menu, or Shelf

Almost any action you take in Maya has corresponding MELscript displayed in the Script Editor, if the Echo All Commands option is enabled. You can assign any action to a marking menu, as you learned in the previous tutorial. You can also assign an action to a hotkey or to the Shelf.

User Hotkeys

The Hotkey Editor (Window Settings/Preferences Hotkeys) you saw in Figure 15.9 allows you to edit the hotkeys assigned to Maya's primary functions. To view all the currently assigned hotkeys in the Hotkey Editor, click the List All button under the Current Hotkeys section to open the List Hotkeys dialog box (see Figure 15.10).

Figure 15.10. A listing of all currently assigned hotkeys.

graphics/15fig10.gif

In the Hotkey Editor, the bottom half functions just as the marking menu command setup did. You click the New button in the Hotkey Editor, select command text from the Script Editor, and MMB-drag it to the Command area. You can then assign a hotkey as well as its name, description, and category. Use the catch-all "User" category if your new hotkeys don't neatly fit into the other categories.

The Shelf

Using the same MMB drag-and-drop technique as before, you can drop items on the Shelf to create a button there with a default "MEL" icon. When you click the Shelf button, that function is performed.

You can create new custom shelves for all your needs. They show up as tabs on the Shelf, and you create new shelves by clicking the down arrow at the far left of the Shelf and selecting New Shelf. You can also edit the Shelf contents and the icons used for the buttons : Click the down arrow at the far left of the Shelf and select Shelf Editor, where you can assign the graphical icon to represent the Shelf button and edit the code and labels for the Shelf.

Tutorial: Shelf and Hotkey Items

In this tutorial, you'll set up a Shelf button for making a specific torus and a hotkey for duplicating it in a unique way. You can then use this method to build your own hotkeys and Shelf items.

  1. Open the Script Editor by clicking the Script Editor button at the right of the Command Line. Make sure there's a check mark by the Script Echo All Commands menu option so that all your actions are recorded. Then choose Edit Clear History from the menu so that you have a clean slate. Minimize the Script Editor so it's out of your way.

    graphics/ch15c_icon.gif
  2. To create a new Shelf, click the down arrow at the far left of the Shelf, and select New Shelf. Name it Maya_4_Fundamentals .

  3. Create the curves of a letter "A." Do this by choosing Hotbox Create Text Option Box, and then reset the options and replace the default text "Maya" with a capital "A." Click the Create button, and the curves are created. Use the frame hotkey (f) to zoom to the new curves. With the curves still selected, bring up the Bevel Plus dialog with Hotbox Surfaces Bevel Plus Option Box. Reset the options, and uncheck the create bevel Start and End options. This will make a simple capped extrusion . Then click the bevel button. An extruded capital "A" appears (see Figure 15.11). Check it in shaded mode to see what it looks like.

    Figure 15.11. Creating a beveled capital "A."

    graphics/15fig11.gif

  4. Restore the Script Editor. In its text area, highlight the actions you just performed, checking to include the things that made up the creation of the extruded letter "A." Now, MMB-drag the highlighted text into the lower half of the Script Editor. Here you can remove all the lines that start with // or that were later undone. The resulting script looks like Figure 15.12. Now select this edited text, MMB-drag it to the shelf, and a MEL icon button should appear. Test this new shelf button by clearing the system with Hotbox File New Scene, and then clicking the MEL icon that remains in the shelf. You should get an instant re-creation of your "A."

    Figure 15.12. The edited script, ready to drag to the Shelf.

    graphics/15fig12.gif

  5. To edit this shelf item, open the Shelf Editor by clicking the down arrow at the far left of the shelf, and choosing Shelf Editor. In the Shelves dialog box that opens, click the Shelf Contents tab. Enter Solid-A in the label and tooltips text box, and clear the Icon Name text box (see Figure 15.13). Click the Change Image button and select the Aicon.bmp file from the CD-ROM. This is simply a 32x32 pixel BMP directly rendered from Maya of a textured version of this very scene. You could render your own if you want, or create one from scratch in a paint program.

    graphics/ch15d_icon.gif
    Figure 15.13. Editing the new Shelf item.

    graphics/15fig13.gif

  6. Clear the history in the Script Editor with Edit Clear History. Make an extruded "A" if you don't already have one in the scene. Open the Duplicate Options dialog box (Hotbox Edit Duplicate Option Box), and reset the settings. Then set Translate Z to 01, Scale X to 0.9, and Scale Y to 1.1. Enter 8 in the Number of Copies text box, and click the Duplicate button. Look in the Script Editor for the line beginning with duplicate rr and select the entire line (see Figure 15.14). If you put your mouse just to the left of the line, the mouse direction will flip, and you can easily select the entire line with one click.

    Figure 15.14. The duplication settings and the selected script that caused the duplication.

    graphics/15fig14.gif

  7. Open the Hotkey Editor (Hotbox Window Settings/Preferences Hotkeys). In the Categories list, select User, and then click the New button. Enter ScaleDupe in the Name text box and 8 copies, stretched in the Description text box. Then MMB-drag the selected line in the Script Editor to the Command area of the Hotkey Editor, and click the Accept button. ScaleDupe is then displayed in the Commands list box. In the Assign New Hotkey area, enter o in the Key text box, select the Alt check box, and click the Assign button. You now have the Alt+o hotkey for this duplication action (see Figure 15.15). Click Save and then Close to close the dialog box. Test the hotkey by making some spheres and pressing Alt+o when they are selected. The hotkey will work on single objects or groups of objects.

    Figure 15.15. Creating a new hotkey in the Hotkey Editor.

    graphics/15fig15.gif

With these methods, you can automate nearly any action in Maya. As your skills progress, notice the actions you perform often and consider whether it would benefit you to have them automated. When you're confident that you've grasped the basic skills and are ready to add workflow enhancements, try creating hotkeys, Shelf items, and marking menus for the most-used functions, in a way that makes sense for the way you work.

Maya 4.5 Shelves

Included with Maya 4.5 is a complete set of shelves to help you improve your workflow. You can load each shelf by clicking the down arrow at the far left of the shelves, and choosing "Load Shelf," or you can run the bit of MELscript below (note: you also can find this text on the CD-ROM):

 loadNewShelf "shelf_General.mel"; loadNewShelf "shelf_Curves.mel"; loadNewShelf "shelf_Surfaces.mel"; loadNewShelf "shelf_Polygons.mel"; loadNewShelf "shelf_Subdivs.mel"; loadNewShelf "shelf_Deformation.mel"; loadNewShelf "shelf_Animation.mel"; loadNewShelf "shelf_Dynamics.mel"; loadNewShelf "shelf_Rendering.mel"; loadNewShelf "shelf_Cloth.mel"; loadNewShelf "shelf_Fluids.mel"; loadNewShelf "shelf_Fur.mel"; saveAllShelves $gShelfTopLevel; 

You'll find the shelves in your scripts\startup folder, which is by default directly under your Maya 4.5 root folder. The installed shelves will look like Figure 15.16.

graphics/ch15e_icon.gif
Figure 15.16. Although not loaded by default, you can install the Maya 4.5 shelves for added ease of use with Maya.

graphics/15fig16.gif

Helper Objects: Organization and Control

The next workflow-assist feature you'll explore is the concept of "helper" objectsnon-renderable objects in a scene that contain a set of controls for other objects. You create a simple object, disable its ability to be rendered, and hide all its existing parameters from appearing in the Channel Box. Then you add new attributes to the helper object and connect them to your critical scene variables, such as character expressions or the scene lighting mix. Helper objects can make animation and scene control much easier because all the variables you need are in the Channel Box, ready for animation.

Tutorial: Building a Helper Object
  1. Reset Maya by choosing File New Scene on the menu. Create a default polygon cube (Ctrl+x and Cube option box). Choose Edit Reset Settings, and then click the Create button. Set Rotate X and Z to 45 . These settings make the cube a kind of diamond in any view, and easier to see.

    graphics/ch15f_icon.gif
  2. Open the Attribute Editor for the cube (hotkey: Ctrl+a ), and make sure the pCubeShape1 tab is selected. Expand the Render Stats section and uncheck all the boxes, as shown in Figure 15.17.

    Figure 15.17. Making the cube invisible, as far as the renderer is concerned .

    graphics/15fig17.gif

  3. With the cube still selected, open the Channel Control Editor (Hotbox Window General Editors Channel Control). In the Keyable tab of the Channel Control dialog box, the variables to be displayed in the Channel Box appear in the Keyable list. Click the first item, and drag down the list to select all the variables, as shown in Figure 15.18. Click the Move button to put all these variables in the Non Keyable list box, and then click Close. You'll notice that no variables are listed in the Channel Box now, even though the cube is selected.

    Figure 15.18. Use the Channel Control dialog box to decide what can be animated (is keyable) and should appear in the Channel Box.

    graphics/15fig18.gif

  4. With the cube still selected, add an attribute to it (Hotbox Modify Add Attribute). In the New tab of the Add Attribute dialog box, enter Steering in the Attribute Name text box. In the Numeric Attribute Properties section at the bottom, enter the following values for this attribute (see Figure 15.19): Minimum to 10 , Maximum to 10 , and Default to . Click OK.

    Figure 15.19. Entering values for the Steering attribute in the Add Attribute dialog box.

    graphics/15fig19.gif

  5. Create a NURBS torus to use for a tire (Hotbox Create NURBS Primitives Torus). Set Rotate X to 90 , Translate X to 10 , and Translate Z to 2 .

  6. Next, duplicate the tire (Hotbox Edit Duplicate option box, choose Edit Reset Settings in the Duplicate Options dialog box, and click the Duplicate button). The duplicate is on top of the existing tire, so change Translate Z to 2 . Select both tires, and press Ctrl+d to duplicate them to get a set of four tires. Change Translate X to 4 to position the front two tires; now all four tires are in place.

  7. With both tires still selected, click on the Rotate Y label in the Channel Box. RMB-click on the label and choose Set Driven Key from the shortcut menu to open the Set Driven Key dialog box. Only one tire will appear, so click the Load Driven button and both tires should appear.

  8. Next, select the cube in the scene, and then click the Load Driver button. In the Driven column, select the two tire entries. In the right-hand columns of the Set Driven Key dialog box, select Steering in the Driver row, and rotateY in the Driven row, as shown in Figure 15.20.

    Figure 15.20. Setting up the Driven keys.

    graphics/15fig20.gif

  9. Now you need to tell Maya how these variables are connected. Select the cube and set its Steering value to 10 in the Channel Box. Select both tori that you loaded into the Set Driven Key dialog box and set their Rotate Y values to 45 . Click the Key button in the Set Driven Key dialog box.

  10. As in Step 9, select the cube and set its Steering value to 10 in the Channel Box, and then select the same two tori and set their Rotate Y values to 45 . Click the Key button in the Set Driven Key dialog box. To test the setup, select the cube, click the Steering label in the Channel Box, and then MMB-drag left and right in the viewport (Maya's Virtual Slider). The tires should rotate through the range you set for it. The Steering variable on the cube now controls the Y rotation of both tires (see Figure 15.21). You can load the scene file noted below the CD icon to check out our end result.

    graphics/ch15g_icon.gif
    Figure 15.21. The cube's Channel Box now controls the overall steering of both tires.

    graphics/15fig21.gif

You can move the cube to a position that keeps it out of the way of other objects so that it's easy to select. In this example, it's part of a car, so you would parent the helper cube to the car's root object, perhaps the body or frame that you would be modeling later. You can add more attributes and set up other Driven keys for the cube, such as the position of the steering wheel (also driven by the Steering attribute), the brightness of the headlights (on a new attribute called Headlights), the position of the seats, or any other variable you plan to animate. You could name the cube object something like aaaCar_Control so that it's easy to find in the Outliner.



Maya 4. 5 Fundamentals
Maya 4.5 Fundamentals
ISBN: 0735713278
EAN: 2147483647
Year: 2005
Pages: 201

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