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

The Updating Scene popup pops up constantly when switching scenes #79227

Closed
Rindbee opened this issue Jul 9, 2023 · 1 comment · Fixed by #79237
Closed

The Updating Scene popup pops up constantly when switching scenes #79227

Rindbee opened this issue Jul 9, 2023 · 1 comment · Fixed by #79237

Comments

@Rindbee
Copy link
Contributor

Rindbee commented Jul 9, 2023

Godot version

v4.2.dev.custom_build [ec395516e]

System information

Linux Mint 21.1 (Vera) - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 Ti (nvidia; 515.105.01) - Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz (4 Threads)

Issue description

When the sub-scene is saved and closed, if it automatically switches to the main scene, then opens the sub-scene again. Later, every time you switch to the main scene, the Updating Scene popup will pop up.

diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index af7163eec1..3e08b2f02f 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -662,6 +662,7 @@ bool EditorData::_find_updated_instances(Node *p_root, Node *p_node, HashSet<Str
                if (!checked_paths.has(path)) {
                        uint64_t modified_time = FileAccess::get_modified_time(path);
                        if (modified_time != ss->get_last_modified_time()) {
+                               print_line(p_root, p_node, ss, ss->get_last_modified_time(), modified_time);
                                return true; //external scene changed
                        }

In later switches, ss->get_last_modified_time() keeps returning 0.

Main:<Node2D#1762429819445> Sub:<Node2D#1762446543234> <SceneState#-9223370274575945336> 1688862627 1688863516
Main:<Node2D#2462106842463> Sub:<Node2D#2462123619739> <SceneState#-9223369575788120694> 0 1688863516
Main:<Node2D#2677157197217> Sub:<Node2D#2677173974273> <SceneState#-9223369575788120694> 0 1688863516
Main:<Node2D#2781830246877> Sub:<Node2D#2781847025065> <SceneState#-9223369575788120694> 0 1688863516

Steps to reproduce

  1. Open MRP, and make sure the main scene and sub scene are opened;
  2. Switch to sub scene, save the scene, and close;
  3. With switching to the main scene, the Updating Scene pop-up window will appear automatically;
  4. Open the sub scene again, and switch between the main scene and the sub scene. Whenever you switch to the main scene, the Updating Scene pop-up window will appear.
0.mp4

Minimal reproduction project

update-scene-issue.zip

@Rindbee
Copy link
Contributor Author

Rindbee commented Jul 9, 2023

godot/editor/editor_node.cpp

Lines 3710 to 3716 in 83cc5d4

// Used from somewhere else? No problem! Update state and replace sdata.
Ref<PackedScene> ps = ResourceCache::get_ref(lpath);
if (ps.is_valid()) {
ps->replace_state(sdata->get_state());
ps->set_last_modified_time(sdata->get_last_modified_time());
sdata = ps;
}

godot/core/io/resource.h

Lines 127 to 128 in 83cc5d4

virtual void set_last_modified_time(uint64_t p_time) { last_modified_time = p_time; }
uint64_t get_last_modified_time() const { return last_modified_time; }

The PackedScene class overrides set_last_modified_time() but not get_last_modified_time(). So get_last_modified_time() always returns 0.

virtual void set_last_modified_time(uint64_t p_time) override {
state->set_last_modified_time(p_time);
}

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

Successfully merging a pull request may close this issue.

3 participants