I needed a simple script to add a feature to blender that I need when I rig meshes.
I need to be able to delete vertex groups that are not locked.
The current choice is to delete them all. I want to keep ones I locked and delete ones not locked.
So far I have this:
import bpy
##get vertex groups
obj = bpy.context.object
for group in obj.vertex_groups: #set current group to active
bpy.ops.object.vertex_group_select()
If VertexGroup.lock_weight== False:
bpy.ops.object.vertex group remove(group)
I can not get the correct code to test if the group is locked or not. If it is not locked, I want to delete it.
import bpy
obj = bpy.context.active_object
for group in obj.vertex_groups:
if group.lock_weight == True:
bpy.ops.object.vertex_group_remove(all=False, all_unlocked=True)