1
$\begingroup$

Is there a way to select all bones from the vertex group of the mesh?

I have too many overlapping bones that are very tedious to work and some are non-deformer which I wanted to hide and only work with the ones that are applied under the vertex group for weight Paint. I can always do this by hand but it'll be extremely time-consuming to go everyone.

$\endgroup$
1
  • $\begingroup$ @Xana I'm sorry, I know nothing about scripting. "BPY is not defined" I don't even know what it means. It also give me file destination error with <module> How to set it up and if it's as simple as copying the line or do I have to reference the name. I need examples $\endgroup$ Commented May 6 at 14:57

1 Answer 1

1
$\begingroup$

It is script Highlights bones with deform in pose mode

import bpy

mesh_objects = []

for object in bpy.data.objects:
    if object.type == 'MESH':
        mesh_objects.append(object)   

vertex_group_names = []

for object in mesh_objects:
    if object.vertex_groups is not None:
        for group in object.vertex_groups:
            vertex_group_names.append(group.name)

rig_name = bpy.context.active_object.name

rig_bones = bpy.data.armatures[rig_name].bones

for bone in rig_bones:
    if bone.use_deform is True:
        if bone.name not in vertex_group_names:
            bone.select = True

enter image description here

enter image description here

enter image description here

When bones in vertex groups need little change / delete "not"

enter image description here

enter image description here

$\endgroup$
5
  • $\begingroup$ Thank you for sharing. I ran this script as instructed and it gave me some error. Python: Traceback (most recent call last): File "C:\Users\Wiiss\PC/Documents\Blender\Characters\Stark.blend\DeformBonesSelectionONLY", line 18, in <module> " "KeyError: 'bpy_prop_collection[key]: key "Armature" not found' $\endgroup$ Commented May 6 at 16:20
  • $\begingroup$ I replaced the line and it still gave me the same error. I made save changes in my file before I ran the script. It seems the error is coming from line 18 and I don't know what it is the implication. $\endgroup$ Commented May 6 at 16:29
  • $\begingroup$ Okay, I just created a new blender file to set up the bones with or without deformation and ran your script and indeed it does work. I should've checked my bones in my current project because all of them are checked deform which is problematic because I assumed it was checked off and now I wonder if there is a script where I want to select Bones with vertex group assigned only. $\endgroup$ Commented May 6 at 16:43
  • $\begingroup$ Yeah I figured. This is what it is designed for but I was asking if there is another script that work in the function for vertexgroup name assigned. If not then I guess I have to go thru every bones with non-deform to check off HaHa $\endgroup$ Commented May 6 at 16:53
  • $\begingroup$ Thank you, I somehow missed your older post with your latest screen shot, showing an example of what to replace the armature name for my rig character and the selection does follow through as it acts accordingly. I don't know if the reason behind this was because I had too many characters in the scene that shared the same armature with different vertex groups which might cause conflict with another $\endgroup$ Commented May 6 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .