I'm looking to write a script that can remove a prefix from all vertex group names, so that I can use the mirror modifier appropriately. The models I work with have "b_" as a prefix for most group names. I found this script to add the prefix back on after mirroring, but it still takes far too long to process the whole thing.
Updated: Removes & Adds prefix back in
import bpy
obj = bpy.context.active_object
bpy.ops.object.mode_set(mode='OBJECT',toggle=True)
for g in obj.vertex_groups:
if g.name.startswith('b_'):
print(g.name)
g.name = g.name[2:]
else:
print(g.name)
g.name = 'b_' + g.name