goo.cell

class goo.cell.Cell[source]

Bases: BlenderObject

A cell.

Cells are represented in Blender by mesh objects. They can interact with physics by adding Blender modifiers, and the forces that influence its motion is determined by an associated collection.

Parameters:

obj – Blender object to be used as the representation of the cell.

Variables:

celltype (CellType) – The cell type to which the cell belongs.

COM(local_coords: bool = False) mathutils.Vector[source]

Calculates the center of mass of the cell.

Parameters:

local_coords (bool) – if True, coordinates are returned in local object space rather than world space.

Returns:

The vector representing the center of mass of the cell.

Return type:

mathutils.Vector

add_effector(force: Force | ForceCollection)[source]

Add a force or a collection of forces that affects this cell.

Parameters:

force (Force | ForceCollection) – The force or collection of forces to add.

add_force(force: Force)[source]

Add a force that affects this cell.

Parameters:

force (Force) – The force to add.

area() float[source]

Calculates the surface area of the cell.

Returns:

The surface area of the cell.

Return type:

float

aspect_ratio() float[source]

Calculates the aspect ratio of the cell.

The aspect ratio is the ratio of the major axis to the minor axis of the cell.

Returns:

The aspect ration value for a cell.

Return type:

float

property cloth_mod: bpy.types.ClothModifier | None

The cloth modifier of the cell if it exists, otherwise None.

property collision_mod: bpy.types.CollisionModifier | None

The collision modifier of the cell if it exists, otherwise None.

property color: tuple[float, float, float]

Color of the cell

compactness() float[source]

Calculates the compactness of the cell.

Compactness provides a measure of how efficiently the volume is enclosed by the surface area, calculated as .

Returns:

The compactness value for the cell.

Return type:

float

copy()[source]
disable_physics()[source]

Disable the physics simulation for the cell.

This function disables the physics simulation for the cell by storing the current modifier settings, removing all modifiers, and disabling any adhesion forces.

Raises:

RuntimeError – If physics is not enabled.

divide(division_logic)[source]

Divide the cell into two daughter cells.

enable_physics()[source]

Enable the physics simulation for the cell.

This function re-enables the physics simulation for the cell by recreating the modifier stack from stored settings, updating the cloth modifier, and enabling any adhesion forces.

Raises:

RuntimeError – If physics is already enabled.

get_modifier(type) bpy.types.Modifier | None[source]

Retrieves the first modifier of the specified type from the underlying object representation of the cell.

Parameters:

type – The type of the modifier to search for.

Returns:

The first modifier of the specified type if found, otherwise None.

Return type:

bpy.types.Modifier | None

Link gene to property, so that changes in the gene will cause changes in the physical property.

major_axis() Axis[source]

Returns the major axis of the cell.

Return type:

Axis

property mat
property metabolites
minor_axis() Axis[source]

Returns the minor axis of the cell.

Return type:

Axis

move(direction: tuple | None = None, strength=None)[source]

Set move location. If direction is not specified, then use previous direction as reference.

Parameters:

direction (tuple | None)

property name
property obj_eval: bpy.types.ID

The evaluated object.

property pressure: float

Internal pressure of the cell.

radius()[source]

Calculate the radius based on the major and minor axes of the cell.

recenter(origin=True, forces=True)[source]

Recenter cell origin to center of mass of cell, and center forces to that same origin.

recolor(color: tuple[float, float, float]) None[source]

Recolors the material of the cell.

This function changes the diffuse color of the cell’s material to the specified color while preserving the alpha value. If the material uses nodes, it also updates the ‘Base Color’ input of any nodes that have it.

Parameters:

color (tuple[float, float, float]) – A tuple (r, g, b) representing the new color to apply.

Return type:

None

remesh(voxel_size: float = 0.45, smooth: bool = True) None[source]

Remesh the underlying mesh representation of the cell.

Remeshing is done using the built-in voxel_remesh().

