summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJulian Murgia - StraToN <the.straton@gmail.com>2015-10-22 00:23:42 +0200
committerJulian Murgia - StraToN <the.straton@gmail.com>2015-10-22 00:23:42 +0200
commitd64c89d44721bf2b8e84ea1a6d3c7ae0085caf6b (patch)
tree995b279b874b207b76c707fcfe5ecf813a24ec74 /tools
parent35959f9c5a314effc9a442931baccec2408b8ece (diff)
Fix #2623
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_node.cpp21
-rw-r--r--tools/editor/editor_node.h1
2 files changed, 16 insertions, 6 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 34e2510791..a3d7cbd7cf 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -2946,6 +2946,20 @@ void EditorNode::_remove_edited_scene() {
unsaved_cache=false;
}
}
+
+void EditorNode::_remove_scene(int index) {
+// printf("Attempting to remove scene %d (current is %d)\n", index, editor_data.get_edited_scene());
+ if (editor_data.get_edited_scene() == index) {
+ //Scene to remove is current scene
+ _remove_edited_scene();
+ }
+ else {
+ // Scene to remove is not active scene.");
+ editor_data.remove_scene(index);
+ editor_data.get_undo_redo().clear_history();
+ }
+}
+
void EditorNode::set_edited_scene(Node *p_scene) {
if (get_editor_data().get_edited_scene_root()) {
@@ -4390,12 +4404,7 @@ void EditorNode::_scene_tab_script_edited(int p_tab) {
}
void EditorNode::_scene_tab_closed(int p_tab) {
- set_current_scene(p_tab);
- bool p_confirmed = true;
- if (unsaved_cache)
- p_confirmed = false;
-
- _menu_option_confirm(FILE_CLOSE, p_confirmed);
+ _remove_scene(p_tab);
_update_scene_tabs();
}
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 978e8390dc..56e455c9c0 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -461,6 +461,7 @@ class EditorNode : public Node {
void _cleanup_scene();
void _remove_edited_scene();
+ void _remove_scene(int index);
bool _find_and_save_resource(RES p_res,Map<RES,bool>& processed,int32_t flags);
bool _find_and_save_edited_subresources(Object *obj,Map<RES,bool>& processed,int32_t flags);
void _save_edited_subresources(Node* scene,Map<RES,bool>& processed,int32_t flags);