Avoid emitting signals if the animation is not ready to be processed

(cherry picked from commit ef5d0b1c06)
This commit is contained in:
Chia-Hsiang Cheng 2023-08-07 18:21:28 +08:00 committed by Yuri Sizov
parent 2e39550306
commit 3e9751aca4
1 changed files with 1 additions and 1 deletions

View File

@ -150,7 +150,7 @@ double AnimationNodeAnimation::_process(double p_time, bool p_seek, bool p_is_ex
// Emit start & finish signal. Internally, the detections are the same for backward. // Emit start & finish signal. Internally, the detections are the same for backward.
// We should use call_deferred since the track keys are still being processed. // We should use call_deferred since the track keys are still being processed.
if (state->tree) { if (state->tree && !p_test_only) {
// AnimationTree uses seek to 0 "internally" to process the first key of the animation, which is used as the start detection. // AnimationTree uses seek to 0 "internally" to process the first key of the animation, which is used as the start detection.
if (p_seek && !p_is_external_seeking && cur_time == 0) { if (p_seek && !p_is_external_seeking && cur_time == 0) {
state->tree->call_deferred(SNAME("emit_signal"), "animation_started", animation); state->tree->call_deferred(SNAME("emit_signal"), "animation_started", animation);