Skip to content

Postpone adding new extension plugins to the editor#109310

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
Yarwin:fix-gdextension-add-editor-plugin-during-initialization-level-editor
Aug 6, 2025
Merged

Postpone adding new extension plugins to the editor#109310
Repiteo merged 1 commit intogodotengine:masterfrom
Yarwin:fix-gdextension-add-editor-plugin-during-initialization-level-editor

Conversation

@Yarwin
Copy link
Copy Markdown
Contributor

@Yarwin Yarwin commented Aug 4, 2025

Extension EditorPlugins added during Hot Reload on Initialization level Editor were being attached to the scene tree before all the GDExtension Classes (such as already loaded resources) are re-initialized.

In general, the order of the operations looked like so:

  1. Hot reload starts
  2. Godot starts unloading extension. (we unregister existing EditorPlugin at this point)
  3. Godot caches all the properties on present instances & turns all the gdextension classes into native classes (GDExtension Class inheriting Resource -> Resource and so on)
  4. Godot starts (re)initalizing the library – Extension registers all the classes etc
  5. on the end of the initialization we run editor_add_plugin - which was instantly adding EditorPlugin to the tree, launching its lifecycle methods.
  6. enter_tree() – we were still in hot reload and any GDExtension class instance at this point is represented by its base class – i.e. loading any previously initialized GDExtension Resource will return "bare" resource.
  7. After initialization – and launching startup callbacks – Godot finishes hot reload, changes all the aforementioned instances back to the Extension Classes and puts back all the cached properties.

Related godot-rust issue: godot-rust/gdext#1132
Thread on Godot contributors chat: https://chat.godotengine.org/channel/gdextension?msg=N2sbbbuw4Z33pacWF

@Yarwin Yarwin requested a review from a team August 4, 2025 18:32
@dsnopek dsnopek added this to the 4.5 milestone Aug 4, 2025
@dsnopek dsnopek requested a review from a team August 4, 2025 18:33
@Yarwin Yarwin force-pushed the fix-gdextension-add-editor-plugin-during-initialization-level-editor branch from e7bcc5f to d37b7f3 Compare August 4, 2025 18:57
----

Extension EditorPlugins added during Hot Reload on Initialization level
Editor were being attached to the scene tree before all the GDExtension
Classes (such as already loaded resources) are re-initialized.
@Yarwin Yarwin force-pushed the fix-gdextension-add-editor-plugin-during-initialization-level-editor branch from d37b7f3 to 1aca96d Compare August 4, 2025 19:57
@Ivorforce Ivorforce removed the request for review from a team August 5, 2025 13:13
Copy link
Copy Markdown
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

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

Thanks! This looks good to me :-)

@dsnopek dsnopek added the cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release label Aug 5, 2025
@Repiteo Repiteo merged commit 65eb664 into godotengine:master Aug 6, 2025
20 checks passed
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented Aug 6, 2025

Thanks! Congratulations on your first merged contribution! 🎉

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

Labels

bug cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release topic:editor topic:gdextension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants