summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-11-12 12:13:03 -0600
committerThaddeus Crews <repiteo@outlook.com>2024-11-12 12:13:03 -0600
commit75dc6e19cdfcc1d32b40cefbd1b36360fcafe493 (patch)
treeac3b25916f111cb18fce1a9e1fdecd21895e2037
parentebf49317a2557e078c2087c8d133fcfb7a9c7828 (diff)
parentd9a1e65d5058678dbbd499194fef46c128f59b64 (diff)
downloadredot-engine-75dc6e19cdfcc1d32b40cefbd1b36360fcafe493.tar.gz
Merge pull request #98826 from UnfavorableEnhancer/animation-editor-snap-fix
Fix animation editor snapping value not lowering as intended when holding shift
-rw-r--r--editor/animation_track_editor.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 076ba6d905..55ea7c0082 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -7383,16 +7383,17 @@ void AnimationTrackEditor::_update_snap_unit() {
float AnimationTrackEditor::snap_time(float p_value, bool p_relative) {
if (is_snap_keys_enabled()) {
+ double current_snap = snap_unit;
if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
// Use more precise snapping when holding Shift.
- snap_unit *= 0.25;
+ current_snap *= 0.25;
}
if (p_relative) {
- double rel = Math::fmod(timeline->get_value(), snap_unit);
- p_value = Math::snapped(p_value + rel, snap_unit) - rel;
+ double rel = Math::fmod(timeline->get_value(), current_snap);
+ p_value = Math::snapped(p_value + rel, current_snap) - rel;
} else {
- p_value = Math::snapped(p_value, snap_unit);
+ p_value = Math::snapped(p_value, current_snap);
}
}