Skip to content

Commit

Permalink
Merge pull request #89575 from TokageItLab/move-loop-check-state
Browse files Browse the repository at this point in the history
Move the line of infinity loop checking in AnimationStateMachine
  • Loading branch information
akien-mga committed Apr 4, 2024
2 parents 7fa97f3 + b8d555c commit f69fab5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scene/animation/animation_node_state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,15 +916,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;

Expand Down

0 comments on commit f69fab5

Please sign in to comment.