1

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)?

p2or
  • 15,860
  • 10
  • 83
  • 143
Sum-Al
  • 567
  • 7
  • 18
  • Do you want to adjust the timeline or cloth cache start and end value? – p2or Jan 22 '16 at 13:41
  • 1
    related: http://blender.stackexchange.com/a/6742/3710. In order to adjust the cache end value via python, you can try: 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
  • I don't know which one is better but both do the job for me. I just want calculation to be done for 40 or 50 frames. I don't even use the timeline beyond that for this simulation. So, I thought changing the end_frame in timeline will do the job for me. But can you please tell me the difference between two? What would happen if I change end point of cloth cache vs timeline? – Sum-Al Jan 22 '16 at 14:25
  • 2
    Further info you can find here: http://blender.stackexchange.com/questions/46039/how-can-i-access-cloth-properties-via-python/46114#46114 – p2or Feb 05 '16 at 15:49

0 Answers0