Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum types are not used for arguments and properties in the api.json #93

Open
vonagam opened this issue May 1, 2021 · 4 comments
Open
Labels

Comments

@vonagam
Copy link
Contributor

vonagam commented May 1, 2021

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.

@BastiaanOlij
Copy link
Collaborator

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.

@vonagam
Copy link
Contributor Author

vonagam commented Sep 27, 2021

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.

@akien-mga akien-mga changed the title Enum types Enum types are not used for arguments and properties in the api.json Sep 27, 2021
@akien-mga
Copy link
Member

This was actually fixed by @raniejade in godotengine/godot#35847.

However this created a regression which has still not been fixed: godotengine/godot#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?).

@akien-mga akien-mga added the bug label Sep 27, 2021
@ParadoxV5
Copy link

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.
godotengine/godot#50388 (comment)

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants