Baking from the Command Line

Ryan Guy edited this page Aug 6, 2018 · 1 revision

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.

Baking a Simulation

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.

Example Command

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:

  1. Your Blender executable is located here:
    C:\Program Files\Blender Foundation\Blender\blender.exe
  2. Your simulation file is located here:
    C:\Users\Ryan\Documents\my_simulation.blend
  3. 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"

Resetting a Simulation

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()
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.