summaryrefslogtreecommitdiff
path: root/editor/animation_track_editor.cpp
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-05-09 09:54:15 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-08-14 22:04:45 +0200
commit4a4d977bea7692395da0f66363709e89cae6e126 (patch)
tree6cf8927dd97fb90049b84381c3ccf7bada88e3b1 /editor/animation_track_editor.cpp
parent9f5c61315c76d5bb11d6deb7a81e4ec0e80298d5 (diff)
Improve the animation bezier editor
- Allow snapping bezier handles to the timeline. - Allow precise snapping when holding Shift for keyframes and handles. - Previously, it was only allowed for seeking the timeline. - This change also impacts the animation track editor, not just the bezier editor. - Invert the Ctrl + mouse wheel behavior to match the zoom direction in the animation track editor. - Increase the line spacing between the "Time:" and "Value:" texts to improve readability. - Tweak box selection styling to match the animation track editor. - Adjust line widths for hiDPI displays.
Diffstat (limited to 'editor/animation_track_editor.cpp')
-rw-r--r--editor/animation_track_editor.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 964c37906f..ff2818f027 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -5642,6 +5642,11 @@ float AnimationTrackEditor::snap_time(float p_value, bool p_relative) {
snap_increment = step->get_value();
}
+ if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+ // Use more precise snapping when holding Shift.
+ snap_increment *= 0.25;
+ }
+
if (p_relative) {
double rel = Math::fmod(timeline->get_value(), snap_increment);
p_value = Math::snapped(p_value + rel, snap_increment) - rel;