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
- 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.
- 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(gene, property, gscale=(0, 1), pscale=(0, 1))[source]¶
Link gene to property, so that changes in the gene will cause changes in the physical property.
- property mat¶
- property metabolites¶
- 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.
Note
See the Blender API Documentation for evaluated_get(depsgraph).
- property pressure: float¶
Internal pressure 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)
- 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]
- 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:
homo_adhesion_strength (int)
homo_adhesion_collection (ForceCollection)
motion_strength (int)
hetero_adhesion_strengths (dict[CellType, int])
hetero_adhesion_collections (dict[CellType, tuple[ForceCollection]])
- build_growth_controller(growth_type: Growth, growth_rate: float = 1, target_volume=30)[source]¶
- Parameters:
growth_type (Growth)
growth_rate (float)
- circuits = []¶
- color = None¶
- initial_pressure = None¶
- mesh_kwargs = {}¶
- metabolites = {}¶
- physics_constructor = None¶
- 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)
- 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.
- 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.
- 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:
- Returns:
A PropertyUpdater object that can be used to update the property.