diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 0f10041034c..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; @@ -613,11 +620,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 +640,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 +773,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 319155655dd..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(); @@ -184,15 +185,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