Batch Delete Vertex Groups script

The addon won’t enable for me in 2.93, and I don’t know how to update it to work, but here is the script by itself which does work when run in the text editor with the object selected:

import bpy
from bpy.types import Operator

ob = bpy.context.object
ob.update_from_editmode()
   
vgroup_used = {i: False for i, k in enumerate(ob.vertex_groups)}
   
for v in ob.data.vertices:
    for g in v.groups:
        if g.weight > 0.0:
            vgroup_used[g.group] = True
   
for i, used in sorted(vgroup_used.items(), reverse=True):
    if not used:
        ob.vertex_groups.remove(ob.vertex_groups[i])

Will this work for Blender 3? Thanks

Thanks @COnLOAR

Your tweaked version worked in blender 3.6.5, removing all excess empty vertex groups created by auto-weighting.

A nice tool to have in the toolbox!

Randy