Insert key on empty animcurve node

I’m trying to set up an animcurve with 3 keys via script (PyMEL). I have done a ton of searching and cannot find a way to set a keyframe on an empty animCurve node. I can’t even figure out a way to do it through the UI, only way is to key some existing attribute and steal the anim curve node. Don’t tell me I’m going to have to create a temp transform node, key it, and then take the animCurve node… there must be a command to add a key? Any help is appreciated.

you can create animation curves with the “createNode” command. You’ll need to know which type of animation Curve you’ll need ahead of time (there are about half a dozen different types). You’ll also have to connect the newly created animation curve’s output to whatever attribute to you want animated.

here is a code snippet from a script I wrote to generate sine waves.

        
animCurve = cmds.createNode('animCurveTU', name='sineWave#')
        
cmds.setKeyframe(animCurve, t=0, v=0, itt='flat', ott='flat')
cmds.setKeyframe(animCurve, t=period, v=0, itt='flat', ott='flat')
cmds.setKeyframe(animCurve, t=(period/2), v=amplitude, itt='flat', ott='flat')

Bringing back an old thread here, but I’m in the same boat as poLLos. How the heck do you add keyframes via vanilla python/Maya on an animCurveUU? Having a hard time figuring this out.

I got it working sort of using cmds.setDrivenKeyframe, but it ended up created a few unnecessary nodes and required an extra driven node to point to. Any help would be appreciated.

Recap. How to add keyframes to a animCurveUU node (to be used to drive fresnel curves of materials whilst being time independent).

Thank you.

Well… I found a gem moments after posting here (believe me, I’ve been hunting for an answer for a while now)

http://www.ngreen.org/portfolio/animcurvetb.html

Just looked through the source code and the answer was using setKeyFrame (properly for an animeCurveUU)-

cmds.setKeyframe(animCurve, float=float(1), value=float(1))

Ignore me. :smiley: Thanks.