2
$\begingroup$

I triangulated a mesh using bmesh.ops.triangulate, and I don't know how to access the weights of vertex groups. The traditional MeshVertex has a groups field that contains these weights. I tried to find it in the bmesh layers, but there are no layers in it.

Is there any way to access vertex weights from bmesh, or is it only available in MeshVertex.groups?

$\endgroup$

1 Answer 1

2
$\begingroup$

I think it's

layer_deform = bm.verts.layers.deform.active
assert layer_deform is not None

bm.verts.ensure_lookup_table()
bmv = bm.verts[0]
bmv[layer_deform][vertex_group_index] = weight

# or
names = tuple(vertex_group.name for vertex_group in obj.vertex_groups)

for vertex_group_index, weight in bmv[layer_deform].items():
    name = names[vertex_group_index]
    print("Name: %s, Weight: %f" % (name, weight))

Links:

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .