Maya / Python: How to scale multiple selected animation curves each from their own pivot point?

I am trying to do a scale operation of multiple animation curves, each using its own low key as a pivot point. I think it should be a nested loop structure, but couldn't get it to work properly.

The scaling is simple, simple:

mykeys = pm.keyframe( query=True, valueChange=True, absolute=True )
low = min(mykeys)
pm.scaleKey( valuePivot=low, valueScale=1.5 )

      

I think it should be something similar to?

selectedCurves = pm.listConnections( t="animCurve")
for curve in selectedCurves:
    mykeys = pm.keyframe( query=True, valueChange=True, absolute=True )
    low = min(mykeys)
    pm.scaleKey( valuePivot=low, valueScale=1.5 )

      

Thanks in advance.

+3


source to share


1 answer


You are fine, you just don't tell the team to work only one curve at a time:



selectedCurves = cmds.listConnections( t="animCurve")
for curve in selectedCurves:
    mykeys = cmds.keyframe(curve, query=True, valueChange=True, absolute=True )
    low = min(mykeys)
    cmds.scaleKey(curve, valuePivot=low, valueScale=1.5 )

      

+2


source







All Articles