Skip to content

Commit

Permalink
Merge pull request #97169 from Dowsley/fix/undo-redo-bezier-anim-editor
Browse files Browse the repository at this point in the history
Fix Undo/Redo not working in Bezier Animation Editor when moving keys
  • Loading branch information
akien-mga committed Sep 19, 2024
2 parents a05e06f + 5aa8f8d commit ff334cd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions editor/animation_bezier_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,11 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &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)) {
Expand Down Expand Up @@ -1967,15 +1972,6 @@ void AnimationBezierTrackEdit::delete_selection() {
void AnimationBezierTrackEdit::_bezier_track_insert_key_at_anim(const Ref<Animation> &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() {
Expand Down

0 comments on commit ff334cd

Please sign in to comment.