← All ideas
  • Published 23 Sep 2023

Expose boolean attributes to bmesh

If you run the code below in python console in default blender scene you can notice there is no way to access boolean attributes from bmesh.

It's functionality can be implemented by using integers but using booleans would more convenient.

bpy.ops.geometry.attribute_add(name="test", domain='EDGE', data_type='BOOLEAN')
bpy.ops.geometry.attribute_add(name="test_int", domain='EDGE', data_type='INT')

import bmesh
bm = bmesh.new()
bm.from_mesh(bpy.context.object.data)
for attr in dir(bm.edges.layers):
    if attr.startswith('__'):
        continue
    print(attr, getattr(bm.edges.layers, attr).keys())

# bevel_weight []
# color []
# crease []
# float []
# float_color []
# float_vector []
# freestyle []
# int ['test_int']
# string []
100%

Development Status: Open

Upvote 4 Downvote 0
andrej730
23 Sep 2023

1 Comment

I'm also missing that feature in my scripting. Seems a bit like an oversight. :)