diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-07 12:38:37 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-07 12:38:37 +0200 |
commit | 0996c8438f06dea1c8fbe451b8d4fa7799f2df84 (patch) | |
tree | 65aea009125b9b50c5dc8e158b6c68b9aa3c421f | |
parent | e05ac797ae3b0bd0ef8446ab2c3371b84fb4acab (diff) | |
parent | fae712d968631e7750b14261ce2c29df1de15739 (diff) | |
download | redot-engine-0996c8438f06dea1c8fbe451b8d4fa7799f2df84.tar.gz |
Merge pull request #93980 from TokageItLab/fix-sync-track-editor-position-with-player-editor
Fix broken sync between animation TrackEditor and PlayerEditor
-rw-r--r-- | editor/animation_track_editor.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 21 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.h | 2 |
3 files changed, 9 insertions, 17 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 6810b802a1..baf2c6502f 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3690,7 +3690,7 @@ void AnimationTrackEditor::_name_limit_changed() { } void AnimationTrackEditor::_timeline_changed(float p_new_pos, bool p_timeline_only) { - emit_signal(SNAME("timeline_changed"), p_new_pos, p_timeline_only); + emit_signal(SNAME("timeline_changed"), p_new_pos, p_timeline_only, false); } void AnimationTrackEditor::_track_remove_request(int p_track) { @@ -3787,6 +3787,7 @@ void AnimationTrackEditor::set_anim_pos(float p_pos) { } _redraw_groups(); bezier_edit->set_play_position(p_pos); + emit_signal(SNAME("timeline_changed"), p_pos, true, true); } static bool track_type_is_resettable(Animation::TrackType p_type) { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 484d2b1fff..02fa582da4 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1395,23 +1395,14 @@ void AnimationPlayerEditor::_current_animation_changed(const String &p_name) { void AnimationPlayerEditor::_animation_key_editor_anim_len_changed(float p_len) { frame->set_max(p_len); } - -void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_timeline_only) { +void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_timeline_only, bool p_update_position_only) { timeline_position = p_pos; - if (!is_visible_in_tree()) { - return; - } - - if (!player) { - return; - } - - if (player->is_playing()) { - return; - } - - if (!player->has_animation(player->get_assigned_animation())) { + if (!is_visible_in_tree() || + p_update_position_only || + !player || + player->is_playing() || + !player->has_animation(player->get_assigned_animation())) { return; } diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index e624522566..4a3b1f37ab 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -214,7 +214,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _animation_player_changed(Object *p_pl); void _animation_libraries_updated(); - void _animation_key_editor_seek(float p_pos, bool p_timeline_only = false); + void _animation_key_editor_seek(float p_pos, bool p_timeline_only = false, bool p_update_position_only = false); void _animation_key_editor_anim_len_changed(float p_len); virtual void shortcut_input(const Ref<InputEvent> &p_ev) override; |