From c3cb846f7200280602669bd320ff4a3f518932e4 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 6 Jun 2023 10:50:46 +0300 Subject: [PATCH] [Input Map] Generate missing values instead of disabling options. --- editor/input_event_configuration_dialog.cpp | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/editor/input_event_configuration_dialog.cpp b/editor/input_event_configuration_dialog.cpp index c2b8992b697..430e81466e7 100644 --- a/editor/input_event_configuration_dialog.cpp +++ b/editor/input_event_configuration_dialog.cpp @@ -107,6 +107,33 @@ void InputEventConfigurationDialog::_set_event(const Ref &p_event, c // Update mode selector based on original key event. Ref ko = p_original_event; if (ko.is_valid()) { + if (ko->get_keycode() == Key::NONE) { + if (ko->get_physical_keycode() != Key::NONE) { + ko->set_keycode(ko->get_physical_keycode()); + } + if (ko->get_key_label() != Key::NONE) { + ko->set_keycode(fix_keycode((char32_t)ko->get_key_label(), Key::NONE)); + } + } + + if (ko->get_physical_keycode() == Key::NONE) { + if (ko->get_keycode() != Key::NONE) { + ko->set_physical_keycode(ko->get_keycode()); + } + if (ko->get_key_label() != Key::NONE) { + ko->set_physical_keycode(fix_keycode((char32_t)ko->get_key_label(), Key::NONE)); + } + } + + if (ko->get_key_label() == Key::NONE) { + if (ko->get_keycode() != Key::NONE) { + ko->set_key_label(fix_key_label((char32_t)ko->get_keycode(), Key::NONE)); + } + if (ko->get_physical_keycode() != Key::NONE) { + ko->set_key_label(fix_key_label((char32_t)ko->get_physical_keycode(), Key::NONE)); + } + } + key_mode->set_item_disabled(KEYMODE_KEYCODE, ko->get_keycode() == Key::NONE); key_mode->set_item_disabled(KEYMODE_PHY_KEYCODE, ko->get_physical_keycode() == Key::NONE); key_mode->set_item_disabled(KEYMODE_UNICODE, ko->get_key_label() == Key::NONE);