From 8d0178a5898e918099ec7281deda9d7589f49bf2 Mon Sep 17 00:00:00 2001 From: Eric M Date: Sun, 8 Jan 2023 20:48:56 +1000 Subject: [PATCH] Remove unnecessary changing of shortcut name. The same effect which was desired here can just be done with `set_item_text(...)`, which is what this PR does. It removes the need to constantly update the shortcut name when the scene menu is opened. --- editor/editor_node.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 13dd03068f1..8bb373cd251 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3245,11 +3245,6 @@ void EditorNode::_discard_changes(const String &p_str) { } void EditorNode::_update_file_menu_opened() { - Ref close_scene_sc = ED_GET_SHORTCUT("editor/close_scene"); - close_scene_sc->set_name(TTR("Close Scene")); - Ref reopen_closed_scene_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene"); - reopen_closed_scene_sc->set_name(TTR("Reopen Closed Scene")); - file_menu->set_item_disabled(file_menu->get_item_index(FILE_OPEN_PREV), previous_scenes.is_empty()); Ref undo_redo = editor_data.get_undo_redo(); @@ -5281,12 +5276,10 @@ void EditorNode::_scene_tab_input(const Ref &p_input) { scene_tabs_context_menu->add_item(TTR("Play This Scene"), RUN_PLAY_SCENE); scene_tabs_context_menu->add_separator(); - Ref close_tab_sc = ED_GET_SHORTCUT("editor/close_scene"); - close_tab_sc->set_name(TTR("Close Tab")); - scene_tabs_context_menu->add_shortcut(close_tab_sc, FILE_CLOSE); - Ref undo_close_tab_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene"); - undo_close_tab_sc->set_name(TTR("Undo Close Tab")); - scene_tabs_context_menu->add_shortcut(undo_close_tab_sc, FILE_OPEN_PREV); + scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/close_scene"), FILE_CLOSE); + scene_tabs_context_menu->set_item_text(scene_tabs_context_menu->get_item_index(FILE_CLOSE), TTR("Close Tab")); + scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/reopen_closed_scene"), FILE_OPEN_PREV); + scene_tabs_context_menu->set_item_text(scene_tabs_context_menu->get_item_index(FILE_OPEN_PREV), TTR("Undo Close Tab")); if (previous_scenes.is_empty()) { scene_tabs_context_menu->set_item_disabled(scene_tabs_context_menu->get_item_index(FILE_OPEN_PREV), true); }