0
$\begingroup$

I am trying to use blender to animate spheres I am controlling with a python script. I already have the position data I want for each sphere at each frame of the animation. I don't need keyframes with their interpolation curves and all that overhead. Is there any way to just update the position of objects at each frame without a keyframe and fcurve between every frame?

$\endgroup$
1
$\begingroup$

fcurves are how blender stores animation data. That is what it is for and you should just use it. If you are defining the animated values every frame then the interpolation will be of no concern. If your values only change on some frames then set the interpolation to be constant.

For creating the animation by script that would be

obj.location.x = 12.23
obj.keyframe_insert('location', index=0, frame=1)

If you really want to manually animate something without animation data, you should be able to use handlers to run a function every frame.

def myframe_change(scene):
    if scene.frame_current == 1:
        scene.objects['Cube'].location.x = 12.23

bpy.app.handlers.frame_change_pre.append(myframe_change)

If you are concerned about overhead, I think you will find running a python script every frame will add more overhead than using native animation data.

$\endgroup$
  • $\begingroup$ I stopped reading after your premise. Fcurves are not how blender stores animation data. They are how it interpolates between stored steps in animation. If the framework exists to animate with them, then facilitating animating without them, aka, frame by frame, is a trivial effort, and requires less overhead in animation generation. It does seem like blender has chosen not to have an on off switch for fcurves, and worse, theyve made it a mandatory step in the process of storing keyframes (again totally unnecessary in some cases). I just wanted to double check. $\endgroup$ – Job Guidos Jul 8 at 7:43
  • $\begingroup$ fcurves are how blender stores animation data is correct. As stated in the answer constant fcurves don't interpolate. Your statement is not always valid. $\endgroup$ – Leander Aug 6 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.