Using Set Driven Key

Maya has a special type of key called a driven key that links one attribute value to another. When you create a driven key, you specify a driver attribute value and a driven attribute value. The value of the driven attribute is locked to a corresponding value of the driver attribute.

By linking several values of the driven and driver attributes, you create a predictable relationship between the attributes. A change in the driving attribute alters the value of the driven attribute. For instance, you can set driven keys to make a door open when a person walks in front of the door.

An attribute can be driven by multiple attributes. For instance, you can make a muscle bulge when an elbow rotates, and bulge even more when the wrist rotates. The muscle bulge is the driven attribute, and the elbow and wrist rotation are the driving attributes.

In standard animation keys, an attribute has values keyed to frames in the Time Slider. For a driven key, an attribute has values keyed to the value of a driving attribute.

The Time Slider is not involved in a driven key relationship and displays no red markers for the keys. Playing or scrubbing the animation alters the value of a driven attribute only if you animate the value of the driving attribute over time.

When you set driven keys, Maya creates a Graph Editor curve that shows the relationship between the linked attributes. For example, suppose you link a unicycle's pedal rotation to its forward movement. Specifically, the unicycle's Z translation drives the local X-axis rotation of the pedals. A curve similar to the following one appears in the Graph Editor:

For standard animation keys, the Graph Editor's vertical axis lists attribute values, and the horizontal axis lists animation time values. For driven keys, the Graph Editor's vertical axis lists driven attribute values, and the horizontal axis lists driver attribute values.

For each attribute value of the driver, the curve shows the associated value of the driven attribute. You can edit the curve to alter the relationship. You can't animate driven attributes with standard keyframes or other techniques.

Displaying the Set Driven Key window

You create driven keys in the Set Driven Key window.

To display the Set Driven Key window:

If you select an object before making the menu selection, the Set Driven Key window lists and selects it as the driven object by default.
or

The object and attribute you clicked in the Attribute Editor or Channel Box are listed and selected in the Set Driven Key window as the driven object and attribute.

Linking two attribute values

You link a pair of attribute values from the Set Driven Key window as follows:

To link two attributes:

1
Open the Set Driven Key window.
2
In the workspace or Outliner, select the object that has the attribute to be the driver.
3
In the Set Driven Key window, click Load Driver.
The object and its attributes appear in the upper part of the window.
4
In the Set Driven Key window, select the attribute to be the driver.
5
In the workspace or Outliner, select the object that has the attribute to be driven.
Note that the driven and driver attributes can be in the same object.
6
Click Load Driven.
The object and its attributes appear in the lower part of the window.
7
In the Set Driven Key window, select the attribute to be the driven attribute.
8
In the Channel Box, Attribute Editor, or elsewhere, set values for the driver and driven attributes.
9
Click Key or select Key > Set.
Maya creates a key that links the selected attributes at the current values. The object with the driven attribute becomes magenta in the workspace. The color indicates the object has a driven attribute.
10
Set new values for the driver and driven attributes.
11
Click Key or select Key > Set.
Maya creates a key that links the attributes at their new values.
You can link the attributes with as many keys as necessary. The default interpolation between the keys is linear.
12
Close the Set Driven Key window.
13
Try various values for the driver attribute to check that the driven attribute responds appropriately.
To tune the relationship between the driver attribute and driven attribute, select Window > Animation > Graph Editor to use the Graph Editor. You can cut, copy, paste, and delete driven keys with the Graph Editor.
The prior procedure used buttons in the Set Driven Key window. You can use menu selections instead of the buttons to get the same result:

Button

Menu selection

Key

Key > Set
Keys > Set Key (from the Animation menu bar)

Load Driver

Load > Selected as Driver

Load Driven

Load > Selected as Driven

Linking multiple attributes

You can use two or more driver attributes to control a single driven attribute. You can also drive more than one driven attribute with the same driver attribute. The technique is similar to linking two attributes, with the following exceptions:

Examining objects with driven key attribute values

You can examine objects with their driven key attribute settings. This is helpful when you're editing the Graph Editor curve or setting additional driven keys.

To see objects with their driven key attribute values:

1
In the workspace or Outliner, select the object that has the driven attribute.
2
From the Set Driven Key window, select Key > Go To Next or Key > Go To Previous.
or
From the Animation menu bar, select Keys > Set Driven Key > Go To Previous or Keys > Set Driven Key > Go To Next.
To loop through all the keys, select any of these menu selections repeatedly.

Enhancing work flow

