Animation breaks when I change hierarchy. How can I resolve it?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Robster
:warning: Old Version Published before Godot 3 was released.

Godot 2.1.4 Stable Official Linux

Hi all,

I have a scene, let’s say it looks like this:

Node2D
- animation player
- sprite

I make an animation, it looks great. I’m a happy guy.

I then change it to:

Node2D
- Container
- - animation player
- - sprite

So now the animation player and the sprite sit under the Container.
The animation is broken and doesn’t play, nor does the game build.

I have a look at the animation player and funnily enough the path HAS updated. So it’s showing in the keyframe channel Container/sprite but when I scrub the time slide nothing happens and there is a line through the path to the node it’s animating.

What can I do to make it work again without having to re-do the animation? I have about 20 scenes that I had to change the hierarchy of and it’s broken a lot of detailed animation.

Any help greatly appreciated.

:bust_in_silhouette: Reply From: mollusca

Try simply removing the Container/ part of the animation track path.

Thank you good person! Saved me HOURS of work. Much appreciated.

Robster | 2017-11-25 23:21

What does that mean?

jeancallisti | 2023-01-18 15:31

:bust_in_silhouette: Reply From: eons

Looks like you have found an interesting bug:

AnimationPlayer tries to fix the paths on the animations when you move the nodes, but sibling nodes do not need that, so the path that is in this case:

sprite:something

gets changed to:

container/sprite:something

Which is wrong, the other path keeps working.

Also depends on the order you move the nodes, if you move the AnimationPlayer first, the path is correct, but if you move it last, no.

TL;DR: AnimationPlayer does not fix the path correctly when moved as a sibling of an animated node.

ps: ayou can edit manually the paths on the tracks, just remove the added container.

Indeed it’s a bug. Removed as /u/mollusca suggested and gone. Should I report this (seeing as it’s not a 3.x build)?

Robster | 2017-11-25 23:21

May affect 3 too but, in any case, 2 is still getting fixes so you can report it.

eons | 2017-11-26 14:40

Ran into this in 3.2.2, so its definitely still a problem.

Cyzaine | 2020-08-29 17:12