From 4248c84e2089b953e00a163962b5b7f19d95e688 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 14 Jan 2016 11:06:20 -0300 Subject: -Make sure scenes properly update when switching tabs, even if sub-instances changed. Fixes #3201 --- tools/editor/editor_data.cpp | 4 ++-- tools/editor/editor_node.cpp | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index d79c1ff466..5e613c658b 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -499,8 +499,8 @@ void EditorData::remove_scene(int p_idx){ bool EditorData::_find_updated_instances(Node* p_root,Node *p_node,Set &checked_paths) { - if (p_root!=p_node && p_node->get_owner()!=p_root && !p_root->is_editable_instance(p_node->get_owner())) - return false; +// if (p_root!=p_node && p_node->get_owner()!=p_root && !p_root->is_editable_instance(p_node->get_owner())) +// return false; Ref ss; diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 9258637a74..4b965ab9cf 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 ps = Ref( ResourceCache::get(lpath)->cast_to() ); + 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); -- cgit v1.2.3