Page MenuHome

EnumProperty weird behavior using ENUM_FLAG option with `number` items argument
Closed, ResolvedPublic


System Information
Windows 10 x64
Renderer: GeForce GTX 860M/PCIe/SSE2

Blender Version
Broken: 2.78.5 c2d285f

Short description of error
EnumProperty shows weird behavior when using ENUM_FLAG option along with number items argument.

Exact steps for others to reproduce the error

  1. Open attached blend file:
  2. Run the script and locate Test panel in object properties area.
    1. 1st case: when items number is 0, it won't select.
    2. 2nd case: when item's number increment from 1, 3rd element affects the state of other elements
    3. 3rd case: if item's number increment from 1, but 3 is skipped, enum works OK
    4. 4th case: if there is no number arguments, enum works OK

5th case has nothing to do with the bug report, but is there a reason why item's icon argument requires the number argument?

Event Timeline

I updated the documentation to describe the reason for this behavior, the numbers must be powers of two:

The icon argument being required is indeed not great, for historical reasons a tuple of size 4 expects a number instead of an icon. Maybe it should have been the other way around, but like the powers of two requirement that would mean breaking backwards compatibility.