I know how detect if a vertex is selected in a vertexgroup.
o = bpy.context.object
gindex = o.vertex_groups[mygrp].index # get group index
for v in o.data.vertices:
for g in v.groups:
if g.group == gindex: # compare with index in VertexGroupElement
print("Ok")
But this works in OBJECT mode. If you are in EDIT mode, the data.vertices array is not updated until you back to OBJECT mode, so if the user add or remove vertices from the vertexgroup I cannot detect it.
I know how to get the vertices in EDIT mode with this:
if myobj.mode == 'EDIT':
bm = bmesh.from_edit_mesh(myobj.data)
obverts = bm.verts
But “obverts” hasn’t a groups information.
How can I get if a vertex is inside Vertexgroup in EDIT mode.