named_attribute(obj, name='position', evaluate=False)
Get the named attribute data from the object.
Parameters
obj |
bpy.types.Object |
The Blender object. |
required |
name |
str |
The name of the attribute, by default ‘position’. |
'position' |
evaluate |
bool |
Whether to evaluate modifiers before reading, by default False. |
False |
Returns
|
np.ndarray |
The attribute data as a numpy array. |
Raises
|
AttributeError |
If the named attribute does not exist on the mesh. |
Examples
import bpy
from databpy import named_attribute, list_attributes
obj = bpy.data.objects["Cube"]
print(f"{list_attributes(obj)=}")
named_attribute(obj, "position")
list_attributes(obj)=['position', '.select_vert', '.edge_verts', '.select_edge', '.select_poly', 'sharp_face', '.corner_vert', '.corner_edge', 'UVMap']
array([[ 1., 1., 1.],
[ 1., 1., -1.],
[ 1., -1., 1.],
[ 1., -1., -1.],
[-1., 1., 1.],
[-1., 1., -1.],
[-1., -1., 1.],
[-1., -1., -1.]])