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

Cannot change the key AnimationPlayer uses for an imported AnimationLibrary #65625

Closed
jtnicholl opened this issue Sep 10, 2022 · 2 comments · Fixed by #67965
Closed

Cannot change the key AnimationPlayer uses for an imported AnimationLibrary #65625

jtnicholl opened this issue Sep 10, 2022 · 2 comments · Fixed by #67965

Comments

@jtnicholl
Copy link
Contributor

Godot version

v4.0.alpha.custom_build [b523053]

System information

Linux (Fedora 36)

Issue description

If an AnimationPlayer uses an AnimationLibrary imported from a glTF, the key used for that library is by default the name of the glTF file, and the editor won't let you change it.
While it makes sense that the animations in the library can't be changed if it was imported, the key is a property of the player, not the library, so it should be editable.
I'm pretty sure it used to be possible to do so through the editor. As a workaround you can manually edit the .tscn file in a text editor, or use AnimationPlayer.rename_animation_library.

Steps to reproduce

  1. Add an imported AnimationLibrary to an AnimationPlayer
  2. The key used for the library is the name of the glTF file and cannot be changed.

Minimal reproduction project

LibraryKeys.zip

@Calinou
Copy link
Member

Calinou commented Sep 10, 2022

This is likely a regression from #63245.

cc @SaracenOne

@lyuma
Copy link
Contributor

lyuma commented Feb 9, 2023

Hi, I discussed this with @SaracenOne in a dm. As you may know, 4.0 hit RC just earlier today.

I've actually been mulling this issue over in the back of my head over the past couple months, so it's not been forgotten.

The main blocker is due to how the animation library keys/values are serialized in 4.0, attempting to rename or add an animation library to an imported AnimationPlayer node would cause all animations from all libraries to be embedded in the .tscn, which is not a good idea, so we can't easily just make the read-write at this time.

The recommended approach for 4.0 is going to be to have another copy of the model and set it to be import as "AnimationLibrary", and then assign that into your AnimationPlayer. This avoids the issue of animations being embedded in the scene, because Godot will reference the imported AnimationLibrary and will also allow you to change the key.
The downsides are: it may make you have a duplicate copy of each .glb with animations in your project, and having to restart the editor each time. The upside is: it works in 4.0 without any engine change.

I think I have an approach in mind, but it would require some slight compat breakage (but can be migrated forwards of course) so it's something we will try to get fixed in 4.1. We could then also add an import setting to change the default key as well. Still, it's worth keeping this issue open until we have a better system.

For a more technical explanation, right now an AnimationPlayer node is serialized like this:

animation_libraries = {"": ExtResource(...), "another_library": ExtResource(...)}

but what I want to propose is to serialize AnimationPlayer node as:

animation_libraries/0/name = ""
animation_libraries/0/library = ExtResource(...)
animation_libraries/1/name = "another_library"
animation_libraries/1/library = ExtResource(...)

@akien-mga akien-mga modified the milestones: 4.0, 4.1 Feb 17, 2023
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 19, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in 4.x Priority Issues Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants