How to get all of the meshes that are attached to an armature?

I know that I can get all of the meshes in a scene by doing this:

for obj in bpy.data.objects:
    if obj.type == 'MESH':
         # Do stuff

But let’s say I have an armature named rig in the scene, and I have several meshes that have been parented to that armature and have been weighted.

How can I loop through all of the meshes in a scene that are attached to a specific armature?

Well according to the API, the object has a “parent” attribute as well as parent_type, etc. So something like

if obj.type=='MESH':
    par=obj.parent
    #do stuff with par like add it to a collection or something
1 Like

Thanks, @jaxtraw – I got it working. :+1:

1 Like