summaryrefslogtreecommitdiffstats
path: root/editor/animation_track_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/animation_track_editor.cpp')
-rw-r--r--editor/animation_track_editor.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index faffbb631f..8268cf10ae 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -306,10 +306,14 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
setting = true;
undo_redo->create_action(TTR("Animation Change Keyframe Value"), UndoRedo::MERGE_ENDS);
- int prev = animation->bezier_track_get_key_handle_mode(track, key);
- undo_redo->add_do_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value);
- undo_redo->add_undo_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev);
+ int prev_mode = animation->bezier_track_get_key_handle_mode(track, key);
+ Vector2 prev_in_handle = animation->bezier_track_get_key_in_handle(track, key);
+ Vector2 prev_out_handle = animation->bezier_track_get_key_out_handle(track, key);
+ undo_redo->add_do_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value);
undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev_mode);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev_in_handle);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev_out_handle);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
@@ -857,8 +861,8 @@ bool AnimationMultiTrackKeyEdit::_set(const StringName &p_name, const Variant &p
undo_redo->create_action(TTR("Animation Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS);
}
Vector2 prev = animation->bezier_track_get_key_in_handle(track, key);
- undo_redo->add_do_method(this, "_bezier_track_set_key_in_handle", track, key, value);
- undo_redo->add_undo_method(this, "_bezier_track_set_key_in_handle", track, key, prev);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev);
update_obj = true;
} else if (name == "out_handle") {
const Variant &value = p_value;
@@ -878,9 +882,13 @@ bool AnimationMultiTrackKeyEdit::_set(const StringName &p_name, const Variant &p
setting = true;
undo_redo->create_action(TTR("Animation Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS);
}
- int prev = animation->bezier_track_get_key_handle_mode(track, key);
- undo_redo->add_do_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value);
- undo_redo->add_undo_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev);
+ int prev_mode = animation->bezier_track_get_key_handle_mode(track, key);
+ Vector2 prev_in_handle = animation->bezier_track_get_key_in_handle(track, key);
+ Vector2 prev_out_handle = animation->bezier_track_get_key_out_handle(track, key);
+ undo_redo->add_do_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value);
+ undo_redo->add_undo_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev_mode);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev_in_handle);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev_out_handle);
update_obj = true;
}
} break;
@@ -5175,6 +5183,7 @@ void AnimationTrackEditor::_update_key_edit() {
key_edit->animation_read_only = read_only;
key_edit->track = selection.front()->key().track;
key_edit->use_fps = timeline->is_using_fps();
+ key_edit->editor = this;
int key_id = selection.front()->key().key;
if (key_id >= animation->track_get_key_count(key_edit->track)) {
@@ -5194,6 +5203,7 @@ void AnimationTrackEditor::_update_key_edit() {
multi_key_edit = memnew(AnimationMultiTrackKeyEdit);
multi_key_edit->animation = animation;
multi_key_edit->animation_read_only = read_only;
+ multi_key_edit->editor = this;
RBMap<int, List<float>> key_ofs_map;
RBMap<int, NodePath> base_map;