I’m using Blender to animate STL objects, by importing tabulated data and inserting keyframes for each location and orientation. For small simulations, this works fine. However, for larger simulations, e.g. ~20,000 rows of data, Blender uses to much time (not responding)…
Is there a better way to do this, or am I doing it wrong ?
## after data-import, object-calls and setting first and last frame-nums of the scene
for i in range(0,n):
obj.location = (x[i], y[i], z[i])
obj.keyframe_insert(data_path = 'location')
obj.rotation_euler = (rx[i], ry[i], rz[i])
obj.keyframe_insert(data_path = 'rotation_euler')
Yeah, in fact the
scene.frame_set(i) forces a scene update which can be very long for 20 000 rows.
What you could do is removing this line, and use the frame param in the
obj.keyframe_insert () function (I don’t remeber exactly the name but there is a param for specifying the frame where to insert keyframe)
See you ++
Yes, you’re right, after data path you just add frame number, like this:
obj.keyframe_insert(data_path = 'location', frame = 1)
Thanks for your reply tricotou. I tried removing the
scene.frame_set() function, and implemented
obj.keyframe_insert(data_path = 'location', frame = i), but unfortunately, it did not make much difference.
I guess this method of animating objects is suitable only for small sets of data.