godotengine / godot-proposals

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

AnimationPlayer should sort tracks #3426

Open fire opened 2 years ago

fire commented 2 years ago

Describe the project you are working on

Game that has skeletal animation.

Describe the problem or limitation you are having in your project

The order of the animation tracks is sorted by type but isn't sorted logically.

One order would be by alphabet another would be by bone hierarchy.

It's not logical where the tracks are when keyframing manually in a "stop motion" workflow.

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

The ui can have an option to sort by:

  1. Hierarchy of bones
  2. Alphabetic node path order sorted. Like by path and by property

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

In the editor ui:

Sort the tracks by method a) hierarchy or b) hierarchy of bones

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

UIUX is about making do what is expected and reducing steps / errors.

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

Editing the core AnimationPlayer.

hsandt commented 5 months ago

I was about to ask to allow the user to manually arrange track orders, but this sounds even faster. I think Unity sorts by node hierarchy order and it's pretty convenient when looking at the tree to find what track corresponds to what.

Current workaround is to either delete track (losing existing keys) and re-add it, or modify serialized text animation resource...

It'd be nice to know if some developers have been relying on fixed track order for them own custom organization, that doesn't match alphabet nor node order. Because if so, we should add an option to enable auto-sorting in the Animation window so existing projects don't lose their handmade ordering (in this case, we should add a feature to do manual ordering as I wanted to suggest initially). The option of auto-sort would either be permanent (modify resource, data loss) or a temporary view (it just reorders track in the editor to show them to user).

Even if auto-sort is always enabled, if we have multiple sorting modes, I'd recommend temporary view since it will avoid shuffling the tracks and modifying VCS diff each time some user decides to sort things differently.

The view approach also doesn't need update when nodes are moved around (but we could also decide to keep updating animation track order to match node order as use it as "canonical order" then use view for other modes like the alphabetical sorting).

DoodleGarbage commented 3 weeks ago

For anyone who ends up here in the future: It is possible to reorder tracks in the animation player at present (I am using Godot 4). Next to the snap option at the bottom of the animation tracks, click the list to make reordering possible.

Just figured this out myself and searching for the solution only returns an old issue that says it isn't possible.

mihe commented 1 week ago

Next to the snap option at the bottom of the animation tracks, click the list to make reordering possible.

I'm assuming you're referring to the node grouping? This really only groups the tracks by their respective nodes, but still leaves the property tracks for those nodes sorted in the order in which the tracks were added. It's definitely better than the plain list mode, but still cumbersome if you have multiple animations that all deal with the same property tracks, but where the tracks have been added in different orders.

Maybe adding a button like this could suffice?

SortTracksAlphabetically

... which would enable (non-destructive) alphabetical sorting based on the entire property path (i.e. what's shown in the "plain list" view).

(The icon is editor/icons/Sort.svg)

I'm not sure how well that goes with the bone hierarchy suggestion mentioned above though.