mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 13:12:42 +00:00
Merge pull request #93860 from CookieBadger/animation-bezier-undo-on-different-animation-fix
Fix inconsistent behavior of Bezier editor undo operations upon selection of different animation
This commit is contained in:
commit
4e38ce294d
@ -1096,7 +1096,8 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
for (int i = 0; i < animation->track_get_key_count(track); ++i) {
|
for (int i = 0; i < animation->track_get_key_count(track); ++i) {
|
||||||
undo_redo->add_undo_method(
|
undo_redo->add_undo_method(
|
||||||
this,
|
this,
|
||||||
"_bezier_track_insert_key",
|
"_bezier_track_insert_key_at_anim",
|
||||||
|
animation,
|
||||||
track,
|
track,
|
||||||
animation->track_get_key_time(track, i),
|
animation->track_get_key_time(track, i),
|
||||||
animation->bezier_track_get_key_value(track, i),
|
animation->bezier_track_get_key_value(track, i),
|
||||||
@ -1370,7 +1371,8 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
key[0] = h;
|
key[0] = h;
|
||||||
undo_redo->add_do_method(
|
undo_redo->add_do_method(
|
||||||
this,
|
this,
|
||||||
"_bezier_track_insert_key",
|
"_bezier_track_insert_key_at_anim",
|
||||||
|
animation,
|
||||||
E->get().first,
|
E->get().first,
|
||||||
newpos,
|
newpos,
|
||||||
key[0],
|
key[0],
|
||||||
@ -1391,7 +1393,8 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
Array key = animation->track_get_key_value(E->get().first, E->get().second);
|
Array key = animation->track_get_key_value(E->get().first, E->get().second);
|
||||||
undo_redo->add_undo_method(
|
undo_redo->add_undo_method(
|
||||||
this,
|
this,
|
||||||
"_bezier_track_insert_key",
|
"_bezier_track_insert_key_at_anim",
|
||||||
|
animation,
|
||||||
E->get().first,
|
E->get().first,
|
||||||
oldpos,
|
oldpos,
|
||||||
key[0],
|
key[0],
|
||||||
@ -1409,7 +1412,8 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1);
|
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1);
|
||||||
undo_redo->add_undo_method(
|
undo_redo->add_undo_method(
|
||||||
this,
|
this,
|
||||||
"_bezier_track_insert_key",
|
"_bezier_track_insert_key_at_anim",
|
||||||
|
animation,
|
||||||
amr.track,
|
amr.track,
|
||||||
amr.time,
|
amr.time,
|
||||||
key[0],
|
key[0],
|
||||||
@ -1918,10 +1922,9 @@ void AnimationBezierTrackEdit::delete_selection() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationBezierTrackEdit::_bezier_track_insert_key(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) {
|
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) {
|
||||||
ERR_FAIL_COND(animation.is_null());
|
int idx = p_anim->bezier_track_insert_key(p_track, p_time, p_value, p_in_handle, p_out_handle);
|
||||||
int idx = animation->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);
|
||||||
animation->bezier_track_set_key_handle_mode(p_track, idx, p_handle_mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationBezierTrackEdit::_bind_methods() {
|
void AnimationBezierTrackEdit::_bind_methods() {
|
||||||
@ -1930,7 +1933,7 @@ void AnimationBezierTrackEdit::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("_select_at_anim"), &AnimationBezierTrackEdit::_select_at_anim);
|
ClassDB::bind_method(D_METHOD("_select_at_anim"), &AnimationBezierTrackEdit::_select_at_anim);
|
||||||
ClassDB::bind_method(D_METHOD("_update_hidden_tracks_after"), &AnimationBezierTrackEdit::_update_hidden_tracks_after);
|
ClassDB::bind_method(D_METHOD("_update_hidden_tracks_after"), &AnimationBezierTrackEdit::_update_hidden_tracks_after);
|
||||||
ClassDB::bind_method(D_METHOD("_update_locked_tracks_after"), &AnimationBezierTrackEdit::_update_locked_tracks_after);
|
ClassDB::bind_method(D_METHOD("_update_locked_tracks_after"), &AnimationBezierTrackEdit::_update_locked_tracks_after);
|
||||||
ClassDB::bind_method(D_METHOD("_bezier_track_insert_key"), &AnimationBezierTrackEdit::_bezier_track_insert_key);
|
ClassDB::bind_method(D_METHOD("_bezier_track_insert_key_at_anim"), &AnimationBezierTrackEdit::_bezier_track_insert_key_at_anim);
|
||||||
|
|
||||||
ADD_SIGNAL(MethodInfo("select_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single"), PropertyInfo(Variant::INT, "track")));
|
ADD_SIGNAL(MethodInfo("select_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single"), PropertyInfo(Variant::INT, "track")));
|
||||||
ADD_SIGNAL(MethodInfo("deselect_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::INT, "track")));
|
ADD_SIGNAL(MethodInfo("deselect_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::INT, "track")));
|
||||||
|
@ -221,7 +221,7 @@ public:
|
|||||||
void paste_keys(real_t p_ofs, bool p_ofs_valid);
|
void paste_keys(real_t p_ofs, bool p_ofs_valid);
|
||||||
void delete_selection();
|
void delete_selection();
|
||||||
|
|
||||||
void _bezier_track_insert_key(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);
|
void _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);
|
||||||
|
|
||||||
AnimationBezierTrackEdit();
|
AnimationBezierTrackEdit();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user