diff options
Diffstat (limited to 'tools/editor/editor_node.cpp')
-rw-r--r-- | tools/editor/editor_node.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index eae2d69dd9..79f5e66401 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -2367,7 +2367,14 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { if (!scene) break; - + + String filename = scene->get_filename(); + + if (filename==String()) { + show_warning("Can't reload a scene that was never saved.."); + break; + } + if (unsaved_cache && !p_confirmed) { confirmation->get_ok()->set_text("Revert"); confirmation->set_text("This action cannot be undone. Revert anyway?"); @@ -2375,7 +2382,13 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { break; } - Error err = load_scene(scene->get_filename()); + + int cur_idx = editor_data.get_edited_scene(); + _remove_edited_scene(); + Error err = load_scene(filename); + editor_data.move_edited_scene_to_index(cur_idx); + get_undo_redo()->clear_history(); + scene_tabs->set_current_tab(cur_idx); } break; @@ -4520,14 +4533,14 @@ void EditorNode::_scene_tab_changed(int p_tab) { editor_data.get_undo_redo().create_action("Switch Scene Tab"); editor_data.get_undo_redo().add_do_method(this,"set_current_version",unsaved?saved_version:0); editor_data.get_undo_redo().add_do_method(this,"set_current_scene",p_tab); - editor_data.get_undo_redo().add_do_method(scene_tabs,"set_current_tab",p_tab); - editor_data.get_undo_redo().add_do_method(scene_tabs,"ensure_tab_visible",p_tab); + //editor_data.get_undo_redo().add_do_method(scene_tabs,"set_current_tab",p_tab); + //editor_data.get_undo_redo().add_do_method(scene_tabs,"ensure_tab_visible",p_tab); editor_data.get_undo_redo().add_do_method(this,"set_current_version",next_scene_version==0?editor_data.get_undo_redo().get_version()+1:next_scene_version); editor_data.get_undo_redo().add_undo_method(this,"set_current_version",next_scene_version); editor_data.get_undo_redo().add_undo_method(this,"set_current_scene",editor_data.get_edited_scene()); - editor_data.get_undo_redo().add_undo_method(scene_tabs,"set_current_tab",editor_data.get_edited_scene()); - editor_data.get_undo_redo().add_undo_method(scene_tabs,"ensure_tab_visible",p_tab,editor_data.get_edited_scene()); + //editor_data.get_undo_redo().add_undo_method(scene_tabs,"set_current_tab",editor_data.get_edited_scene()); + //editor_data.get_undo_redo().add_undo_method(scene_tabs,"ensure_tab_visible",p_tab,editor_data.get_edited_scene()); editor_data.get_undo_redo().add_undo_method(this,"set_current_version",saved_version); editor_data.get_undo_redo().commit_action(); @@ -4579,6 +4592,16 @@ ToolButton *EditorNode::add_bottom_panel_item(String p_text,Control *p_item) { } +bool EditorNode::are_bottom_panels_hidden() const { + + for(int i=0;i<bottom_panel_items.size();i++) { + if (bottom_panel_items[i].button->is_pressed()) + return false; + } + + return true; +} + void EditorNode::hide_bottom_panel() { _bottom_panel_switch(false,0); |