Skip to content

Commit 4588542

Browse files
committed
Merge pull request #107065 from timothyqiu/scene-close-all
Allow closing all scene tabs via shortcut
2 parents 7738626 + 819c804 commit 4588542

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

editor/editor_node.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3051,7 +3051,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
30513051
}
30523052
_proceed_closing_scene_tabs();
30533053
} break;
3054-
case EditorSceneTabs::SCENE_CLOSE_ALL: {
3054+
case SCENE_CLOSE_ALL: {
30553055
tab_closing_menu_option = -1;
30563056
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
30573057
tabs_to_close.push_back(editor_data.get_scene_path(i));
@@ -8108,6 +8108,7 @@ EditorNode::EditorNode() {
81088108
file_menu->add_separator();
81098109
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reload_saved_scene", TTRC("Reload Saved Scene")), SCENE_RELOAD_SAVED_SCENE);
81108110
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/close_scene", TTRC("Close Scene"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::W), SCENE_CLOSE);
8111+
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/close_all_scenes", TTRC("Close All Scenes")), SCENE_CLOSE_ALL);
81118112
ED_SHORTCUT_OVERRIDE("editor/close_scene", "macos", KeyModifierMask::CMD_OR_CTRL + Key::W);
81128113

81138114
if (!global_menu || !OS::get_singleton()->has_feature("macos")) {

editor/editor_node.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class EditorNode : public Node {
155155
SCENE_REDO,
156156
SCENE_RELOAD_SAVED_SCENE,
157157
SCENE_CLOSE,
158+
SCENE_CLOSE_ALL,
158159
SCENE_QUIT,
159160

160161
FILE_EXPORT_MESH_LIBRARY,

editor/project_upgrade/project_upgrade_tool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void ProjectUpgradeTool::begin_upgrade() {
9696
}
9797

9898
void ProjectUpgradeTool::finish_upgrade() {
99-
EditorNode::get_singleton()->trigger_menu_option(EditorSceneTabs::SCENE_CLOSE_ALL, true);
99+
EditorNode::get_singleton()->trigger_menu_option(EditorNode::SCENE_CLOSE_ALL, true);
100100

101101
Vector<String> paths = EditorSettings::get_singleton()->get_project_metadata(META_PROJECT_UPGRADE_TOOL, META_REIMPORT_PATHS, Vector<String>());
102102
EditorFileSystem::get_singleton()->reimport_files(paths);

editor/scene/editor_scene_tabs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ void EditorSceneTabs::_update_context_menu() {
208208
DISABLE_LAST_OPTION_IF(EditorNode::get_editor_data().get_edited_scene_count() <= 1);
209209
scene_tabs_context_menu->add_item(TTR("Close Tabs to the Right"), SCENE_CLOSE_RIGHT);
210210
DISABLE_LAST_OPTION_IF(EditorNode::get_editor_data().get_edited_scene_count() == tab_id + 1);
211-
scene_tabs_context_menu->add_item(TTR("Close All Tabs"), SCENE_CLOSE_ALL);
211+
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/close_all_scenes"), EditorNode::SCENE_CLOSE_ALL);
212+
scene_tabs_context_menu->set_item_text(-1, TTRC("Close All Tabs"));
212213

213214
const PackedStringArray paths = { EditorNode::get_editor_data().get_scene_path(tab_id) };
214215
EditorContextMenuPluginManager::get_singleton()->add_options_from_plugins(scene_tabs_context_menu, EditorContextMenuPlugin::CONTEXT_SLOT_SCENE_TABS, paths);

editor/scene/editor_scene_tabs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class EditorSceneTabs : public MarginContainer {
5151
SCENE_RUN,
5252
SCENE_CLOSE_OTHERS,
5353
SCENE_CLOSE_RIGHT,
54-
SCENE_CLOSE_ALL,
5554
};
5655

5756
private:

0 commit comments

Comments
 (0)