Maya/Python:如何从各自的特定枢轴点缩放多个选定的动画曲线?

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

我正在尝试对多条动画曲线进行缩放操作,每条曲线都使用其最低键作为轴心点。我认为它应该是一个嵌套的 for 循环结构,但未能使其正常工作。

缩放很简单,就是:

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

我认为它应该类似于?

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 )

提前致谢。

你说得对,你只是没有告诉命令一次只处理一条曲线:

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 )