As the questions already states? How do we get a list of all possible/available entries of an EnumProperty?


Enums are something Blender defines, which doesn't have a Python equivalent. Therefor you need to use the RNA API. (See API docs)

Here is a function which returns possible values for an enum:

import bpy

def enum_members_from_type(rna_type, prop_str):
    prop = rna_type.bl_rna.properties[prop_str]
    return [e.identifier for e in prop.enum_items]

def enum_members_from_instance(rna_item, prop_str):
    return enum_members_from_type(type(rna_item), prop_str)

# Test the functions above:
enum = enum_members_from_instance(bpy.context.object, "rotation_mode")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.