From 5aa8f8dfeec657afb967a6f9c5fe8a8dbd0d1fbe Mon Sep 17 00:00:00 2001 From: Dowsley Date: Wed, 18 Sep 2024 20:45:08 -0300 Subject: [PATCH] Fix Undo/Redo not working in Bezier Animation Editor when moving keys --- editor/animation_bezier_editor.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 66ebd07c2a3..2e8c727849e 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -1443,6 +1443,11 @@ void AnimationBezierTrackEdit::gui_input(const Ref &p_event) { i++; } + AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton(); + if (ape) { + undo_redo->add_do_method(ape, "_animation_update_key_frame"); + undo_redo->add_undo_method(ape, "_animation_update_key_frame"); + } undo_redo->commit_action(); } else if (select_single_attempt != IntPair(-1, -1)) { @@ -1967,15 +1972,6 @@ void AnimationBezierTrackEdit::delete_selection() { void AnimationBezierTrackEdit::_bezier_track_insert_key_at_anim(const Ref &p_anim, int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle, const Animation::HandleMode p_handle_mode) { int idx = p_anim->bezier_track_insert_key(p_track, p_time, p_value, p_in_handle, p_out_handle); p_anim->bezier_track_set_key_handle_mode(p_track, idx, p_handle_mode); - - EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); - undo_redo->create_action(TTR("Animation Bezier Curve Change Call")); - AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton(); - if (ape) { - undo_redo->add_do_method(ape, "_animation_update_key_frame"); - undo_redo->add_undo_method(ape, "_animation_update_key_frame"); - } - undo_redo->commit_action(); } void AnimationBezierTrackEdit::_bind_methods() {