Skip to content

Commit

Permalink
Fix infinity loop state can't break
Browse files Browse the repository at this point in the history
  • Loading branch information
TokageItLab committed Jul 7, 2023
1 parent b7c2fd2 commit 79656d1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scene/animation/animation_node_state_machine.cpp
Expand Up @@ -901,18 +901,19 @@ bool AnimationNodeStateMachinePlayback::_transition_to_next_recursive(AnimationT
bool is_state_changed = false;

NextInfo next;
StringName transition_start = current;
Vector<StringName> transition_path;
transition_path.push_back(current);
while (true) {
next = _find_next(p_tree, p_state_machine);
if (next.node == transition_start) {
is_state_changed = false;
if (transition_path.has(next.node)) {
break; // Maybe infinity loop, do noting more.
}

if (!_can_transition_to_next(p_tree, p_state_machine, next, p_test_only)) {
break; // Finish transition.
}

transition_path.push_back(next.node);
is_state_changed = true;

// Setting for fading.
Expand Down

0 comments on commit 79656d1

Please sign in to comment.