2
$\begingroup$

I've just learned about property definitions in operators. I can't find an answer on how to set them up in a way that their possible options appear as a dropdown in the Keymap panel. Like this one:

example of proper dropdown

I've managed to get something to appear there by inserting something into default = '' but that's about it.

uitype: bpy.props.StringProperty(
        name = 'uitype',
        default = 'Something',
        #preset_options = ['item1', 'item2', 'item3']
        )

How do I program that?

$\endgroup$

1 Answer 1

2
$\begingroup$

I think I just figured it out. I needed to use bpy.props.EnumProperty

uitype: bpy.props.EnumProperty(
        name = 'uitype',
        items = (
            ('Something1', "Something 1", ""), 
            ('Something2', "Something 2", ""), 
            ('Something3', "Something 3", ""))
        )

https://docs.blender.org/api/current/bpy.types.Operator.html#enum-search-popup

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .