0
$\begingroup$

I have a previously assigned Vertex Groups on my object. After creating the bmesh, if I understand correctly that Vertex Group should now be dvert_lay = bm.verts.layers.deform.active. If I print that, it looks like this:

<BMLayerItem object at 0x000002A7E18B5A50>

I'd like to get a list of bm.verts from my deform layer that could be used with bmesh.ops. It should have this format:

[<BMVert(0x000002A7818090B0), index=12>, <BMVert(0x000002A7818090E8), index=13>, <BMVert(0x000002A781809120), index=14>]

Any help appreciated.

$\endgroup$
0
$\begingroup$

OK I managed to find the values I needed by printing these variables:

# Layer Deform is the vertex group layer in bmesh mode.
layer_deform = bm.verts.layers.deform.active
if layer_deform is not None:
print('--- This is the deform layer info: ---')
    for vert in bm.verts:
        dvert = vert[layer_deform]
        print('vert index: ', vert.index, 'vert id:', vert,'vertex groups:', dvert.items()) #dvert.items gives you two elements: int of vertex group (I think by the order they were created added), and a 0.0 to 1.0 about the weight. If the vert doesn't belong to any vertex group, this dict will be emtpy. vert gives the BMVert in this format: BMVert(0x0000000012998B88)
print('--- End of deform layer info ---')
$\endgroup$

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.