Is there an easy way to remove all weight painting influence for a particular bone?
In other words, I would like to select a bone for weight painting and, instead of using a brush to subtract from the existing weight painting, I want to either run a script, press a keyboard shortcut, or choose some sort of menu option that will automatically subtract all weight painting influence for a bone. That way, I can start re-painting the weight and there won’t be any stray, previously-painted vertices that I happened to have missed.
Thanks for the reply, @Ryan_Bailey. I’m aware that I can do that, but I’d like to keep the vertex group.
Unless…would it make sense to write a script that would look at the currently-selected bone, delete the associated vertex group (I’m using Rigify, so the vertex group always has the same name as the bone) and then create the vertex group again?
Thanks everybody for the suggestions, but I ended up writing a script that I can call with one click when I’m in weight painting mode:
if bpy.context.mode == 'PAINT_WEIGHT':
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
for modifier in obj.modifiers:
if modifier.type == 'ARMATURE':
if bpy.context.active_object.mode == 'WEIGHT_PAINT':
rig_name = get_rig_name()
active_bone_name = bpy.data.objects[rig_name].data.bones.active.name
active_object_name = bpy.context.active_object.name
# We can always assume that a rigged bone has a vertex group with the same name.
obj = bpy.data.objects.get(active_object_name)
source_group = None
for i in range(0, len(obj.vertex_groups)):
source_group = obj.vertex_groups[i]
if source_group.name == active_bone_name:
# Now access the vertices that are assigned to this group
mesh = obj.data
for vert in mesh.vertices:
for vertGroup in vert.groups:
if vertGroup.group == i:
vertGroup.weight = 0
I haven’t thoroughly road tested this yet, but it appears to work as expected.