goo.simulator

class goo.simulator.Render(value)

Bases: Enum

An enumeration.

MP4 = 3
PNG = 1
TIFF = 2
class goo.simulator.Simulator(celltypes: List[CellType | Cell] = [], diffsystems: DiffusionSystem = [], time: int = 250, physics_dt: int = 1, molecular_dt: int = 1)[source]

Bases: object

A simulator for cell-based simulations in Blender.

Parameters:
  • cells (List[Cell]) – List of cells.

  • time (List[int]) – Start and end frames.

  • physics_dt (int) – Time step for physics simulation.

  • molecular_dt (int) – Time step for molecular simulation.

  • celltypes (List[CellType | Cell])

  • diffsystems (DiffusionSystem)

add_handler(handler: Handler, celltypes: list[CellType] | None = None, diffsystem: DiffusionSystem | None = None)[source]

Add a handler to the simulation.

Parameters:
add_handlers(handlers: list[Handler])[source]

Add multiple handlers to the simulation.

Parameters:

handlers (list[Handler])

enable_addon(addon)[source]

Enable an addon in Blender.

extend_scene()[source]

Extend the scene to allow cloth physics to pass the default 250 frames.

get_cells(celltypes=None)[source]

Get all cells in the simulation.

get_cells_func(celltypes=None)[source]

Get a function that returns all cells in the simulation.

get_diffsystem_func(diffsystem=None)[source]

Get a function that returns the diffusion system.

render(frames: List[int] | range | None = None, path: str | None = None, camera=False, format: Render = Render.PNG)[source]

Render the simulation in the background without updating the 3D Viewport in real time. If a camera is specified, the frames will be rendered with it, otherwise the frames will be rendered in the 3D Viewport. It will updated the scene at the end of the simulation.

Parameters:
  • start (int) – Start frame.

  • end (int) – End frame.

  • path (str) – Path to save the frames.

  • camera (bool) – Render with the camera.

  • format (Render) – Render format: PNG (default), TIFF, MP4.

  • frames (List[int] | range | None)

render_animation(path=None, end=bpy.context.scene.frame_end, camera=False)[source]

Render the simulation as an animation.

run(end=bpy.context.scene.frame_end)[source]

Run the simulation in the background without updating the 3D Viewport in real time.

Parameters:

end (int) – End frame. Defaults to the last frame of the scene.

set_seed(seed)[source]

Set the random seed for the simulation.

setup_world(seed=1)[source]

Set up the Blender scene for the simulation.

toggle_gravity(on)[source]

Toggle gravity in the scene.