diff options
author | Samuele Panzeri <samuele.panzeri@gmail.com> | 2023-04-16 11:08:53 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-04-26 14:32:21 +0200 |
commit | 12969aadbde43d5b1fcc9720de87ce4d3a079cf5 (patch) | |
tree | 81f788b411a8cfa21b4cdb8a37d12d0f366bab9c /editor | |
parent | 7f1b1e1c1b52ef854062d02b3c481507ba910b1d (diff) |
Fix editor spin slider remaining editable if set read_only during an edit and fix related animation player crash
(cherry picked from commit b6abb347595faa7bad57afff1f10e8c7b8528e5d)
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor.cpp | 4 | ||||
-rw-r--r-- | editor/editor_spin_slider.cpp | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index c27417f037..f86d239a0f 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -4631,6 +4631,10 @@ void AnimationTrackEditor::_update_scroll(double) { } void AnimationTrackEditor::_update_step(double p_new_step) { + if (animation.is_null()) { + return; + } + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("Change Animation Step")); float step_value = p_new_step; diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 2d3ec437c6..7b30eaa6ac 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -577,8 +577,13 @@ void EditorSpinSlider::_value_focus_exited() { return; } + if (is_read_only()) { + // Spin slider has become read only while it was being edited. + return; + } + _evaluate_input_text(); - // focus is not on the same element after the vlalue_input was exited + // focus is not on the same element after the value_input was exited // -> focus is on next element // -> TAB was pressed // -> modal_close was not called @@ -608,6 +613,10 @@ void EditorSpinSlider::_grabber_mouse_exited() { void EditorSpinSlider::set_read_only(bool p_enable) { read_only = p_enable; + if (read_only && value_input) { + value_input->release_focus(); + } + queue_redraw(); } |