GDExtension Class Documentation - Enumerator Order Question

Godot Version4.6.1

I’m working on using a cmake target to generate doxygen content and convert it to class documentation for the extension. Everything’s mostly fine, I just have a strange problem, well not really a problem but it is bothering me.

In this case I’m using the TrafficLight example from Godotcon 2024. I have the following enum:

```

/**
 * TrafficLightType enumerator
 * the traffic light enumerator is used to track the current state of the light (Go,Caution,Stop)
 */
enum TrafficLightType {
    TRAFFIC_LIGHT_GO, /**< Represents a light indicating Go*/
    TRAFFIC_LIGHT_CAUTION, /**< Represents a light indicating Caution*/
    TRAFFIC_LIGHT_STOP /**< Represents a light indicating Stop*/
};

The relevant portion of the generated XML class documentation is below:

<constants>
    <constant name="TrafficLightType::TRAFFIC_LIGHT_GO" value="0" enum="TrafficLightType">
        Represents a light indicating Go
    </constant>
    <constant name="TrafficLightType::TRAFFIC_LIGHT_CAUTION" value="1" enum="TrafficLightType">
        Represents a light indicating Caution
    </constant>
    <constant name="TrafficLightType::TRAFFIC_LIGHT_STOP" value="2" enum="TrafficLightType">
        Represents a light indicating Stop
    </constant>
</constants>

Yet when the class documentation is viewed in the Godot editor it looks like this:

Which is neither alphabetical nor by order of value. Anyone have any ideas why?

Sounds weird to say it - but is it ordering by the length of the enum name?

At a glance it fits the pattern, but I just figured it out.

It looks like they show up in the order that they are registered with ClassDB in _bind_methods.

Changing it so caution was registered before stop fixed the problem.

But that begs the question why does the editor sort properties regardless of the order they are registered, but enum values are not?