Filtering armature objects (Not armature datablocks)

I’ve been working on plugin that works a lot with armatures, but lately i’ve been having a bit of an issue when it comes to filtering what can be selected.

Sadly i am unable to add more than one image to this post since this account is new, but currently the armature selection property shows every object in the scene. It is only supposed to display armatures in the file, however, i have not been able to find the correct return value for that property poll, since what is want is not the armature datablock, i want the armature object, and i know it’s possible since the Armature modifier makes use of it.

image

I tried looking inside of the Blender scripts to find the property with that poll but there’s a lot of stuff in there, and i am afraid i was not able to find it, and i haven’t been able to find any results on the internet about it either, so that’s why i’m here. Here’s part of the plugin if it’s of any use.

class VAT_properties(bpy.types.PropertyGroup):

    ''' #Not currently working, meant to only filter objects that are armatures
    def targetpoll(cls, context):
        return bpy.types.ArmatureModifier #Last one i tried, still does not work
    '''

    target_armature : bpy.props.PointerProperty(type = bpy.types.Object, name = "Armature", update = functions.create_armature)`

Of course, target_armature has no poll parameter since like i said, i haven’t been able to find the correct one, but the result i’d like is the same as its seen in the Armature modifier.

Thanks in advance!

1 Like

based on this, seems to be simply expecting a boolean value to tell if the object should appear or not in the list.


def armature_poll(self, object):
    return object.type == 'ARMATURE'

target_armature : bpy.props.PointerProperty(type = bpy.types.Object, name = "Armature", update = functions.create_armature, poll=armature_poll)`

Edit:
just tested, and it works, and it will be useful for my add-on also, so thank you for point ting this out.

2 Likes