godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Add AUX mode to the `AnimationPlayer` to make the `AnimationPlaybackTrack` be blendable like the `AudioTrack` #8783

Open TokageItLab opened 8 months ago

TokageItLab commented 8 months ago

Describe the project you are working on

Godot Animation features stabilization

Describe the problem or limitation you are having in your project

AnimationPlaybackTrack cannot be blended.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

AnimationPlaybackTrack functions like a simple StateMachine, but it only calls the AnimationPlayer's play() and seek() methods and cannot blend. This causes a limitation as mentioned in https://github.com/godotengine/godot/issues/70338.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

For a long time, this problem was unsolvable, as indicated by the comment in https://github.com/godotengine/godot/issues/70338#issuecomment-1360414948. However, AnimationPlayer now inherits AnimationMixer as its base class, which allows for blending equivalent to AnimationTree. So, correct blending should be possible by implementing the ability to manage multiple animations simultaneously in them.

In the case of AudioTrack, the host AnimationTree generates an AudioStreamPolyphony, which is then played back by the AudioStreamPlayer.

In the case of AnimationPlaybackTrack, the host AnimationTree generates a list of AnimationInstances in a similar fashion, and the assigned AnimationPlayer plays them back.

The concern is that the user may manipulate the assigned AnimationPlayer and unintentionally break their playback state. To prevent this, an AUX mode is needed to be implemented to disable some methods while the AnimationPlayer's animation is being played externally.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Never

Is there a reason why this should be core and not an add-on in the asset library?

Animation blending is a core feature

ScribblesandFlapjacks commented 6 months ago

This feature is sorely needed for 3d to 2d animation workflows especially given that the GPU particle rework was in the same version that AnimationPlaybackTrack could no longer be scrubbed through.