goo.handler

class goo.handler.ColorizeHandler(colorizer: Colorizer = Colorizer.PRESSURE, gene: Gene | str | None = None, range: tuple | None = None)[source]

Bases: Handler

Handler for coloring cells based off of a specified property.

Cells are colored on a blue-red spectrum, based on the relative value of the specified property to all other cells. For example, the cell with the highest pressure is colored red, while the cell with an average pressure is colored purple.

Variables:
  • colorizer (Colorizer) – the property by which cells are colored.

  • gene (str) – optional, the gene off of which cell color is based.

Parameters:
run(scene, depsgraph)[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

class goo.handler.Colorizer(value)

Bases: Enum

An enumeration.

GENE = 4
PRESSURE = 1
RANDOM = 3
VOLUME = 2
class goo.handler.DataExporter(path='', options: ~goo.handler.DataFlag = <DataFlag.CELL_CONCENTRATIONS|GRID|SHAPE_FEATURES|CONTACT_AREAS|PRESSURES|VOLUMES|FORCE_PATH|MOTION_PATH|DIVISIONS|TIMES: 1023>)[source]

Bases: Handler

Handler for the reporting and saving of data generated during the simulation.

Parameters:

options (DataFlag)

close()[source]

Close the HDF5 file.

run(scene, depsgraph) None[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

Return type:

None

setup(get_cells: Callable[[], list[Cell]], get_diffsystems: Callable[[], list[DiffusionSystem]], dt) None[source]

Set up the handler.

Parameters:
  • get_cells (Callable[[], list[Cell]]) – A function that, when called, retrieves the list of cells that may divide.

  • dt – The time step for the simulation.

  • get_diffsystems (Callable[[], list[DiffusionSystem]])

Return type:

None

class goo.handler.DataFlag(value)[source]

Bases: Flag

Enum of data flags used by the DataExporter() handler.

Variables:
  • TIMES – time elapsed since beginning of simulation.

  • DIVISIONS – list of cells that have divided and their daughter cells.

  • MOTION_PATH – list of the current position of each cell.

  • FORCE_PATH – list of the current positions of the associated motion force of each cell.

  • VOLUMES – list of the current volumes of each cell.

  • PRESSURES – list of the current pressures of each cell.

  • CONTACT_AREAS – list of contact areas between each pair of cells.

  • CONCENTRATIONS – concentrations of each molecule in the grid system.

ALL = 1023
CELL_CONCENTRATIONS = 512
CONTACT_AREAS = 64
DIVISIONS = 2
FORCE_PATH = 8
GRID = 256
MOTION_PATH = 4
PRESSURES = 32
SHAPE_FEATURES = 128
TIMES = 1
VOLUMES = 16
class goo.handler.DiffusionHandler[source]

Bases: Handler

Handler for simulating diffusion of a substance in the grid in the scene.

Parameters:

diffusionSystem – The reaction-diffusion system to simulate.

run(scene, depsgraph) None[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

Return type:

None

setup(get_cells: Callable[[], list[Cell]], get_diffsystems: Callable[[], list[DiffusionSystem]], dt)[source]

Build the KD-Tree from the grid coordinates if not already built.

Parameters:
class goo.handler.ForceDist(value)

Bases: Enum

An enumeration.

CONSTANT = 1
GAUSSIAN = 3
UNIFORM = 2
class goo.handler.GrowthPIDHandler[source]

Bases: Handler

run(scene, depsgraph)[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

class goo.handler.Handler[source]

Bases: ABC

abstract run(scene: bpy.types.Scene, depsgraph: bpy.types.Depsgraph) None[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene (bpy.types.Scene) – The Blender scene.

  • depsgraph (bpy.types.Depsgraph) – The dependency graph.

Return type:

None

setup(get_cells: Callable[[], list[Cell]], get_diffsystem: Callable[[], DiffusionSystem], dt: float) None[source]

Set up the handler.

Parameters:
  • get_cells (Callable[[], list[Cell]]) – A function that, when called, retrieves the list of cells that may divide.

  • dt (float) – The time step for the simulation.

  • get_diffsystem (Callable[[], DiffusionSystem])

Return type:

None

class goo.handler.NetworkHandler[source]

Bases: Handler

Handler for gene regulatory networks.

run(scene, despgraph)[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

class goo.handler.RandomMotionHandler(distribution: ForceDist = ForceDist.UNIFORM, strength: int = 0, persistence: tuple[float, float, float] = (0, 0, 0))[source]

Bases: Handler

Handler for simulating random cell motion.

At every frame, the direction of motion is is randomly selected from a specified distribution, and the strength is set by the user.

Variables:
  • distribution (ForceDist) – Distribution of random location of motion force.

  • strength (int) – Strength of the motion force.

  • persistence (tuple[float, float, float]) – Persistent direction of motion force.

Parameters:
  • distribution (ForceDist)

  • strength (int)

  • persistence (tuple[float, float, float])

run(scene, depsgraph)[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

class goo.handler.RecenterHandler[source]

Bases: Handler

Handler for updating cell origin and location of cell-associated adhesion locations every frame.

run(scene, depsgraph)[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

class goo.handler.RemeshHandler(freq=1, voxel_size=None, smooth_factor=0.1, sphere_factor=0)[source]

Bases: Handler

Handler for remeshing cells at given frequencies.

Variables:
  • freq (int) – Number of frames between remeshes.

  • smooth_factor (float) – Factor to pass to bmesh.ops.smooth_vert. Disabled if set to 0.

  • voxel_size (float) – Factor to pass to voxel_remesh(). Disabled if set to 0.

  • sphere_factor (float) – Factor to pass to Cast to sphere modifier. Disabled if set to 0.

run(scene, depsgraph)[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

class goo.handler.StopHandler[source]

Bases: Handler

Handler for stopping the simulation at the end of the simulation time.

run(scene, depsgraph)[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.