Importing animated shape keys from Blender

Godot Version

4.7.2

Question

I have several different animations, saved as actions in Blender, and while all of them import, and their skeletal animations import, the associated keyframes for the shape keys only load for one of the animations. Weirder still which animation gets keyframes for its shape keys seems to depend on which animation I last edited/previewed in Blender before saving the file. But all of the animations have them, and all of them preview fine in Blender.

I’ve been saving and reimporting and fiddling with import settings, and googling fruitlessly, for two hours now without being able to find any leads on to what I might be doing wrong. Anyone have any ideas?

If it helps, here’s a link to the .blend file:

I downloaded the file and opened it in Blender, then exported it as ‘Glb’, as I do with all my animated creatures. Dragged into a Godot Project, it was immediately recognised, with all animations working correctly; I saved it as a Scene.
Is there a difference in our methods..? Maybe. I removed the unwanted Modifier in Blender, as I couldn’t simply ‘apply’ it, and exported simply ‘Selected’ ‘Visible’, and Animations checked, that’s all.
Does this help you at all..?

Thanks for taking a look.

Are you sure you’re not seeing just the skeletal animations? Those all import correctly.

I typically just load the .blend file directly but I tried exporting as .glb with the settings you described but encountered the same problem. Though all the actions/animations have shape key animations, the only one that correctly loaded in Godot was the last one I had open in Blender when exporting.

As you can see, shape key keyframes on the bottom there on my “Spawn” animation

But not here on my “Attack” animation, despite that both animations have shape key keyframes in Blender.

Hi!

As for why the Shapekey Animations appear only in the Spawn Animation:

In Blender in the Action Editor you can see the difference on your Animations:

As you can see, the slots for GooBody and Eye are unassigned in the “Attack” Animation (and the other Animations). This is the reason why the Shapekey Animations are not are not exported.

The Eye-Slot in “Spawn” is assigned in the Eye Mesh:

The Problem is, you can set only one Shapekey Animation…

What can you do:

You could make an blend file for each Animation, link you Armature and create your Animation there. So you can assign the Shapekey Animation to the correct Armature Animation.
But this solution is only preferable if you have many Animations, so lets not overcomplicate this.

In your case it’s better we use the second solution: Driver
With this you can can control the values of the Shapekey with bones.

Create in your Armature new bones for each Shapekey (disable Deform for this bones), place and size them how you prefer. Turn on Show Name in the Armature.

In the Pose Mode, add the Bone Constrain “Limit Location” and use the settings from the pic.
The most important settings are “Owner”, this should be “Local Space” and "Affect Transform. For the rest set them as you like.

Now setup the Driver.
Select your Mesh, right-click on your Shapekey Value(!) and select “Add Driver…”
“Add Driver” will not show up if there’s an Animation active (background of the value is yellow or green)! The background of the value should now be violett.

Again right-click in your Shapekey Value, select “Open Driver Editor”, set the Expression, assign your bone and set Space to Local Space. This must be done for each Shapekey.
For Expression: multiply the var based on your “Limit Location” Constraint. My “Maximum X” was 0.5, so i use “var * 2”. The result for this multiplication must be 1.

Now you can control and animate the Shapekey Values with the bones in your Armature and they will also be exported:

You can download the blend file which i prepared from here:

That was it, thank you very much!

I had read that adding drivers was wise for shape keys but I’d thought it was just for organizational reasons, not because Blender’s Actions lost their link to the shape-key’s owners every time I swapped to a new one

I’m kinda interested in how your “Goo” looks in game if it isn’t to much to ask :wink:
In blender it looks really good!

Oh, thanks. Unfortunately it doesn’t look great in game hah. The muscles/nerves aren’t loading their texture and have some sort of weird issues with transparencies/sorting. Neither of which have I even begun to investigate or attempt to fix. My current priority is just learning asset importing and developing an acceptable workflow for it as well as figuring out Godot’s animation systems. This was just a quick model I threw together that would be easier to animate and test with than a whole rigged human character.

Figuring out Godot’s rendering pipeline and writing shaders is like 3rd or 4th on my current todo list so it’ll be quite some time before I find out if I can make it look good in game

Just an unauthorised view of this Goo in a Test Project of mine. My Textures, and a very short video…