Is it possible to assign custom properties to vertices (or edges or faces)? If yes, how?
The manual says that custom properties are only supported for datablocks with an ID. what exactly is meant with this ID?
Only objects which are derived from bpy.types.ID support custom properties. These subclasses are listed here: API docs - bpy.types.ID. You access them via bpy.data.
Additionally, Bone and PoseBone objects support custom properties as well: API docs - bpy.props.
The standard API does not support custom data for geometry elements (bpy).
The BMesh Module (bmesh) does however.
Note that custom data layers are rather slow when utilized with Python.
Keep in mind the "propagation" of custom data, the attributes are copied on operations like extrusion - hence, you can't really use it to give each vert / edge / face a unique number for instance.
See also:
verts[index]is usually equal to.index, but scripts can overwrite the index property for internal purposes. It does not change the actual vertex index. You can test that with a wrapped bmesh -bm = bmesh.from_edit_mesh(bpy.context.object.data)- and indices displayed in viewport:bpy.app.debug = Trueand Indices enabled in N-panel, Mesh Display options. To reset the temporary overwritten indices, usebm.verts.index_update(). – CodeManX Apr 29 '14 at 19:52bm.verts.index_update()? Otherwise they never get reset? So i could use them for custom data? – horace Apr 29 '14 at 21:25