Easy way to remove all weight painting influence for a particular bone?

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.

Any suggestions?

With automatic weighting it will have created vertex groups. Find the vertex group for the bone you’re working on, select, it, then remove. No script required.

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?

…and welcome to Blender Artists!

As a vertex group, but without any verts assigned? You can enter edit, select all, ctrl-g (vertex group specials)-> remove from active group.

You could also just disable “deform” on the bone in question, in properties/bone/deform.

Doesn’t have anything to do with Rigify, that’s how it always works. That’s how the armature modifier works.

1 Like

Could you not select all the verts in the group, set the weight slider to zero for the group then assign?

1 Like

levels_weight (0)

1 Like

Ah – thanks for clarifying that.

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:

def get_rig_name():
    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':
			return modifier.object.name
    return bpy.context.object.data.name

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.

for anyone coming across this question in the future, I found an easier way to do it:

  1. set the vertices weight to 100% to any bone.
  2. With Vertex Selection enabled and all of the vertices selected (you can enable it by pressing V while weight mode on and pressing A) go to the Weights menu and select Normalize All.
  3. All other bones weights have been removed from the selected vertices, so now, if you remove the bone influence on this vertices, no bone will have influence in this selected vertices.

TL;DR:

  1. set weight to 1 to one bone
  2. go to Weights menu → Normalize All
  3. remove weights from bone on step 1.

This here saved my life.