From 158585b21cf5570c425428bb76c6749518199042 Mon Sep 17 00:00:00 2001 From: MarianoGNU Date: Fri, 8 Jul 2016 13:36:57 -0300 Subject: [PATCH] save the editor state of the right scene instead of current --- tools/editor/editor_data.cpp | 7 +++++++ tools/editor/editor_data.h | 1 + tools/editor/editor_node.cpp | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 78c3392f4f2..8d3fd6c9c2f 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -326,6 +326,13 @@ Dictionary EditorData::get_editor_states() const { } +Dictionary EditorData::get_scene_editor_states(int p_idx) const +{ + ERR_FAIL_INDEX_V(p_idx,edited_scene.size(),Dictionary()); + EditedScene es = edited_scene[p_idx]; + return es.editor_states; +} + void EditorData::set_editor_states(const Dictionary& p_states) { List keys; diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h index 785e9076d7c..a0b716f560a 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -156,6 +156,7 @@ public: void paste_object_params(Object *p_object); Dictionary get_editor_states() const; + Dictionary get_scene_editor_states(int p_idx) const; void set_editor_states(const Dictionary& p_states); void get_editor_breakpoints(List *p_breakpoints); void clear_editor_states(); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 98cd8b9cd23..6f4f86ea64f 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -740,7 +740,7 @@ void EditorNode::_set_scene_metadata(const String& p_file, int p_idx) { Ref cf; cf.instance(); - Dictionary md = editor_data.get_editor_states(); + Dictionary md = editor_data.get_edited_scene()==p_idx?editor_data.get_editor_states():editor_data.get_scene_editor_states(p_idx); List keys; md.get_key_list(&keys); @@ -970,7 +970,7 @@ void EditorNode::_save_scene(String p_file, int idx) { editor_data.apply_changes_in_editors(); - _set_scene_metadata(p_file); + _set_scene_metadata(p_file,idx); Ref sdata;