Interrogate: does not take into account the enum type

I use such code on the C++ side.

enum class PImGuiCond : int {
    none            = 0
    always          = 1 << 0,
    once            = 1 << 1,
    first_use_ever  = 1 << 2,
    appearing       = 1 << 3,
};

However, on the Python side, I got a regular enum (without typecasting). Which can be checked by printing out the member.

from panda3d.imgui import PImGuiWindowFlags
print(PImGuiCond.appearing)

out: PImGuiCond.appearing

At the same time, python allows you to specify enumerations with typecasting.

from enum import IntEnum

class PImGuiCond(IntEnum):
    none            = 0
    always          = 1 << 0
    once            = 1 << 1
    first_use_ever  = 1 << 2
    appearing       = 1 << 3

print(PImGuiCond.appearing)

out: 8

Is it currently possible to use enumerated types in interrogate?

Yes. enum gets mapped to int values and enum class to the enum type. What exactly is the problem here? Do you expect to be able to access the integer value more easily?

I gave the last example in python, this is the expected behavior when an enum has a given type. However, I do not know how this happens in C++, what is the point of specifying the type if it is impossible to extract the value.

from enum import Enum

class FlagsEnum(Enum):
    none            = 0
    always          = 1 << 0
    once            = 1 << 1
    first_use_ever  = 1 << 2
    appearing       = 1 << 3
    
print(FlagsEnum.appearing)

out: PImGuiCond.appearing

Python has the same behavior if you don’t convert the enum to a type int.

Interrogate is faithfully wrapping C++ here. With enum classes, | is illegal without specifically overloading operator |.

However, I could change interrogate to auto-detect whether there exists an operator | overload and wrap it as enum.Flag instead of enum.Enum.

You know better, I just assumed that the very fact of inheriting from the INT type would transform it into a similar class in Python.

You can make it easier by using a special tag for the parser, so you can add more types.