I am animating a scene with the help of bpy.app.handlers.frame_change_pre hook.

I'd like to be able to store the "initial state" (vertex position in this case) in some Python objects so that I can reset the animation after the changes made by the handler and even if I overwrite my .blend file with my "changed" scene. As a matter of fact, the next time I load my file, the initial state will be the "changed" one.

So, my question is, more or less, can I save Python objects in my .blend file?

  • $\begingroup$ Possibly related simply write vert co's and face indices to text block. $\endgroup$
    – batFINGER
    Mar 22 '18 at 18:11
  • $\begingroup$ You can use some hidden mesh objects to store vertex positions. $\endgroup$
    – lemon
    Mar 23 '18 at 6:50
  • $\begingroup$ @lemon Great idea. Generate a duplicate of the initial state and move it to an other layer. Thanks! Would you mind turning your comment into an answer so that I can accept it? $\endgroup$
    – cjorssen
    Mar 23 '18 at 11:40
  • $\begingroup$ @batFINGER Simple but effective! Thanks. $\endgroup$
    – cjorssen
    Mar 23 '18 at 11:41

A possibility is to use some hidden mesh (or other native Blender object type) to store the wanted data.

Also, as indicated by @batFinger in comments, you can use text blocks as a more versatile solution, if needed.


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.