save the editor state of the right scene instead of current

This commit is contained in:
MarianoGNU 2016-07-08 13:36:57 -03:00
parent 2924536e90
commit 158585b21c
3 changed files with 10 additions and 2 deletions

View file

@ -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) { void EditorData::set_editor_states(const Dictionary& p_states) {
List<Variant> keys; List<Variant> keys;

View file

@ -156,6 +156,7 @@ public:
void paste_object_params(Object *p_object); void paste_object_params(Object *p_object);
Dictionary get_editor_states() const; Dictionary get_editor_states() const;
Dictionary get_scene_editor_states(int p_idx) const;
void set_editor_states(const Dictionary& p_states); void set_editor_states(const Dictionary& p_states);
void get_editor_breakpoints(List<String> *p_breakpoints); void get_editor_breakpoints(List<String> *p_breakpoints);
void clear_editor_states(); void clear_editor_states();

View file

@ -740,7 +740,7 @@ void EditorNode::_set_scene_metadata(const String& p_file, int p_idx) {
Ref<ConfigFile> cf; Ref<ConfigFile> cf;
cf.instance(); 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<Variant> keys; List<Variant> keys;
md.get_key_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(); editor_data.apply_changes_in_editors();
_set_scene_metadata(p_file); _set_scene_metadata(p_file,idx);
Ref<PackedScene> sdata; Ref<PackedScene> sdata;