I am working on a script to generate scenes and render them.
Since I want my objects to fall on a plane before rendering, what I want to do is bake the rigid body simulation, go to the last frame and render the scene.
I am baking the simulation like this
for i in range(0, 1000):
generate_scene(i)
#bake
bpy.context.scene.rigidbody_world.point_cache.frame_start = 0
bpy.context.scene.rigidbody_world.point_cache.frame_end = 100
bpy.ops.ptcache.bake_all(bake=True)
bpy.context.scene.frame_set(100)
render_scene(i)
At the end of the process my timeline looks like this:
As you can see the simulation was only baked about till frame 25.
This of course results in a incorrect render.
How can I bake all the frames and render only when I am sure that the bake is done?