Add a new face property

I want to add a new property to be editable on all faces.

In Blender 2.51 there is MeshFace type.

But I currently am on 2.71, and there appears to be no such type. Which one is the correct one to add a new property on? = bpy.props.IntProperty(name = "MyProperty")

Also, is the following the correct way to safely establish the property when addon gets registered?

def register():
    if !hasattr(, 'my_property'): = bpy.props.IntProperty(name = "MyProperty")
    # ...

bpy.props properties don’t work on mesh elements, you can only try bmesh module custom data layers:


Note that they will propagate on certain operations like extrude to some new faces.

So I will have to add the property to every mesh instead of just registering it in one location?

Can these even be controlled from a bpy.types.Panel.layout.prop()?

It’s per mesh, yes. It’s possible to create some UI, but it will probably not be efficient and require some trickery.

Can probably make do with that, but there are some other problems:

How do I set and get the property on a BMFace?

        for f in bm.faces:
                f.setvalue("MyProperty", 42)
                print(f.getvalue("MyProperty")) # 42

See the link I posted above.

It works like:

import bmesh
bm =
fp ="MyFaceProp")
# ... 
bm.faces[0][fp] = 5

Ah. Sorry I somehow could not decode that information from the link. I found the example confusing.

For anyone else wanting to do something like this, the following also helped me when I realized I wanted to work with the mesh in edit mode:

Can mark thread a solved. Thanks!