0
$\begingroup$

blenderers! I want to write a Python script to simulate two clothes being dropped on top of a cube. Here are the steps that I want to take:

  1. I want to drop the first cloth and simulate the physics for 200 frames. (frame 1 to 200)
  2. Then, I want to freeze the cloth as a solid hard object.
  3. The second piece of cloth is now added. It will drop on top of the first cloth (which is now frozen) and the cube. The simulation will continue for 200 more frames (frame 201 until 400)
  4. Then, I want to freeze the second cloth as a solid hard object, just like the first cloth.

I have many problems in doing so. Here are my main concerns:

  1. properly managing the start_frame and end_frame when baking, and the cached object memory
  2. changing modifiers from cloth to a solid static mesh creates more issues.
  3. Is it possible to bake the result after step 2, view it, and then continue steps 3 and 4, and then continue baking the rest of the model?

Would you please guide me on how such a procedure is possible? I couldn't find relevant material anywhere online. Your help is greatly appreciated <3

$\endgroup$
3
  • 2
    $\begingroup$ "1. properly managing the start_frame and end_frame when baking, and the cached object memory" - Don't. Just apply your cloth modifier and move back to the first frame. "2. changing modifiers from cloth to a solid static mesh creates more issues." - What are the issues? "3. Is it possible to bake the result after step 2" - yes, of course, just stop the script there and run another after you view it? It seems you have a specific job to do and ask for a step-by-step tutorial, but this is not how BSE works :) Take a look here: blender.stackexchange.com/tour $\endgroup$ Commented Jun 9 at 22:16
  • $\begingroup$ To "freeze" the cloth and make a static mesh, you just need to apply the Cloth modifier. Maybe make a backup or work copy first. For the backup copy, you can disable the Cloth modifier with the monitor icon right next to its name (or scripted: object.modifiers["Cloth"].show_viewport = False). If you want to have a collision of the static cloth 1 and the simulated cloth 2 you also need to add a Collision modifier on cloth 1 after "freezing" it. $\endgroup$
    – Blunder
    Commented Jun 12 at 17:47
  • $\begingroup$ Also good to know: there are several application handlers. Check out the object_bake_xxxxxx ones to deal with the baking background job. If you want to have a quick preview you can do a "rewind" (set frame to 1) and use the frame_change_post handler to stop at a given frame number so the simulation doesn't loop forever and you can check the final result. $\endgroup$
    – Blunder
    Commented Jun 12 at 17:53

0

You must log in to answer this question.

Browse other questions tagged .