def execute(self, context):
ob = context.active_object
me = ob.data
bm = bmesh.from_edit_mesh(me)
# Save current selection
selected_verts = []
for v in bm.verts:
if v.select is True:
selected_verts.append(v.index)
if v.index != self.vert_and_group[0]:
v.select = False
ob.vertex_groups.active_index = self.vert_and_group[1]
bpy.ops.object.vertex_group_remove_from()
# Re-select vertices
for v in bm.verts:
if v.index in selected_verts:
v.select = True
#XXX Hacky, but there's no other way to update the UI panels
bpy.ops.object.editmode_toggle()
bpy.ops.object.editmode_toggle()
return {'FINISHED'}
评论列表
文章目录