Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new Animation Library changes existing Library from Foreign to Built-In #74766

Open
Yogoda opened this issue Mar 11, 2023 · 4 comments · May be fixed by #84168
Open

Adding a new Animation Library changes existing Library from Foreign to Built-In #74766

Yogoda opened this issue Mar 11, 2023 · 4 comments · May be fixed by #84168

Comments

@Yogoda
Copy link

Yogoda commented Mar 11, 2023

Godot version

4.0.stable

System information

Windows 10

Issue description

Issue:

When adding a new animation library, the existing animation library imported from the .glb file is automatically changed from foreign to built-in upon saving, without any prompt or understandable reason. I believe this is a bug.

This results in losing the link between the .glb and the .tscn, now if animations are changed in the .glb they won't be updated in the .tscn.

Expected behaviour:

When adding a new animation library, the existing animation library imported from the .glb file does not change its type (if not possible, at least the animation(s) should not change its type).

image

image

Steps to reproduce

Using the project attached, do the following:

  • Click on the AnimationPlayer of model.tscn, this displays the animation "Action" from the imported model.
  • Click on the button "Animation"
  • Click on "Manage Animations", and notice that the existing animation library is set as "foreign" (imported from model.glb)
  • Click on "Add Library", set a name and click ok.
  • Close the dialog, save the file, and reopen the animation libraries.
  • Notice that now the "Global" animation library is set as "[built-in]". (The animation has been integrated into the model.tscn file and the link to the glb is lost).

Minimal reproduction project

AnimationLibraryBug.zip

@SaracenOne
Copy link
Member

Okay, so I've been looking into this. Basically, it's primarily caused by a major limitation Godot has when it come to referencing external resources: although most of the functionality is technically there, Godot does not currently have a means of serializing an external resource which references a resource inside another resource. When you import a scene in Godot, the default behaviour is that if it has any animations, it is imported with an AnimationLibrary. This AnimationLibrary becomes a subresource of the imported scene meaning it can't be directly edited which is what is considered a 'foreign' resource.

The main problem is despite Godot technically being able to reference these foreign resources, there is no capability for it to serialize these references. Since the AnimationMixer's 'libraries' parameter is a dictionary, any changes to this which deviate from the default will result in any foreign libraries being converted into local ones, breaking the reference. As far as I can tell, the only real proper way to fix this is to introduce the capacity for external resources to reference foreign resources so that any changes to the libraries parameter will still point to the original resource.

@Nodragem
Copy link
Contributor

just to say that I stumbled on the same issue today.
Maybe a warning message should be added while the feature is being worked on?

@jkulawik
Copy link

jkulawik commented Jul 29, 2024

Still present in 4.2.2

Meanwhile, any workarounds? Should we just dump imported animations to files and manually create a library for them? Or make the animations as libraries and import them separately?

@jkulawik
Copy link

jkulawik commented Jul 29, 2024

I will also add that in my case, trying to reimport and save the scene causes the editor to crash. Trying to remove all animation libraries beforehand doesn't help. I can live with importing animations manually, but the inability to reimport the scene itself is a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants