Skip to content

Add API Type Override Method to ClassDB + ClassDB Binding Enhancements - #1127

Merged
Arctis-Fireblight merged 1 commit into
Redot-Engine:devfrom
Selciner-Games:dev
Dec 22, 2025
Merged

Arctis-Fireblight merged 1 commit into
Redot-Engine:devfrom
Selciner-Games:dev

Conversation

@TheAenema

Copy link
Copy Markdown
Contributor

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 ClassDB to dynamically override a class api type. In addition to this function, I also added bindings for set_current_api and get_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:

  • Added override_api_type to ClassDB to dynamically override a registered class API type.
  • Exposed class_override_api_type to GDExtension/Core Bindings
  • Exposed set_current_api to GDExtension/Core Bindings
  • Exposed get_current_api to GDExtension/Core Bindings
  • Added Documentation for ClassDB::class_override_api_type
  • Added Documentation for ClassDB::set_current_api
  • Added Documentation for ClassDB::get_current_api

The documentation also includes a clear warning advising users against using these functions without a thorough understanding of their purpose and implications.

@Arctis-Fireblight Arctis-Fireblight left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@Arctis-Fireblight
Arctis-Fireblight merged commit de13578 into Redot-Engine:dev Dec 22, 2025
20 checks passed
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.

2 participants