summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-10-14 14:09:55 -0500
committerThaddeus Crews <repiteo@outlook.com>2024-10-14 14:09:55 -0500
commite15000eb4580f4171827a2103ec8d16f5ba5d30f (patch)
tree661003f04c1400fdf5be0837e0b794b23087fa67
parenta7b4e67c79f4aef923c946f5f16b7970060d6b58 (diff)
parent8c93e8667c49d6ad6237c67d27cdacbb009a8781 (diff)
downloadredot-engine-e15000eb4580f4171827a2103ec8d16f5ba5d30f.tar.gz
Merge pull request #97833 from AtlaStar/Fix-issue-97832
Allow seconds snapping to use minimum intervals of 0.0001 once more
-rw-r--r--editor/animation_track_editor.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index f8d35f2112..25e3925653 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -63,7 +63,7 @@
constexpr double FPS_DECIMAL = 1.0;
constexpr double SECOND_DECIMAL = 0.0001;
-constexpr double FACTOR = 0.0625;
+constexpr double FPS_STEP_FRACTION = 0.0625;
void AnimationTrackKeyEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_obj"), &AnimationTrackKeyEdit::_update_obj);
@@ -5028,6 +5028,8 @@ void AnimationTrackEditor::_snap_mode_changed(int p_mode) {
key_edit->set_use_fps(use_fps);
}
marker_edit->set_use_fps(use_fps);
+ // To ensure that the conversion results are consistent between serialization and load, the value is snapped with 0.0625 to be a rational number when FPS mode is used.
+ step->set_step(use_fps ? FPS_STEP_FRACTION : SECOND_DECIMAL);
_update_step_spinbox();
}
@@ -5155,12 +5157,12 @@ void AnimationTrackEditor::_update_step(double p_new_step) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Change Animation Step"));
- // To ensure that the conversion results are consistent between serialization and load, the value is snapped with 0.0625 to be a rational number.
- // step_value must also be less than or equal to 1000 to ensure that no error accumulates due to interactions with retrieving values from inner range.
- double step_value = MIN(1000.0, Math::snapped(p_new_step, FACTOR));
+ double step_value = p_new_step;
if (timeline->is_using_fps()) {
if (step_value != 0.0) {
- step_value = 1.0 / step_value;
+ // step_value must also be less than or equal to 1000 to ensure that no error accumulates due to interactions with retrieving values from inner range.
+ step_value = 1.0 / MIN(1000.0, p_new_step);
+ ;
}
timeline->queue_redraw();
}