Skip to content

Rework scene restoring#110183

Open
KoBeWi wants to merge 1 commit into
godotengine:masterfrom
KoBeWi:funni_boogs_incometh
Open

Rework scene restoring#110183
KoBeWi wants to merge 1 commit into
godotengine:masterfrom
KoBeWi:funni_boogs_incometh

Conversation

@KoBeWi
Copy link
Copy Markdown
Member

@KoBeWi KoBeWi commented Sep 1, 2025

Changed the way scene restoring works. Instead of loading all scenes, only the current scene is loaded, other scenes are opened as "dummy scenes". They are not being loaded until you switch to them. This makes the editor open fast regardless of how many scenes you had opened when closing.

godot.windows.editor.dev.x86_64_9fRMa1xSUw.mp4

As a result, restore_scenes_on_load setting became obsolete and I removed it.
Discussion for more context: https://chat.godotengine.org/channel/editor?msg=6MqBpHYC5xdJShs4z
Needs some testing.

@KoBeWi KoBeWi added this to the 4.x milestone Sep 1, 2025
@KoBeWi KoBeWi requested a review from a team as a code owner September 1, 2025 21:49
@KoBeWi KoBeWi requested a review from a team September 1, 2025 21:49
@KoBeWi KoBeWi requested a review from a team as a code owner September 1, 2025 21:49
Comment thread editor/editor_node.cpp
Comment on lines +4250 to +4253
Error err;
Ref<PackedScene> sdata = ResourceLoader::load(editor_data.get_scene_path(p_idx), "", ResourceFormatLoader::CACHE_MODE_REPLACE, &err);
Node *new_scene = sdata->instantiate(PackedScene::GEN_EDIT_STATE_MAIN);
editor_data.set_scene_root(p_idx, new_scene);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This part needs to be improved to include some basic error handling.

@smix8 smix8 modified the milestones: 4.x, 4.6 Sep 1, 2025
@Lielay9
Copy link
Copy Markdown
Contributor

Lielay9 commented Sep 7, 2025

https://xkcd.com/1172/
I haven't necessarily disabled restore_scenes_on_load for performance reasons, I just prefer to start without previous scenes loaded - the disabled behavior defaulting to opening the main scene has been a happy accident. On toy-projects with single or couple scenes, the relevant scene opens automatically, and on bigger projects I can mentally reset after every session and start a day from scratch. On some older projects it's also helpful at locating the main scene to start the process of retracing the project scene hierarchy. Finally the setting has eased editing tool scripts in-editor after some idiot from a minute ago bricked the scene by writing an infinite loop.

Could we keep the toggle or better yet make a new property with 3 options: previous, main, none?

@KoBeWi KoBeWi force-pushed the funni_boogs_incometh branch from 85efb63 to 761d6f7 Compare September 7, 2025 12:14
@KoBeWi
Copy link
Copy Markdown
Member Author

KoBeWi commented Sep 7, 2025

I restored the setting, but changing how it works is out of scope for this PR.

Comment thread editor/editor_data.h Outdated
@KoBeWi KoBeWi force-pushed the funni_boogs_incometh branch from 761d6f7 to 4f9a0b7 Compare September 11, 2025 13:14
@Repiteo Repiteo modified the milestones: 4.6, 4.x Nov 18, 2025
@Repiteo Repiteo requested a review from a team as a code owner February 17, 2026 20:10
@AdriaandeJongh AdriaandeJongh self-requested a review March 5, 2026 14:27
@AdriaandeJongh
Copy link
Copy Markdown
Contributor

If async loading of the scenes speeds up the editor, then we should totally do this – or possibly an iteration on this where the remaining scenes are loaded asynchronously in the background.

I coincidentally didn't have any heavy-to-load scenes in the projects on my computer lol, but can you elaborate whether clicking on unloaded scenes also pops some sort of progress bar if it takes a little while? The hang in your video doesn't look great. We'd like to avoid 'software is unresponsive' kind of situations I think?

@KoBeWi
Copy link
Copy Markdown
Member Author

KoBeWi commented Mar 20, 2026

I forgot this exists 🤔
Some progress bar makes sense, but I'd wait until #116905 is merged until I make further improvements.

@AdriaandeJongh AdriaandeJongh removed their request for review March 20, 2026 15:56
@nikitalita

This comment was marked as off-topic.

@KoBeWi

This comment was marked as outdated.

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.

7 participants