Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save manavortex/080d04065ee4c45aaad1e7c221db68c9 to your computer and use it in GitHub Desktop.
Save manavortex/080d04065ee4c45aaad1e7c221db68c9 to your computer and use it in GitHub Desktop.
check_orphaned_vertex_groups.gist
import bpy
import bmesh
# script originally created by engres
for armature in filter(lambda obj: obj.type == 'ARMATURE', bpy.data.objects):
print("Checking armature {}".format(armature.name))
boneNames = []
for pBone in armature.pose.bones:
boneName = pBone.name
print(boneName)
boneNames.append(boneName)
meshes = filter(lambda obj: obj.type == 'MESH' and obj.parent == armature, bpy.data.objects)
for mesh in meshes:
missingBones = []
for vGroup in mesh.vertex_groups:
if vGroup.name not in boneNames:
missingBones.append(vGroup.name)
if missingBones != []:
print(" {}: missing {} bones".format(
mesh.name,
len(missingBones),
missingBones
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment