godotengine / godot-proposals

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

Add animation inheritance #9802

Open theraot opened 3 months ago

theraot commented 3 months ago

Describe the project you are working on

A 3D third person game with souls inspired melee combat.

Describe the problem or limitation you are having in your project

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

I want to make an animation that extends another animation. That is, I want to make an animation defined to include all the tracks of another animation but can also have additional tracks.

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

The Animation class would need a way to refernece a parent Animation and the animation player will include its tracks during playback. The tracks of the included animation should also be included in the animation panel, but be readonly.

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

We can have an animation player reference another animation player.

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

Since we have a workaround this feature is not needed in core per-se. In fact, I have completed games in Godot where I have used said work around multiple times with no big issue.

Yet, it is a recurrent need, and it would be good to have support in core for ease of use.

Futhermore, it would make easier the setup for https://github.com/godotengine/godot-proposals/discussions/9712 - See also: https://github.com/godotengine/godot-proposals/issues/9801

Summersay415 commented 3 months ago

godotengine/godot#86779 is not what are you looking for?

theraot commented 3 months ago

Perhaps https://github.com/godotengine/godot/pull/86779 will cover this, as it says it should. I would have to test it, and it if works then it closes this proposal too... Meanwhile, I think animations are an special case, which needs custom tooling due to the animation panel, and I think a proposal for animation inheritance in particular makes sense according to https://docs.godotengine.org/en/stable/contributing/development/best_practices_for_engine_contributors.html#to-each-problem-its-own-solution

theraot commented 3 months ago

I have now taken the time to test https://github.com/godotengine/godot/pull/86779

First of all, there is no longer a way to add just an animation to the Animation player... Thus, although the linked PR allows me to make an Animation that inherits from another, I can't use it.

Thus, I have to make an AnimationLibrary that inherits from another. The problem is that when I modify the animations in the inherited AnimationLibrary, I'm modifying the original.

I can add new Animations to the derived AnimationLibrary which do not appear in the original, but that is not useful for me.

Thus, https://github.com/godotengine/godot/pull/86779 is not sufficient. I do not think it is necessary either, but if that PR will be merged into Godot, it might make sense to implement my proposal ontop of it.

Addendum: I want to clarify that I believe the linked PR is not necesary for this proposal, because I believe this proposal can be implemented independently. However, it makes no sense to do that if that PR is merged, and that PR addresses other issues which are important on their own.