godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

`AnimationPlayer` don't have a way to make the animations unique #10761

Open PixelTim opened 1 month ago

PixelTim commented 1 month ago

Describe the project you are working on

A project that needs many AnimationPlayer nodes with similar animations (but still different)

Describe the problem or limitation you are having in your project

There's no way to quickly make animations unique

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

There are a few ideas:

  1. When you press "Make unique" on a AnimationLibrary it will also make animations unique
  2. Add options "Make animation unique" and "Make all animations unique" in animation dropdown menu(that is on image): AnimationDropdown

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

"Make unique" button will make only current animation unique, "Make all unique" button will make all animations unique: AnimationDropdownAddition

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

This can be done with these lines of code:

for anim_lib_nm in get_animation_library_list():
    for anim_nm in get_animation_library(anim_lib_nm).get_animation_list():
        var animation := get_animation_library(anim_lib_nm).get_animation(anim_nm).duplicate()
        get_animation_library(anim_lib_nm).remove_animation(anim_nm)
        get_animation_library(anim_lib_nm).add_animation(anim_nm, animation)

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

Because making animations unique by 1 click should improve the usability of the editor, and, as far as I know, there's no way to make such plugin (I never worked with editor plugins, correct me if I'm wrong)

dalexeev commented 1 month ago

There are "Make Sub-Resources Unique" button and AnimationMixer.libraries property.

PixelTim commented 1 month ago

There are "Make Sub-Resources Unique" button and AnimationMixer.libraries property.

Thanks, I never used that menu before. Maybe this should be added to the docs? Also this method has one downside: you can't leave any animations non-unique if you'll press "Make Sub-Resources Unique" button

Calinou commented 1 month ago

I still think there's value to this proposal, specifically about adding new options to the Animation menu. Maybe this should be reopened?

Note that both Make unique and Make all unique would need to make the AnimationLibrary unique as soon as you make a single animation unique, as otherwise, the unique animation would be in a shared AnimationLibrary.

PixelTim commented 1 month ago

Reopened the issue