Parameters:
  • voxel_size (float) – The resolution used for the remesher (smaller means more

  • smooth (polygons).) – If true, the final cell faces will appear smooth.

Return type:

None

Note

The voxel_remesh() operator is used to remesh the cell. This operator is faster than using the remesh modifier, but it can only be used on objects with a mesh data type.

remove_effector(force: Force | ForceCollection)[source]

Remove a force or a collection of forces that affects this cell.

Parameters:

force (Force | ForceCollection) – The force or collection of forces to remove.

sav_ratio() float[source]

Calculates the surface area: volume (SA:V) ratio of the cell.

Returns:

V ratio of the cell.

Return type:

The SA

sphericity() float[source]

Calculates the sphericity of the cell.

The sphericity is a measure of how closely a cell resembles a perfect sphere. It is calculated as the ratio of the surface area of a sphere with the same volume as the cell to the surface area of the cell.

Returns:

The sphericity value for the cell.

Return type:

float

step_grn(diffsys: DiffusionSystem | None = None, dt=1)[source]

Calculate and update the metabolite concentrations of the gene regulatory network after 1 time step.

Parameters:

diffsys (DiffusionSystem | None)

step_growth(dt=1)[source]
property stiffness: float

Stiffness of the membrane of the cell.

vertices(local_coords: bool = False) list[mathutils.Vector][source]

Returns the vertices of the mesh representation of the cell.

Parameters:
  • local_coords (bool) – if True, coordinates are returned in local object space

  • space. (rather than world)

Returns:

List of coordinates of vertices.

Return type:

list[mathutils.Vector]

volume() float[source]

Calculates the volume of the cell.

Returns:

The signed volume of the cell (with physics evaluated).

Return type:

float

class goo.cell.CellPattern[source]

Bases: object

Builders of different cell parts. The CellType class takes these patterns in order to create new cells.

build_forces(homo_adhesion_strength: int, homo_adhesion_collection: ForceCollection, motion_strength: int, hetero_adhesion_strengths: dict[CellType, int], hetero_adhesion_collections: dict[CellType, tuple[ForceCollection]])[source]
Parameters:
build_growth_controller(growth_type: Growth, growth_rate: float = 1, target_volume=30)[source]
Parameters:
  • growth_type (Growth)

  • growth_rate (float)

build_network(circuits=None, metabolites=None)[source]
build_obj(name, loc, color=None, **mesh_kwargs)[source]
build_physics(physics_constructor=None)[source]
circuits = []
color = None
initial_pressure = None
mesh_kwargs = {}
metabolites = {}
physics_constructor = None
reset()[source]
retrieve_cell()[source]

Retrieves constructed cell, links cell to the scene, and resets the director.

set_obj(name, obj)[source]
class goo.cell.CellType(name, pattern='standard', target_volume=30, homo_adhesion_strength=2000, hetero_adhesion_strengths={}, motion_strength=0, **kwargs)[source]

Bases: object

A cell type.

Cell types are represented in Blender by collection. Cells of the same cell type interact through homotypic adhesion forces, and interact with cells of different cell types through heterotypic adhesion forces. Cell types have default mesh creation settings (including color) and default physics settings (including cloth, collision, homotypic adhesion forces, and motion forces).

Parameters:
  • name – The name of the cell type.

  • physics_enabled – Whether cells of this cell type are responsive to physics.

Variables:
  • homo_adhesion_strength (int) – Default homotypic adhesion strength between cells of this type.

  • motion_strength (int) – Default motion strength of cells of this type.

