1
$\begingroup$

I'm using a callback for an enumproperty type to display a dropdown menu:

def item_callback(self, context=None):
        global modelDropdownIndex
        global enumHolder
        if modelDropdownIndex == 0:
            enumHolder = fetcher.enumModelTotal[0]
            return enumHolder


dropdown_Parts: bpy.props.EnumProperty(
    items=item_callback,
    name="Parts",
    description="Model Parts",
    default=None,
    options={'ANIMATABLE'},
    update=None,
    get=None,
    set=None
)

Here is the link to the documentation. I do know that the return value is correct, as the dropdown box always has the accurate first entry. Still, when I try to expand the dropdown to view the rest of the tuples, I get the error TypeError: EnumProperty(...): return value from the callback was not a sequence, and I cannot figure out what it means. I've tried sending longer and shorter lists, all to the same error, and I resolved the potential callback error not holding memory by using the global variable enumHolder to ensure that I can access the variable at all times. Yes, I have checked to make sure that the variable is holding the correct contents and it was correct, I've looked on the blender docs and online but I'm not sure what sequence means in the context of a callback.

$\endgroup$
1
  • $\begingroup$ Hello ! Is fetcher.enumModelTotal[0] a sequence (list, tuple, ...) ? I would try with fetcher.enumModelTotal instead $\endgroup$
    – Gorgious
    Commented Oct 4, 2022 at 6:12

1 Answer 1

1
$\begingroup$

For anyone trying to do something similar - I wasn't able to achieve my output with the if statement. I changed the logic for what to compare modelDropdownIndex to earlier and returned just the dynamic class list after calling the function and it works? Super weird solution - but hopefully that helps someone.

$\endgroup$

You must log in to answer this question.

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