36
36
#include " editor/editor_undo_redo_manager.h"
37
37
#include " editor/gui/editor_spin_slider.h"
38
38
#include " editor/themes/editor_scale.h"
39
+ #include " plugins/animation_player_editor_plugin.h"
39
40
#include " scene/gui/view_panner.h"
40
41
#include " scene/resources/text_line.h"
41
42
@@ -869,6 +870,11 @@ void AnimationBezierTrackEdit::_change_selected_keys_handle_mode(Animation::Hand
869
870
undo_redo->add_undo_method (animation.ptr (), " bezier_track_set_key_out_handle" , track_key_pair.first , track_key_pair.second , animation->bezier_track_get_key_out_handle (track_key_pair.first , track_key_pair.second ));
870
871
undo_redo->add_do_method (editor, " _bezier_track_set_key_handle_mode" , animation.ptr (), track_key_pair.first , track_key_pair.second , p_mode, p_auto ? Animation::HANDLE_SET_MODE_AUTO : Animation::HANDLE_SET_MODE_RESET);
871
872
}
873
+ AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton ();
874
+ if (ape) {
875
+ undo_redo->add_do_method (ape, " _animation_update_key_frame" );
876
+ undo_redo->add_undo_method (ape, " _animation_update_key_frame" );
877
+ }
872
878
undo_redo->commit_action ();
873
879
}
874
880
@@ -1560,6 +1566,11 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
1560
1566
undo_redo->add_do_method (animation.ptr (), " bezier_track_set_key_out_handle" , moving_handle_track, moving_handle_key, moving_handle_right, ratio);
1561
1567
undo_redo->add_undo_method (animation.ptr (), " bezier_track_set_key_out_handle" , moving_handle_track, moving_handle_key, animation->bezier_track_get_key_out_handle (moving_handle_track, moving_handle_key), ratio);
1562
1568
}
1569
+ AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton ();
1570
+ if (ape) {
1571
+ undo_redo->add_do_method (ape, " _animation_update_key_frame" );
1572
+ undo_redo->add_undo_method (ape, " _animation_update_key_frame" );
1573
+ }
1563
1574
undo_redo->commit_action ();
1564
1575
moving_handle = 0 ;
1565
1576
queue_redraw ();
@@ -1673,6 +1684,11 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) {
1673
1684
undo_redo->add_do_method (animation.ptr (), " track_insert_key" , selected_track, time , new_point);
1674
1685
undo_redo->add_undo_method (this , " _clear_selection_for_anim" , animation);
1675
1686
undo_redo->add_undo_method (animation.ptr (), " track_remove_key_at_time" , selected_track, time );
1687
+ AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton ();
1688
+ if (ape) {
1689
+ undo_redo->add_do_method (ape, " _animation_update_key_frame" );
1690
+ undo_redo->add_undo_method (ape, " _animation_update_key_frame" );
1691
+ }
1676
1692
undo_redo->commit_action ();
1677
1693
queue_redraw ();
1678
1694
}
@@ -1773,6 +1789,11 @@ void AnimationBezierTrackEdit::duplicate_selected_keys(real_t p_ofs, bool p_ofs_
1773
1789
i++;
1774
1790
}
1775
1791
1792
+ AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton ();
1793
+ if (ape) {
1794
+ undo_redo->add_do_method (ape, " _animation_update_key_frame" );
1795
+ undo_redo->add_undo_method (ape, " _animation_update_key_frame" );
1796
+ }
1776
1797
undo_redo->add_do_method (this , " queue_redraw" );
1777
1798
undo_redo->add_undo_method (this , " queue_redraw" );
1778
1799
undo_redo->commit_action ();
@@ -1822,6 +1843,15 @@ void AnimationBezierTrackEdit::copy_selected_keys(bool p_cut) {
1822
1843
undo_redo->add_undo_method (this , " _select_at_anim" , animation, E->key ().track , E->value ().pos , i == 0 );
1823
1844
i++;
1824
1845
}
1846
+
1847
+ AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton ();
1848
+ if (ape) {
1849
+ undo_redo->add_do_method (ape, " _animation_update_key_frame" );
1850
+ undo_redo->add_undo_method (ape, " _animation_update_key_frame" );
1851
+ }
1852
+ undo_redo->add_do_method (this , " queue_redraw" );
1853
+ undo_redo->add_undo_method (this , " queue_redraw" );
1854
+
1825
1855
undo_redo->commit_action ();
1826
1856
}
1827
1857
}
@@ -1900,9 +1930,15 @@ void AnimationBezierTrackEdit::paste_keys(real_t p_ofs, bool p_ofs_valid) {
1900
1930
i++;
1901
1931
}
1902
1932
1903
- undo_redo->commit_action ();
1933
+ AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton ();
1934
+ if (ape) {
1935
+ undo_redo->add_do_method (ape, " _animation_update_key_frame" );
1936
+ undo_redo->add_undo_method (ape, " _animation_update_key_frame" );
1937
+ }
1938
+ undo_redo->add_do_method (this , " queue_redraw" );
1939
+ undo_redo->add_undo_method (this , " queue_redraw" );
1904
1940
1905
- queue_redraw ();
1941
+ undo_redo-> commit_action ();
1906
1942
}
1907
1943
}
1908
1944
@@ -1917,6 +1953,11 @@ void AnimationBezierTrackEdit::delete_selection() {
1917
1953
}
1918
1954
undo_redo->add_do_method (this , " _clear_selection_for_anim" , animation);
1919
1955
undo_redo->add_undo_method (this , " _clear_selection_for_anim" , animation);
1956
+ AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton ();
1957
+ if (ape) {
1958
+ undo_redo->add_do_method (ape, " _animation_update_key_frame" );
1959
+ undo_redo->add_undo_method (ape, " _animation_update_key_frame" );
1960
+ }
1920
1961
undo_redo->commit_action ();
1921
1962
1922
1963
// selection.clear();
@@ -1926,6 +1967,14 @@ void AnimationBezierTrackEdit::delete_selection() {
1926
1967
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) {
1927
1968
int idx = p_anim->bezier_track_insert_key (p_track, p_time, p_value, p_in_handle, p_out_handle);
1928
1969
p_anim->bezier_track_set_key_handle_mode (p_track, idx, p_handle_mode);
1970
+
1971
+ EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton ();
1972
+ undo_redo->create_action (TTR (" Animation Bezier Curve Change Call" ));
1973
+ if (AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton ()) {
1974
+ undo_redo->add_do_method (ape, " _animation_update_key_frame" );
1975
+ undo_redo->add_undo_method (ape, " _animation_update_key_frame" );
1976
+ }
1977
+ undo_redo->commit_action ();
1929
1978
}
1930
1979
1931
1980
void AnimationBezierTrackEdit::_bind_methods () {
0 commit comments