Monday, January 10, 2011

Connecting Nodes with the Connection Editor

Connections between nodes can be added, deleted, or changed using the Hypergraph and  the Connection Editor.
  1. Start a new Maya scene. 
  2. Create a locator in the scene by choosing Create > Locator. A simple cross appears at the center of the grid in the viewport. This locator is a simple nonrendering null that indicates a point in space. Locators are handy tools that can be used for a wide variety  of things in Maya.
  3. Press the w hot key to switch to the Move tool; select the locator at the center of the grid, and move it out of the way.
  4. Press the g hot key to create another locator. The g hot key repeats the last action you performed, in this case the creation of the locator.
  5. Create a NURBS sphere in the viewport by choosing Create > NURBS Primitives > Sphere. If you have Interactive Creation selected, you’ll be prompted to drag on the grid in the viewport to create the sphere; otherwise, the sphere will be created at the center of the grid based on its default settings.

NURBS
A Non-Uniform Rational B-Spline (NURBS) object is a type of surface that is defned by a network of editable curves. Chapter 3 introduces how to create and model NURBS surfaces

    6.  Move the sphere away from the center of the grid so you can clearly see both locators and the sphere.
    7.  Use the Select tool (hot key = q) to drag a selection marquee around all three objects.
    8.  Open the Hypergraph in connections mode by choosing Window >Hypergraph:Connections. You 
         should see eight nodes in the Hypergraph (see Figure 1.6). 




 
Figure 1.6
The input and output connections of the two locators and the sphere are graphed in the Hypergraph.


          locator1 and locator2 are the two transform nodes for the locators. locatorShape1 and locatorShape2 
          are the two shape nodes for the locators. nurbsSphere1 is the transform node for the NURBS sphere. 
          And nurbsSphereShape1 is the shape node for the sphere; it’s connected to MakeNurbsSphere1, 
         which is the history node, and to initialShadingGroup. The initialShadingGroup node is the default 
         shading group that is applied to all geometry; without this node, the geometry can’t be shaded or  
         rendered. When you apply a new shader to an object, the connection to initialShadingGroup is  
         replaced  with a connection to the new shader

      9.  In the Hypergraph window, use Alt+RMB to zoom out a little. 
     10.  Select the locator1, locator2, and nurbsSphere1 nodes, and drag them away from the other nodes 
            so   you can work on them in their own space.
     11.  In the Hypergraph, MMB-drag the locator1 node over the nurbsSphere1 node. 
     12.  From the pop-up menu, choose Other at the bottom (Figure 1.7). A new dialog box will open; this is 
            the Connection Editor


 
Figure 1.7
You can connect two nodes in the Hypergraph by MMB-dragging one on top of the other and choosing from the options in the pop-up menu.

The Connection Editor is where you create and edit connections between nodes. The  left side of the panel represents the output of a selected node, in this case the locator1 node. The output is the controlling node; the right side is the input, and in this case is nurbsSphere1, which will be controlled based on whatever connections you make in  the list.

The list represents the attributes of each node. Any of the attributes that have a plus sign next to them can be expanded to reveal nested attributes. For instance, fnd the Translate attribute in the left side of the column, and expand it by clicking the plus sign. You’ll see that Translate has Translate X, Translate Y, and Translate Z. This means you can choose either to select the Translate attribute, which will automatically use all three nested attributes as the output connection, or to expand Translate and choose one or more of the nested Translate X, Y, or Z attributes as the output connection. In some situations, a connection becomes grayed out, indicating that the connection between the two attributes cannot be made, usually because the connection is not appropriate for the selected attri-butes (see Figure 1.8).



Figure 1.8
The Connection Editor specifes which attributes are connected between nodes.

13.  Select the Translate attribute on the left. You’ll notice that many of the selections on the right side become grayed out, meaning that they cannot be connected to Translate. This is because Translate is a vector—it is an output consisting of three connections (Translate X, Translate Y, and Translate Z). The vector can be connected only to other vectors on the right side of the list.

14.  On the right side, scroll down and select Translate. Both connections in the list are itali-cized, indicating that there is a connection to this attribute. If one of the other attributes on the right were italicized, it would indicate that another node is already connected to that attribute (see Figure 1.8).

15.  In the viewport, switch to wireframe mode. You can do this by pressing 4 on the keyboard or clicking the wireframe icon on the icon bar at the top of the viewport window; the wireframe icon is the wireframe cube.

16.  In the viewport, you’ll notice that the sphere has snapped to the same position as the locator. Select the sphere, and try to move it using the Move tool (hot key = w). The sphere is locked to the locator, so it cannot be moved. Select the locator, and try to move it; the sphere moves with the locator. The output of the locator’s Translate attributes are the input for the sphere’s Translate.

Incoming Connections
In wireframe view, an object will be highlighted in purple if it has an incoming connection from
the selected object.


17.  Select the nurbsSphere1 node in the Hypergraph, and MMB-drag it on top of locator2. 

18.  From the pop-up list, choose Rotate (see Figure 1.9). The Connection Editor opens again.




Figure 1.9
The nurbsSphere1 node is MMB-dragged on top of the locator2 node, making the sphere the input connection for locator2.

Specifying Connections
In some cases when you choose to make a connection from the pop-up window, Maya will automati-cally make it for you without opening the Connection Editor; however, in other cases, even when you choose what seems like an obvious connection from the list, Maya will still open the Connection Editor so you can make exactly the connection you want.


19.  Now the nurbsSphere1 node is listed on the left, and locator2 is on the right. Find the Rotate attributes, expand the list, and choose Rotate X from the list.

20.  On the right side, fnd the Rotate attributes, expand them, and choose Rotate Y. This causes the Rotate X of the nurbsSphere1 node to control the Rotate Y of the locator.

21.  In the viewport, select the sphere, and switch to the Rotate tool (hot key = e). 

22.  Drag up and down on the red circle of the tool to rotate the sphere in X only. The locator
rotates around its y-axis.


Use the Connection editor to Make Simple Connections
The Connection Editor is best used when you want to make a one-to-one relationship between attributes on two nodes. In other words, the value of the output connection needs to equal exactly the value of the input connection. More complex connections can be made using expressions, special nodes, or Set Driven Key. All of these options will be discussed throughout the book.


You can break a connection by reselecting the connected node on either side of the Connection Editor so that the attribute is no longer highlighted. You can also select the connecting line in the Hypergraph and press the Delete key to break the connection.

 
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