aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/editor_node.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2016-01-14 11:06:20 -0300
committerJuan Linietsky2016-01-14 11:06:20 -0300
commit4248c84e2089b953e00a163962b5b7f19d95e688 (patch)
treea3b72cadad02a816dd1c78ecb425992a883c172b /tools/editor/editor_node.cpp
parente2be837520c0a6e4fed19b714f0477cb9c32eb78 (diff)
downloadgodot-4248c84e2089b953e00a163962b5b7f19d95e688.tar.gz
godot-4248c84e2089b953e00a163962b5b7f19d95e688.tar.zst
godot-4248c84e2089b953e00a163962b5b7f19d95e688.zip
-Make sure scenes properly update when switching tabs, even if sub-instances changed. Fixes #3201
Diffstat (limited to '')
-rw-r--r--tools/editor/editor_node.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 9258637a7..4b965ab9c 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -3623,7 +3623,18 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
add_io_error(txt);
}
- sdata->set_path(lpath,true); //take over path
+ if (ResourceCache::has(lpath)) {
+ //used from somewhere else? no problem! update state
+ Ref<PackedScene> ps = Ref<PackedScene>( ResourceCache::get(lpath)->cast_to<PackedScene>() );
+ if (ps.is_valid()) {
+ ps->replace_state( sdata->get_state() );
+ ps->set_last_modified_time( sdata->get_last_modified_time() );
+ sdata=ps;
+ }
+
+ } else {
+ sdata->set_path(lpath,true); //take over path
+ }
Node*new_scene=sdata->instance(true);