Skip to content

Add SceneTree::get_singleton()#2007

Open
Ijtihed wants to merge 1 commit into
godotengine:masterfrom
Ijtihed:fix/scene-tree-get-singleton
Open

Add SceneTree::get_singleton()#2007
Ijtihed wants to merge 1 commit into
godotengine:masterfrom
Ijtihed:fix/scene-tree-get-singleton

Conversation

@Ijtihed

@Ijtihed Ijtihed commented Jun 24, 2026

Copy link
Copy Markdown

Adds a SceneTree::get_singleton() to godot-cpp which mirrors the method available to modules in Godot core. SceneTree is not a registered engine singleton so I implemented it like it was suggested in the issue (thanks to @dsnopek):

Object::cast_to<SceneTree>(Engine::get_singleton()->get_main_loop());

the declaration is injected into the generated header with a binding_generator.py specias case. I added a test method and assertion to the integration test.

Fixes #1597

AI disclosure

I used claude to brainstorm then make sure I didn't miss any blind spots/repo conventions. All code was written and reviewed by me.

@Ijtihed Ijtihed requested a review from a team as a code owner June 24, 2026 05:05
@Ijtihed Ijtihed force-pushed the fix/scene-tree-get-singleton branch from fa02843 to 7afa095 Compare June 27, 2026 14:04
@Ijtihed

Ijtihed commented Jun 27, 2026

Copy link
Copy Markdown
Author

It failed CI and now it shouldn't anymore :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SceneTree::get_singleton() is not available

1 participant