-
Notifications
You must be signed in to change notification settings - Fork 190
Baking from the Command Line
It is possible to run a FLIP Fluids simulation from the command line without opening the Blender interface. This document will detail how to bake your .blend file simulation from the command line. You will need to have basic knowledge of how to use your OS command line utility to follow this document.
The FLIP Fluids Helper > Command Line Tools menu can help you automatically set up command line baking or rendering.
This method will bake your simulation exactly as if you had pressed the Bake operator within the the Blender interface. That means that if you have a paused simulation, this method will resume the simulation from the last computed frame!
First, you will need to create a very simple Python script to tell Blender to begin baking the FLIP Fluids simulation. You may save this script as run_simulation.py
:
import bpy
bpy.ops.flip_fluid_operators.bake_fluid_simulation_cmd()
Next, you will run Blender from the command line and tell it to run the above script in your simulation blend file. Open your command line utility and run the following command:
blender --background file.blend --python run_simulation.py
Your simulation should now be running! The addon will display simulation progress to the command line.
Here is an example of how to use the command in the above section on the Windows operating system using CMD. Let's assume that:
- Your Blender executable is located here:
C:\Program Files\Blender Foundation\Blender\blender.exe
- Your simulation file is located here:
C:\Users\Ryan\Documents\my_simulation.blend
- Your simulation script is located here:
C:\Users\Ryan\Documents\run_simulation.py
Then your fully formed command to bake the simulation would be:
"C:\Program Files\Blender Foundation\Blender\blender.exe" --background "C:\Users\Ryan\Documents\my_simulation.blend" --python "C:\Users\Ryan\Documents\run_simulation.py"
You can also reset a simulation from the command line! You would run the same command as in the above section except that you would use this Python script instead:
import bpy
bpy.ops.flip_fluid_operators.reset_bake()
- For instructions on how to render a simulation from the command line, see this document: Rendering from the Command Line.
- For more information on using Blender from the command line, see the Blender Command Line documentation.