Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Grouped AnimationNodeStateMachine throws warnings and errors but seems to work fine otherwise #88878

Open
mrcdk opened this issue Feb 26, 2024 · 2 comments

Comments

@mrcdk
Copy link
Contributor

mrcdk commented Feb 26, 2024

Tested versions

Reproducible in: v4.2.1.stable.arch_linux, v4.3.dev3.official [36e943b]

System information

Godot v4.3.dev3 - Manjaro Linux #1 SMP PREEMPT_DYNAMIC Sat Feb 10 09:40:02 UTC 2024 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU () - AMD Ryzen 9 5900HX with Radeon Graphics (16 Threads)

Issue description

When traveling into a node in an AnimationNodeStateMachine which type is Grouped using the root state machine's AnimationNodeStateMachinePlayback a couple of warnings and errors will appear in the Debugger tab.

Root state machine:

image

Inner state machine attack (set as Grouped):

image

Steps to reproduce

  • Create an AnimationTree
  • Add an AnimationNodeStateMachine as root
  • Add an AnimationNodeStateMachine as a node to the other state machine and set its type to Grouped
  • In the inner state machine, create a couple Animation nodes and connect the Start node to each one. Connect each Animation node to the End node.

In a script, using the AnimationNodeStateMachinePlayback of the root state machine, try traveling to a node in the inner state machine. In the Debugger the following warnings and errors will appear:

W 0:00:02:0772   _set_current: There are two or more transitions from the Start of Grouped AnimationNodeStateMachine in AnimationNodeStateMachine: parameters/attack, which may result in unintended transitions.
  <C++ Source>   scene/animation/animation_node_state_machine.cpp:226 @ _set_current()
W 0:00:02:0772   _set_current: There are two or more transitions to the End of Grouped AnimationNodeStateMachine in AnimationNodeStateMachine: parameters/attack, which may result in unintended transitions.
  <C++ Source>   scene/animation/animation_node_state_machine.cpp:229 @ _set_current()
E 0:00:02:0772   _set_current: There is a mismatch in the number of start transitions in and out of the Grouped AnimationNodeStateMachine on AnimationNodeStateMachine: parameters/attack.
  <C++ Source>   scene/animation/animation_node_state_machine.cpp:232 @ _set_current()
E 0:00:02:0772   _set_current: There is a mismatch in the number of end transitions in and out of the Grouped AnimationNodeStateMachine on AnimationNodeStateMachine: parameters/attack.
  <C++ Source>   scene/animation/animation_node_state_machine.cpp:235 @ _set_current()

But it seems to work fine otherwise.

Minimal reproduction project (MRP)

test_grouped_state_machine.zip

It's just a tscn file. Press ui_accept to toggle from idle to attack/cut or attack/slash and back.

@TokageItLab
Copy link
Member

TokageItLab commented Feb 27, 2024

This is the intended behavior: the Transitions to Start and End in a GroupedStateMachine refer to the Transitions of the parent, so correctness for the behavior is not guaranteed if their numbers do not match. To solve this problem correctly, an implementation such as indexes to tie between ports and transitions together is required. See also #75759 description.

If the parent has only one Transition and the GroupedStateMachine has more Transitions than the parent, some consistency is guaranteed, but that would be the only exception.

If the parent has no Transitions and the GroupedStateMachine has Transitions, it will be broken because there is nothing to reference. Also, if the parent has more Transitions than GroupedStateMachine, the user cannot decide neither know which Transition will be referenced.

@mrcdk
Copy link
Contributor Author

mrcdk commented Feb 27, 2024

Uhm, I see. I think I get what you mean. So the transitions that go to and from a GroupedStateMachine need extra information like to which node to go when starting and which transition to use when ending, right? Makes sense. Right now, in my example, if I were to do travel("attack") it wouldn't know to which node in the grouped state machine to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Work in progress
Development

No branches or pull requests

3 participants