databpy
  • Home
  • Attributes
  • API
  1. Objects
  2. BlenderObjectBase
  • Function reference
  • Attribute
    • named_attribute
    • store_named_attribute
    • remove_named_attribute
    • AttributeDomains
    • AttributeTypes
    • AttributeArray
  • Collections
    • create_collection
  • Objects
    • create_object
    • create_mesh_object
    • create_curves_object
    • create_pointcloud_object
    • create_bob
    • evaluate_object
    • BlenderObject
    • BlenderObjectBase
    • LinkedObjectError

On this page

  • BlenderObjectBase
    • Attributes
    • Methods
  1. Objects
  2. BlenderObjectBase

BlenderObjectBase

BlenderObjectBase(obj=None)

Minimal base class for Blender objects with attribute access.

This class provides core functionality for storing and accessing named attributes on Blender objects. It can be inherited by other packages that need attribute management without the full BlenderObject feature set.

Attributes

Name Type Description
object bpy.types.Object The wrapped Blender object.
uuid str Unique identifier for this object instance.
name str Name of the Blender object.
position AttributeArray Position attribute of the object’s vertices/points.
data bpy.types.Mesh | bpy.types.Curves | bpy.types.PointCloud The data block associated with this object.
attributes Get the attributes collection of the Blender object.

Methods

Name Description
evaluate Return a version of the object with all modifiers applied.
list_attributes Returns a list of attribute names for the object.
named_attribute Retrieve a named attribute from the object.
remove_named_attribute Remove a named attribute from the object.
store_named_attribute Store a named attribute on the Blender object.

evaluate

BlenderObjectBase.evaluate()

Return a version of the object with all modifiers applied.

Returns

Name Type Description
Object A new Object that isn’t yet registered with the database

list_attributes

BlenderObjectBase.list_attributes(evaluate=False, drop_hidden=False)

Returns a list of attribute names for the object.

Parameters

Name Type Description Default
evaluate bool Whether to first evaluate the modifiers on the object before listing the available attributes. False
drop_hidden bool Whether to drop hidden attributes (those starting with a dot). Defaults to False. False

Returns

Name Type Description
list[str] | None A list of attribute names if the molecule object exists, None otherwise.

named_attribute

BlenderObjectBase.named_attribute(name, evaluate=False)

Retrieve a named attribute from the object.

Optionally, evaluate the object before reading the named attribute

Parameters

Name Type Description Default
name str Name of the attribute to get. required
evaluate bool Whether to evaluate the object before reading the attribute (default is False). False

Returns

Name Type Description
np.ndarray The attribute read from the mesh as a numpy array.

remove_named_attribute

BlenderObjectBase.remove_named_attribute(name)

Remove a named attribute from the object.

Parameters

Name Type Description Default
name str The name of the attribute to remove. required

store_named_attribute

BlenderObjectBase.store_named_attribute(
    data,
    name,
    atype=None,
    domain=AttributeDomains.POINT,
)

Store a named attribute on the Blender object.

Parameters

Name Type Description Default
data np.ndarray The data to be stored as an attribute. required
name str The name for the attribute. Will overwrite an already existing attribute. required
atype str or AttributeType or None The attribute type to store the data as. Either string or selection from the AttributeTypes enum. None will attempt to infer the attribute type from the input array. None
domain str or AttributeDomain The domain to store the attribute on. Defaults to Domains.POINT. AttributeDomains.POINT

Returns

Name Type Description
self