[Python] Need help creating curves based on set keyframe positions (maya/python)

Discussão em 'Python' iniciado por Stack, Agosto 11, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to create a tool in maya using python that creates curves based on an objects keyframe positions. The end goal is to create different animation curves that the object can blend between so as to create adjustments to the main animation. Here's what I have so far. It creates a curve that follows the path of motion but it's not based on keyframe position. Any help would be really appreciated.

    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")

    Continue reading...

Compartilhe esta Página