Merge pull request #107065 from timothyqiu/scene-close-all

Allow closing all scene tabs via shortcut
This commit is contained in:
Thaddeus Crews 2025-09-20 13:41:37 -05:00
commit 4588542dfc
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
5 changed files with 6 additions and 4 deletions

View file

@ -3051,7 +3051,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
_proceed_closing_scene_tabs();
} break;
case EditorSceneTabs::SCENE_CLOSE_ALL: {
case SCENE_CLOSE_ALL: {
tab_closing_menu_option = -1;
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
tabs_to_close.push_back(editor_data.get_scene_path(i));
@ -8108,6 +8108,7 @@ EditorNode::EditorNode() {
file_menu->add_separator();
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);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/close_all_scenes", TTRC("Close All Scenes")), SCENE_CLOSE_ALL);
ED_SHORTCUT_OVERRIDE("editor/close_scene", "macos", KeyModifierMask::CMD_OR_CTRL + Key::W);
if (!global_menu || !OS::get_singleton()->has_feature("macos")) {

View file

@ -155,6 +155,7 @@ public:
SCENE_REDO,
SCENE_RELOAD_SAVED_SCENE,
SCENE_CLOSE,
SCENE_CLOSE_ALL,
SCENE_QUIT,
FILE_EXPORT_MESH_LIBRARY,

View file

@ -96,7 +96,7 @@ void ProjectUpgradeTool::begin_upgrade() {
}
void ProjectUpgradeTool::finish_upgrade() {
EditorNode::get_singleton()->trigger_menu_option(EditorSceneTabs::SCENE_CLOSE_ALL, true);
EditorNode::get_singleton()->trigger_menu_option(EditorNode::SCENE_CLOSE_ALL, true);
Vector<String> paths = EditorSettings::get_singleton()->get_project_metadata(META_PROJECT_UPGRADE_TOOL, META_REIMPORT_PATHS, Vector<String>());
EditorFileSystem::get_singleton()->reimport_files(paths);

View file

@ -208,7 +208,8 @@ void EditorSceneTabs::_update_context_menu() {
DISABLE_LAST_OPTION_IF(EditorNode::get_editor_data().get_edited_scene_count() <= 1);
scene_tabs_context_menu->add_item(TTR("Close Tabs to the Right"), SCENE_CLOSE_RIGHT);
DISABLE_LAST_OPTION_IF(EditorNode::get_editor_data().get_edited_scene_count() == tab_id + 1);
scene_tabs_context_menu->add_item(TTR("Close All Tabs"), SCENE_CLOSE_ALL);
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/close_all_scenes"), EditorNode::SCENE_CLOSE_ALL);
scene_tabs_context_menu->set_item_text(-1, TTRC("Close All Tabs"));
const PackedStringArray paths = { EditorNode::get_editor_data().get_scene_path(tab_id) };
EditorContextMenuPluginManager::get_singleton()->add_options_from_plugins(scene_tabs_context_menu, EditorContextMenuPlugin::CONTEXT_SLOT_SCENE_TABS, paths);

View file

@ -51,7 +51,6 @@ public:
SCENE_RUN,
SCENE_CLOSE_OTHERS,
SCENE_CLOSE_RIGHT,
SCENE_CLOSE_ALL,
};
private: