Rename editor "File" MenuOption enums for clarity

This commit is contained in:
Rémi Verschelde
2025-04-29 23:30:31 +02:00
parent 32eafc18b4
commit 694d034d5b
12 changed files with 439 additions and 433 deletions

View File

@@ -302,9 +302,9 @@ void DependencyEditorOwners::_list_rmb_clicked(int p_item, const Vector2 &p_pos,
}
if (only_scenes_selected) {
file_options->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRN("Open Scene", "Open Scenes", selected_items.size()), FILE_OPEN_);
file_options->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRN("Open Scene", "Open Scenes", selected_items.size()), FILE_MENU_OPEN);
} else if (selected_items.size() == 1) {
file_options->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Open"), FILE_OPEN_);
file_options->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Open"), FILE_MENU_OPEN);
} else {
return;
}
@@ -333,7 +333,7 @@ void DependencyEditorOwners::_empty_clicked(const Vector2 &p_pos, MouseButton p_
void DependencyEditorOwners::_file_option(int p_option) {
switch (p_option) {
case FILE_OPEN_: {
case FILE_MENU_OPEN: {
PackedInt32Array selected_items = owners->get_selected_items();
for (int i = 0; i < selected_items.size(); i++) {
int item_idx = selected_items[i];

View File

@@ -80,7 +80,7 @@ class DependencyEditorOwners : public AcceptDialog {
private:
enum FileMenu {
FILE_OPEN_,
FILE_MENU_OPEN,
};
public:

View File

@@ -859,7 +859,7 @@ void EditorNode::_notification(int p_what) {
} break;
case NOTIFICATION_WM_CLOSE_REQUEST: {
_menu_option_confirm(FILE_QUIT, false);
_menu_option_confirm(SCENE_QUIT, false);
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
@@ -1393,8 +1393,8 @@ void EditorNode::_titlebar_resized() {
void EditorNode::_update_undo_redo_allowed() {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
file_menu->set_item_disabled(file_menu->get_item_index(FILE_UNDO), !undo_redo->has_undo());
file_menu->set_item_disabled(file_menu->get_item_index(FILE_REDO), !undo_redo->has_redo());
file_menu->set_item_disabled(file_menu->get_item_index(SCENE_UNDO), !undo_redo->has_undo());
file_menu->set_item_disabled(file_menu->get_item_index(SCENE_REDO), !undo_redo->has_redo());
}
void EditorNode::_node_renamed() {
@@ -2114,8 +2114,8 @@ void EditorNode::save_scene_list(const HashSet<String> &p_scene_paths) {
}
void EditorNode::save_before_run() {
current_menu_option = FILE_SAVE_AND_RUN;
_menu_option_confirm(FILE_SAVE_AS_SCENE, true);
current_menu_option = SAVE_AND_RUN;
_menu_option_confirm(SCENE_SAVE_AS_SCENE, true);
file->set_title(TTR("Save scene before running..."));
}
@@ -2131,7 +2131,7 @@ void EditorNode::try_autosave() {
_save_scene_with_preview(scene->get_scene_file_path());
}
}
_menu_option(FILE_SAVE_ALL_SCENES);
_menu_option(SCENE_SAVE_ALL_SCENES);
editor_data.save_editor_external_data();
}
@@ -2210,16 +2210,16 @@ bool EditorNode::_is_scene_unsaved(int p_idx) {
void EditorNode::_dialog_action(String p_file) {
switch (current_menu_option) {
case FILE_NEW_INHERITED_SCENE: {
case SCENE_NEW_INHERITED_SCENE: {
Node *scene = editor_data.get_edited_scene_root();
// If the previous scene is rootless, just close it in favor of the new one.
if (!scene) {
_menu_option_confirm(FILE_CLOSE, true);
_menu_option_confirm(SCENE_CLOSE, true);
}
load_scene(p_file, false, true);
} break;
case FILE_OPEN_SCENE: {
case SCENE_OPEN_SCENE: {
load_scene(p_file);
} break;
case SETTINGS_PICK_MAIN_SCENE: {
@@ -2229,12 +2229,12 @@ void EditorNode::_dialog_action(String p_file) {
project_run_bar->play_main_scene((bool)pick_main_scene->get_meta("from_native", false));
} break;
case FILE_CLOSE:
case SCENE_CLOSE:
case SCENE_TAB_CLOSE:
case FILE_SAVE_SCENE:
case FILE_MULTI_SAVE_AS_SCENE:
case FILE_SAVE_AS_SCENE: {
int scene_idx = (current_menu_option == FILE_SAVE_SCENE || current_menu_option == FILE_SAVE_AS_SCENE || current_menu_option == FILE_MULTI_SAVE_AS_SCENE) ? -1 : tab_closing_idx;
case SCENE_SAVE_SCENE:
case SCENE_MULTI_SAVE_AS_SCENE:
case SCENE_SAVE_AS_SCENE: {
int scene_idx = (current_menu_option == SCENE_SAVE_SCENE || current_menu_option == SCENE_SAVE_AS_SCENE || current_menu_option == SCENE_MULTI_SAVE_AS_SCENE) ? -1 : tab_closing_idx;
if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) {
bool same_open_scene = false;
@@ -2262,13 +2262,13 @@ void EditorNode::_dialog_action(String p_file) {
}
}
if (current_menu_option == FILE_MULTI_SAVE_AS_SCENE) {
if (current_menu_option == SCENE_MULTI_SAVE_AS_SCENE) {
_proceed_save_asing_scene_tabs();
}
} break;
case FILE_SAVE_AND_RUN: {
case SAVE_AND_RUN: {
if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) {
save_default_environment();
_save_scene_with_preview(p_file);
@@ -2276,7 +2276,7 @@ void EditorNode::_dialog_action(String p_file) {
}
} break;
case FILE_SAVE_AND_RUN_MAIN_SCENE: {
case SAVE_AND_RUN_MAIN_SCENE: {
ProjectSettings::get_singleton()->set("application/run/main_scene", ResourceUID::path_to_uid(p_file));
ProjectSettings::get_singleton()->save();
@@ -2874,12 +2874,12 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
switch (p_option) {
case FILE_NEW_SCENE: {
case SCENE_NEW_SCENE: {
new_scene();
} break;
case FILE_NEW_INHERITED_SCENE:
case FILE_OPEN_SCENE: {
case SCENE_NEW_INHERITED_SCENE:
case SCENE_OPEN_SCENE: {
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
@@ -2892,20 +2892,20 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (scene) {
file->set_current_path(scene->get_scene_file_path());
};
file->set_title(p_option == FILE_OPEN_SCENE ? TTR("Open Scene") : TTR("Open Base Scene"));
file->set_title(p_option == SCENE_OPEN_SCENE ? TTR("Open Scene") : TTR("Open Base Scene"));
file->popup_file_dialog();
} break;
case FILE_QUICK_OPEN: {
case SCENE_QUICK_OPEN: {
quick_open_dialog->popup_dialog({ "Resource" }, callable_mp(this, &EditorNode::_quick_opened));
} break;
case FILE_QUICK_OPEN_SCENE: {
case SCENE_QUICK_OPEN_SCENE: {
quick_open_dialog->popup_dialog({ "PackedScene" }, callable_mp(this, &EditorNode::_quick_opened));
} break;
case FILE_QUICK_OPEN_SCRIPT: {
case SCENE_QUICK_OPEN_SCRIPT: {
quick_open_dialog->popup_dialog({ "Script" }, callable_mp(this, &EditorNode::_quick_opened));
} break;
case FILE_OPEN_PREV: {
case SCENE_OPEN_PREV: {
if (!prev_closed_scenes.is_empty()) {
load_scene(prev_closed_scenes.back()->get());
}
@@ -2934,12 +2934,12 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
_proceed_closing_scene_tabs();
} break;
case FILE_CLOSE: {
case SCENE_CLOSE: {
_scene_tab_closed(editor_data.get_edited_scene());
} break;
case SCENE_TAB_CLOSE:
case FILE_SAVE_SCENE: {
int scene_idx = (p_option == FILE_SAVE_SCENE) ? -1 : tab_closing_idx;
case SCENE_SAVE_SCENE: {
int scene_idx = (p_option == SCENE_SAVE_SCENE) ? -1 : tab_closing_idx;
Node *scene = editor_data.get_edited_scene_root(scene_idx);
if (scene && !scene->get_scene_file_path().is_empty()) {
if (DirAccess::exists(scene->get_scene_file_path().get_base_dir())) {
@@ -2960,14 +2960,14 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
[[fallthrough]];
}
case FILE_MULTI_SAVE_AS_SCENE:
case FILE_SAVE_AS_SCENE: {
int scene_idx = (p_option == FILE_SAVE_SCENE || p_option == FILE_SAVE_AS_SCENE || p_option == FILE_MULTI_SAVE_AS_SCENE) ? -1 : tab_closing_idx;
case SCENE_MULTI_SAVE_AS_SCENE:
case SCENE_SAVE_AS_SCENE: {
int scene_idx = (p_option == SCENE_SAVE_SCENE || p_option == SCENE_SAVE_AS_SCENE || p_option == SCENE_MULTI_SAVE_AS_SCENE) ? -1 : tab_closing_idx;
Node *scene = editor_data.get_edited_scene_root(scene_idx);
if (!scene) {
if (p_option == FILE_SAVE_SCENE) {
if (p_option == SCENE_SAVE_SCENE) {
// Pressing Ctrl + S saves the current script if a scene is currently open, but it won't if the scene has no root node.
// Work around this by explicitly saving the script in this case (similar to pressing Ctrl + Alt + S).
ScriptEditor::get_singleton()->save_current_script();
@@ -2976,7 +2976,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
const int saved = _save_external_resources(true);
if (saved > 0) {
EditorToaster::get_singleton()->popup_str(vformat(TTR("The current scene has no root node, but %d modified external resource(s) and/or plugin data were saved anyway."), saved), EditorToaster::SEVERITY_INFO);
} else if (p_option == FILE_SAVE_AS_SCENE) {
} else if (p_option == SCENE_SAVE_AS_SCENE) {
// Don't show this dialog when pressing Ctrl + S to avoid interfering with script saving.
show_accept(
TTR("A root node is required to save the scene. You can add a root node using the Scene tree dock."),
@@ -3018,7 +3018,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_SAVE_ALL_SCENES: {
case SCENE_SAVE_ALL_SCENES: {
_save_all_scenes();
} break;
@@ -3039,7 +3039,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file_pack_zip->popup_file_dialog();
} break;
case FILE_UNDO: {
case SCENE_UNDO: {
if ((int)Input::get_singleton()->get_mouse_button_mask() & 0x7) {
log->add_message(TTR("Can't undo while mouse buttons are pressed."), EditorLog::MSG_TYPE_EDITOR);
} else {
@@ -3062,7 +3062,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
}
} break;
case FILE_REDO: {
case SCENE_REDO: {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
if ((int)Input::get_singleton()->get_mouse_button_mask() & 0x7) {
log->add_message(TTR("Can't redo while mouse buttons are pressed."), EditorLog::MSG_TYPE_EDITOR);
@@ -3089,7 +3089,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
} break;
case FILE_RELOAD_SAVED_SCENE: {
case SCENE_RELOAD_SAVED_SCENE: {
Node *scene = get_edited_scene();
if (!scene) {
@@ -3180,7 +3180,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
OS::get_singleton()->ensure_user_data_dir();
OS::get_singleton()->shell_show_in_file_manager(OS::get_singleton()->get_user_data_dir(), true);
} break;
case FILE_QUIT:
case SCENE_QUIT:
case PROJECT_QUIT_TO_PROJECT_MANAGER:
case PROJECT_RELOAD_CURRENT_PROJECT: {
if (p_confirmed && plugin_to_save) {
@@ -3261,7 +3261,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
save_confirmation->set_text(TTR("Save changes to the following scene(s) before reloading?") + unsaved_scenes);
} else {
save_confirmation->set_ok_button_text(TTR("Save & Quit"));
save_confirmation->set_text((p_option == FILE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes to the following scene(s) before opening Project Manager?")) + unsaved_scenes);
save_confirmation->set_text((p_option == SCENE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes to the following scene(s) before opening Project Manager?")) + unsaved_scenes);
}
save_confirmation->reset_size();
save_confirmation->popup_centered();
@@ -3591,7 +3591,7 @@ void EditorNode::unload_editor_addons() {
void EditorNode::_discard_changes(const String &p_str) {
switch (current_menu_option) {
case FILE_CLOSE:
case SCENE_CLOSE:
case SCENE_TAB_CLOSE: {
Node *scene = editor_data.get_edited_scene_root(tab_closing_idx);
if (scene != nullptr) {
@@ -3605,7 +3605,7 @@ void EditorNode::_discard_changes(const String &p_str) {
}
_proceed_closing_scene_tabs();
} break;
case FILE_RELOAD_SAVED_SCENE: {
case SCENE_RELOAD_SAVED_SCENE: {
Node *scene = get_edited_scene();
String scene_filename = scene->get_scene_file_path();
@@ -3624,7 +3624,7 @@ void EditorNode::_discard_changes(const String &p_str) {
confirmation->hide();
} break;
case FILE_QUIT: {
case SCENE_QUIT: {
project_run_bar->stop_playing();
_exit_editor(EXIT_SUCCESS);
@@ -3647,11 +3647,11 @@ void EditorNode::_update_file_menu_opened() {
}
}
if (has_unsaved) {
file_menu->set_item_disabled(file_menu->get_item_index(FILE_SAVE_ALL_SCENES), false);
file_menu->set_item_tooltip(file_menu->get_item_index(FILE_SAVE_ALL_SCENES), String());
file_menu->set_item_disabled(file_menu->get_item_index(SCENE_SAVE_ALL_SCENES), false);
file_menu->set_item_tooltip(file_menu->get_item_index(SCENE_SAVE_ALL_SCENES), String());
} else {
file_menu->set_item_disabled(file_menu->get_item_index(FILE_SAVE_ALL_SCENES), true);
file_menu->set_item_tooltip(file_menu->get_item_index(FILE_SAVE_ALL_SCENES), TTR("All scenes are already saved."));
file_menu->set_item_disabled(file_menu->get_item_index(SCENE_SAVE_ALL_SCENES), true);
file_menu->set_item_tooltip(file_menu->get_item_index(SCENE_SAVE_ALL_SCENES), TTR("All scenes are already saved."));
}
_update_undo_redo_allowed();
}
@@ -4745,7 +4745,7 @@ String EditorNode::get_multiwindow_support_tooltip_text() const {
}
void EditorNode::_inherit_request(String p_file) {
current_menu_option = FILE_NEW_INHERITED_SCENE;
current_menu_option = SCENE_NEW_INHERITED_SCENE;
_dialog_action(p_file);
}
@@ -4769,7 +4769,7 @@ void EditorNode::_update_prev_closed_scenes(const String &p_scene_path, bool p_a
} else {
prev_closed_scenes.erase(p_scene_path);
}
file_menu->set_item_disabled(file_menu->get_item_index(FILE_OPEN_PREV), prev_closed_scenes.is_empty());
file_menu->set_item_disabled(file_menu->get_item_index(SCENE_OPEN_PREV), prev_closed_scenes.is_empty());
}
}
@@ -4985,8 +4985,8 @@ void EditorNode::_pick_main_scene_custom_action(const String &p_custom_action_na
pick_main_scene->hide();
if (!FileAccess::exists(scene->get_scene_file_path())) {
current_menu_option = FILE_SAVE_AND_RUN_MAIN_SCENE;
_menu_option_confirm(FILE_SAVE_AS_SCENE, true);
current_menu_option = SAVE_AND_RUN_MAIN_SCENE;
_menu_option_confirm(SCENE_SAVE_AS_SCENE, true);
file->set_title(TTR("Save scene before running..."));
} else {
current_menu_option = SETTINGS_PICK_MAIN_SCENE;
@@ -5663,11 +5663,11 @@ bool EditorNode::has_scenes_in_session() {
}
void EditorNode::undo() {
_menu_option_confirm(FILE_UNDO, true);
_menu_option_confirm(SCENE_UNDO, true);
}
void EditorNode::redo() {
_menu_option_confirm(FILE_REDO, true);
_menu_option_confirm(SCENE_REDO, true);
}
bool EditorNode::ensure_main_scene(bool p_from_native) {
@@ -5857,11 +5857,11 @@ void EditorNode::_proceed_save_asing_scene_tabs() {
int scene_idx = scenes_to_save_as.front()->get();
scenes_to_save_as.pop_front();
_set_current_scene(scene_idx);
_menu_option_confirm(FILE_MULTI_SAVE_AS_SCENE, false);
_menu_option_confirm(SCENE_MULTI_SAVE_AS_SCENE, false);
}
bool EditorNode::_is_closing_editor() const {
return tab_closing_menu_option == FILE_QUIT || tab_closing_menu_option == PROJECT_QUIT_TO_PROJECT_MANAGER || tab_closing_menu_option == PROJECT_RELOAD_CURRENT_PROJECT;
return tab_closing_menu_option == SCENE_QUIT || tab_closing_menu_option == PROJECT_QUIT_TO_PROJECT_MANAGER || tab_closing_menu_option == PROJECT_RELOAD_CURRENT_PROJECT;
}
void EditorNode::_restart_editor(bool p_goto_project_manager) {
@@ -7597,7 +7597,7 @@ EditorNode::EditorNode() {
save_accept = memnew(AcceptDialog);
save_accept->set_unparent_when_invisible(true);
save_accept->connect(SceneStringName(confirmed), callable_mp(this, &EditorNode::_menu_option).bind((int)MenuOptions::FILE_SAVE_AS_SCENE));
save_accept->connect(SceneStringName(confirmed), callable_mp(this, &EditorNode::_menu_option).bind((int)MenuOptions::SCENE_SAVE_AS_SCENE));
project_export = memnew(ProjectExportDialog);
gui_base->add_child(project_export);
@@ -7654,27 +7654,27 @@ EditorNode::EditorNode() {
command_palette->set_title(TTR("Command Palette"));
gui_base->add_child(command_palette);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/new_scene", TTRC("New Scene"), KeyModifierMask::CMD_OR_CTRL + Key::N), FILE_NEW_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/new_inherited_scene", TTRC("New Inherited Scene..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::N), FILE_NEW_INHERITED_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/open_scene", TTRC("Open Scene..."), KeyModifierMask::CMD_OR_CTRL + Key::O), FILE_OPEN_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reopen_closed_scene", TTRC("Reopen Closed Scene"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::T), FILE_OPEN_PREV);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/new_scene", TTRC("New Scene"), KeyModifierMask::CMD_OR_CTRL + Key::N), SCENE_NEW_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/new_inherited_scene", TTRC("New Inherited Scene..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::N), SCENE_NEW_INHERITED_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/open_scene", TTRC("Open Scene..."), KeyModifierMask::CMD_OR_CTRL + Key::O), SCENE_OPEN_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reopen_closed_scene", TTRC("Reopen Closed Scene"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::T), SCENE_OPEN_PREV);
recent_scenes = memnew(PopupMenu);
recent_scenes->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
file_menu->add_submenu_node_item(TTR("Open Recent"), recent_scenes, FILE_OPEN_RECENT);
file_menu->add_submenu_node_item(TTR("Open Recent"), recent_scenes, SCENE_OPEN_RECENT);
recent_scenes->connect(SceneStringName(id_pressed), callable_mp(this, &EditorNode::_open_recent_scene));
file_menu->add_separator();
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_scene", TTRC("Save Scene"), KeyModifierMask::CMD_OR_CTRL + Key::S), FILE_SAVE_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_scene_as", TTRC("Save Scene As..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::S), FILE_SAVE_AS_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_all_scenes", TTRC("Save All Scenes"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::S), FILE_SAVE_ALL_SCENES);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_scene", TTRC("Save Scene"), KeyModifierMask::CMD_OR_CTRL + Key::S), SCENE_SAVE_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_scene_as", TTRC("Save Scene As..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::S), SCENE_SAVE_AS_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_all_scenes", TTRC("Save All Scenes"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::S), SCENE_SAVE_ALL_SCENES);
file_menu->add_separator();
file_menu->add_shortcut(ED_SHORTCUT_ARRAY_AND_COMMAND("editor/quick_open", TTRC("Quick Open..."), { int32_t(KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::O), int32_t(KeyModifierMask::CMD_OR_CTRL + Key::P) }), FILE_QUICK_OPEN);
file_menu->add_shortcut(ED_SHORTCUT_ARRAY_AND_COMMAND("editor/quick_open", TTRC("Quick Open..."), { int32_t(KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::O), int32_t(KeyModifierMask::CMD_OR_CTRL + Key::P) }), SCENE_QUICK_OPEN);
ED_SHORTCUT_OVERRIDE_ARRAY("editor/quick_open", "macos", { int32_t(KeyModifierMask::META + KeyModifierMask::CTRL + Key::O), int32_t(KeyModifierMask::CMD_OR_CTRL + Key::P) });
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open_scene", TTRC("Quick Open Scene..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::O), FILE_QUICK_OPEN_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open_script", TTRC("Quick Open Script..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::ALT + Key::O), FILE_QUICK_OPEN_SCRIPT);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open_scene", TTRC("Quick Open Scene..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::O), SCENE_QUICK_OPEN_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open_script", TTRC("Quick Open Script..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::ALT + Key::O), SCENE_QUICK_OPEN_SCRIPT);
file_menu->add_separator();
export_as_menu = memnew(PopupMenu);
@@ -7683,18 +7683,18 @@ EditorNode::EditorNode() {
export_as_menu->connect("index_pressed", callable_mp(this, &EditorNode::_export_as_menu_option));
file_menu->add_separator();
file_menu->add_shortcut(ED_GET_SHORTCUT("ui_undo"), FILE_UNDO, false, true);
file_menu->add_shortcut(ED_GET_SHORTCUT("ui_redo"), FILE_REDO, false, true);
file_menu->add_shortcut(ED_GET_SHORTCUT("ui_undo"), SCENE_UNDO, false, true);
file_menu->add_shortcut(ED_GET_SHORTCUT("ui_redo"), SCENE_REDO, false, true);
file_menu->add_separator();
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reload_saved_scene", TTRC("Reload Saved Scene")), FILE_RELOAD_SAVED_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/close_scene", TTRC("Close Scene"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::W), FILE_CLOSE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reload_saved_scene", TTRC("Reload Saved Scene")), SCENE_RELOAD_SAVED_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/close_scene", TTRC("Close Scene"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::W), SCENE_CLOSE);
ED_SHORTCUT_OVERRIDE("editor/close_scene", "macos", KeyModifierMask::CMD_OR_CTRL + Key::W);
if (!global_menu || !OS::get_singleton()->has_feature("macos")) {
// On macOS "Quit" and "About" options are in the "app" menu.
file_menu->add_separator();
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/file_quit", TTRC("Quit"), KeyModifierMask::CMD_OR_CTRL + Key::Q), FILE_QUIT, true);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/file_quit", TTRC("Quit"), KeyModifierMask::CMD_OR_CTRL + Key::Q), SCENE_QUIT, true);
}
ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTRC("Editor Settings..."));

View File

@@ -138,23 +138,23 @@ public:
enum MenuOptions {
// Scene menu.
FILE_NEW_SCENE,
FILE_NEW_INHERITED_SCENE,
FILE_OPEN_SCENE,
FILE_OPEN_PREV,
FILE_OPEN_RECENT,
FILE_SAVE_SCENE,
FILE_SAVE_AS_SCENE,
FILE_SAVE_ALL_SCENES,
FILE_MULTI_SAVE_AS_SCENE,
FILE_QUICK_OPEN,
FILE_QUICK_OPEN_SCENE,
FILE_QUICK_OPEN_SCRIPT,
FILE_UNDO,
FILE_REDO,
FILE_RELOAD_SAVED_SCENE,
FILE_CLOSE,
FILE_QUIT,
SCENE_NEW_SCENE,
SCENE_NEW_INHERITED_SCENE,
SCENE_OPEN_SCENE,
SCENE_OPEN_PREV,
SCENE_OPEN_RECENT,
SCENE_SAVE_SCENE,
SCENE_SAVE_AS_SCENE,
SCENE_SAVE_ALL_SCENES,
SCENE_MULTI_SAVE_AS_SCENE,
SCENE_QUICK_OPEN,
SCENE_QUICK_OPEN_SCENE,
SCENE_QUICK_OPEN_SCRIPT,
SCENE_UNDO,
SCENE_REDO,
SCENE_RELOAD_SAVED_SCENE,
SCENE_CLOSE,
SCENE_QUIT,
FILE_EXPORT_MESH_LIBRARY,
@@ -210,8 +210,8 @@ public:
// Non-menu options.
SCENE_TAB_CLOSE,
FILE_SAVE_AND_RUN,
FILE_SAVE_AND_RUN_MAIN_SCENE,
SAVE_AND_RUN,
SAVE_AND_RUN_MAIN_SCENE,
RESOURCE_SAVE,
RESOURCE_SAVE_AS,
SETTINGS_PICK_MAIN_SCENE,
@@ -756,7 +756,7 @@ public:
void trigger_menu_option(int p_option, bool p_confirmed);
bool has_previous_closed_scenes() const;
void new_inherited_scene() { _menu_option_confirm(FILE_NEW_INHERITED_SCENE, false); }
void new_inherited_scene() { _menu_option_confirm(SCENE_NEW_INHERITED_SCENE, false); }
void update_distraction_free_mode();
void set_distraction_free_mode(bool p_enter);

View File

@@ -2100,14 +2100,14 @@ void FileSystemDock::_tree_rmb_option(int p_option) {
// Execute the current option.
switch (p_option) {
case FOLDER_EXPAND_ALL:
case FOLDER_COLLAPSE_ALL: {
case FILE_MENU_EXPAND_ALL:
case FILE_MENU_COLLAPSE_ALL: {
// Expand or collapse the folder
if (selected_strings.size() == 1) {
tree->get_selected()->set_collapsed_recursive(p_option == FOLDER_COLLAPSE_ALL);
tree->get_selected()->set_collapsed_recursive(p_option == FILE_MENU_COLLAPSE_ALL);
}
} break;
case FILE_RENAME: {
case FILE_MENU_RENAME: {
selected_strings = _tree_get_selected(false, true);
[[fallthrough]];
}
@@ -2140,7 +2140,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
// The first one should be the active item.
switch (p_option) {
case FILE_SHOW_IN_EXPLORER: {
case FILE_MENU_SHOW_IN_EXPLORER: {
// Show the file/folder in the OS explorer.
String fpath = current_path;
if (current_path == "Favorites") {
@@ -2151,7 +2151,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
OS::get_singleton()->shell_show_in_file_manager(dir, true);
} break;
case FILE_OPEN_EXTERNAL: {
case FILE_MENU_OPEN_EXTERNAL: {
String fpath = current_path;
if (current_path == "Favorites") {
fpath = p_selected[0];
@@ -2188,7 +2188,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_OPEN_IN_TERMINAL: {
case FILE_MENU_OPEN_IN_TERMINAL: {
String fpath = current_path;
if (current_path == "Favorites") {
fpath = p_selected[0];
@@ -2323,7 +2323,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_OPEN_: {
case FILE_MENU_OPEN: {
// Open folders.
TreeItem *selected = tree->get_root();
selected = tree->get_next_selected(selected);
@@ -2339,14 +2339,14 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_INHERIT: {
case FILE_MENU_INHERIT: {
// Create a new scene inherited from the selected one.
if (p_selected.size() == 1) {
emit_signal(SNAME("inherit"), p_selected[0]);
}
} break;
case FILE_MAIN_SCENE: {
case FILE_MENU_MAIN_SCENE: {
// Set as main scene with selected scene file.
if (p_selected.size() == 1) {
ProjectSettings::get_singleton()->set("application/run/main_scene", ResourceUID::path_to_uid(p_selected[0]));
@@ -2356,7 +2356,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_INSTANTIATE: {
case FILE_MENU_INSTANTIATE: {
// Instantiate all selected scenes.
Vector<String> paths;
for (int i = 0; i < p_selected.size(); i++) {
@@ -2370,7 +2370,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_ADD_FAVORITE: {
case FILE_MENU_ADD_FAVORITE: {
// Add the files from favorites.
Vector<String> favorites_list = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < p_selected.size(); i++) {
@@ -2382,7 +2382,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
_update_tree(get_uncollapsed_paths());
} break;
case FILE_REMOVE_FAVORITE: {
case FILE_MENU_REMOVE_FAVORITE: {
// Remove the files from favorites.
Vector<String> favorites_list = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < p_selected.size(); i++) {
@@ -2395,13 +2395,13 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_SHOW_IN_FILESYSTEM: {
case FILE_MENU_SHOW_IN_FILESYSTEM: {
if (!p_selected.is_empty()) {
navigate_to_path(p_selected[0]);
}
} break;
case FILE_DEPENDENCIES: {
case FILE_MENU_DEPENDENCIES: {
// Checkout the file dependencies.
if (!p_selected.is_empty()) {
const String &fpath = p_selected[0];
@@ -2409,7 +2409,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_OWNERS: {
case FILE_MENU_OWNERS: {
// Checkout the file owners.
if (!p_selected.is_empty()) {
const String &fpath = p_selected[0];
@@ -2417,7 +2417,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_MOVE: {
case FILE_MENU_MOVE: {
// Move or copy the files to a given location.
to_move.clear();
Vector<String> collapsed_paths = _remove_self_included_paths(p_selected);
@@ -2433,7 +2433,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_RENAME: {
case FILE_MENU_RENAME: {
if (!p_selected.is_empty()) {
// Set to_rename variable for callback execution.
to_rename.path = p_selected[0];
@@ -2463,7 +2463,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_REMOVE: {
case FILE_MENU_REMOVE: {
// Remove the selected files.
Vector<String> remove_files;
Vector<String> remove_folders;
@@ -2485,7 +2485,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_DUPLICATE: {
case FILE_MENU_DUPLICATE: {
if (p_selected.size() != 1) {
return;
}
@@ -2504,11 +2504,11 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
make_dir_dialog->popup_centered();
} break;
case FILE_REIMPORT: {
case FILE_MENU_REIMPORT: {
ImportDock::get_singleton()->reimport_resources(p_selected);
} break;
case FILE_NEW_FOLDER: {
case FILE_MENU_NEW_FOLDER: {
String directory = current_path;
if (!directory.ends_with("/")) {
directory = directory.get_base_dir();
@@ -2518,7 +2518,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
make_dir_dialog->popup_centered();
} break;
case FILE_NEW_SCENE: {
case FILE_MENU_NEW_SCENE: {
String directory = current_path;
if (!directory.ends_with("/")) {
directory = directory.get_base_dir();
@@ -2527,7 +2527,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
make_scene_dialog->popup_centered();
} break;
case FILE_NEW_SCRIPT: {
case FILE_MENU_NEW_SCRIPT: {
String fpath = current_path;
if (!fpath.ends_with("/")) {
fpath = fpath.get_base_dir();
@@ -2536,14 +2536,14 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
make_script_dialog->popup_centered();
} break;
case FILE_COPY_PATH: {
case FILE_MENU_COPY_PATH: {
if (!p_selected.is_empty()) {
const String &fpath = p_selected[0];
DisplayServer::get_singleton()->clipboard_set(fpath);
}
} break;
case FILE_COPY_ABSOLUTE_PATH: {
case FILE_MENU_COPY_ABSOLUTE_PATH: {
if (!p_selected.is_empty()) {
const String &fpath = p_selected[0];
const String absolute_path = ProjectSettings::get_singleton()->globalize_path(fpath);
@@ -2551,7 +2551,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_COPY_UID: {
case FILE_MENU_COPY_UID: {
if (!p_selected.is_empty()) {
ResourceUID::ID uid = ResourceLoader::get_resource_uid(p_selected[0]);
if (uid != ResourceUID::INVALID_ID) {
@@ -2561,10 +2561,10 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
case FILE_NEW_RESOURCE: {
case FILE_MENU_NEW_RESOURCE: {
new_resource_dialog->popup_create(true);
} break;
case FILE_NEW_TEXTFILE: {
case FILE_MENU_NEW_TEXTFILE: {
String fpath = current_path;
if (!fpath.ends_with("/")) {
fpath = fpath.get_base_dir();
@@ -3211,24 +3211,24 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
if (all_files) {
if (all_files_scenes) {
if (filenames.size() == 1) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scene"), FILE_OPEN_);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("CreateNewSceneFrom")), TTRC("New Inherited Scene"), FILE_INHERIT);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scene"), FILE_MENU_OPEN);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("CreateNewSceneFrom")), TTRC("New Inherited Scene"), FILE_MENU_INHERIT);
if (GLOBAL_GET("application/run/main_scene") != filenames[0]) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("PlayScene")), TTRC("Set as Main Scene"), FILE_MAIN_SCENE);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("PlayScene")), TTRC("Set as Main Scene"), FILE_MENU_MAIN_SCENE);
}
} else {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scenes"), FILE_OPEN_);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scenes"), FILE_MENU_OPEN);
}
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Instance")), TTRC("Instantiate"), FILE_INSTANTIATE);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Instance")), TTRC("Instantiate"), FILE_MENU_INSTANTIATE);
p_popup->add_separator();
} else if (filenames.size() == 1) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open"), FILE_OPEN_);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open"), FILE_MENU_OPEN);
p_popup->add_separator();
}
if (filenames.size() == 1) {
p_popup->add_item(TTRC("Edit Dependencies..."), FILE_DEPENDENCIES);
p_popup->add_item(TTRC("View Owners..."), FILE_OWNERS);
p_popup->add_item(TTRC("Edit Dependencies..."), FILE_MENU_DEPENDENCIES);
p_popup->add_item(TTRC("View Owners..."), FILE_MENU_OWNERS);
p_popup->add_separator();
}
}
@@ -3237,14 +3237,14 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
PopupMenu *new_menu = memnew(PopupMenu);
new_menu->connect(SceneStringName(id_pressed), callable_mp(this, &FileSystemDock::_generic_rmb_option_selected));
p_popup->add_submenu_node_item(TTRC("Create New"), new_menu, FILE_NEW);
p_popup->set_item_icon(p_popup->get_item_index(FILE_NEW), get_editor_theme_icon(SNAME("Add")));
p_popup->add_submenu_node_item(TTRC("Create New"), new_menu, FILE_MENU_NEW);
p_popup->set_item_icon(p_popup->get_item_index(FILE_MENU_NEW), get_editor_theme_icon(SNAME("Add")));
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("Folder..."), FILE_NEW_FOLDER);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("Scene..."), FILE_NEW_SCENE);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("Script..."), FILE_NEW_SCRIPT);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("Resource..."), FILE_NEW_RESOURCE);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("TextFile..."), FILE_NEW_TEXTFILE);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("Folder..."), FILE_MENU_NEW_FOLDER);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("Scene..."), FILE_MENU_NEW_SCENE);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("Script..."), FILE_MENU_NEW_SCRIPT);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("Resource..."), FILE_MENU_NEW_RESOURCE);
new_menu->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("TextFile..."), FILE_MENU_NEW_TEXTFILE);
EditorContextMenuPluginManager::get_singleton()->add_options_from_plugins(new_menu, EditorContextMenuPlugin::CONTEXT_SLOT_FILESYSTEM_CREATE, p_paths);
p_popup->add_separator();
@@ -3255,11 +3255,11 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
bool root_path_not_selected = p_paths[0] != "res://" && (p_paths.size() <= 1 || p_paths[1] != "res://");
if (all_folders && foldernames.size() > 0) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Expand Folder"), FILE_OPEN_);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Expand Folder"), FILE_MENU_OPEN);
if (foldernames.size() == 1) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowDown")), TTRC("Expand Hierarchy"), FOLDER_EXPAND_ALL);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowRight")), TTRC("Collapse Hierarchy"), FOLDER_COLLAPSE_ALL);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowDown")), TTRC("Expand Hierarchy"), FILE_MENU_EXPAND_ALL);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowRight")), TTRC("Collapse Hierarchy"), FILE_MENU_COLLAPSE_ALL);
}
p_popup->add_separator();
@@ -3287,21 +3287,21 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
// Add the options that are only available when a single item is selected.
if (p_paths.size() == 1) {
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("ActionCopy")), ED_GET_SHORTCUT("filesystem_dock/copy_path"), FILE_COPY_PATH);
p_popup->add_shortcut(ED_GET_SHORTCUT("filesystem_dock/copy_absolute_path"), FILE_COPY_ABSOLUTE_PATH);
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("ActionCopy")), ED_GET_SHORTCUT("filesystem_dock/copy_path"), FILE_MENU_COPY_PATH);
p_popup->add_shortcut(ED_GET_SHORTCUT("filesystem_dock/copy_absolute_path"), FILE_MENU_COPY_ABSOLUTE_PATH);
if (ResourceLoader::get_resource_uid(p_paths[0]) != ResourceUID::INVALID_ID) {
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Instance")), ED_GET_SHORTCUT("filesystem_dock/copy_uid"), FILE_COPY_UID);
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Instance")), ED_GET_SHORTCUT("filesystem_dock/copy_uid"), FILE_MENU_COPY_UID);
}
if (root_path_not_selected) {
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Rename")), ED_GET_SHORTCUT("filesystem_dock/rename"), FILE_RENAME);
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Duplicate")), ED_GET_SHORTCUT("filesystem_dock/duplicate"), FILE_DUPLICATE);
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Rename")), ED_GET_SHORTCUT("filesystem_dock/rename"), FILE_MENU_RENAME);
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Duplicate")), ED_GET_SHORTCUT("filesystem_dock/duplicate"), FILE_MENU_DUPLICATE);
}
}
// Add the options that are only available when the root path is not selected.
if (root_path_not_selected) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("MoveUp")), TTRC("Move/Duplicate To..."), FILE_MOVE);
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Remove")), ED_GET_SHORTCUT("filesystem_dock/delete"), FILE_REMOVE);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("MoveUp")), TTRC("Move/Duplicate To..."), FILE_MENU_MOVE);
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Remove")), ED_GET_SHORTCUT("filesystem_dock/delete"), FILE_MENU_REMOVE);
}
// Only add a separator if we have actually placed any options in the menu since the last separator.
@@ -3312,10 +3312,10 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
// Add the options that are available when one or more items are selected.
if (p_paths.size() >= 1) {
if (!all_favorites) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Favorites")), TTRC("Add to Favorites"), FILE_ADD_FAVORITE);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Favorites")), TTRC("Add to Favorites"), FILE_MENU_ADD_FAVORITE);
}
if (!all_not_favorites) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("NonFavorite")), TTRC("Remove from Favorites"), FILE_REMOVE_FAVORITE);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("NonFavorite")), TTRC("Remove from Favorites"), FILE_MENU_REMOVE_FAVORITE);
}
if (root_path_not_selected) {
@@ -3335,7 +3335,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
container_menu = memnew(PopupMenu);
container_menu->connect(SceneStringName(id_pressed), callable_mp(this, &FileSystemDock::_generic_rmb_option_selected));
p_popup->add_submenu_node_item(TTRC("Convert to..."), container_menu, FILE_NEW);
p_popup->add_submenu_node_item(TTRC("Convert to..."), container_menu, FILE_MENU_NEW);
conversion_string_template = "%s";
}
@@ -3380,7 +3380,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
}
if (resource_valid) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Reimport"), FILE_REIMPORT);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Reimport"), FILE_MENU_REIMPORT);
}
}
}
@@ -3405,7 +3405,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
if (is_item_in_favorites) {
p_popup->add_separator();
added_separator = true;
p_popup->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTRC("Show in FileSystem"), FILE_SHOW_IN_FILESYSTEM);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTRC("Show in FileSystem"), FILE_MENU_SHOW_IN_FILESYSTEM);
}
}
@@ -3418,15 +3418,15 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
// Opening the system file manager is not supported on the Android and web editors.
const bool is_directory = fpath.ends_with("/");
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Terminal")), ED_GET_SHORTCUT("filesystem_dock/open_in_terminal"), FILE_OPEN_IN_TERMINAL);
p_popup->set_item_text(p_popup->get_item_index(FILE_OPEN_IN_TERMINAL), is_directory ? TTRC("Open in Terminal") : TTRC("Open Folder in Terminal"));
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Terminal")), ED_GET_SHORTCUT("filesystem_dock/open_in_terminal"), FILE_MENU_OPEN_IN_TERMINAL);
p_popup->set_item_text(p_popup->get_item_index(FILE_MENU_OPEN_IN_TERMINAL), is_directory ? TTRC("Open in Terminal") : TTRC("Open Folder in Terminal"));
if (!is_directory) {
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("ExternalLink")), ED_GET_SHORTCUT("filesystem_dock/open_in_external_program"), FILE_OPEN_EXTERNAL);
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("ExternalLink")), ED_GET_SHORTCUT("filesystem_dock/open_in_external_program"), FILE_MENU_OPEN_EXTERNAL);
}
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
p_popup->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), is_directory ? TTRC("Open in File Manager") : TTRC("Show in File Manager"));
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_MENU_SHOW_IN_EXPLORER);
p_popup->set_item_text(p_popup->get_item_index(FILE_MENU_SHOW_IN_EXPLORER), is_directory ? TTRC("Open in File Manager") : TTRC("Show in File Manager"));
#endif
current_path = fpath;
@@ -3463,16 +3463,16 @@ void FileSystemDock::_tree_empty_click(const Vector2 &p_pos, MouseButton p_butto
current_path = "res://";
tree_popup->clear();
tree_popup->reset_size();
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("New Folder..."), FILE_NEW_FOLDER);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("New Scene..."), FILE_NEW_SCENE);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("New Script..."), FILE_NEW_SCRIPT);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("New Resource..."), FILE_NEW_RESOURCE);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("New TextFile..."), FILE_NEW_TEXTFILE);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("New Folder..."), FILE_MENU_NEW_FOLDER);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("New Scene..."), FILE_MENU_NEW_SCENE);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("New Script..."), FILE_MENU_NEW_SCRIPT);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("New Resource..."), FILE_MENU_NEW_RESOURCE);
tree_popup->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("New TextFile..."), FILE_MENU_NEW_TEXTFILE);
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
// Opening the system file manager is not supported on the Android and web editors.
tree_popup->add_separator();
tree_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Terminal")), ED_GET_SHORTCUT("filesystem_dock/open_in_terminal"), FILE_OPEN_IN_TERMINAL);
tree_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
tree_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Terminal")), ED_GET_SHORTCUT("filesystem_dock/open_in_terminal"), FILE_MENU_OPEN_IN_TERMINAL);
tree_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_MENU_SHOW_IN_EXPLORER);
#endif
tree_popup->set_position(tree->get_screen_position() + p_pos);
@@ -3533,14 +3533,14 @@ void FileSystemDock::_file_list_empty_clicked(const Vector2 &p_pos, MouseButton
file_list_popup->clear();
file_list_popup->reset_size();
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("New Folder..."), FILE_NEW_FOLDER);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("New Scene..."), FILE_NEW_SCENE);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("New Script..."), FILE_NEW_SCRIPT);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("New Resource..."), FILE_NEW_RESOURCE);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("New TextFile..."), FILE_NEW_TEXTFILE);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("New Folder..."), FILE_MENU_NEW_FOLDER);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("PackedScene")), TTRC("New Scene..."), FILE_MENU_NEW_SCENE);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Script")), TTRC("New Script..."), FILE_MENU_NEW_SCRIPT);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("Object")), TTRC("New Resource..."), FILE_MENU_NEW_RESOURCE);
file_list_popup->add_icon_item(get_editor_theme_icon(SNAME("TextFile")), TTRC("New TextFile..."), FILE_MENU_NEW_TEXTFILE);
file_list_popup->add_separator();
file_list_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Terminal")), ED_GET_SHORTCUT("filesystem_dock/open_in_terminal"), FILE_OPEN_IN_TERMINAL);
file_list_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
file_list_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Terminal")), ED_GET_SHORTCUT("filesystem_dock/open_in_terminal"), FILE_MENU_OPEN_IN_TERMINAL);
file_list_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_MENU_SHOW_IN_EXPLORER);
file_list_popup->set_position(files->get_screen_position() + p_pos);
file_list_popup->reset_size();
@@ -3641,23 +3641,23 @@ void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
if (ED_IS_SHORTCUT("filesystem_dock/duplicate", p_event)) {
_tree_rmb_option(FILE_DUPLICATE);
_tree_rmb_option(FILE_MENU_DUPLICATE);
} else if (ED_IS_SHORTCUT("filesystem_dock/copy_path", p_event)) {
_tree_rmb_option(FILE_COPY_PATH);
_tree_rmb_option(FILE_MENU_COPY_PATH);
} else if (ED_IS_SHORTCUT("filesystem_dock/copy_absolute_path", p_event)) {
_tree_rmb_option(FILE_COPY_ABSOLUTE_PATH);
_tree_rmb_option(FILE_MENU_COPY_ABSOLUTE_PATH);
} else if (ED_IS_SHORTCUT("filesystem_dock/copy_uid", p_event)) {
_tree_rmb_option(FILE_COPY_UID);
_tree_rmb_option(FILE_MENU_COPY_UID);
} else if (ED_IS_SHORTCUT("filesystem_dock/delete", p_event)) {
_tree_rmb_option(FILE_REMOVE);
_tree_rmb_option(FILE_MENU_REMOVE);
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
_tree_rmb_option(FILE_RENAME);
_tree_rmb_option(FILE_MENU_RENAME);
} else if (ED_IS_SHORTCUT("filesystem_dock/show_in_explorer", p_event)) {
_tree_rmb_option(FILE_SHOW_IN_EXPLORER);
_tree_rmb_option(FILE_MENU_SHOW_IN_EXPLORER);
} else if (ED_IS_SHORTCUT("filesystem_dock/open_in_external_program", p_event)) {
_tree_rmb_option(FILE_OPEN_EXTERNAL);
_tree_rmb_option(FILE_MENU_OPEN_EXTERNAL);
} else if (ED_IS_SHORTCUT("filesystem_dock/open_in_terminal", p_event)) {
_tree_rmb_option(FILE_OPEN_IN_TERMINAL);
_tree_rmb_option(FILE_MENU_OPEN_IN_TERMINAL);
} else if (ED_IS_SHORTCUT("file_dialog/focus_path", p_event)) {
focus_on_path();
} else if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
@@ -3724,19 +3724,19 @@ void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventKey> key = p_event;
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
if (ED_IS_SHORTCUT("filesystem_dock/duplicate", p_event)) {
_file_list_rmb_option(FILE_DUPLICATE);
_file_list_rmb_option(FILE_MENU_DUPLICATE);
} else if (ED_IS_SHORTCUT("filesystem_dock/copy_path", p_event)) {
_file_list_rmb_option(FILE_COPY_PATH);
_file_list_rmb_option(FILE_MENU_COPY_PATH);
} else if (ED_IS_SHORTCUT("filesystem_dock/copy_absolute_path", p_event)) {
_file_list_rmb_option(FILE_COPY_ABSOLUTE_PATH);
_file_list_rmb_option(FILE_MENU_COPY_ABSOLUTE_PATH);
} else if (ED_IS_SHORTCUT("filesystem_dock/delete", p_event)) {
_file_list_rmb_option(FILE_REMOVE);
_file_list_rmb_option(FILE_MENU_REMOVE);
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
_file_list_rmb_option(FILE_RENAME);
_file_list_rmb_option(FILE_MENU_RENAME);
} else if (ED_IS_SHORTCUT("filesystem_dock/show_in_explorer", p_event)) {
_file_list_rmb_option(FILE_SHOW_IN_EXPLORER);
_file_list_rmb_option(FILE_MENU_SHOW_IN_EXPLORER);
} else if (ED_IS_SHORTCUT("filesystem_dock/open_in_terminal", p_event)) {
_file_list_rmb_option(FILE_OPEN_IN_TERMINAL);
_file_list_rmb_option(FILE_MENU_OPEN_IN_TERMINAL);
} else if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
focus_on_filter();
} else {

View File

@@ -101,34 +101,34 @@ public:
private:
enum FileMenu {
FILE_OPEN_, // Conflict with WinAPI.
FILE_INHERIT,
FILE_MAIN_SCENE,
FILE_INSTANTIATE,
FILE_ADD_FAVORITE,
FILE_REMOVE_FAVORITE,
FILE_SHOW_IN_FILESYSTEM,
FILE_DEPENDENCIES,
FILE_OWNERS,
FILE_MOVE,
FILE_RENAME,
FILE_REMOVE,
FILE_DUPLICATE,
FILE_REIMPORT,
FILE_NEW,
FILE_SHOW_IN_EXPLORER,
FILE_OPEN_EXTERNAL,
FILE_OPEN_IN_TERMINAL,
FILE_COPY_PATH,
FILE_COPY_ABSOLUTE_PATH,
FILE_COPY_UID,
FOLDER_EXPAND_ALL,
FOLDER_COLLAPSE_ALL,
FILE_NEW_RESOURCE,
FILE_NEW_TEXTFILE,
FILE_NEW_FOLDER,
FILE_NEW_SCRIPT,
FILE_NEW_SCENE,
FILE_MENU_OPEN,
FILE_MENU_INHERIT,
FILE_MENU_MAIN_SCENE,
FILE_MENU_INSTANTIATE,
FILE_MENU_ADD_FAVORITE,
FILE_MENU_REMOVE_FAVORITE,
FILE_MENU_SHOW_IN_FILESYSTEM,
FILE_MENU_DEPENDENCIES,
FILE_MENU_OWNERS,
FILE_MENU_MOVE,
FILE_MENU_RENAME,
FILE_MENU_REMOVE,
FILE_MENU_DUPLICATE,
FILE_MENU_REIMPORT,
FILE_MENU_NEW,
FILE_MENU_SHOW_IN_EXPLORER,
FILE_MENU_OPEN_EXTERNAL,
FILE_MENU_OPEN_IN_TERMINAL,
FILE_MENU_COPY_PATH,
FILE_MENU_COPY_ABSOLUTE_PATH,
FILE_MENU_COPY_UID,
FILE_MENU_EXPAND_ALL,
FILE_MENU_COLLAPSE_ALL,
FILE_MENU_NEW_RESOURCE,
FILE_MENU_NEW_TEXTFILE,
FILE_MENU_NEW_FOLDER,
FILE_MENU_NEW_SCRIPT,
FILE_MENU_NEW_SCENE,
CONVERT_BASE_ID = 1000,
};

View File

@@ -131,7 +131,7 @@ void EditorSceneTabs::_scene_tab_input(const Ref<InputEvent> &p_input) {
}
if ((is_layout_rtl() && mb->get_position().x > tab_buttons) || (!is_layout_rtl() && mb->get_position().x < scene_tabs->get_size().width - tab_buttons)) {
EditorNode::get_singleton()->trigger_menu_option(EditorNode::FILE_NEW_SCENE, true);
EditorNode::get_singleton()->trigger_menu_option(EditorNode::SCENE_NEW_SCENE, true);
}
}
if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
@@ -173,11 +173,11 @@ void EditorSceneTabs::_update_context_menu() {
int tab_id = scene_tabs->get_hovered_tab();
bool no_root_node = !EditorNode::get_editor_data().get_edited_scene_root(tab_id);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/new_scene"), EditorNode::FILE_NEW_SCENE);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/new_scene"), EditorNode::SCENE_NEW_SCENE);
if (tab_id >= 0) {
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_scene"), EditorNode::FILE_SAVE_SCENE);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_scene"), EditorNode::SCENE_SAVE_SCENE);
DISABLE_LAST_OPTION_IF(no_root_node);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_scene_as"), EditorNode::FILE_SAVE_AS_SCENE);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_scene_as"), EditorNode::SCENE_SAVE_AS_SCENE);
DISABLE_LAST_OPTION_IF(no_root_node);
}
@@ -188,7 +188,7 @@ void EditorSceneTabs::_update_context_menu() {
break;
}
}
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_all_scenes"), EditorNode::FILE_SAVE_ALL_SCENES);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_all_scenes"), EditorNode::SCENE_SAVE_ALL_SCENES);
DISABLE_LAST_OPTION_IF(!can_save_all_scenes);
if (tab_id >= 0) {
@@ -199,9 +199,9 @@ void EditorSceneTabs::_update_context_menu() {
DISABLE_LAST_OPTION_IF(no_root_node);
scene_tabs_context_menu->add_separator();
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/close_scene"), EditorNode::FILE_CLOSE);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/close_scene"), EditorNode::SCENE_CLOSE);
scene_tabs_context_menu->set_item_text(-1, TTR("Close Tab"));
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/reopen_closed_scene"), EditorNode::FILE_OPEN_PREV);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/reopen_closed_scene"), EditorNode::SCENE_OPEN_PREV);
scene_tabs_context_menu->set_item_text(-1, TTR("Undo Close Tab"));
DISABLE_LAST_OPTION_IF(!EditorNode::get_singleton()->has_previous_closed_scenes());
scene_tabs_context_menu->add_item(TTR("Close Other Tabs"), SCENE_CLOSE_OTHERS);
@@ -439,7 +439,7 @@ EditorSceneTabs::EditorSceneTabs() {
scene_tab_add->set_tooltip_text(TTR("Add a new scene."));
scene_tab_add->set_accessibility_name(TTRC("Add Scene"));
scene_tabs->add_child(scene_tab_add);
scene_tab_add->connect(SceneStringName(pressed), callable_mp(EditorNode::get_singleton(), &EditorNode::trigger_menu_option).bind(EditorNode::FILE_NEW_SCENE, false));
scene_tab_add->connect(SceneStringName(pressed), callable_mp(EditorNode::get_singleton(), &EditorNode::trigger_menu_option).bind(EditorNode::SCENE_NEW_SCENE, false));
scene_tab_add_ph = memnew(Control);
scene_tab_add_ph->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);

View File

@@ -1175,7 +1175,7 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Resource> p_for_script) {
void ScriptEditor::_file_dialog_action(const String &p_file) {
switch (file_dialog_option) {
case FILE_NEW_TEXTFILE: {
case FILE_MENU_NEW_TEXTFILE: {
Error err;
{
Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
@@ -1196,11 +1196,11 @@ void ScriptEditor::_file_dialog_action(const String &p_file) {
}
[[fallthrough]];
}
case FILE_OPEN_: {
case FILE_MENU_OPEN: {
open_file(p_file);
file_dialog_option = -1;
} break;
case FILE_SAVE_AS: {
case FILE_MENU_SAVE_AS: {
ScriptEditorBase *current = _get_current_editor();
if (current) {
Ref<Resource> resource = current->get_edited_resource();
@@ -1264,14 +1264,14 @@ bool ScriptEditor::is_files_panel_toggled() {
void ScriptEditor::_menu_option(int p_option) {
ScriptEditorBase *current = _get_current_editor();
switch (p_option) {
case FILE_NEW: {
case FILE_MENU_NEW: {
script_create_dialog->config("Node", "new_script", false, false);
script_create_dialog->popup_centered();
} break;
case FILE_NEW_TEXTFILE: {
case FILE_MENU_NEW_TEXTFILE: {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file_dialog_option = FILE_NEW_TEXTFILE;
file_dialog_option = FILE_MENU_NEW_TEXTFILE;
file_dialog->clear_filters();
for (const String &E : textfile_extensions) {
@@ -1281,10 +1281,10 @@ void ScriptEditor::_menu_option(int p_option) {
file_dialog->popup_file_dialog();
open_textfile_after_create = true;
} break;
case FILE_OPEN_: {
case FILE_MENU_OPEN: {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file_dialog_option = FILE_OPEN_;
file_dialog_option = FILE_MENU_OPEN;
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Script", &extensions);
@@ -1301,7 +1301,7 @@ void ScriptEditor::_menu_option(int p_option) {
file_dialog->popup_file_dialog();
return;
} break;
case FILE_REOPEN_CLOSED: {
case FILE_MENU_REOPEN_CLOSED: {
if (previous_scripts.is_empty()) {
return;
}
@@ -1342,7 +1342,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
}
} break;
case FILE_SAVE_ALL: {
case FILE_MENU_SAVE_ALL: {
if (_test_script_times_on_disk()) {
return;
}
@@ -1375,17 +1375,17 @@ void ScriptEditor::_menu_option(int p_option) {
OS::get_singleton()->shell_open(GODOT_VERSION_DOCS_URL "/");
}
} break;
case WINDOW_NEXT: {
case FILE_MENU_HISTORY_NEXT: {
_history_forward();
} break;
case WINDOW_PREV: {
case FILE_MENU_HISTORY_PREV: {
_history_back();
} break;
case WINDOW_SORT: {
case FILE_MENU_SORT: {
_sort_list_on_update = true;
_update_script_names();
} break;
case TOGGLE_FILES_PANEL: {
case FILE_MENU_TOGGLE_FILES_PANEL: {
toggle_files_panel();
if (current) {
current->update_toggle_files_button();
@@ -1410,10 +1410,10 @@ void ScriptEditor::_menu_option(int p_option) {
if (current) {
switch (p_option) {
case FILE_SAVE: {
case FILE_MENU_SAVE: {
save_current_script();
} break;
case FILE_SAVE_AS: {
case FILE_MENU_SAVE_AS: {
if (trim_trailing_whitespace_on_save) {
current->trim_trailing_whitespace();
}
@@ -1433,7 +1433,7 @@ void ScriptEditor::_menu_option(int p_option) {
if (text_file.is_valid()) {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file_dialog_option = FILE_SAVE_AS;
file_dialog_option = FILE_MENU_SAVE_AS;
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Script", &extensions);
@@ -1457,7 +1457,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
} break;
case FILE_TOOL_RELOAD_SOFT: {
case FILE_MENU_SOFT_RELOAD_TOOL: {
Ref<Script> scr = current->get_edited_resource();
if (scr.is_null()) {
EditorNode::get_singleton()->show_warning(TTR("Can't obtain the script for reloading."));
@@ -1471,7 +1471,7 @@ void ScriptEditor::_menu_option(int p_option) {
} break;
case FILE_RUN: {
case FILE_MENU_RUN: {
Ref<Script> scr = current->get_edited_resource();
if (scr.is_null()) {
EditorToaster::get_singleton()->popup_str(TTR("Cannot run the edited file because it's not a script."), EditorToaster::SEVERITY_WARNING);
@@ -1512,20 +1512,20 @@ void ScriptEditor::_menu_option(int p_option) {
es->run();
} break;
case FILE_CLOSE: {
case FILE_MENU_CLOSE: {
if (current->is_unsaved()) {
_ask_close_current_unsaved_tab(current);
} else {
_close_current_tab(false);
}
} break;
case FILE_COPY_PATH: {
case FILE_MENU_COPY_PATH: {
_copy_script_path();
} break;
case FILE_COPY_UID: {
case FILE_MENU_COPY_UID: {
_copy_script_uid();
} break;
case SHOW_IN_FILE_SYSTEM: {
case FILE_MENU_SHOW_IN_FILE_SYSTEM: {
const Ref<Resource> scr = current->get_edited_resource();
String path = scr->get_path();
if (!path.is_empty()) {
@@ -1536,38 +1536,32 @@ void ScriptEditor::_menu_option(int p_option) {
FileSystemDock::get_singleton()->navigate_to_path(path);
}
} break;
case CLOSE_DOCS: {
case FILE_MENU_CLOSE_DOCS: {
_close_docs_tab();
} break;
case CLOSE_OTHER_TABS: {
case FILE_MENU_CLOSE_OTHER_TABS: {
_close_other_tabs();
} break;
case CLOSE_TABS_BELOW: {
case FILE_MENU_CLOSE_TABS_BELOW: {
_close_tabs_below();
} break;
case CLOSE_ALL: {
case FILE_MENU_CLOSE_ALL: {
_close_all_tabs();
} break;
case WINDOW_MOVE_UP: {
case FILE_MENU_MOVE_UP: {
if (tab_container->get_current_tab() > 0) {
tab_container->move_child(current, tab_container->get_current_tab() - 1);
tab_container->set_current_tab(tab_container->get_current_tab());
_update_script_names();
}
} break;
case WINDOW_MOVE_DOWN: {
case FILE_MENU_MOVE_DOWN: {
if (tab_container->get_current_tab() < tab_container->get_tab_count() - 1) {
tab_container->move_child(current, tab_container->get_current_tab() + 1);
tab_container->set_current_tab(tab_container->get_current_tab());
_update_script_names();
}
} break;
default: {
if (p_option >= WINDOW_SELECT_BASE) {
_go_to_tab(p_option - WINDOW_SELECT_BASE);
_update_script_names();
}
}
}
} else {
EditorHelp *help = Object::cast_to<EditorHelp>(tab_container->get_current_tab_control());
@@ -1582,29 +1576,29 @@ void ScriptEditor::_menu_option(int p_option) {
case HELP_SEARCH_FIND_PREVIOUS: {
help->search_again(true);
} break;
case FILE_CLOSE: {
case FILE_MENU_CLOSE: {
_close_current_tab();
} break;
case CLOSE_DOCS: {
case FILE_MENU_CLOSE_DOCS: {
_close_docs_tab();
} break;
case CLOSE_OTHER_TABS: {
case FILE_MENU_CLOSE_OTHER_TABS: {
_close_other_tabs();
} break;
case CLOSE_TABS_BELOW: {
case FILE_MENU_CLOSE_TABS_BELOW: {
_close_tabs_below();
} break;
case CLOSE_ALL: {
case FILE_MENU_CLOSE_ALL: {
_close_all_tabs();
} break;
case WINDOW_MOVE_UP: {
case FILE_MENU_MOVE_UP: {
if (tab_container->get_current_tab() > 0) {
tab_container->move_child(help, tab_container->get_current_tab() - 1);
tab_container->set_current_tab(tab_container->get_current_tab());
_update_script_names();
}
} break;
case WINDOW_MOVE_DOWN: {
case FILE_MENU_MOVE_DOWN: {
if (tab_container->get_current_tab() < tab_container->get_tab_count() - 1) {
tab_container->move_child(help, tab_container->get_current_tab() + 1);
tab_container->set_current_tab(tab_container->get_current_tab());
@@ -1679,50 +1673,50 @@ void ScriptEditor::_prepare_file_menu() {
ScriptEditorBase *editor = _get_current_editor();
const Ref<Resource> res = editor ? editor->get_edited_resource() : Ref<Resource>();
menu->set_item_disabled(menu->get_item_index(FILE_REOPEN_CLOSED), previous_scripts.is_empty());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_REOPEN_CLOSED), previous_scripts.is_empty());
menu->set_item_disabled(menu->get_item_index(FILE_SAVE), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_SAVE_AS), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_SAVE_ALL), !_has_script_tab());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SAVE), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SAVE_AS), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SAVE_ALL), !_has_script_tab());
menu->set_item_disabled(menu->get_item_index(FILE_TOOL_RELOAD_SOFT), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_COPY_PATH), res.is_null() || res->get_path().is_empty());
menu->set_item_disabled(menu->get_item_index(FILE_COPY_UID), res.is_null() || ResourceLoader::get_resource_uid(res->get_path()) == ResourceUID::INVALID_ID);
menu->set_item_disabled(menu->get_item_index(SHOW_IN_FILE_SYSTEM), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SOFT_RELOAD_TOOL), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_COPY_PATH), res.is_null() || res->get_path().is_empty());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_COPY_UID), res.is_null() || ResourceLoader::get_resource_uid(res->get_path()) == ResourceUID::INVALID_ID);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SHOW_IN_FILE_SYSTEM), res.is_null());
menu->set_item_disabled(menu->get_item_index(WINDOW_PREV), history_pos <= 0);
menu->set_item_disabled(menu->get_item_index(WINDOW_NEXT), history_pos >= history.size() - 1);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_HISTORY_PREV), history_pos <= 0);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_HISTORY_NEXT), history_pos >= history.size() - 1);
menu->set_item_disabled(menu->get_item_index(FILE_CLOSE), tab_container->get_tab_count() < 1);
menu->set_item_disabled(menu->get_item_index(CLOSE_ALL), tab_container->get_tab_count() < 1);
menu->set_item_disabled(menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
menu->set_item_disabled(menu->get_item_index(CLOSE_DOCS), !_has_docs_tab());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_CLOSE), tab_container->get_tab_count() < 1);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_CLOSE_ALL), tab_container->get_tab_count() < 1);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_CLOSE_DOCS), !_has_docs_tab());
menu->set_item_disabled(menu->get_item_index(FILE_RUN), res.is_null());
menu->set_item_disabled(menu->get_item_index(FILE_MENU_RUN), res.is_null());
}
void ScriptEditor::_file_menu_closed() {
PopupMenu *menu = file_menu->get_popup();
menu->set_item_disabled(menu->get_item_index(FILE_REOPEN_CLOSED), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_REOPEN_CLOSED), false);
menu->set_item_disabled(menu->get_item_index(FILE_SAVE), false);
menu->set_item_disabled(menu->get_item_index(FILE_SAVE_AS), false);
menu->set_item_disabled(menu->get_item_index(FILE_SAVE_ALL), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SAVE), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SAVE_AS), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SAVE_ALL), false);
menu->set_item_disabled(menu->get_item_index(FILE_TOOL_RELOAD_SOFT), false);
menu->set_item_disabled(menu->get_item_index(FILE_COPY_PATH), false);
menu->set_item_disabled(menu->get_item_index(SHOW_IN_FILE_SYSTEM), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SOFT_RELOAD_TOOL), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_COPY_PATH), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_SHOW_IN_FILE_SYSTEM), false);
menu->set_item_disabled(menu->get_item_index(WINDOW_PREV), false);
menu->set_item_disabled(menu->get_item_index(WINDOW_NEXT), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_HISTORY_PREV), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_HISTORY_NEXT), false);
menu->set_item_disabled(menu->get_item_index(FILE_CLOSE), false);
menu->set_item_disabled(menu->get_item_index(CLOSE_ALL), false);
menu->set_item_disabled(menu->get_item_index(CLOSE_OTHER_TABS), false);
menu->set_item_disabled(menu->get_item_index(CLOSE_DOCS), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_CLOSE), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_CLOSE_ALL), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_CLOSE_OTHER_TABS), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_CLOSE_DOCS), false);
menu->set_item_disabled(menu->get_item_index(FILE_RUN), false);
menu->set_item_disabled(menu->get_item_index(FILE_MENU_RUN), false);
}
void ScriptEditor::_tab_changed(int p_which) {
@@ -2843,12 +2837,12 @@ void ScriptEditor::_reload_scripts(bool p_refresh_only) {
}
void ScriptEditor::open_script_create_dialog(const String &p_base_name, const String &p_base_path) {
_menu_option(FILE_NEW);
_menu_option(FILE_MENU_NEW);
script_create_dialog->config(p_base_name, p_base_path);
}
void ScriptEditor::open_text_file_create_dialog(const String &p_base_path, const String &p_base_name) {
_menu_option(FILE_NEW_TEXTFILE);
_menu_option(FILE_MENU_NEW_TEXTFILE);
file_dialog->set_current_dir(p_base_path);
file_dialog->set_current_file(p_base_name);
open_textfile_after_create = false;
@@ -3365,11 +3359,11 @@ void ScriptEditor::shortcut_input(const Ref<InputEvent> &p_event) {
accept_event();
}
if (ED_IS_SHORTCUT("script_editor/window_move_up", p_event)) {
_menu_option(WINDOW_MOVE_UP);
_menu_option(FILE_MENU_MOVE_UP);
accept_event();
}
if (ED_IS_SHORTCUT("script_editor/window_move_down", p_event)) {
_menu_option(WINDOW_MOVE_DOWN);
_menu_option(FILE_MENU_MOVE_DOWN);
accept_event();
}
@@ -3389,7 +3383,7 @@ void ScriptEditor::_script_list_clicked(int p_item, Vector2 p_local_mouse_pos, M
if (p_mouse_button_index == MouseButton::MIDDLE) {
script_list->select(p_item);
_script_selected(p_item);
_menu_option(FILE_CLOSE);
_menu_option(FILE_MENU_CLOSE);
}
if (p_mouse_button_index == MouseButton::RIGHT) {
@@ -3407,42 +3401,42 @@ void ScriptEditor::_make_script_list_context_menu() {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(selected));
if (se) {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save"), FILE_SAVE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save_as"), FILE_SAVE_AS);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save"), FILE_MENU_SAVE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save_as"), FILE_MENU_SAVE_AS);
}
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_file"), FILE_CLOSE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_other_tabs"), CLOSE_OTHER_TABS);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_tabs_below"), CLOSE_TABS_BELOW);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_all"), CLOSE_ALL);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_docs"), CLOSE_DOCS);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_file"), FILE_MENU_CLOSE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_other_tabs"), FILE_MENU_CLOSE_OTHER_TABS);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_tabs_below"), FILE_MENU_CLOSE_TABS_BELOW);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_all"), FILE_MENU_CLOSE_ALL);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_docs"), FILE_MENU_CLOSE_DOCS);
context_menu->add_separator();
if (se) {
Ref<Script> scr = se->get_edited_resource();
if (scr.is_valid() && scr->is_tool()) {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/reload_script_soft"), FILE_TOOL_RELOAD_SOFT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/run_file"), FILE_RUN);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/reload_script_soft"), FILE_MENU_SOFT_RELOAD_TOOL);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/run_file"), FILE_MENU_RUN);
context_menu->add_separator();
}
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/copy_path"), FILE_COPY_PATH);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/copy_path"), FILE_MENU_COPY_PATH);
context_menu->set_item_disabled(-1, se->get_edited_resource()->get_path().is_empty());
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/copy_uid"), FILE_COPY_UID);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/copy_uid"), FILE_MENU_COPY_UID);
context_menu->set_item_disabled(-1, ResourceLoader::get_resource_uid(se->get_edited_resource()->get_path()) == ResourceUID::INVALID_ID);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/show_in_file_system"), SHOW_IN_FILE_SYSTEM);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/show_in_file_system"), FILE_MENU_SHOW_IN_FILE_SYSTEM);
context_menu->add_separator();
}
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_move_up"), WINDOW_MOVE_UP);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_move_down"), WINDOW_MOVE_DOWN);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_sort"), WINDOW_SORT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_files_panel"), TOGGLE_FILES_PANEL);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_move_up"), FILE_MENU_MOVE_UP);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_move_down"), FILE_MENU_MOVE_DOWN);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_sort"), FILE_MENU_SORT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_files_panel"), FILE_MENU_TOGGLE_FILES_PANEL);
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_ALL), tab_container->get_tab_count() <= 0);
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_DOCS), !_has_docs_tab());
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_TABS_BELOW), tab_container->get_current_tab() >= tab_container->get_tab_count() - 1);
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_UP), tab_container->get_current_tab() <= 0);
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_DOWN), tab_container->get_current_tab() >= tab_container->get_tab_count() - 1);
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_SORT), tab_container->get_tab_count() <= 1);
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_CLOSE_ALL), tab_container->get_tab_count() <= 0);
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_CLOSE_DOCS), !_has_docs_tab());
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_CLOSE_TABS_BELOW), tab_container->get_current_tab() >= tab_container->get_tab_count() - 1);
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_MOVE_UP), tab_container->get_current_tab() <= 0);
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_MOVE_DOWN), tab_container->get_current_tab() >= tab_container->get_tab_count() - 1);
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_SORT), tab_container->get_tab_count() <= 1);
// Context menu plugin.
Vector<String> selected_paths;
@@ -4256,38 +4250,38 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
file_menu->set_shortcut_context(this);
menu_hb->add_child(file_menu);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTRC("New Script..."), KeyModifierMask::CMD_OR_CTRL | Key::N), FILE_NEW);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTRC("New Text File..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::N), FILE_NEW_TEXTFILE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTRC("Open...")), FILE_OPEN_);
file_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_editor/reopen_closed_script"), FILE_REOPEN_CLOSED);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTRC("New Script..."), KeyModifierMask::CMD_OR_CTRL | Key::N), FILE_MENU_NEW);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTRC("New Text File..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::N), FILE_MENU_NEW_TEXTFILE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTRC("Open...")), FILE_MENU_OPEN);
file_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_editor/reopen_closed_script"), FILE_MENU_REOPEN_CLOSED);
recent_scripts = memnew(PopupMenu);
recent_scripts->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
file_menu->get_popup()->add_submenu_node_item(TTR("Open Recent"), recent_scripts, FILE_OPEN_RECENT);
file_menu->get_popup()->add_submenu_node_item(TTR("Open Recent"), recent_scripts, FILE_MENU_OPEN_RECENT);
recent_scripts->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptEditor::_open_recent_script));
_update_recent_scripts();
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTRC("Save"), KeyModifierMask::ALT | KeyModifierMask::CMD_OR_CTRL | Key::S), FILE_SAVE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTRC("Save As...")), FILE_SAVE_AS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTRC("Save All"), KeyModifierMask::SHIFT | KeyModifierMask::ALT | Key::S), FILE_SAVE_ALL);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTRC("Save"), KeyModifierMask::ALT | KeyModifierMask::CMD_OR_CTRL | Key::S), FILE_MENU_SAVE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTRC("Save As...")), FILE_MENU_SAVE_AS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTRC("Save All"), KeyModifierMask::SHIFT | KeyModifierMask::ALT | Key::S), FILE_MENU_SAVE_ALL);
ED_SHORTCUT_OVERRIDE("script_editor/save_all", "macos", KeyModifierMask::META | KeyModifierMask::CTRL | Key::S);
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_script_soft", TTRC("Soft Reload Tool Script"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT | Key::R), FILE_TOOL_RELOAD_SOFT);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy_path", TTRC("Copy Script Path")), FILE_COPY_PATH);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy_uid", TTRC("Copy Script UID")), FILE_COPY_UID);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/show_in_file_system", TTRC("Show in FileSystem")), SHOW_IN_FILE_SYSTEM);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_script_soft", TTRC("Soft Reload Tool Script"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT | Key::R), FILE_MENU_SOFT_RELOAD_TOOL);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy_path", TTRC("Copy Script Path")), FILE_MENU_COPY_PATH);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy_uid", TTRC("Copy Script UID")), FILE_MENU_COPY_UID);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/show_in_file_system", TTRC("Show in FileSystem")), FILE_MENU_SHOW_IN_FILE_SYSTEM);
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(
ED_SHORTCUT_ARRAY("script_editor/history_previous", TTRC("History Previous"),
{ int32_t(KeyModifierMask::ALT | Key::LEFT), int32_t(Key::BACK) }),
WINDOW_PREV);
FILE_MENU_HISTORY_PREV);
file_menu->get_popup()->add_shortcut(
ED_SHORTCUT_ARRAY("script_editor/history_next", TTRC("History Next"),
{ int32_t(KeyModifierMask::ALT | Key::RIGHT), int32_t(Key::FORWARD) }),
WINDOW_NEXT);
FILE_MENU_HISTORY_NEXT);
ED_SHORTCUT_OVERRIDE("script_editor/history_previous", "macos", KeyModifierMask::ALT | KeyModifierMask::META | Key::LEFT);
ED_SHORTCUT_OVERRIDE("script_editor/history_next", "macos", KeyModifierMask::ALT | KeyModifierMask::META | Key::RIGHT);
@@ -4296,7 +4290,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
theme_submenu = memnew(PopupMenu);
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTRC("Import Theme...")), THEME_IMPORT);
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTRC("Reload Theme")), THEME_RELOAD);
file_menu->get_popup()->add_submenu_node_item(TTR("Theme"), theme_submenu, FILE_THEME);
file_menu->get_popup()->add_submenu_node_item(TTR("Theme"), theme_submenu, FILE_MENU_THEME_SUBMENU);
theme_submenu->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptEditor::_theme_option));
theme_submenu->add_separator();
@@ -4304,17 +4298,17 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/save_theme_as", TTRC("Save Theme As...")), THEME_SAVE_AS);
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTRC("Close"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_CLOSE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTRC("Close All")), CLOSE_ALL);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_other_tabs", TTRC("Close Other Tabs")), CLOSE_OTHER_TABS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_tabs_below", TTRC("Close Tabs Below")), CLOSE_TABS_BELOW);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTRC("Close Docs")), CLOSE_DOCS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTRC("Close"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_MENU_CLOSE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTRC("Close All")), FILE_MENU_CLOSE_ALL);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_other_tabs", TTRC("Close Other Tabs")), FILE_MENU_CLOSE_OTHER_TABS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_tabs_below", TTRC("Close Tabs Below")), FILE_MENU_CLOSE_TABS_BELOW);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTRC("Close Docs")), FILE_MENU_CLOSE_DOCS);
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/run_file", TTRC("Run"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::X), FILE_RUN);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/run_file", TTRC("Run"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::X), FILE_MENU_RUN);
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_files_panel", TTRC("Toggle Files Panel"), KeyModifierMask::CMD_OR_CTRL | Key::BACKSLASH), TOGGLE_FILES_PANEL);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_files_panel", TTRC("Toggle Files Panel"), KeyModifierMask::CMD_OR_CTRL | Key::BACKSLASH), FILE_MENU_TOGGLE_FILES_PANEL);
file_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptEditor::_menu_option));
file_menu->get_popup()->connect("about_to_popup", callable_mp(this, &ScriptEditor::_prepare_file_menu));
file_menu->get_popup()->connect("popup_hide", callable_mp(this, &ScriptEditor::_file_menu_closed));

