Fix Go to Previous Keyframe shortcut needs to be pressed twice to work#118347
Fix Go to Previous Keyframe shortcut needs to be pressed twice to work#118347ydeltastar wants to merge 1 commit intogodotengine:masterfrom
Go to Previous Keyframe shortcut needs to be pressed twice to work#118347Conversation
|
This PR might be okay as a temporary band-aid fix. However, judging from the description, I'm skeptical that "snap" should even be performed within that void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_timeline_only, bool p_update_position_only) {
double pos = track_editor->is_snap_timeline_enabled() ? Math::snapped(p_pos, _get_editor_step()) : p_pos; // Snapped pos.
timeline_position = pos;
if (!is_visible_in_tree() ||
p_update_position_only ||
!player ||
player->is_playing() ||
!player->has_animation(player->get_assigned_animation())) {
return;
}
updating = true;
frame->set_value(pos );
updating = false;
_seek_value_changed(pos , p_timeline_only);
}
Also, it seems that snapping via the frame SpinBox signal is not functioning correctly in the first place (see also #34431). So I think it should be refactored and PR #118031 will likely need to be reconsidered/rewritten with that premise in mind. |
|
Snapping at Well, the main issue is that the system is too intertwined with the UI and signals. The logic sets the UI, then UI emit signals which also set the state, then the state triggers UI updates, and so on. The A general solution is probably to refactor all state logic in |
Go to Previous Keyframeshortcut needs to be pressed twice to work #117543go_to_nearest_keyframe()seeks to the exact keyframe time, then updates the timeline spinbox withframe->set_value(nearest_key_time). This triggers_seek_value_changed(), because it is connected to the spinner'svalue_changedsignal. The method snaps the position to the editor step grid and sets the animation player to that snapped value, overwriting the exact keyframe time.It worked the second time because the spinbox doesn't emit the
value_changedsignal since it's the same snapped value.