Animating mesh-deformation using python

Hi, I have just been into blender for a few days, but I am very impressed! I spec. like the python scripting.

Say I have some simulated or sampled ocean surface elevation data that I would like to animate in Blender. I have successfully loaded the initial mesh, and I am wondering about were I go from here.

I know how to create a IPO curve for an object and modify this with python. But what about my vertices? Say I only have a sampling frequency of 2-3 Hz (2-3 samples per second), but i want to a smooth motion (with about 25 fps). I would prefeer some kind of interpolation for the position of each vertex, but to assosiate an IPO-curve to each vertex is not possible. Any suggestions?

Is there no other way but to update each vertex at each frame?

You could make your script import the data, then create shape keys for your mesh defining the ‘samples’. These shape keys need to be set to show at different frames so that they can be interpolated between.


Hmm, interesting. I only knew about basic ipo-curves and armature, but shape keys looks to be exactly what i need.

Thats great, thanks.

I have been looking into this now, and i have runned into a problem. I can create shape keys to my mesh (using ob.insertShapeKey() ), but i can not figure out how to set their value. Really, i only need to do this the for the first key (or second), so that my objects ipo-list will not be empty.

So, if i have a non-empty IPO-list for my keys, i can easily add more keys and set their values via their ipo-curve. However, i do not know how to initialize the first shape key value, so my ipo-list will allways be empty. (see my dilemma :slight_smile: )

Any suggestions?

By the way, i am using Mesh in my script, not NMesh.

You might get more helpful responses to your questions if you post this in the Python and Plugins forum.