diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 98991cd7c0..29912feb1f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -217,6 +217,12 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) { } else if (ED_IS_SHORTCUT("editor/editor_prev", p_event)) { _editor_select_prev(); } + + if (k->get_scancode() == KEY_ESCAPE) { + for (int i = 0; i < bottom_panel_items.size(); i++) { + _bottom_panel_switch(false, i); + } + } } } @@ -339,7 +345,7 @@ void EditorNode::_notification(int p_what) { if (ScriptEditor::get_singleton()->get_debugger()->is_visible()) bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); - //_update_icons + // update_icons for (int i = 0; i < singleton->main_editor_buttons.size(); i++) { Ref<Texture> icon = singleton->main_editor_buttons[i]->get_icon(); @@ -709,7 +715,7 @@ void EditorNode::_dialog_display_load_error(String p_file, Error p_error) { case ERR_CANT_OPEN: { - accept->set_text(vformat(TTR("Can't open '%s'."), p_file.get_file())); + accept->set_text(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_file.get_file())); } break; case ERR_PARSE_ERROR: { @@ -1110,7 +1116,7 @@ void EditorNode::_dialog_action(String p_file) { if (res.is_null()) { current_option = -1; - accept->get_ok()->set_text("ok :("); + accept->get_ok()->set_text("Ugh"); accept->set_text(TTR("Failed to load resource.")); return; }; @@ -1145,6 +1151,7 @@ void EditorNode::_dialog_action(String p_file) { _save_default_environment(); _save_scene_with_preview(p_file, scene_idx); + _add_to_recent_scenes(p_file); if (scene_idx != -1) _discard_changes(); @@ -1919,7 +1926,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { if (!scene) { current_option = -1; - //confirmation->get_cancel()->hide(); accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation can't be done without a tree root.")); accept->popup_centered_minsize(); @@ -1937,7 +1943,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } - //file->set_current_path(current_path); if (scene->get_filename() != "") { file->set_current_path(scene->get_filename()); if (extensions.size()) { @@ -1987,7 +1992,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { if (!editor_data.get_edited_scene_root()) { current_option = -1; - //confirmation->get_cancel()->hide(); accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation can't be done without a scene.")); accept->popup_centered_minsize(); @@ -2036,8 +2040,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } break; case FILE_IMPORT_SUBSCENE: { - //import_subscene->popup_centered_ratio(); - if (!editor_data.get_edited_scene_root()) { current_option = -1; @@ -2056,7 +2058,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { if (unsaved_cache && !p_confirmed) { confirmation->get_ok()->set_text(TTR("Open")); - //confirmation->get_cancel()->show(); confirmation->set_text(TTR("Current scene not saved. Open anyway?")); confirmation->popup_centered_minsize(); break; @@ -2843,7 +2844,7 @@ void EditorNode::_remove_scene(int index) { //Scene to remove is current scene _remove_edited_scene(); } else { - // Scene to remove is not active scene + //Scene to remove is not active scene editor_data.remove_scene(index); } } @@ -3240,48 +3241,47 @@ void EditorNode::_show_messages() { void EditorNode::_add_to_recent_scenes(const String &p_scene) { - String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); - Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); - String name = p_scene; - name = name.replace("res://", ""); - if (rc.find(name) != -1) - rc.erase(name); - rc.insert(0, name); + Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scenes", Array()); + if (rc.find(p_scene) != -1) + rc.erase(p_scene); + rc.push_front(p_scene); if (rc.size() > 10) rc.resize(10); - EditorSettings::get_singleton()->set(base + "/_recent_scenes", rc); - EditorSettings::get_singleton()->save(); + EditorSettings::get_singleton()->set_project_metadata("recent_files", "scenes", rc); _update_recent_scenes(); } void EditorNode::_open_recent_scene(int p_idx) { - String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); - if (p_idx == recent_scenes->get_item_count() - 1) { - EditorSettings::get_singleton()->erase(base + "/_recent_scenes"); + EditorSettings::get_singleton()->set_project_metadata("recent_files", "scenes", Array()); call_deferred("_update_recent_scenes"); } else { - Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); + Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scenes", Array()); ERR_FAIL_INDEX(p_idx, rc.size()); - String path = "res://" + rc[p_idx]; - load_scene(path); + if (load_scene(rc[p_idx]) != OK) { + + rc.remove(p_idx); + EditorSettings::get_singleton()->set_project_metadata("recent_files", "scenes", rc); + _update_recent_scenes(); + } } } void EditorNode::_update_recent_scenes() { - String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); - Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); + Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scenes", Array()); recent_scenes->clear(); + String path; for (int i = 0; i < rc.size(); i++) { - recent_scenes->add_item(rc[i], i); + path = rc[i]; + recent_scenes->add_item(path.replace("res://", ""), i); } recent_scenes->add_separator(); @@ -5118,7 +5118,6 @@ EditorNode::EditorNode() { gui_base->add_child(dependency_fixer); settings_config_dialog = memnew(EditorSettingsDialog); - // settings_config_dialog->add_style_override("panel", gui_base->get_stylebox("EditorSettingsDialog", "EditorStyles")); gui_base->add_child(settings_config_dialog); project_settings = memnew(ProjectSettingsEditor(&editor_data)); @@ -5192,7 +5191,6 @@ EditorNode::EditorNode() { p->add_item(TTR("Project Settings"), RUN_SETTINGS); p->add_separator(); p->connect("id_pressed", this, "_menu_option"); - //p->add_item(TTR("Run Script"), FILE_RUN_SCRIPT, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_R); p->add_item(TTR("Export"), FILE_EXPORT_PROJECT); PopupMenu *tool_menu = memnew(PopupMenu); @@ -5283,7 +5281,6 @@ EditorNode::EditorNode() { menu_hb->add_child(play_cc); play_button_panel = memnew(PanelContainer); - // play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles")); play_cc->add_child(play_button_panel); HBoxContainer *play_hb = memnew(HBoxContainer); |