[QUOTE=gpz;26143]Quickly, I know how to do it on frames by applying it on the first and last. Is it necessary to be key indices? The only problem left is that you need to drop the query flag in order to apply a new value. Using a different state flag like edit, or query changes the behavior of the command and at the same time, the inputs it is expecting. This should work:
from maya import cmds
def adjust_tangents( inNode ):
# Get the curves.
anim_curves = cmds.listConnections( inNode, type='animCurve' )
# Apply the new tangent on the first and last keys.
for anim in anim_curves:
keys = cmds.keyframe( anim, query=True )
cmds.keyTangent( anim, time=( keys[0], ), inTangentType='spline', outTangentType='spline' )
cmds.keyTangent( anim, time=( keys[-1], ), inTangentType='spline', outTangentType='spline' )
adjust_tangents( <your_animated_node_here> )
Hope it helped.
G[/QUOTE]
Hey gpz, sorry for the late reply…
It seems to be working in my cause. Gonna try to incorprate the code into the code that I have written.
Any ideas why by adding in a query flag (as the one posted by rgkovach123) does not works? Pardon me, but I thought that at times when trying to modify something within the object etc, query or edit should do the trick?
So would this means that what I am trying to achieve isn’t part of this sort of modification?