create_cell(name, loc, color: tuple | None = None, physics_enabled: bool = True, physics_constructor: PhysicsConstructor | None = None, growth_enabled: bool = True, growth_type: Growth = Growth.LINEAR, growth_rate: float = 1, target_volume: float | None = None, genes_enabled: bool = True, circuits: list[Circuit] | None = None, metabolites: dict[str, float] = {}, obj: bpy.types.Object | None = None, **mesh_kwargs)[source]
Parameters:
  • color (tuple | None)

  • physics_enabled (bool)

  • physics_constructor (PhysicsConstructor | None)

  • growth_enabled (bool)

  • growth_type (Growth)

  • growth_rate (float)

  • target_volume (float | None)

  • genes_enabled (bool)

  • circuits (list[Circuit] | None)

  • metabolites (dict[str, float])

  • obj (bpy.types.Object | None)

static default_celltype() CellType[source]

Get the default cell type.

Return type:

CellType

set_hetero_adhesion_strength(other_celltype: CellType, strength: float)[source]
Parameters:
  • other_celltype (CellType)

  • strength (float)

class goo.cell.PropertyUpdater(getter, transformer, setter)[source]

Bases: object

A class that updates a property of a cell based on a gene value.

Parameters:
  • getter – The getter function.

  • transformer – The transformer function.

  • setter – The setter function.

Variables:
  • getter – A function that retrieves the gene value from a diffusion system.

  • transformer – A function that transforms the gene value into a property value.

  • setter – A function that sets the property value of a cell.

class goo.cell.SimplePattern[source]

Bases: CellPattern

A cell type that is reduced in complexity for faster rendering.

color = (0.5, 0.5, 0.5)
physics_constructor = <goo.utils.PhysicsConstructor object>
Parameters:

bobj (BlenderObject)

class goo.cell.StandardPattern[source]

Bases: CellPattern

color = (0.007, 0.021, 0.3)
initial_pressure = 12
mesh_kwargs = {}
physics_constructor = <goo.utils.PhysicsConstructor object>
Parameters:

bobj (BlenderObject)

class goo.cell.YolkPattern[source]

Bases: CellPattern

A larger cell type used for modeling embryonic yolks.

color = (0.64, 0.64, 0.64)
mesh_kwargs = {'size': 10, 'subdivisions': 4}
physics_constructor = <goo.utils.PhysicsConstructor object>
Parameters:

bobj (BlenderObject)

goo.cell.create_direction_updater(cell: Cell, gene: Gene)[source]

Create a direction updater that links a gene to the direction of a cell.

Parameters:
  • cell (Cell) – The cell object.

  • gene (Gene) – The gene that is linked to the direction.

goo.cell.create_motion_strength_updater(cell: Cell, gene: Gene, gscale=(0.5, 2), pscale=(0, 1))[source]

Create a motion strength updater that links a gene to the motion strength of a cell.

Parameters:
  • cell (Cell) – The cell object.

  • gene (Gene) – The gene that is linked to the motion strength.

  • gscale – The scale of the gene values.

  • pscale – The scale of the motion strength values.

Returns:

A PropertyUpdater object that can be used to update the motion strength.

goo.cell.create_scalar_updater(cell: Cell, gene: Gene, property, relationship='linear', gscale=(0, 1), pscale=(0, 1))[source]

Create a scalar updater that links a gene to a scalar property of a cell.

Parameters:
  • cell (Cell) – The cell object.

  • gene (Gene) – The gene that is linked to the property.

  • property – The property that is linked to the gene.

  • relationship – The relationship between the gene and the property.

  • gscale – The scale of the gene values.

  • pscale – The scale of the property values.

Returns:

A PropertyUpdater object that can be used to update the property.

goo.cell.declare_settings(mod: bpy.types.bpy_struct, settings: dict)[source]

Recursively apply stored settings to a Blender modifier.

Parameters:
  • mod (bpy.types.bpy_struct) – The Blender modifier to which the settings are applied.

  • settings (dict) – A dictionary containing the settings.

goo.cell.store_settings(mod: bpy.types.bpy_struct) dict[source]

Store the settings of a Blender modifier in a dictionary.

Parameters:

mod (bpy.types.bpy_struct) – The Blender modifier.

Returns:

A dictionary with the stored settings.

Return type:

dict