Function reference
Attribute
For interacting with attributes on meshes
| named_attribute | Read the values of a named attribute into a numpy array. |
| store_named_attribute | Write values to a named attribute on the object, creating it if needed. |
| remove_named_attribute | Remove a named attribute from an object. |
| list_attributes | List the names of the attributes on an object, sorted alphabetically. |
| AttributeDomains | Enumeration of attribute domains in Blender. |
| AttributeTypes | Enumeration of attribute types in Blender. |
| AttributeArray | A numpy array of an attribute’s values that writes changes back to Blender. |
| Attribute | Low-level wrapper around a Blender attribute with explicit reads and writes. |
| attribute.guess_atype_from_array | Infer the attribute type for an array from its shape and dtype. |
Typed arrays
Attribute arrays that state the attribute type they are stored as, wrapping data as db.vec3(data) and checking the type when read as bob["name", db.vec3]
| float32 | A FLOAT attribute: one float32 value per element. |
| vec2 | A FLOAT2 attribute: a 2D float32 vector per element. |
| vec3 | A FLOAT_VECTOR attribute: a 3D float32 vector per element. |
| vec4 | A FLOAT4 attribute: a 4D float32 vector per element (Blender 5.2+). |
| color | A FLOAT_COLOR attribute: a linear RGBA float32 color per element. |
| srgb | A FLOAT_COLOR attribute as sRGB RGBA float32 colors. |
| color8 | A BYTE_COLOR attribute: an sRGB RGBA uint8 color per element. |
| quat | A QUATERNION attribute: a (w, x, y, z) float32 rotation per element. |
| mat4 | A FLOAT4X4 attribute: a row-major 4x4 float32 matrix per element. |
| int32 | An INT attribute: one int32 value per element. |
| int8 | An INT8 attribute: one int8 value per element. |
| ivec2 | An INT32_2D attribute: a 2D int32 vector per element. |
| sivec2 | An INT16_2D attribute: a 2D int16 vector per element. |
| boolean | A BOOLEAN attribute: one bool per element. |
| string | A STRING attribute: one string per element. |
Collections
Working with collections in Blender
| create_collection | Create a new Blender collection or get an existing one. |
| move_to_collection | Move one or many objects into a target collection. |
Objects
| create_object | Create a new Blender mesh object. |
| create_mesh_object | Create a new Blender mesh object. |
| create_curves_object | Create a new Blender Curves object (the hair curves type, not the legacy Curve type). |
| create_grease_pencil_object | Create a new Blender grease pencil object. |
| create_pointcloud_object | Create a new Blender point cloud object. |
| create_bob | Create a BlenderObject wrapper around a new Blender mesh object. |
| evaluate_object | Return the object with its modifiers evaluated. |
| GeometrySet | Access the evaluated geometry of an object (bpy.types.GeometrySet). |
| BlenderObject | A convenience class for working with Blender objects. |
| AttributeDomainView | Dictionary-style access to the attributes on a single domain of an object. |
| InstanceDomainView | Read-only dictionary-style access to the INSTANCE domain of evaluated geometry. |
| Drawing | The points and strokes of a grease pencil drawing: one layer on one keyframe. |
| Drawings | The drawings of a grease pencil’s layers, by layer name. |
| BlenderObjectAttribute | Minimal base class for Blender objects with attribute access. |
| BlenderObjectBase | Minimal base class for Blender objects with name and object access. |
Errors
Exceptions raised by databpy, which all inherit from DatabpyError
| DatabpyError | Base class for all errors raised by databpy. |
| NamedAttributeError | Base exception for all attribute-related errors in databpy. |
| AttributeNotFoundError | Exception raised when a named attribute doesn’t exist. |
| AttributeMismatchError | Exception raised when data doesn’t fit an attribute. |
| LinkedObjectError | Error raised when a wrapper can no longer find the Blender object it is linked to. |
Utilities
Typed helpers that check for None or narrow data-block types, plus general utilities
| require | Return the given value, raising an error if it is None. |
| require_data | Return the object’s data-block, checked to be of the given type. |
| mesh_data | Return the object’s data-block, checked to be a Mesh. |
| curves_data | Return the object’s data-block, checked to be a Curves. |
| pointcloud_data | Return the object’s data-block, checked to be a PointCloud. |
| volume_data | Return the object’s data-block, checked to be a Volume. |
| active_scene | Return the active scene, raising an error if there is none. |
| active_object | Return the active object, raising an error if there is none. |
| centre | Calculate the weighted centroid of the vectors. |
| lerp | Linearly interpolate between two values. |
Nodes (deprecated)
Deprecated and removed in databpy 0.13.0, as node groups are handled by nodebpy (https://pypi.org/project/nodebpy/). Importing databpy.nodes warns with a FutureWarning.
| nodes.new_tree | |
| nodes.swap_tree | |
| nodes.custom_string_iswitch | Creates a node group containing a Index Switch node with all the given values. |
| nodes.append_from_blend | Append a Geometry Nodes node tree from the given .blend file |
| nodes.new_socket | Create a new input or output socket on the interface of the node tree. |
| nodes.tree_interface | Return the interface of a node tree, raising an error if it has none. |
| nodes.input_socket | Get an input socket of a node by index or name. |
| nodes.output_socket | Get an output socket of a node by index or name. |
| nodes.socket_value | Return the default value of a socket. |
| nodes.set_socket_value | Set the default value of a socket. |
| nodes.MaintainConnections | |
| nodes.DuplicatePrevention | Context manager to cleanup duplicated node trees when appending node groups |