-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Add Variant value pointer getter functions, similar to get_validated_object. #98392
Conversation
0a1e7bf
to
b4c0a6b
Compare
I needed to say goodbye to lvalue references. Besides the rather explicit crashes on conversions, the explicit lvalue conversions were being used automatically leading to unit test crashes already. Pointers make somewhat more sense anyway because it can be nullable, which is fitting in this case, requiring no explicit crash. |
b4c0a6b
to
20254cd
Compare
20254cd
to
8f011e4
Compare
Ok, I refactored to use I also added getters for all the other types, except Object which already has such a getter ( |
These functions seem basically the same as the Given that we want to expose something like this on the GDExtension side, I'm not sure what the API should be. We could certainly make matching So, probably the first thing is we need to decide on what API we want within Godot, and then we can figure out how to make the same work in GDExtension and godot-cpp. |
Oh, I had no idea those existed! There remains a small difference in that my implementation checks for variant state first. This may or may not be wanted; the
This would be blocked by Variant not exposing
There seem to be a few scattered uses of the |
Superseded by #99201 because Variant internal has the proposed functionality already, an equivalent just needs to be exposed to gdextension. |
Adds the ability to interact with Variant's underlying types in a strongly typed fashion.
Related to #98373: They two fill similar, but still somewhat orthogonal, use-cases.
Related to godotengine/godot-proposals#10830. This PR does not close the proposal, but partially addresses its use-cases. For more information, see my discussion with @dsnopek in the proposal.