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

[API] Property type hint is exported as property type in api if using a TypedArray of Resources #70736

Open
piiertho opened this issue Dec 30, 2022 · 3 comments

Comments

@piiertho
Copy link
Contributor

Godot version

4.0.dev (d0398f6)

System information

Windows 10

Issue description

Api export hint string as type when using a TypedArray.
Here is an example for SystemFont::fallbacks:

				{
					"type": "typedarray::24/17:Font",
					"name": "fallbacks",
					"setter": "set_fallbacks",
					"getter": "get_fallbacks"
				}

This issue was already present in former api: godotengine/godot-headers#67.

Steps to reproduce

N/A

Minimal reproduction project

N/A

@piiertho piiertho changed the title [API] Property type hint is exported as propety type in api if using a TypedArray of Resources [API] Property type hint is exported as property type in api if using a TypedArray of Resources Dec 31, 2022
@akien-mga
Copy link
Member

akien-mga commented Jan 10, 2023

That's intentional, no? To handle typed arrays you need information on their type, which is provided here.

See #65817 which implemented it, and further discussion in #64249.

@CedNaru
Copy link
Contributor

CedNaru commented Jan 10, 2023

We only need the information about the subtype for the Array, the rest of the hint string doesn't bring new information.
In the example, typedarray::Font is plenty enough for creation of bindings (which should result naturally into something close to Array<Font> in a typed language with generics).

From what I understand, the original HintString used for the Font fallback is there for the inspector, so it doesn't let you add any kind of Object in the array but only the Font type.

I don't think that information is necessary in the api.json, but if somehow it was, we should have a more consistent behaviour then. As it is right now, we get our regular typedarray::SubType in almost all cases of Typed arrays and then we have this corner case like this with a different format typedarray::HintString.

@CedNaru
Copy link
Contributor

CedNaru commented Jan 10, 2023

Also should be noted that this behavior doesn't happen when it's written as the type of method argument:
image

Only when it's a property it behaves like this:
image

Of course we have other occurences of that, each time it's a typedArray property with a ressource as Subtype:

image

Everytime it's the same hintstring 24/17/Subtype, the presence of the same prefix means it doesn't provide new informations.

@dsnopek dsnopek added this to the 4.x milestone Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Assess
Development

No branches or pull requests

5 participants