summaryrefslogtreecommitdiff
path: root/tools/editor/editor_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/editor_data.cpp')
-rw-r--r--tools/editor/editor_data.cpp44
1 files changed, 34 insertions, 10 deletions
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index 4c4fecdd83..35ec1ebfcc 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<Variant> keys;
@@ -565,6 +572,8 @@ bool EditorData::check_and_update_scene(int p_idx) {
bool must_reload = _find_updated_instances(edited_scene[p_idx].root,edited_scene[p_idx].root,checked_scenes);
+ print_line("MUST RELOAD? "+itos(must_reload));
+
if (must_reload) {
Ref<PackedScene> pscene;
pscene.instance();
@@ -611,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) {
@@ -628,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;
+ }
}
@@ -756,12 +773,19 @@ void EditorData::set_edited_scene_import_metadata(Ref<ResourceImportMetadata> p_
}
-Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata() const{
+Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata(int idx) const{
ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),Ref<ResourceImportMetadata>());
- 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<ResourceImportMetadata>());
+ return edited_scene[idx].medatata;
+ }
}
+
+
void EditorData::clear_edited_scenes() {
for(int i=0;i<edited_scene.size();i++) {
@@ -810,7 +834,7 @@ void EditorSelection::_node_removed(Node *p_node) {
void EditorSelection::add_node(Node *p_node) {
ERR_FAIL_NULL(p_node);
-
+ ERR_FAIL_COND(!p_node->is_inside_tree());
if (selection.has(p_node))
return;