godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
87.2k stars 19.6k forks source link

AnimationTree seek nodes don't reset after preview in editor #39734

Open RobTheFiveNine opened 4 years ago

RobTheFiveNine commented 4 years ago

Godot version: 3.2.1.stable.official

OS/device including version: Ubuntu 18.04

Issue description: When adding a seek node to an AnimationNodeBlend in an AnimationTree, the value of the position parameter resets to -1 after the initial seek (as it is supposed to), but when previewing this in the editor by toggling the Active property of the AnimationTree, the value does not reset; meaning any seek values that were setup need to be reconfigured every time the animation is previewed in the editor.

Steps to reproduce:

After doing this, the seek parameter in the editor will remain at -1 as per the screenshot below (meaning you would need to make note of the value of all seek nodes before previewing so they can be reconfigured):

image

TokageItLab commented 3 years ago

Does that mean you always want to keep the animation frame at 0.5? The current SeekNode is a feature that forces the source animation to move to a target frame during one frame (and it ignores other SeekNode, TimeScaleNode), so it is not a bug.

Perhaps what is needed is a node with the ability to always keep a target frame with the Active: bool option, using the current SeekNode, you can reproduce the wanted behavior by continuing to set the same frame in the script. However, in any case, this is a bad matching with the #41728 method of calculating the root motion. If the position of the frame back after the seek, it will be always recognized for time rewinding because the root motion cannot know whether it was rewound by the loop or not: this means that you will not be able to loop the root animation during the animation seeking

The ideal implementation would be to rename the current SeekNode to SeekOneShotNode and implement a new SeekNode with two options, Active: bool and Looped: Int.