View File

@@ -233,53 +233,65 @@ class FindInFilesPanel;
class ScriptEditor : public PanelContainer {
GDCLASS(ScriptEditor, PanelContainer);
enum {
FILE_NEW,
FILE_NEW_TEXTFILE,
FILE_OPEN_, // Conflict with WinAPI.
FILE_REOPEN_CLOSED,
FILE_OPEN_RECENT,
FILE_SAVE,
FILE_SAVE_AS,
FILE_SAVE_ALL,
FILE_THEME,
FILE_RUN,
FILE_CLOSE,
CLOSE_DOCS,
CLOSE_ALL,
CLOSE_OTHER_TABS,
CLOSE_TABS_BELOW,
TOGGLE_FILES_PANEL,
SHOW_IN_FILE_SYSTEM,
FILE_COPY_PATH,
FILE_COPY_UID,
FILE_TOOL_RELOAD_SOFT,
SEARCH_IN_FILES,
REPLACE_IN_FILES,
SEARCH_HELP,
SEARCH_WEBSITE,
enum MenuOptions {
// File.
FILE_MENU_NEW,
FILE_MENU_NEW_TEXTFILE,
FILE_MENU_OPEN,
FILE_MENU_REOPEN_CLOSED,
FILE_MENU_OPEN_RECENT,
FILE_MENU_SAVE,
FILE_MENU_SAVE_AS,
FILE_MENU_SAVE_ALL,
FILE_MENU_SOFT_RELOAD_TOOL,
FILE_MENU_COPY_PATH,
FILE_MENU_COPY_UID,
FILE_MENU_SHOW_IN_FILE_SYSTEM,
FILE_MENU_HISTORY_PREV,
FILE_MENU_HISTORY_NEXT,
FILE_MENU_THEME_SUBMENU,
FILE_MENU_CLOSE,
FILE_MENU_CLOSE_ALL,
FILE_MENU_CLOSE_OTHER_TABS,
FILE_MENU_CLOSE_TABS_BELOW,
FILE_MENU_CLOSE_DOCS,
FILE_MENU_RUN,
FILE_MENU_TOGGLE_FILES_PANEL,
FILE_MENU_MOVE_UP,
FILE_MENU_MOVE_DOWN,
FILE_MENU_SORT,
// Search.
HELP_SEARCH_FIND,
HELP_SEARCH_FIND_NEXT,
HELP_SEARCH_FIND_PREVIOUS,
WINDOW_MOVE_UP,
WINDOW_MOVE_DOWN,
WINDOW_NEXT,
WINDOW_PREV,
WINDOW_SORT,
WINDOW_SELECT_BASE = 100,
SEARCH_IN_FILES,
REPLACE_IN_FILES,
SEARCH_HELP,
SEARCH_WEBSITE,
};
enum {
enum ThemeMenu {
THEME_IMPORT,
THEME_RELOAD,
THEME_SAVE,
THEME_SAVE_AS
THEME_SAVE_AS,
};
enum ScriptSortBy {
SORT_BY_NAME,
SORT_BY_PATH,
SORT_BY_NONE
SORT_BY_NONE,
};
enum ScriptListName {

View File

@@ -394,34 +394,34 @@ void ShaderEditorPlugin::_shader_list_clicked(int p_item, Vector2 p_local_mouse_
void ShaderEditorPlugin::_setup_popup_menu(PopupMenuType p_type, PopupMenu *p_menu) {
if (p_type == FILE) {
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/new", TTRC("New Shader..."), KeyModifierMask::CMD_OR_CTRL | Key::N), FILE_NEW);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/new_include", TTRC("New Shader Include..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::N), FILE_NEW_INCLUDE);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/new", TTRC("New Shader..."), KeyModifierMask::CMD_OR_CTRL | Key::N), FILE_MENU_NEW);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/new_include", TTRC("New Shader Include..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::N), FILE_MENU_NEW_INCLUDE);
p_menu->add_separator();
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/open", TTRC("Load Shader File..."), KeyModifierMask::CMD_OR_CTRL | Key::O), FILE_OPEN_);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/open_include", TTRC("Load Shader Include File..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::O), FILE_OPEN_INCLUDE);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/open", TTRC("Load Shader File..."), KeyModifierMask::CMD_OR_CTRL | Key::O), FILE_MENU_OPEN);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/open_include", TTRC("Load Shader Include File..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::O), FILE_MENU_OPEN_INCLUDE);
}
if (p_type == FILE || p_type == CONTEXT_VALID_ITEM) {
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/save", TTRC("Save File"), KeyModifierMask::ALT | KeyModifierMask::CMD_OR_CTRL | Key::S), FILE_SAVE);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/save_as", TTRC("Save File As...")), FILE_SAVE_AS);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/save", TTRC("Save File"), KeyModifierMask::ALT | KeyModifierMask::CMD_OR_CTRL | Key::S), FILE_MENU_SAVE);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/save_as", TTRC("Save File As...")), FILE_MENU_SAVE_AS);
}
if (p_type == FILE) {
p_menu->add_separator();
p_menu->add_item(TTR("Open File in Inspector"), FILE_INSPECT);
p_menu->add_item(TTR("Inspect Native Shader Code..."), FILE_INSPECT_NATIVE_SHADER_CODE);
p_menu->add_item(TTR("Open File in Inspector"), FILE_MENU_INSPECT);
p_menu->add_item(TTR("Inspect Native Shader Code..."), FILE_MENU_INSPECT_NATIVE_SHADER_CODE);
p_menu->add_separator();
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/close_file", TTRC("Close File"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_CLOSE);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/close_file", TTRC("Close File"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_MENU_CLOSE);
p_menu->add_separator();
p_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_files_panel"), TOGGLE_FILES_PANEL);
p_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_files_panel"), FILE_MENU_TOGGLE_FILES_PANEL);
} else {
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/close_file", TTRC("Close File"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_CLOSE);
p_menu->add_item(TTR("Close All"), CLOSE_ALL);
p_menu->add_item(TTR("Close Other Tabs"), CLOSE_OTHER_TABS);
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/close_file", TTRC("Close File"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_MENU_CLOSE);
p_menu->add_item(TTR("Close All"), FILE_MENU_CLOSE_ALL);
p_menu->add_item(TTR("Close Other Tabs"), FILE_MENU_CLOSE_OTHER_TABS);
if (p_type == CONTEXT_VALID_ITEM) {
p_menu->add_separator();
p_menu->add_item(TTR("Copy Script Path"), COPY_PATH);
p_menu->add_item(TTR("Show in FileSystem"), SHOW_IN_FILE_SYSTEM);
p_menu->add_item(TTR("Copy Script Path"), FILE_MENU_COPY_PATH);
p_menu->add_item(TTR("Show in FileSystem"), FILE_MENU_SHOW_IN_FILE_SYSTEM);
}
}
}
@@ -439,8 +439,8 @@ void ShaderEditorPlugin::_make_script_list_context_menu() {
_setup_popup_menu(is_valid_editor_control ? CONTEXT_VALID_ITEM : CONTEXT, context_menu);
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_ALL), shader_tabs->get_tab_count() <= 0);
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_OTHER_TABS), shader_tabs->get_tab_count() <= 1);
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_CLOSE_ALL), shader_tabs->get_tab_count() <= 0);
context_menu->set_item_disabled(context_menu->get_item_index(FILE_MENU_CLOSE_OTHER_TABS), shader_tabs->get_tab_count() <= 1);
context_menu->set_position(files_split->get_screen_position() + files_split->get_local_mouse_position());
context_menu->reset_size();
@@ -508,23 +508,23 @@ void ShaderEditorPlugin::_resource_saved(Object *obj) {
void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
switch (p_index) {
case FILE_NEW: {
case FILE_MENU_NEW: {
String base_path = FileSystemDock::get_singleton()->get_current_path().get_base_dir();
shader_create_dialog->config(base_path.path_join("new_shader"), false, false, 0);
shader_create_dialog->popup_centered();
} break;
case FILE_NEW_INCLUDE: {
case FILE_MENU_NEW_INCLUDE: {
String base_path = FileSystemDock::get_singleton()->get_current_path().get_base_dir();
shader_create_dialog->config(base_path.path_join("new_shader"), false, false, 2);
shader_create_dialog->popup_centered();
} break;
case FILE_OPEN_: {
case FILE_MENU_OPEN: {
InspectorDock::get_singleton()->open_resource("Shader");
} break;
case FILE_OPEN_INCLUDE: {
case FILE_MENU_OPEN_INCLUDE: {
InspectorDock::get_singleton()->open_resource("ShaderInclude");
} break;
case FILE_SAVE: {
case FILE_MENU_SAVE: {
int index = shader_tabs->get_current_tab();
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
TextShaderEditor *editor = Object::cast_to<TextShaderEditor>(edited_shaders[index].shader_editor);
@@ -546,7 +546,7 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
editor->tag_saved_version();
}
} break;
case FILE_SAVE_AS: {
case FILE_MENU_SAVE_AS: {
int index = shader_tabs->get_current_tab();
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
TextShaderEditor *editor = Object::cast_to<TextShaderEditor>(edited_shaders[index].shader_editor);
@@ -577,7 +577,7 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
editor->tag_saved_version();
}
} break;
case FILE_INSPECT: {
case FILE_MENU_INSPECT: {
int index = shader_tabs->get_current_tab();
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
if (edited_shaders[index].shader.is_valid()) {
@@ -586,21 +586,21 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
EditorNode::get_singleton()->push_item(edited_shaders[index].shader_inc.ptr());
}
} break;
case FILE_INSPECT_NATIVE_SHADER_CODE: {
case FILE_MENU_INSPECT_NATIVE_SHADER_CODE: {
int index = shader_tabs->get_current_tab();
if (edited_shaders[index].shader.is_valid()) {
edited_shaders[index].shader->inspect_native_shader_code();
}
} break;
case FILE_CLOSE: {
case FILE_MENU_CLOSE: {
_close_shader(shader_tabs->get_current_tab());
} break;
case CLOSE_ALL: {
case FILE_MENU_CLOSE_ALL: {
while (shader_tabs->get_tab_count() > 0) {
_close_shader(0);
}
} break;
case CLOSE_OTHER_TABS: {
case FILE_MENU_CLOSE_OTHER_TABS: {
int index = shader_tabs->get_current_tab();
for (int i = 0; i < index; i++) {
_close_shader(0);
@@ -609,18 +609,18 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
_close_shader(1);
}
} break;
case SHOW_IN_FILE_SYSTEM: {
case FILE_MENU_SHOW_IN_FILE_SYSTEM: {
Ref<Resource> shader = _get_current_shader();
String path = shader->get_path();
if (!path.is_empty()) {
FileSystemDock::get_singleton()->navigate_to_path(path);
}
} break;
case COPY_PATH: {
case FILE_MENU_COPY_PATH: {
Ref<Resource> shader = _get_current_shader();
DisplayServer::get_singleton()->clipboard_set(shader->get_path());
} break;
case TOGGLE_FILES_PANEL: {
case FILE_MENU_TOGGLE_FILES_PANEL: {
shader_list->set_visible(!shader_list->is_visible());
int index = shader_tabs->get_current_tab();
@@ -857,11 +857,11 @@ void ShaderEditorPlugin::_res_saved_callback(const Ref<Resource> &p_res) {
void ShaderEditorPlugin::_set_file_specific_items_disabled(bool p_disabled) {
PopupMenu *file_popup_menu = file_menu->get_popup();
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_SAVE), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_SAVE_AS), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_INSPECT), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_INSPECT_NATIVE_SHADER_CODE), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_CLOSE), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_MENU_SAVE), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_MENU_SAVE_AS), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_MENU_INSPECT), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_MENU_INSPECT_NATIVE_SHADER_CODE), p_disabled);
file_popup_menu->set_item_disabled(file_popup_menu->get_item_index(FILE_MENU_CLOSE), p_disabled);
}
void ShaderEditorPlugin::_notification(int p_what) {

View File

@@ -57,21 +57,21 @@ class ShaderEditorPlugin : public EditorPlugin {
LocalVector<EditedShader> edited_shaders;
enum {
FILE_NEW,
FILE_NEW_INCLUDE,
FILE_OPEN_,
FILE_OPEN_INCLUDE,
FILE_SAVE,
FILE_SAVE_AS,
FILE_INSPECT,
FILE_INSPECT_NATIVE_SHADER_CODE,
FILE_CLOSE,
CLOSE_ALL,
CLOSE_OTHER_TABS,
SHOW_IN_FILE_SYSTEM,
COPY_PATH,
TOGGLE_FILES_PANEL,
enum FileMenu {
FILE_MENU_NEW,
FILE_MENU_NEW_INCLUDE,
FILE_MENU_OPEN,
FILE_MENU_OPEN_INCLUDE,
FILE_MENU_SAVE,
FILE_MENU_SAVE_AS,
FILE_MENU_INSPECT,
FILE_MENU_INSPECT_NATIVE_SHADER_CODE,
FILE_MENU_CLOSE,
FILE_MENU_CLOSE_ALL,
FILE_MENU_CLOSE_OTHER_TABS,
FILE_MENU_SHOW_IN_FILE_SYSTEM,
FILE_MENU_COPY_PATH,
FILE_MENU_TOGGLE_FILES_PANEL,
};
enum PopupMenuType {

View File

@@ -110,8 +110,8 @@ void ProjectUpgradeTool::finish_upgrade() {
for (const String &file_path : paths) {
ep.step(TTR("Re-saving scene:") + " " + file_path, step++);
EditorNode::get_singleton()->load_scene(file_path);
EditorNode::get_singleton()->trigger_menu_option(EditorNode::FILE_SAVE_SCENE, true);
EditorNode::get_singleton()->trigger_menu_option(EditorNode::FILE_CLOSE, true);
EditorNode::get_singleton()->trigger_menu_option(EditorNode::SCENE_SAVE_SCENE, true);
EditorNode::get_singleton()->trigger_menu_option(EditorNode::SCENE_CLOSE, true);
}
EditorSettings::get_singleton()->set_project_metadata(META_PROJECT_UPGRADE_TOOL, META_RESAVE_SCENES, Variant());
}