I'm trying to determine if it's possible to define custom attributes associated with vertices or edges of a mesh and then assign values to them manually as part of the mesh creation process, much like how edges can be (un)marked as sharp in edit mode, or vertices in groups can be assigned weights.

When initially skimming the user guide for 3.2 as a new user, it sounded like custom attributes provided exactly the ability I was looking for. But as best as I can tell, these named custom attributes exist only as locations to which geometry nodes can write procedurally calculated intermediate values. E.g., the Spreadsheet editor type displays any added custom attributes for a mesh and their values, and has separate views for "evaluated" and "original," but there seems to be no way in this or any other interface to assign values to the starting mesh.

Are custom attributes exclusively derived / procedural state, or is there a way (including through the Python API) to assign custom attribute values to mesh elements as part of the authoring process, similar to built-in properties like edge sharp/smooth? Are there any other Blender features suitable for assigning custom data manually to vertices / edges / etc. of a mesh?


1 Answer 1


Custom attributes can be set through the python API. For example, to add a float attribute to each vertex of the default cube:

mesh = bpy.context.collection.objects["Cube"].data
mesh.attributes.new(name="new attribute", type="FLOAT", domain="POINT")
attribute_values = [i for i in range(len(mesh.vertices))]
mesh.attributes["new attribute"].data.foreach_set("value", attribute_values)

See docs for more details on the options

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.