Skip to content

Commit

Permalink
Fix editor spin slider remaining editable if set read_only during an …
Browse files Browse the repository at this point in the history
…edit and fix related animation player crash
  • Loading branch information
spanzeri committed Apr 22, 2023
1 parent afca0b8 commit b6abb34
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4639,6 +4639,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;
Expand Down
11 changes: 10 additions & 1 deletion editor/gui/editor_spin_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,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
Expand Down Expand Up @@ -604,6 +609,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();
}

Expand Down

0 comments on commit b6abb34

Please sign in to comment.