godot
godot copied to clipboard
Fix selecting root when opening scene.
Fixes #91411
This part was literaly pushing the root to be edited whenever loaded. This made a lot of issues and my modifications to edit_current and selection made it more visible.
This was removed in #80517 during restoration of scenes because those problems became too apparent there but kept it for normal loading. The fact is some of those bugs can be reproduced with simple loading like the theme one
https://github.com/godotengine/godot/assets/66184050/26b572da-d762-4946-989e-72779d87f265
Here I removed it untirely but I'm wondering if it is a feature that if nothing is selected when opening the scene it automatically selects the root if so then I can update the PR to make it so in a non problematic way.
There's another PR that also says that will fix the issue: #91430
Even if the other one is merged I think this should still me merged because of the issue I showed
I tested this PR and everything seems to work fine except when tabbing between scenes without changing the selection. I think it's maybe another side effect of calling SceneTreeDock::get_singleton()->set_selection in EditorNode::_edit_current ?
After the first load of a scene, the selection is restored correctly, but if I switch to another scene (another tab) and go back to the first scene, only one node is selected.
Exemple: https://github.com/godotengine/godot/assets/81109165/f0b58ba0-1a83-4cce-8b40-76bdb946c7a3
Before (version 4.2.1): https://github.com/godotengine/godot/assets/81109165/4839a66b-a8c9-4a8f-a163-89cc69f736c6
Thanks!