Missing animations after import glTF file from Blender.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By congbinh75

So I’m working on a 3D project.
After exporting a gun model with glTF 2.0 format, I try to import it to Godot. Everything is good until I check the animations list and find out that there are some missing animations. Other animations work fine.
Thanks in advance.

:bust_in_silhouette: Reply From: thirite

glTF exporting is sort of messy business right now, which is somewhat unfortunate because it’s the only format that actually seems to fully work. There’s a number of things I’ve done to ensure it works properly:

  1. If you’re not using it already, install Blender 2.81. I don’t believe the glTF exporter works properly with older versions.
  2. Delete the glTF addon folder from blender’s install directory (eg. "C:\Program Files\Blender Foundation\blender-2.81\2.81\scripts\addons\io_scene_gltf2") and replace it with the current version from github. (you can just take out the “io_scene_gltf2” folder under addons and ignore the other files)
  3. Ensure your rig has no ‘floating bones’ without a parent, except for the root bone. It seems the ChildOf constraint is unsupported and using it will cause export to fail. Drivers driven by Custom Properties also do not seem to be supported and will cause export failure, so try to accommodate that.
  4. Create a ‘null’ animation with all of the actor’s bones in the default state (you can easily achieve this by enabling ‘Auto Keying’ and pressing Ctrl+G, Ctrl+R, Ctrl+S in succession. Select this as the current action for the armature each time before you export.
  5. Ensure your model’s mesh(es) are parented to their armature.
  6. Ensure all the animations you want to export are in seperate NLA tracks. Because the glTF exporter exports animations individually (rather than as one long sequence, which is then divided into strips by the game engine like FBX), it doesn’t matter if they overlap.
  7. Select your meshes and armature objects and export as .glTF with the following export options:
    Remember export settings: Yes
    Selected Objects: Yes
    Transform +Y-Up: Yes
    =Use current frame: No
    =Animation: Yes
    ==Limit to playback range: No
    ==Always sample animations: Yes
    ==NLA strips: Yes
    ==Export deformation bones only: Yes

In Godot, I highly recommend setting the Animation Storage option to “Files (.anim)”. This way, you can export single animations from blender at a time, as needed, without having to export the entire animation library every time you adjust or add an animation- which will speed up your export and import time considerably.

Wow, really thank you! I didn’t follow every step but when I checked NLA tracks as you said in step 6 and found that isn’t every animations has its own NLA track. I seperated them by “Stash” button in Action Editor and then imported the model to Godot. Finally all of its show up and work fine. Thank you again.

congbinh75 | 2019-11-15 14:33

:bust_in_silhouette: Reply From: christinoleo

I solved this issue by using blender’s NLA (nonlinear animation editor).
Reference from where I understood it better: https://www.youtube.com/watch?v=mfdufhaiKtI

Basically what you need is to create a new window with NLA (Nonlinear animation) panel, on your action editor, click one of your animations so that you can see it in action, and then back in the NLA panel, click on the button to the right of the animation’s name (the button is the “push down action”) and rename the action you pushed down to your animation name. Now when you export the gltf or glb, under animation make sure the “group by NLA track” is selected and godot should import all your animations correctly, or at least this is what worked to me, especially when the first frame of the animation did not match the resting pose of the model.

I noticed that the other answer said something about NLA but I didn’t understand it well, so in case anyone gets confused as I did, remember to try this out!

This did the trick for me, thanks! All of my animations were attached to my object instead of the armature in the NLA panel, and using “push down” on each animation brought it to the armature (I left all boxes in the armature unchecked) and got the export from Blender/import to Godot working as expected.

spotlessapple | 2021-07-08 14:27