I'm trying to do a scale operation of multiple animation curves, each using its lowest key as the pivot point. I am thinking it should be a nested for loop structure but have not been able to get it working properly.
我正在尝试对多个动画曲线进行缩放操作,每个动画曲线都使用其最低键作为轴心点。我认为它应该是一个嵌套的循环结构,但无法使其正常工作。
The scaling is simple, just:
缩放很简单,只需:
mykeys = pm.keyframe( query=True, valueChange=True, absolute=True )
low = min(mykeys)
pm.scaleKey( valuePivot=low, valueScale=1.5 )
I am thinking 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.
提前致谢。
1 个解决方案
#1
2
You have it right, you're just not telling the command to work on 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 )
#1
2
You have it right, you're just not telling the command to work on 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 )