Use Enter instead of F2 as an editor renaming shortcut on macOS

This commit is contained in:
Hugo Locurcio 2021-11-12 20:50:38 +01:00
parent 5752457854
commit 0f4b0cb3dd
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
3 changed files with 10 additions and 0 deletions

View file

@ -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/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/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D);
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE); 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); 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); ED_SHORTCUT("filesystem_dock/open_search", TTR("Focus the search box"), KEY_MASK_CMD | KEY_F);
VBoxContainer *top_vbc = memnew(VBoxContainer); VBoxContainer *top_vbc = memnew(VBoxContainer);

View file

@ -2554,6 +2554,7 @@ ProjectManager::ProjectManager() {
Button *rename = memnew(Button); Button *rename = memnew(Button);
rename->set_text(TTR("Rename")); 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)); rename->set_shortcut(ED_SHORTCUT("project_manager/rename_project", TTR("Rename Project"), KEY_F2));
tree_vb->add_child(rename); tree_vb->add_child(rename);
rename->connect("pressed", this, "_rename_project"); rename->connect("pressed", this, "_rename_project");

View file

@ -3205,8 +3205,13 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
HBoxContainer *filter_hbc = memnew(HBoxContainer); HBoxContainer *filter_hbc = memnew(HBoxContainer);
filter_hbc->add_constant_override("separate", 0); 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/rename", TTR("Rename"), KEY_F2);
ED_SHORTCUT("scene_tree/batch_rename", TTR("Batch Rename"), KEY_MASK_SHIFT | 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/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/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")); ED_SHORTCUT("scene_tree/expand_collapse_all", TTR("Expand/Collapse All"));