From 2924536e903bebe0d7ddb892784fb3c3f16b23dd Mon Sep 17 00:00:00 2001 From: MarianoGNU Date: Sun, 26 Jun 2016 00:54:17 -0300 Subject: Save all edited scenes when Runing (and auto-save is enabled). Fixes #4410 --- tools/editor/editor_data.cpp | 31 ++++++++++++++++++++++--------- tools/editor/editor_data.h | 6 +++--- tools/editor/editor_node.cpp | 37 ++++++++++++++++++++++++------------- tools/editor/editor_node.h | 5 +++-- 4 files changed, 52 insertions(+), 27 deletions(-) diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 0f10041034..78c3392f4f 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -613,11 +613,14 @@ void EditorData::set_edited_scene(int p_idx){ current_edited_scene=p_idx; //swap } -Node* EditorData::get_edited_scene_root(){ - - ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),NULL); - - return edited_scene[current_edited_scene].root; +Node* EditorData::get_edited_scene_root(int p_idx){ + if (p_idx < 0) { + ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),NULL); + return edited_scene[current_edited_scene].root; + } else { + ERR_FAIL_INDEX_V(p_idx,edited_scene.size(),NULL); + return edited_scene[p_idx].root; + } } void EditorData::set_edited_scene_root(Node* p_root) { @@ -630,9 +633,14 @@ int EditorData::get_edited_scene_count() const { return edited_scene.size(); } -void EditorData::set_edited_scene_version(uint64_t version) { +void EditorData::set_edited_scene_version(uint64_t version, int scene_idx) { ERR_FAIL_INDEX(current_edited_scene,edited_scene.size()); - edited_scene[current_edited_scene].version=version; + if (scene_idx < 0) { + edited_scene[current_edited_scene].version=version; + } else { + ERR_FAIL_INDEX(scene_idx,edited_scene.size()); + edited_scene[scene_idx].version=version; + } } @@ -758,10 +766,15 @@ void EditorData::set_edited_scene_import_metadata(Ref p_ } -Ref EditorData::get_edited_scene_import_metadata() const{ +Ref EditorData::get_edited_scene_import_metadata(int idx) const{ ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),Ref()); - return edited_scene[current_edited_scene].medatata; + if(idx<0) { + return edited_scene[current_edited_scene].medatata; + } else { + ERR_FAIL_INDEX_V(idx,edited_scene.size(),Ref()); + return edited_scene[idx].medatata; + } } diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h index 319155655d..785e9076d7 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -184,15 +184,15 @@ public: void set_edited_scene(int p_idx); void set_edited_scene_root(Node* p_root); void set_edited_scene_import_metadata(Ref p_mdata); - Ref get_edited_scene_import_metadata() const; + Ref get_edited_scene_import_metadata(int p_idx = -1) const; int get_edited_scene() const; - Node* get_edited_scene_root(); + Node* get_edited_scene_root(int p_idx = -1); int get_edited_scene_count() const; String get_scene_title(int p_idx) const; String get_scene_path(int p_idx) const; String get_scene_type(int p_idx) const; Ref