1
$\begingroup$

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?

$\endgroup$
4
  • $\begingroup$ Possibly related simply write vert co's and face indices to text block. $\endgroup$
    – batFINGER
    Commented Mar 22, 2018 at 18:11
  • $\begingroup$ You can use some hidden mesh objects to store vertex positions. $\endgroup$
    – lemon
    Commented Mar 23, 2018 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
    Commented Mar 23, 2018 at 11:40
  • $\begingroup$ @batFINGER Simple but effective! Thanks. $\endgroup$
    – cjorssen
    Commented Mar 23, 2018 at 11:41

1 Answer 1

2
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .