Add API Type Override Method to ClassDB + ClassDB Binding Enhancements - #1127
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Jenova it's possible to develop Nested Extensions using C++ and hot-reload them on-the-fly. Somehow, any extension class registered after the engine's initialization stage is automatically registered with
API_EDITOR_EXTENSION. This causes the initiation of nested classes to fail when running the game in Debug mode.To fix this issue I've added a new function to
ClassDBto dynamically override a class api type. In addition to this function, I also added bindings forset_current_apiandget_current_api. While these bindings aren't strictly necessary for enabling hot-reloading of Nested Extensions, I included them to anticipate future needs and reduce the likelihood of requiring a separate pull request.Simple demonstration of the PR in action
Before Implementations
BeforePR.mp4
After Implementations
AfterPR.mp4
To implement these changes, I closely followed existing implementations to ensure compatibility and avoid any conflicts, with all changes extending functionality without altering any existing code. Additionally, GitHub Actions build completed successfully with zero issues.
This PR includes following changes:
override_api_typetoClassDBto dynamically override a registered class API type.class_override_api_typeto GDExtension/Core Bindingsset_current_apito GDExtension/Core Bindingsget_current_apito GDExtension/Core BindingsClassDB::class_override_api_typeClassDB::set_current_apiClassDB::get_current_apiThe documentation also includes a clear warning advising users against using these functions without a thorough understanding of their purpose and implications.