I am doing a cloth simulation. After baking I realize that the required simulation comes to an end in the 40th frame itself but it keeps simulating till the 250th frame. Now I am able to change the end-frame of this simulation in the GUI simply by changing the value in the end frame box in the timeline. I tried to implement this from script by the following commands:
bpy.context.scene.frame_start = 1
bpy.context.scene.frame_end = 40
But this is not working. When I run this, the end frame in the timeline still is 250 and Blender is baking all the 250 frames. So, to sum it up, how can I set the start frame and end frame for a bake from script (not GUI in blender)?
bpy.context.active_object.modifiers['Cloth'].point_cache.frame_end, api link: https://www.blender.org/api/blender_python_api_current/bpy.types.PointCache.html?highlight=end#bpy.types.PointCache.frame_end – p2or Jan 22 '16 at 14:10