diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-02-09 21:21:48 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-02-09 21:21:48 -0300 |
commit | d45a227e2549b7dfa40cec92aefa0fca12d8bc88 (patch) | |
tree | f2fdde8e992f6be3f9ea317bff6501707d11084b /tools | |
parent | 31d0c65298dfef51da1453041763b981c3b54cf0 (diff) | |
parent | 5e1e78b257ad89dde7cd9becdbaa5fdadca08e19 (diff) |
Merge pull request #1303 from erbridge/revert_menu_item
Add a revert menu item
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/editor_node.cpp | 21 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 6ff16e661c..a48545d152 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1967,6 +1967,25 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { log->add_message("REDO: "+action); } break; + + case EDIT_REVERT: { + + Node *scene = get_edited_scene(); + + if (!scene) + break; + + if (unsaved_cache && !p_confirmed) { + confirmation->get_ok()->set_text("Revert"); + confirmation->set_text("This action cannot be undone. Revert anyway?"); + confirmation->popup_centered(Size2(300,70)); + break; + } + + Error err = load_scene(scene->get_filename()); + + } break; + #if 0 case NODE_EXTERNAL_INSTANCE: { @@ -3469,6 +3488,8 @@ EditorNode::EditorNode() { p->add_separator(); p->add_item("Project Settings",RUN_SETTINGS); p->add_separator(); + p->add_item("Revert Scene",EDIT_REVERT); + p->add_separator(); p->add_item("Quit to Project List",RUN_PROJECT_MANAGER,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_Q); p->add_item("Quit",FILE_QUIT,KEY_MASK_CMD+KEY_Q); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 7560c2b149..54b9dc2b0b 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -127,6 +127,7 @@ class EditorNode : public Node { FILE_EXTERNAL_OPEN_SCENE, EDIT_UNDO, EDIT_REDO, + EDIT_REVERT, RESOURCE_NEW, RESOURCE_LOAD, RESOURCE_SAVE, |