From 3f3cd15e077e3f59e44cbed1407ff5373d4a6579 Mon Sep 17 00:00:00 2001 From: Francois Belair Date: Tue, 26 Oct 2021 16:38:45 -0400 Subject: [PATCH] Make EditorSpinSlider wait for text on key_up/down --- editor/editor_spin_slider.cpp | 14 ++++++++++++-- editor/editor_spin_slider.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index ec90af1bccc..82b5ec5ca1d 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -225,7 +225,8 @@ void EditorSpinSlider::_value_input_gui_input(const Ref &p_event) { set_value(last_value + real_step); } - value_input->set_text(get_text_value()); + value_input_dirty = true; + set_process_internal(true); } break; case KEY_DOWN: { _evaluate_input_text(); @@ -238,7 +239,8 @@ void EditorSpinSlider::_value_input_gui_input(const Ref &p_event) { set_value(last_value - real_step); } - value_input->set_text(get_text_value()); + value_input_dirty = true; + set_process_internal(true); } break; } } @@ -424,6 +426,14 @@ void EditorSpinSlider::_notification(int p_what) { _update_value_input_stylebox(); break; + case NOTIFICATION_INTERNAL_PROCESS: + if (value_input_dirty) { + value_input_dirty = false; + value_input->set_text(get_text_value()); + } + set_process_internal(false); + break; + case NOTIFICATION_DRAW: _draw_spin_slider(); break; diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h index 7e10764491b..68448b32405 100644 --- a/editor/editor_spin_slider.h +++ b/editor/editor_spin_slider.h @@ -66,6 +66,7 @@ class EditorSpinSlider : public Range { Popup *value_input_popup = nullptr; LineEdit *value_input = nullptr; bool value_input_just_closed = false; + bool value_input_dirty = false; void _grabber_gui_input(const Ref &p_event); void _value_input_closed();