Import .babylon with animation

Is it possible to export a loaded Gltf model with animation from the sandbox as .babylon?

Hey @Leandro_Gonzalez_Cue

Yup absolutely.

Here’s how you do it:

Open the Inspector:
image

Then go to the tools tab:
image

Then hit the export to babylon button:
image

Hope this helps!

3 Likes

Because I load this model

on the sandbox and then export it to .babylon, but when I show it, appears without animation

Maybe @Drigax can chime in :slight_smile:

Btw when loading the Babylon.js file, do you see animation groups in the inspector?

I don’t think we ever expected this usecase of .glTF->.babylon export, my current guess is that we use linked transform node to drive skeletal animation from imported glTFs, but we don’t serialize that information to .babylon so the animation data is exported, but the bones are disconnected from their drivers on round-trip. hopefully this kinda explains what I mean:

1 Like

let’s capture it as an issue that we may want to fix in the future (Or ask our great community for help ;))

I think we’re already tracking something similar via:

Its on the list for 4.2, so I don’t mind looking into it, I think I’m getting close here :slight_smile:

1 Like

Thankfully we already have deserialization logic to handle linkedtransform nodes, we just forget to export that data at serialization, but I also noticed that our meshes are missing their skeletons after reimporting:


vs

I’ll see if serializing our skeleton id, and linking it to our loaded mesh after we create our skeletons fixes this

1 Like

Fix is up via Fix for .babylon exported gltf meshes having improper deformation by Drigax · Pull Request #8802 · BabylonJS/Babylon.js · GitHub

There were a few other fields we needed to serialize like Skeleton.overrideMesh, Bone.linkedTransformNode, and we had to make sure we were preserved the bone ids as well so we properly ignore some of the bones in the hierarchy.

1 Like