Wednesday, January 12, 2011

Creating Node Hierarchies in the Outliner

The Outliner shows a hierarchical list of the nodes in the scene in a form similar to the outline of a book. It is another way to view the transform and shape nodes in a scene and a way to create hierarchical relationships between nodes through parenting. The Outliner does not show the connections between nodes like the Hypergraph; rather, it shows the hierarchy of the nodes in the scene. To see how this works, try the following exercise:

  • 1.  Open the miniGun_v01.ma fle from the Chapter1/scenes directory on the DVD. The scene consists of a minigun model in three parts.
  • 2.  Open the Outliner by choosing Window > Outliner.

Outliner Layout presets
The Outliner can be opened as a separate panel or, like many of the panels in Maya, can be opened in a viewport. A popular window arrangement is to split the viewports into two views, with the left view set to the Outliner and the right view set to the perspective view. You can open this arrange-ment by going to the menu bar in a viewport window and choosing Panels > Saved Layouts > Persp/Outliner (as shown here). You can also click the third layout button on the left side of the interface just below the toolbox.



  • 3.  At the top of the Outliner is a menu bar. In the Display menu, make sure DAG Objects only is selected and Shapes is deselected (see Figure 1.10). In the Outliner, you’ll see three nodes listed: gunBarrels, housing, and mount in addition to the four default cameras and several set nodes (don’t worry about the set nodes). These are the three transform nodes for the pieces of the minigun. Select each node, and you’ll see the corresponding part highlighted in the perspective view. At the moment, each piece is completely separate and unconnected.



Figure 1.10
The Display menu at the top of the Outliner



  • 4.  Select the housing node, and switch to the Rotate tool (hot key = e). 
  • 5.  Rotate the objects; nothing else is affected. Try moving housing (hot key = w); again,
    nothing else is affected.
  • 6.  Hit Undo a few times until the housing node returns to its original location and
    orientation.
  • 7.  In the Outliner, select the gunBarrels object. Then Ctrl+click the housing object, and choose Edit > Parent.Parenting one object to another means you have made one transform node the child of the second. When an object is a child node, it inherits its position, rotation, scale, and visibility from the parent node. In the Outliner, you’ll notice that the housing node has a plus sign beside it and the gunBarrels node is not visible. The plus sign indicates that the node has a child node.
  • 8.  Click the plus sign next to the housing node to expand this two-node hierarchy. The  gunBarrels node is now visible as the child of the housing node. 
  • 9.  Select the housing node, and try rotating and translating it. The gunBarrels node follows the rotation and translation of the housing node (see Figure 1.11).Unlike the situation presented in the “Connecting Nodes with the Connection Editor” section of the chapter, the rotation and translation of the gunBarrels object are not locked to the rotation and translation of the housing node; rather, as a child, its rotation, translation, scale, and visibility are all relative to that of its parent.


 Figure 1.11
When the gunBarrels node is made a child of the housing object, it inherits changes made to the housing object’s transform node.

  • 10.  Select the gunBarrels node, and try rotating and translating the object; then rotate and translate the housing node. You’ll see the gun barrels maintain their position relative to the housing node. You could create an animation in which the gun barrels rotate on their own z-axis to spin around while fring, while the housing node is animated, rotating on all three axes in order to aim.
  • 11.  Hit Undo a few times (hot key = Ctrl+z) until both the housing and gunBarrel objects are back to their original positions. 
  • 12.  In the Outliner, select the housing node, and MMB-drag it on top of the mount node. This is a way to quickly parent objects in the Outliner.
  • 13.  Click the plus signs next to the mount and housing nodes in the Outliner to expand the hierarchy. The lines indicate the organization of the hierarchy; the gun barrels are parented to the housing node, which is parented to the mount node
Shift+click to expand the hierarchy
You can expand an entire hierarchy with one click in the Outliner. Just Shift+click the arrow for the hierarchy you want to expand.


  • 14.  Select the mount node, and choose Edit > Duplicate (hot key = Ctrl+d). This makes a copy of the entire hierarchy. The duplicated mount node is named mount1. 15.  Select the mount1 node, and switch to the Move tool (hot key = w). Pull on the red  arrow of the tool to move the duplicate along the x-axis about two units.
  • 16.  Select the mount node, and then Ctrl+click the mount1 node in the Outliner. 
  • 17.  Choose Edit > Group (hot key = Ctrl+g) to group these two nodes under a single  parent node.A group node is a transform node that has no shape node. It’s just a location in space used to organize a hierarchy. Like a parent node, its children inherit its rotation, translation, scale, and visibility.
  • 18.  Select the group1 node, and Shift+click the plus sign next to it in the Outliner to expand the group and all its children. 
  • 19.  Double-click the label for the group1 node in the Outliner to rename it; rename the 
    group guns.
Renaming Nodes
You’ll notice that the duplicate mount node has been renamed mount1 automatically. Nodes on the same level of the hierarchy can’t have the same name. The child nodes do have the same name, and this is usually a bad idea. It can confuse Maya when more complex connections are made between nodes. Whenever youencounter this situation, you should take the time to rename the child nodes so that everything in the scene has a unique name.

  • 20.  Select the mount1 node in the Guns hierarchy, and choose Modify > Prefx Hierarchy Names. 
  • 21.  In the pop-up window, type right_. This renames the top node and all its children so that “right_” precedes the name. Do the same with the other mount node, but change the prefx to left_.
  • 22.  Select the guns group, and choose Modify > Center Pivot. This places the pivot at the center of the group. Try rotating the Guns group, and you’ll see both guns rotate together (see Figure 1.12).

Figure 1.12
The Guns group is rotated as a single unit.

Each member of the hierarchy can have its own animation, so both gun barrels can rotate around their z-axes as they fre, the two housing nodes could be animated to aim in different directions, and the two guns could rotate as one unit, all at the same time. The entire group can be parented to another node that is part of a vehicle.

 
next Creating Node Hierarchies in the Outliner
 
 
By Eric Keller with Todd Palamar and Anthony Honn
Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana

0 comments:

Post a Comment

 
Powered by Blogger