-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
4.0 GDExtension: global_get_singleton not returning expected singletons. #64975
Comments
@Splizard Please upload a minimal reproduction project to make this easier to troubleshoot. |
Minimal reproduction project Only a |
Fixes godotengine#64975 by enabling server singletons to be retrieved at initialization time. Previously, GDExtension libraries would fail to return Server singletons ie. 'global_get_singleton' at any defined initialization level. This enables Server singletons to be retrieved at GDNATIVE_INITIALIZATION_COMPLETE time so that GDExtensions can load all singletons on startup.
I'm running into this too with XR interfaces implemented in GDExternal. I've updated my reference implementation today so it can be reproduced with that. This line fails:
Bit of a showstopper, shame we mist it for the stable release. |
Ok, looking into this some more, the problem is due to this:
This is after:
Which is the last time we call into the initialization of GDExternals meaning that GDExternals has no way to interact with the server singletons, even though some of them have long since been created. The solution in @Splizard PR was to introduce a new initialization level, which we definitely don't want to do. The problem that we have in this is that there have been many discussions over time about the timing of registering our singletons, and reasons for why the timing was changed. These reasons are poorly documented so changing the timing once again may cause other problems to surface. For my use case, I definitely need access to the The question here to answer is: What is the reasons all the servers need to be registered together? The flipside of the argument is that not registering servers as soon as possible after they have been instantiated, makes our initialization levels pretty much useless. This will need further discussion with the results documented properly once and for all, but seeing the core team is currently preoccupied with GDC, this will likely happen afterwards. |
This works around godotengine/godot#64975 the same way as the reference XR and TiltFive extensions.
- Update godot-cpp to track 4.2 - Update openvr to 2.0.10 - Remove bundled godot-xr-tools - Remove support for MacOS, never tested and long broken - Update gdextension interface for changes in godot 4.1 - Support finding system-installed libopenvr on platforms with pkg-config - Support for mingw in build using tunabrain-patched openvr header - Add autoload singleton to register XR interface with server - This works around godotengine/godot#64975 the same way as the reference XR and TiltFive extensions. - Default to static libc++ to match godot-cpp - Remove CRT debug flag to match godot and godot-cpp - Update CI to publish gdextension artifacts correctly
Godot version
v4.0.alpha.custom_build.0c5f25495
System information
Ubuntu 22.04 Vulkan
Issue description
I'm writing a set of GDExtension/GDNative Go bindings and attempting to load all of the global singletons. I have tried loading them both at level 3 initialization time (
GDNATIVE_INITIALIZATION_EDITOR
) and/or when_ready
is called on a extension class. A select number of them fail to load and while I expected that Javascript and JavaClassWrapper fail because they require certain environments. I did not expect the Server types to fail.I might add that calling
Engine.get_singleton("DisplayServer")
for example, does work from GDScript. Is there something special about these 'Server' singletons? How is the initialization for these singletons meant to work from GDExtension?Steps to reproduce
Call
global_get_singleton
on aGDNativeInterface
with any of the failing cases shown in the Issue Description.Example
The text was updated successfully, but these errors were encountered: