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.
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.
co[0]
and co[1]
like co.x
(frame) and co.y
(value). The action associated with an object is accessible via Object.animation_data.action
. Note that both animation_data
and action
can be None
.
$\endgroup$