Last active
November 18, 2023 18:09
-
-
Save manavortex/080d04065ee4c45aaad1e7c221db68c9 to your computer and use it in GitHub Desktop.
check_orphaned_vertex_groups.gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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