A sample to get animate points une roto node :

views = nuke.views()
print views

rotoNode = nuke.selectedNode()
print rotoNode
rootLayer = rotoNode['curves'].rootLayer
print rootLayer
for shape in rootLayer:
    print shape
    for point in shape:
        print point
        view = views[0]
        print point.center
        print point.leftTangent
        print point.rightTangent

        listControlPointKeyTimes =  point.center.getControlPointKeyTimes()
        print listControlPointKeyTimes

        for keyTime in listControlPointKeyTimes:
            print point.center.getPosition( keyTime, view)
            print point.leftTangent.getPosition( keyTime, view)
            print point.rightTangent.getPosition( keyTime, view)

            print point.featherCenter.getPosition( keyTime, view)
            print point.featherLeftTangent.getPosition( keyTime, view)
            print point.featherRightTangent.getPosition( keyTime, view)

Yann


2011/6/15 Pete O'Connell <pedrooconn...@gmail.com>

> Hello Nuke Python enthusiasts. I am trying to make a python list of
> every keyframe for any given selected node (based on the first
> animation curve the python code finds). The code below works for every
> kind of keyframe except the Bezier node's "shape" knob and the
> RotoPaint node's "key" knob. I guess it's because those knobs don't
> have "animations()" in the simple numeric sense? So is there any way
> to get a list of Bezier or Roto keyframes (without having to resort to
> looping through each frame)?
>
>
>
> #this code works on a transform node's translate knob keyframes but
> not on a Bezier's shape knob keyframes :(
> theSelectedNode = nuke.selectedNode()
> theListOfFrames = []
> for aKnob in theSelectedNode.knobs():
>   if theSelectedNode[aKnob].isAnimated():
>           anAnimationCurve = theSelectedNode[aKnob].animations()[0]
> for i in range(len(anAnimationCurve.keys())):
>    theListOfFrames.append(anAnimationCurve.keys()[i].x)
>
> Pete
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to