animCurve, key values and time
import maya.cmds as mc;
## Querying
# Current time
crntT = mc.currentTime(q=1);
# Getting anim nodes of current key selection
animNodesOfSelectedKeys = mc.keyframe(q=1,sl=1,n=1);
offsetval= 12.34;
if animNodesOfSelectedKeys:
for aNode in animNodesOfSelectedKeys:
# Current time value of selected key curve
keyCurveValue = mc.keyframe(aNode,q=1,ev=1,t=(crntT,crntT))[0];
# Num of keys of an animCurve node
numKeys = mc.keyframe(animCurveNode,q=1,keyframeCount=1);
# All key "TIMES"
times = mc.keyframe(animCurveNode,index=(0,numKeys-1),q=1);
# All key time "VALUES"
vals = mc.keyframe(animCurveNode,t=(times[0],times[len(times)-1]),q=1,valueChange=1);
## Changing key times and values
## Add offset values
## One at a time
for i in range(0,numKeys):
currentVal = mc.keyframe(aNode,t=(times[0],times[numK-1]),q=1,valueChange=1);
mc.keyframe(animCurveNode,edit=1,index=(i,i),valueChange=currentVal+currentVal);
Comments
Post a Comment