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

Allow GDExtension to access core singletons in INITIALIZATION_LEVEL_SERVERS #79584

Closed

Conversation

dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Jul 17, 2023

There are long-standing tricky problems with GDExtension accessing the core singletons, due to the order that they are registered and created.

This PR moves the execution of GDExtension's INITALIZATION_LEVEL_SERVERS until after the core singletons are registered.

This does create a difference between modules and GDExtensions: modules have INITIALIZATION_LEVEL_SERVERS run before the singletons are registered. However, modules don't actually need the singletons be registered, because they can fetch them directly!

So, while this is creating a difference, it's allowing the code in a GDExtension to effectively be more similar to a module's, by allowing it to access singletons at all during this level.

EDIT: Marking this as a draft currently, as this is currently just a proposal for discussion on the GDExtension team. Will take it out of draft if folks think this makes sense!

@dsnopek
Copy link
Contributor Author

dsnopek commented Jul 27, 2023

Closing this for now, as I think the first step is more discussion

@dsnopek dsnopek closed this Jul 27, 2023
@YuriSizov YuriSizov removed this from the 4.x milestone Jul 27, 2023
@Bromeon
Copy link
Contributor

Bromeon commented Aug 21, 2023

Related: ThemeDB is not available during initialization time, as it's registered in register_scene_singletons() -- which is called after the MODULE_INITIALIZATION_LEVEL_EDITOR stage.

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

Successfully merging this pull request may close these issues.

3 participants