From 3c779d37bfcb62472f5f99d3424451a7fc4b220e Mon Sep 17 00:00:00 2001 From: "Silc Lizard (Tokage) Renew" <61938263+TokageItLab@users.noreply.github.com> Date: Sun, 17 Mar 2024 00:45:55 +0900 Subject: [PATCH] Move the line of infinity loop checking in AnimationStateMachine (cherry picked from commit b8d555c74b13693063c7ebd8000f64fa0500cf03) --- scene/animation/animation_node_state_machine.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 0254419d228..5dde2c7adbe 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -905,15 +905,16 @@ bool AnimationNodeStateMachinePlayback::_transition_to_next_recursive(AnimationT transition_path.push_back(current); while (true) { next = _find_next(p_tree, p_state_machine); - if (transition_path.has(next.node)) { - WARN_PRINT_ONCE_ED("AnimationNodeStateMachinePlayback: " + base_path + "playback aborts the transition by detecting one or more looped transitions in the same frame to prevent to infinity loop. You may need to check the transition settings."); - break; // Maybe infinity loop, do nothing more. - } if (!_can_transition_to_next(p_tree, p_state_machine, next, p_test_only)) { break; // Finish transition. } + if (transition_path.has(next.node)) { + WARN_PRINT_ONCE_ED("AnimationNodeStateMachinePlayback: " + base_path + "playback aborts the transition by detecting one or more looped transitions in the same frame to prevent to infinity loop. You may need to check the transition settings."); + break; // Maybe infinity loop, do nothing more. + } + transition_path.push_back(next.node); is_state_changed = true;