From 7489ae377706565bc2d6a09de079a296044d26ac Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 25 Nov 2021 15:16:56 +0200 Subject: [PATCH] Optimize update_hint_tooltips() calls Now gets called once at the beginning instead of multiple times for every shortcut. --- src/Preferences/HandleShortcuts.gd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Preferences/HandleShortcuts.gd b/src/Preferences/HandleShortcuts.gd index 5d8a92065..1ed6221b7 100644 --- a/src/Preferences/HandleShortcuts.gd +++ b/src/Preferences/HandleShortcuts.gd @@ -100,6 +100,7 @@ func apply_shortcuts_preset(preset) -> void: get_node("Shortcuts/" + action).text = OS.get_scancode_string( preset[action].get_scancode_with_modifiers() ) + Global.update_hint_tooltips() func toggle_shortcut_buttons(enabled: bool) -> void: @@ -119,7 +120,6 @@ func set_action_shortcut(action: String, oldinput: InputEventKey, newinput: Inpu # Set shortcut to switch colors button if action == "switch_colors": color_switch.shortcut.shortcut = InputMap.get_action_list("switch_colors")[0] - Global.update_hint_tooltips() func _on_Shortcut_button_pressed(button: Button) -> void: @@ -138,6 +138,7 @@ func _on_ShortcutSelector_popup_hide() -> void: func _on_ShortcutSelector_confirmed() -> void: if not shortcut_already_assigned: set_action_shortcut(action_being_edited, old_input_event, new_input_event) + Global.update_hint_tooltips() custom_shortcuts_preset[action_being_edited] = new_input_event Global.config_cache.set_value("shortcuts", action_being_edited, new_input_event) Global.config_cache.save("user://cache.ini")