Scripting - modification of an f curve

Just started to play with scripting and wanted to know if anyone has managed to modify an f curve’s shape using a script. I’ve started with just a cube with a couple of keyframes changing the scale. I want a rapidly accelerated change - easy to achieve in the graph editor by moving handles and altering the curve.

Motivation; It will be useful when I have a large number of objects.

A workaround will be lots of keyframes but I was hoping there might be a more elegant solution :slight_smile:

Thanks in advance!

Hello,

Yes that’s definitively possible.

print(bpy.context.selected_objects[0].animation_data.action.fcurves[0].keyframe_points[0].handle_left)

Will print the coordinates of the left handle, of the first keyframe, of the first Fcurve of the action of the first selected object :smiley:

print(bpy.context.selected_objects[0].animation_data.action.fcurves[0].data_path)

Will print what the curve is corresponding to (ex : “location”)

Now you need to make your own script to iterate through that and do the hard work :smiley:

Good Luck !

1 Like

Yikes! Thank you for the reply. It seemed like a good idea at the time - I think it may prove beyond me but I’ll give it a go.

1 Like