This section describes techniques for speeding your work as you set driven keys. Specifically, you can select menu items to:

To load the driver linked to a loaded driven object:

1
Select the driven object in the workspace or Outliner.
2
Click Load Driven.
3
In the Set Driven Key window, select Load > Current Driver.
The driver object appears in the Driver list of the window.

To add an object to the existing Driver or Driven list:

1
Select the object in the workspace or Outliner.
2
In the Set Driven Key window, turn off Options > Clear On Load.
3
Click Load Driver or Load Driven.
The object is added to the existing Driver or Driven list.

To load only shape nodes of selected transform nodes:

1
Select the transform node of the object in the workspace or Outliner.
2
In the Set Driven Key window, turn on Options > Load Shapes.
3
Click Load Driver or Load Driven.
The object's shape node or nodes are loaded.

To list nonkeyable attributes for an object:

1
Select the object in the workspace or Outliner.
2
In the Set Driven Key window, turn on Options > List non-keyable attributes for driven.
3
Click Load Driver or Load Driven.
The Set Driven Key window displays keyable and nonkeyable attributes for the object.
Nonkeyable attributes for joints and transform nodes aren't displayed in the window because they are rarely animated. To display these attributes in the window, use Window > General Editors > Channel Control and make them keyable.

To select an object only in the Set Driven Key window:

In the Set Driven Key window, turn off Options > AutoSelect.
When you select an object in the Set Driven Key window, it`s not selected in the workspace.

To select a driven object from the Set Driven Key window:

1
Select the object name in the Driven list of the Set Driven Key window.
2
Choose Select > Driven Items.
This selects the object in the workspace.

Note

The settings you make in the Options menu stay in effect for the rest of your current work session and for future work sessions.

Example of setting driven keys

The following example shows how to set driven keys to slide a door upwards when a ball moves toward it. The translateX attribute of an object named Ball is the driver attribute. The translateY attribute of an object named Door is the driven attribute.

To link the attributes:

1
Select Door in the workspace or Outliner.
2
From the Animation menu bar, choose Keys > Set Driven Key > Set-.
The Set Driven Key window appears with Door in the Driven list.
3
Click translateY in the Driven list.
This is the attribute to be driven by Ball's movement.
4
Select Ball in the workspace or Outliner.
5
In the Set Driven Key window, click Load Driver.
Ball appears in the Driver list.
6
Click translateX in the Driver list.
This is the attribute that will drive Door's movement.
The Key button is no longer dim. You can set a driven key only after you select an attribute in the Driver list and in the Driven list.
7
In the Set Driven Key window, click Key.
This sets a driven key that links the current X translation of Ball to the current Y translation of Door. Whenever Ball's translateX attribute is at this position, Door's translateY position will be at its current position.
8
Move Ball to Door's position and move Door above Ball:
9
Click Key again.
This sets another driven key that links the X translation of Ball to the Y translation of Door.
10
Move Ball to the right of Door. Lower Door to its previous position:
11
Click Key again.
This sets another driven key that links the attributes.
The three keys set in this procedure link the attributes at their keyed values. Maya interpolates the linked values to generate the values between the keys. Because interpolation is linear by default, Door rises smoothly when you drag Ball toward it from either side.
Playing the animation doesn't move Ball or Door. Driven keys link one attribute to another. They don't link attributes to animation frames in the Time Slider.
12
Select Window > Animation > Graph Editor.
13
Select Door.
The Graph Editor shows the driven keys that link Door's translateY value to Ball's translate X value:

The column of numbers on the left lists the driven attribute values. The row at the bottom lists driver attribute values. The bell-shaped curve shows the relationship between the values-Door's translateY value rises as Ball's translateX value approaches 0.
Door's translateY value has a steady value near 6.5 when Ball's translateX value is less than -6 or greater than 6. In other words, Door is in its closed position when Ball is further than 6 units from the X-axis 0 position.
You can change the shape of the curve to make Door rise faster, slower, and higher as Ball approaches it. You can also cut, copy, paste, and delete the driven keys in the Graph Editor.
You can use standard animation keys, expressions, motion paths, or other techniques to animate Ball's translateX value. For example, you might animate Ball moving back and forth under the sliding door. The animated translateX value of Ball drives Door's translateY value as the animation plays.
You cannot animate a driven attribute with such techniques after you set driven keys for it. Attributes can be animated with only one animation technique.


 

mayadocs@aw.sgi.com
Copyright © 1999, Alias|Wavefront, an SGI company. All rights reserved.