Blender -> JME for Animated Models

Hello,

I am having some difficulties getting animated models to work with JME. When I export the model as a .glb with no animations it is able to load without issues, but if I export it with animation (has frame sampling at rate 1) it gives an error “WARNING: JME only supports linear interpolation for animations”. I think I did make sure the animations are linear and tried different models without change in behavior. I selected all the points in the animation timeline with “A” and pressed “T” and set to linear, and now appears to be linear in bender so Im not sure why it is still giving that error. Maybe this is more of a blender mistake on my end? I used a model from the internet for said file, so I don’t believe there is any problems with the model itself. I cannot attach the .blend file so I will attach a screenshot of my animation timeline:


Let me know what information you need.

I have loaded a few hundred animated models into JME from a Blender produced gltf file without issue.

…so it is definitely something to do with your model. The most complicated thing I’ve ever had to do is push the animations to the NLA and/or apply transforms.

It’s unfortunate that JME does not provide more information about where the non-linear interpolation is. Perhaps there is an errant animation attached to something not in the view you are looking.

1 Like

These are the steps I take to create animations manually and import to JME. I hope it helps.

Dope Sheet > Action Editor > New

Name the animation.

Pose the character

Pose Panel: Press T

Insert > LocRot

Slide to new key frame in the timeline.

Clear Pose: A to select all > Pose > Clear Transform > All

Second Animation:

Stash

Dope Sheet > Action Editor > New

Edit (Old) Animation:

Dope Sheet > Action Editor > Select Stashed Animation from Drop Down.

In NLA Editor > Select the strip on the left, not the segment on the right, Press Delete.

Stash Edited Animation.

Export:

Action Editor > Dropdown > Select the Action

Select Mesh > Press Shift > Select Armature > Export

Nowadays I skip the Export part. I learned that JME can import .blend files well, so I don’t re-invent the wheel.

You may watch this if you need more visual explanation:

Your end goal should be to make each animation separate on the NLA Editor by Stashing them. Do not leave them in the Action editor or you are going to end up with the same error message.

1 Like

For me, if I don’t push them to the NLA then I just don’t see them in my loaded model.

I’ve never gotten the error mentioned.

1 Like

I had gotten the error mentioned by @_Conure before started following the steps I provided. :slightly_smiling_face:

1 Like

In my case, if I didn’t push anything to the NLA then one seemingly random animation would show up but none of the others.

Makes me wonder if the random animation that was showing up for you guys has non-linear stuff in it… then when you push things to NLA, only those animations end up in the final product.

Still weird and it would be nice if JME could give more information in the exception. That would also help narrow down if JME is throwing the wrong exception.

One thing, if you export the model as gltf you might be able find the interpolations in the file itself since it’s just JSON. Maybe something can be spotted that provides a clue.

1 Like

I also encountered this “WARNING”.

I remember that the gltf (2.0) model exported using blender2.x did not have this problem, but this problem occurred when I upgraded blender to 3.6.

But this doesn’t seem to affect my model animation. It’s just that this “WARNING” will appear when loading the gltf model.

I have tried adjusting the animation interpolation, and also tried setting “Default Interpolation” to linear in Blender, but unfortunately it didn’t work.

1 Like

I was able to finally fix it! I found interpolation data in the JSON and saw that it was mostly set as “STEP” in between 3 instances of linear, and replacing it all to linear seems to have fixed the problem. It seems like the points in the sheet were linear but the interpolating frames were all “STEP” which caused issues. I got a nullptr when i tried to use spatial.getcontrol(Animcontrol.class) but fixed it by getting the child node from the spatial and calling for animcontrol on that, with the animation playing now. Thank you so much @FoxCC @pspeed and @Pixelapp for all your help!

2 Likes

This same issue (or something similar) happens to me with models I download from other people when I try to open them in blender and then export them as gltf.

There seems to be a weird bug where exporting in Blender ignores every animation on a newly imported model unless that animation has been selected at least once in blender, and in many cases I wouldn’t preview the animations in blender so it would only export the first animation that was selected by default. So to export them all I realized I just have to select each individual animation and play them at least once in blender before exporting and saving. And then it successfully exports all the animations without having to use the NLA track. So there definitely seems to be some bug there in blender.