Skip to content

Animations get sorted after reloading scene, causing large diffs #112340

@KoBeWi

Description

@KoBeWi

Tested versions

4.5 and earlier (didn't test when it started exactly, but not a regression)

System information

W10

Issue description

When you create new animations in AnimationPlayer, they will be saved in the order they were added. Example from MRP:

[sub_resource type="Animation" id="Animation_y32ns"]
resource_name = "Animation"
step = 0.1

[sub_resource type="Animation" id="Animation_wtcfe"]
resource_name = "Cnimation"
step = 0.1

[sub_resource type="Animation" id="Animation_0e48y"]
resource_name = "Bnimation"
step = 0.1

[sub_resource type="AnimationLibrary" id="AnimationLibrary_wtcfe"]
_data = {
&"Animation": SubResource("Animation_y32ns"),
&"Bnimation": SubResource("Animation_0e48y"),
&"Cnimation": SubResource("Animation_wtcfe")
}

However, when you reload the scene and save it again, the animations get sorted:


[sub_resource type="Animation" id="Animation_y32ns"]
resource_name = "Animation"
step = 0.1

[sub_resource type="Animation" id="Animation_0e48y"]
resource_name = "Bnimation"
step = 0.1

[sub_resource type="Animation" id="Animation_wtcfe"]
resource_name = "Cnimation"
step = 0.1

[sub_resource type="AnimationLibrary" id="AnimationLibrary_wtcfe"]
_data = {
&"Animation": SubResource("Animation_y32ns"),
&"Bnimation": SubResource("Animation_0e48y"),
&"Cnimation": SubResource("Animation_wtcfe")
}

As you can see, the animation sub-resources in the scene change order to conform the alphabetical order. Animations are usually tens of lines long, so if you commit the unsorted state and then go back to your scene, you suddenly end up with hundreds of lines of useless diff.

Steps to reproduce

  1. Create AnimationPlayer and add some animations
  2. Open the tscn file and note the animation order
  3. Reload the scene and save again
  4. Check animation order again

Minimal reproduction project (MRP)

animebug.zip
Just save the scene and see how Bnimation swaps places.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions