godot-headers
godot-headers copied to clipboard
Enum types are not used for arguments and properties in the api.json
Question about api.json
:
Why enum types are presented as such only in return_type
and shown as int
everywhere else?
Random example: OS
has screen_orientation
property with type of enum OS.ScreenOrientation
, but this enum is presented only in return_type
for getter, while set_screen_orientation
has an argument orientation
of type int
and property itself typed as int
too.
In documentation there is no such discrepancy everything that is enum has enum
attribute.
I'm guessing because behind the scenes they are integers and you need to dive deeper into the ClassDB data to retrieve the associated enum.
This is rectified in the new GD Extensions btw. It will show the type as an enum and which enum it is and then leave it up to whomever parses the json
to fully support enums or just use ints.
Yeah, but why it was done only for return_type
?..
Anyway, if new info will be complete in that regard then i have no problem with closure of this issue.
This was actually fixed by @raniejade in https://github.com/godotengine/godot/pull/35847.
However this created a regression which has still not been fixed: https://github.com/godotengine/godot/issues/50388
So the fix hasn't been backported to the 3.x
branch yet (and 4.0
is currently with a half-broken state, though this might have been resolved later on with GDExtension work?).
Excuse me for necroposting, but a heads-up that
However this created a regression which has still not been fixed: godotengine/godot#50388 […] though this might have been resolved later on with GDExtension work?
this issue is closed, indeed as obsolete by the GDExtension rework.
GDNative was replaced by GDExtension in 4.0, and godotengine/godot#35847 has not been cherry-picked to
3.x
due to this regression, so we can consider it solved. ⸺ https://github.com/godotengine/godot/issues/50388#issuecomment-1445400928
As the (regressing) fix is not backported to 3.x, this issue can be closed either as not planned or by updating to 4.x (#107).