How to synch armature name with object name?

Hi, newbie here :slight_smile:

So I’m trying to list existing armatures on the user interface. While that part is done, the generated list shows the armature’s names (bpy.data.armatures[].name) instead of the user-visible name (bpy.data.objects[].name).

E.g. : I have created an armature and rename it “Bob” from the 3D view -> UI. My custom UI panel, however, listed it as “Armature”.

Is there a way to synch both names?

How about a python code that checks whether an object is an armature or not?

this isn’t the best solution to the drop down box issue- but it will go through objects and if it’s an armature it will rename armature data to objects name. Of course this could become a problem if you have armature data linked to multiple objects, but this is a start.


import bpy
obs = bpy.data.objects
for o in obs:
    if o.type == 'ARMATURE':
        if o.data.name != o.name:
            o.data.name = o.name

Thanks for the help again teldredge :smiley: though I never face a situation where an armature is linked to multiple objects. Nevertheless, you’ve solved my problem :slight_smile: