I'm trying to insert an separator to an EnumProperty like used in the Operator object.select_by_type. This is the Property used by this Operator (blender-2.77a.tar/blender-2.77a/source/blender/makesrna/intern/rna_object.c - it's written in C):

EnumPropertyItem rna_enum_object_type_items[] = {
    {OB_MESH, "MESH", 0, "Mesh", ""},
    {OB_MBALL, "META", 0, "Meta", ""},
    {0, "", 0, NULL, NULL},
    {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
    {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
    {OB_EMPTY, "EMPTY", 0, "Empty", ""},
    {0, "", 0, NULL, NULL},
    {OB_CAMERA, "CAMERA", 0, "Camera", ""},
    {OB_LAMP, "LAMP", 0, "Lamp", ""},
    {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
    {0, NULL, 0, NULL, NULL}

The line {0, "", 0, NULL, NULL} creates a seperator (In Python the tupel is sorted different from the C-one). In Python I can't use a tupel like ("", None, None) within the item-set and a tupel like ("", "", "") creates a new column (described here: https://blenderartists.org/forum/showthread.php?409613-How-to-create-columns-in-operator_menu_enum-SOLVED).

How can I add a seperator to an EnumProperty in Python?


  • 1
    $\begingroup$ I expect the c-code that generates the menu from that list will add a separator if the value is 0. I don't think we have a way to add a separator through an enum in python, so we have to create a custom menu instead of using prop_menu_enum $\endgroup$ – sambler Dec 30 '16 at 10:16

Your Answer

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

Browse other questions tagged or ask your own question.