Why does adding an AnimationTree to an inherited 3D scene bloat the tscn file?

Godot Version

4.2.1.stable

Question

I have noticed that whenever I import a file with an animated 3D model I can create an inherited scene from which all the animations can be played via the AnimationPlayer node, and the tscn file is reasonably small - typically between around 500 bytes and 2.5 kB depending on the model.

However, if I then add an AnimationTree, set its Tree Root to a new AnimationNodeStateMachine, and then assign the inherited AnimationPlayer to the Anim Player property, when I save the scene the tscn file size will become huge because all of the animation data gets duplicated within the scene file.

For example, I followed these short tutorial videos from the YouTube channel KidsCanCode: Part 1 - Importing 3D Models & Part 2 - Character Animation, and after assigning the AnimationPlayer to the AnimationTree the tscn file grows from 2.5 kB to 4.1 MB. That about 1,600 times bigger, and the scene file becomes larger than the source glb file.

I have observed the same issue when importing any animated models, in various projects, and when using different 3D file formats.

Am I doing something wrong or is this a bug in the engine?

Thanks in advance for any help.

Seems to be fixed in 4.2.2:

1 Like

In the meantime, it might be wise to store the animations separately in the imported scene:

image

(this won’t prevent the AnimationLibrary from being duplicated, but at least it’ll be very small in comparison)

Thank you. I just downloaded the latest 4.2.2 release candidate and this has fixed the issue :grinning:

1 Like