Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the loading scene open in the current scene tab if the current scene is empty #90566

Conversation

Rindbee
Copy link
Contributor

@Rindbee Rindbee commented Apr 12, 2024

Previously, even if the scene in the current scene tab was empty (no scene root added and no scene path assigned), a new scene might be opened in a new tab when opening the scene through EditorNode::load_scene().

b2f425f This PR
0 1

This is even worse when dragging the scene file to the 2D screen.

#90559 #90559 + This PR
2 3

@akien-mga
Copy link
Member

What if the "empty" scene is actually not empty but just unsaved? I.e. if you start adding some nodes to it, don't save, and then open a new scene? I wouldn't expect it to discard the unsaved work.

@Rindbee
Copy link
Contributor Author

Rindbee commented Apr 12, 2024

What if the "empty" scene is actually not empty but just unsaved? I.e. if you start adding some nodes to it, don't save, and then open a new scene? I wouldn't expect it to discard the unsaved work.

In this case, the scene root is not null, the scene is unsaved not empty, so a new tab will be opened.

4

@KoBeWi
Copy link
Member

KoBeWi commented Apr 12, 2024

When you delete scene root and load another scene, it will replace the "empty" one and will be marked as modified. Interestingly, you can undo that to restore the old root and it doesn't break anything 🤔
A scene is truly empty when it has no root node nor scene path assigned (rootless scenes can still be tied to a file if you deleted the root node).

@Rindbee Rindbee force-pushed the make-the-load-scene-open-in-current-scene-tab-if-it-is-empty branch from 200f050 to d9b31d4 Compare April 12, 2024 09:10
@Rindbee
Copy link
Contributor Author

Rindbee commented Apr 12, 2024

0.mp4

It should be fine now, but dragging the scene file into the 2D Screen causes the shortcut Ctrl + Z to temporarily not work.

@KoBeWi
Copy link
Member

KoBeWi commented Apr 12, 2024

I can't reproduce the issue in your video. Seems like the node was added to wrong scene tab?

KoBeWi
KoBeWi previously approved these changes Apr 12, 2024
@KoBeWi KoBeWi dismissed their stale review April 12, 2024 12:00

nevermind, found another corner case :D

@KoBeWi
Copy link
Member

KoBeWi commented Apr 12, 2024

Another bug:

  1. Create new empty scene
  2. Add root
  3. Delete root
  4. Open scene

The undo history is carried to the new scene. You should clear it.

@Rindbee Rindbee force-pushed the make-the-load-scene-open-in-current-scene-tab-if-it-is-empty branch 3 times, most recently from 25fbd1b to 87fd121 Compare April 12, 2024 23:33
@Rindbee Rindbee force-pushed the make-the-load-scene-open-in-current-scene-tab-if-it-is-empty branch from 87fd121 to 291450a Compare April 16, 2024 15:00
@Rindbee Rindbee force-pushed the make-the-load-scene-open-in-current-scene-tab-if-it-is-empty branch from 291450a to b5157e0 Compare April 16, 2024 15:23
@akien-mga akien-mga merged commit 517d7cf into godotengine:master Apr 17, 2024
16 checks passed
@Rindbee Rindbee deleted the make-the-load-scene-open-in-current-scene-tab-if-it-is-empty branch April 17, 2024 09:06
@akien-mga
Copy link
Member

Thanks!

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.

3 participants