Go to: Synopsis. Return value. Flags. Python examples.
, [attribute=string], [attribute0=name], [attribute1=name], [blender=name], [controlPoints=boolean], [driver=int], [name=string], [shape=boolean], [time=timerange])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
blendTwoAttr is undoable, queryable, and editable.
A blendTwoAttr nodes takes two inputs, and blends the values of the inputs
from one to the other, into an output value. The blending of the two
inputs uses a blending function, and the following formula:
(1 - blendFunction) * input + blendFunction * input
The blendTwoAttr command can be used to blend the animation of an
object to transition smoothly between the animation of two other
When the blendTwoAttr command is issued, it creates a blendTwoAttr
node on the specified attributes, and reconnects whatever was previously
connected to the attributes to the new blend nodes. You may also
specify which two attributes should be used to blend together.
The driver is used when you want to keyframe an object after it is
being animated by a blend node. The current driver index specifies
which of the two blended attributes should be keyframed.
|string||The names of the blendTwoAttr dependency nodes that were created.|
In query mode, return type is based on queried flag.
attribute, attribute0, attribute1, blender, controlPoints, driver, name, shape, time
Flag can appear in Create mode of command
Flag can appear in Edit mode of command
Flag can appear in Query mode of command
Flag can have multiple arguments, passed either as a tuple or a list.
import maya.cmds as cmds
# Assume we have animated a bouncing sphere, sphere1, and we would like
# the sphere to smoothly transition into following a second sphere's,
# sphere2, animation between time 15 and 20.
cmds.select( 'sphere1' )
cmds.blendTwoAttr( at='tx', at1='sphere2.tx', t=(15,20) )
cmds.blendTwoAttr( at='ty', at1='sphere2.ty', t=(15,20) )
cmds.blendTwoAttr( at='tz', at1='sphere2.tz', t=(15,20) )
# You can use the "-at" flag to narrow the query. For example, if
# you wanted to know the names of the newly created blender curves
# for only the tx and tz attributes of sphere1, you could say:
cmds.blendTwoAttr( at=['tx','tz'], query=True, blender=True )
# You can now keyframe the sphere2's animation by changing the
# driver on sphere1.
cmds.blendTwoAttr( at='tx', edit=True, driver=1 )
# setKeyframe ...
# If you already had two objects, sphere1 and sphere2 animated, and
# you wanted to blend between their animation abruptly at time 15,
# you could do:
cmds.blendTwoAttr( 'newObject.tx', t=(15,15), at0='sphere1.tx', at1='sphere2.tx' )