我尝试使用python在maya中创建一个工具,该工具根据对象的关键帧位置创建曲线。最终目标是创建对象可以在其间混合的不同动画曲线,以便创建对主动画的调整。这是我到目前为止所拥有的。它创建一条遵循运动路径的曲线,但它不是基于关键帧位置。任何帮助都会非常感激。
import maya.cmds as cmds
def createAnimCurve( startFrame, endFrame, numCV, object ):
curveCVstep = ((endFrame - startFrame)+startFrame)/numCV
points = []
for step in range( startFrame, endFrame, int(curveCVstep)):
# Moves throughout the specified timeline to find point results
cmds.currentTime( step )
# Queries the pivot position to draw the curve relative to the controller
xpos = cmds.xform( object,q=1,ws=1,rp=1 )
# convert the tuple (vector) to a string
points.append(xpos)
cmds.curve(d=3, ws=True, p=points, n=object+'_xPath')
createAnimCurve(1,24,12,"L_hand_CTL")