Disconnect an attribute
 
 
 

If you disconnect an attribute from an expression, the expression no longer reads or set its value. You might want to disconnect an attribute, for example, so you can keyframe the attribute rather than control it with an expression.

These actions disconnect an attribute from an expression:

Display disconnected attributes in expressions

The Expression Editor displays a disconnected attribute with a symbolic placeholder representing the attribute’s former existence in the expression.

Example

Suppose your scene has two objects, Ball and Cone, and you’ve written this expression:

Ball.translateX = Cone.translateX;
Ball.translateY = Cone.translateY;
Ball.translateZ = Cone.translateZ;

If you delete Cone from the scene, Cone.translateX, Cone.translateY, and Cone.translateZ attributes no longer exist for the expression to read and assign to Ball’s translateX, translateY, and translateZ attributes.

If you display the expression again, it appears as follows:

Ball.translateX = .I[0];
Ball.translateY = .I[1];
Ball.translateZ = .I[2];

The .I[0], .I[1], and .I[2] characters indicate you’ve disconnected Cone’s translate attributes from the expression. These symbols represent placeholders for the former use of the attributes in the expression.

The .I means the placeholder represents an input to the expression. An input to an expression is an attribute with a value the expression reads for assignment to another attribute or variable. The number in brackets indicates the order in the expression the attribute was read.

For example, .I[0] indicates the input is the first attribute read in the expression, .I[1] indicates the input is the second attribute read, and .I[2] indicates the input is the third attribute read.

A floating point or integer attribute placeholder has a value of 0. A particle shape node’s vector attribute placeholder has a value of <<0,0,0>>. In the example, the placeholders .I[0], .I[1], and I[2] have the value 0. When the expression executes, it assigns Ball.translateX, Ball.translateY, and Ball.translateZ the value 0.

If you disconnect an attribute from an expression but the attribute still exists in the scene, the attribute keeps its value from the last time the expression executed and set its value.

Example

Suppose you’ve written these statements among others:

Ball.translateX = Cone.translateX;
Ball.translateY = Cone.translateY;
Ball.translateZ = Cone.translateZ;

If you delete Ball from the scene, Ball.translateX, Ball.translateY, and Ball.translateZ attributes no longer exist. The expression can no longer assign Cone’s translateX, translateY, and translateZ values to the corresponding Ball attributes.

Symbolic placeholders replace Ball attributes in the expression. If you display the expression again, the statements appear as follows:

.O[0] = Cone.translateX;
.O[1] = Cone.translateY;
.O[2] = Cone.translateZ;
NoteIf an expression assigns values to the attributes of only one object, deleting the object deletes the expression also. If your expression assigns values to attributes of several object attributes, deleting all those objects deletes the expression.

To avoid deleting the expression in the preceding example, you would need have some statement that sets an attribute of an object other than the deleted Ball. For example, you might include this statement:

Cone.visibility = 1;

The .O[0] characters indicate you’ve disconnected the attribute Ball.translateY from the expression. The .O indicates that the placeholder represents an output from the expression.

An output from an expression is an attribute assigned a value by the expression. The number in brackets, for example, [0], indicates the order in which the attribute was assigned a value in the expression.

Because Ball.translateX was the first output from the expression, the expression replaces it with .O[0]. The expression replaces Ball.translateY and Ball.translateZ with .O[1] and .O[2] because they were the second and third outputs from the expression.

When the expression executes, it continues to assign values to the placeholder, though the placeholder has no effect on any object or component of scene.

The expression assigns the placeholders .O[0], .O[1], and .O[2] the value of Cone.translateX, Cone.translateY, and Cone.translateZ, but these placeholders don’t control anything in the scene. The statements have no effect.

Connect an attribute to a symbolic placeholder

After you’ve disconnected an attribute from an expression, a symbolic placeholder replaces it in the expression as described in the preceding topic. You can replace the placeholder with the attribute of your choice.

The most obvious way to do this is to type the desired attribute name in every occurrence of the symbolic placeholder in the expression.

If you have a lengthy expression that has lots of symbolic placeholders, you can use a single MEL connectAttr command to connect the new attribute to all occurrences of the same symbolic placeholder. You can also use Window > General Editors > Connection Editor.

Example 1

Suppose you have these statements among others in an expression named HorseController:

WhiteHorse.translateX = Car.translateX;
BlackHorse.translateX = Car.translateX;
BrownHorse.translateX = Car.translateX;

Deleting the Car and reloading the expression shows this:

WhiteHorse.translateX = .I[0];
BlackHorse.translateX = .I[0];
BrownHorse.translateX = .I[0];

.I[0] is the symbolic placeholder for what was the Car.translateX attribute. You can connect a different attribute to this placeholder to assign its contents to the translateX attributes of WhiteHorse, BlackHorse, and BrownHorse.

Suppose you want to control these attributes with the translateX attribute of an object named Cow. You can enter the following MEL command at the Command Line:

connectAttr Cow.tx HorseController.input[0]

This command connects the attribute Cow.tx to the expression’s input[0]. The expression is named HorseController. The input[0] is abbreviated as .I[0] in the expression. You can see the spelled-out input name input[0] in the Graph > Input and Output Connections display of the Hypergraph.

Reloading the expression shows the new attribute connection:

WhiteHorse.translateX = Cow.translateX;
BlackHorse.translateX = Cow.translateX;
BrownHorse.translateX = Cow.translateX;

Example 2

You can also reconnect an expression’s output with the connectAttr command. Suppose you have these statements among others in an expression named HorseController:

WhiteHorse.translateX = Car.translateX;
BlackHorse.translateX = Car.translateX;
BrownHorse.translateX = Car.translateX;

Deleting the BrownHorse object and reloading the expression displays this:

WhiteHorse.translateX = Car.translateX;
BlackHorse.translateX = Car.translateX;
.O[2] = Car.translateX;

.O[2] is the symbolic placeholder for what was the BrownHorse.translateX attribute. It received the placeholder .O[2] because it’s the third output from the expression. (The first and second outputs from the expression are .O[0] and .O[1] .) You can connect a different object attribute to this placeholder to control it with the value in Car.translateX, as shown in the third statement.

Suppose you want to control the attribute of a new object named RedHorse.translateX with the Car.translateX value. You can enter the following MEL command in the Command Line:

connectAttr HorseController.output[2] RedHorse.tx

This command connects the HorseController expression’s output[2] to the attribute RedHorse.tx. The output[2] is abbreviated .O[2] in the expression.

Reloading the expression shows the new attribute connection:

WhiteHorse.translateX = Cow.translateX;
BlackHorse.translateX = Cow.translateX;
RedHorse.translateX = Cow.translateX;