From 0f4b0cb3dd1b78cc594016a79066da583cf5ae69 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 12 Nov 2021 20:50:38 +0100 Subject: [PATCH] Use Enter instead of F2 as an editor renaming shortcut on macOS --- editor/filesystem_dock.cpp | 4 ++++ editor/project_manager.cpp | 1 + editor/scene_tree_dock.cpp | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 4dc1747bcab..52b97394004 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2789,7 +2789,11 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C); ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D); ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE); +#ifdef OSX_ENABLED + ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), KEY_ENTER); +#else ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), KEY_F2); +#endif ED_SHORTCUT("filesystem_dock/open_search", TTR("Focus the search box"), KEY_MASK_CMD | KEY_F); VBoxContainer *top_vbc = memnew(VBoxContainer); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 763a9be538e..7fee6a5a553 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2554,6 +2554,7 @@ ProjectManager::ProjectManager() { Button *rename = memnew(Button); rename->set_text(TTR("Rename")); + // The F2 shortcut isn't overridden with Enter on macOS as Enter is already used to edit a project. rename->set_shortcut(ED_SHORTCUT("project_manager/rename_project", TTR("Rename Project"), KEY_F2)); tree_vb->add_child(rename); rename->connect("pressed", this, "_rename_project"); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index eb968d691dc..38f5aae7e57 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -3205,8 +3205,13 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel HBoxContainer *filter_hbc = memnew(HBoxContainer); filter_hbc->add_constant_override("separate", 0); +#ifdef OSX_ENABLED + ED_SHORTCUT("scene_tree/rename", TTR("Rename"), KEY_ENTER); + ED_SHORTCUT("scene_tree/batch_rename", TTR("Batch Rename"), KEY_MASK_SHIFT | KEY_ENTER); +#else ED_SHORTCUT("scene_tree/rename", TTR("Rename"), KEY_F2); ED_SHORTCUT("scene_tree/batch_rename", TTR("Batch Rename"), KEY_MASK_SHIFT | KEY_F2); +#endif ED_SHORTCUT("scene_tree/add_child_node", TTR("Add Child Node"), KEY_MASK_CMD | KEY_A); ED_SHORTCUT("scene_tree/instance_scene", TTR("Instance Child Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_A); ED_SHORTCUT("scene_tree/expand_collapse_all", TTR("Expand/Collapse All"));