How to move keyframes using Python?

by Einar   Last Updated April 16, 2019 08:15 AM

Is there a way to move a keyframe using Python (change the frame at which the keyframe is set)?

The keyframe already exists. I need to access it and move it, with the script.

Tags : python keyframes


Answers 2


This is not hard:

bpy.data.actions[aname].fcurves[i].keyframe_points[j].co[0] = fr1

The tricky part is picking the right fcurve[i] and keyframe_points[j] if there are more than one. You'll have to check fcurve[i].data_path and (if it's a vector data_path like location or rotation*) fcurve[i].array_index to make sure you're altering the right fcurve.

Mutant Bob
Mutant Bob
January 28, 2015 16:23 PM

I need more hel`

  1. enter code here

`

user84383
user84383
April 16, 2019 07:26 AM

Related Questions


Updated April 04, 2015 15:06 PM

Updated June 16, 2015 07:06 AM

Updated March 22, 2017 08:15 AM

Updated July 13, 2015 13:06 PM

Updated February 04, 2018 19:15 PM