summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-08-26 22:44:52 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-08-26 22:44:52 +0200
commita5e157dd3719b55dc0776b992a67a1ea8083febd (patch)
treeec47cbdab821bd135c8efdad9c5d52c75d4a6437
parent2c14f3ef95322589650ea94bd25cf931331f1a3f (diff)
parent0f7c4d8375e5066500ad9a44402adbb197d1c1a2 (diff)
downloadredot-engine-a5e157dd3719b55dc0776b992a67a1ea8083febd.tar.gz
Merge pull request #91854 from ImpishOaths/PullReady
Don't lose in/out handles when bezier keyframe inserted on top of existing keyframe
-rw-r--r--editor/animation_track_editor.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 5706853b2a..f4403780c2 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -4500,7 +4500,14 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
} break;
case Animation::TYPE_BEZIER: {
- value = animation->make_default_bezier_key(p_id.value);
+ int existing = animation->track_find_key(p_id.track_idx, time, Animation::FIND_MODE_APPROX);
+ if (existing != -1) {
+ Array arr = animation->track_get_key_value(p_id.track_idx, existing);
+ arr[0] = p_id.value;
+ value = arr;
+ } else {
+ value = animation->make_default_bezier_key(p_id.value);
+ }
bezier_edit_icon->set_disabled(false);
} break;
default: {