Still having problems with this .blend model... and now doesn't work at all

I just dowloaded the beta and updated to the latest stable.



I think tried viewing and converting this model to j3o:

http://e2-productions.com/repository/modules/PDdownloads/singlefile.php?cid=1&lid=273



All of that worked fine except that it still didn’t have a skeleton control. If I use the export to ogre from blender way then it does have a skeleton.



So, seeing that there has been a bunch of blender related commits lately, I updated to the latest nightly. Now that .blend file won’t load at all.



I even tried loading it into Blender 259 and saving it again as a different file.



When I try to view it I see this in the console:

[xml]

Loading obejct: Armature.001

Armature.001: (0.0, 0.0, -0.0)–> null

Child (Armature.001) attached to this node (Models/female259.blend)

Loading obejct: Cylinder.002

Importing mesh.

Packed texture. Reading directly from the blend file!

Loading material.

Materials name: {0}

Loaded material definition: Phong Lighting

Child (Cylinder.0021) attached to this node (Cylinder.002)

Child (Cylinder.002) attached to this node (Armature.001)

Cylinder.002: (-1.1383748E-28, 2.8240078E-15, 2.1320666E-22)–> Armature.001

Loading obejct: Sphere.001

Importing mesh.

Packed texture. Reading directly from the blend file!

Loading material.

Materials name: {0}

Child (Sphere.0011) attached to this node (Sphere.001)

Child (Sphere.001) attached to this node (Cylinder.002)

Sphere.001: (0.0, 8.500364, -0.0)–> Cylinder.002

[/xml]



And get a pop-up error. The exception is:

[java]java.lang.NullPointerException

at com.jme3.animation.SkeletonControl.cloneForSpatial(SkeletonControl.java:201)

at com.jme3.scene.Spatial.clone(Spatial.java:1155)

at com.jme3.scene.Node.clone(Node.java:565)

at com.jme3.scene.Node.clone(Node.java:61)

at com.jme3.scene.Spatial.clone(Spatial.java:1142)

at com.jme3.scene.Node.clone(Node.java:565)

at com.jme3.scene.Node.clone(Node.java:61)

at com.jme3.scene.Spatial.clone(Spatial.java:1142)

at com.jme3.scene.Node.clone(Node.java:565)

at com.jme3.scene.Node.clone(Node.java:61)

at com.jme3.scene.Spatial.clone(Spatial.java:1182)

at com.jme3.asset.ModelKey.createClonedInstance(ModelKey.java:58)

at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:300)

at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:408)

[catch] at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:90)

at com.jme3.gde.core.assets.actions.OpenModel$1.run(OpenModel.java:72)

at java.lang.Thread.run(Thread.java:662)

[/java]



If I try to convert it to a j30 then I get the following output and no model or error:

[xml]Loading obejct: Armature.001

Armature.001: (0.0, 0.0, -0.0)–> null

Child (Armature.001) attached to this node (Models/female259.blend)

Loading obejct: Cylinder.002

Importing mesh.

Packed texture. Reading directly from the blend file!

Loading material.

Materials name: {0}

Loaded material definition: Phong Lighting

Child (Cylinder.0021) attached to this node (Cylinder.002)

Child (Cylinder.002) attached to this node (Armature.001)

Cylinder.002: (-1.1383748E-28, 2.8240078E-15, 2.1320666E-22)–> Armature.001

Loading obejct: Sphere.001

Importing mesh.

Packed texture. Reading directly from the blend file!

Loading material.

Materials name: {0}

Child (Sphere.0011) attached to this node (Sphere.001)

Child (Sphere.001) attached to this node (Cylinder.002)

Sphere.001: (0.0, 8.500364, -0.0)–> Cylinder.002

Loading obejct: Armature.001

Armature.001: (0.0, 0.0, -0.0)–> null

Child (Armature.001) attached to this node (Models/female259.blend)

Loading obejct: Cylinder.002

Importing mesh.

Packed texture. Reading directly from the blend file!

Loading material.

Materials name: {0}

Child (Cylinder.0021) attached to this node (Cylinder.002)

Child (Cylinder.002) attached to this node (Armature.001)

Cylinder.002: (-1.1383748E-28, 2.8240078E-15, 2.1320666E-22)–> Armature.001

Loading obejct: Sphere.001

Importing mesh.

Packed texture. Reading directly from the blend file!

Loading material.

Materials name: {0}

Child (Sphere.0011) attached to this node (Sphere.001)

Child (Sphere.001) attached to this node (Cylinder.002)

Sphere.001: (0.0, 8.500364, -0.0)–> Cylinder.002

Trying to save asset that has not been loaded before or does not support saving!

Could not locate saved file.

[/xml]



Seems like a pretty straight forward model and worked fine in the last stable update other than the missing skeleton control. So maybe there is something simple wrong.

I managed to load it. Apparently the skeleton is null if there is no animation in the blend file.

I added an animation to the model in blender 2.5 and it loads fine.



The problem is that the anim is completely wrong, but i think it’s a fix up axis problem

You were able to load it after you added an animation? Or you were even able to load it before that?



Guess I’ll just keep using the old bald model until this bug is fixed. :stuck_out_tongue: I have no idea (yet) how to add animations to a model and I don’t need them anyway. I just need the bones.

After adding the animation.



i’m looking into it, i’m not an expert with the blender loader though… :stuck_out_tongue:

Ok i fixed the model



the thing is there was some problems on the file :

1- the rotations and position of the armature were not applied

2- no animation (this should not be an issue but apparently the loader does not like it

3- the vertex → bones assignment was messy



I fixed the file and now it works nice with the blender loader.

it’s a blender 2.58 file

http://www.filefactory.com/file/c0e9688/n/female.blend



sorry for the crappy file hosting couldn’t quickly find something better .

Can you load the file twice too? Sounds like this is an issue with cloning no? That only happens on the second load afaik.

No it happens on the first load.

Even on the first load the models are cloned

I used the file that I posted the link to because it was easy but the model I use has been modified.



I think the blender loader still needs to be fixed to not crash. The latest stable JME could load the model just fine and just wouldn’t load the skeleton. So something changed between stable and nightly… but hasn’t changed enough.



Basically, I know that you can massage a model enough to eventually get it to load with the blender loader. But here was an easy example of a relatively straight forward model that fails outright. I thought it might be useful to someone trying to fix the loader.

But thanks for fixing the model. It’s nice to know what could have worked.

@pspeed said:
I used the file that I posted the link to because it was easy but the model I use has been modified.

I think the blender loader still needs to be fixed to not crash. The latest stable JME could load the model just fine and just wouldn't load the skeleton. So something changed between stable and nightly... but hasn't changed enough.

Basically, I know that you can massage a model enough to _eventually_ get it to load with the blender loader. But here was an easy example of a relatively straight forward model that fails outright. I thought it might be useful to someone trying to fix the loader.

Yeah but the "applying transforms" thing won't be worked around i'm afraid, it was also there for ogre export.
Also not applying them can have bad side effects in blender itself, so it should be a best practice.
Of course the loader should not crash, and it should be able to load model with no anim but with a skeleton.

Actually I'm pretty happy to see that you can now import a blend model with skeletal animation even if it requires to be cautious in blender.
@nehon said:
Yeah but the "applying transforms" thing won't be worked around i'm afraid, it was also there for ogre export.


I'm not even sure what it means exactly. I do know that when importing the model through the ogre export path that it "worked" but the scales were all wrong. I might have also had to rotate the model 90 degrees (as I would with the .blend as well) but I don't have the code in front of me at the moment.

Personally, I think if the .blend import is going to be the recommended way to get assets into JME then it should be as bullet proof as possible. In that light, these models are good examples of good intentions gone wrong... that at least in my playing Blender was handling this model fine. So if possible, JME should try to load them as well as it can... and yeah, definitely not crash. :) (Especially since crashing is a really new bug for this model.)
@pspeed said:
I'm not even sure what it means exactly. I do know that when importing the model through the ogre export path that it "worked" but the scales were all wrong. I might have also had to rotate the model 90 degrees (as I would with the .blend as well) but I don't have the code in front of me at the moment.

Personally, I think if the .blend import is going to be the recommended way to get assets into JME then it should be as bullet proof as possible. In that light, these models are good examples of good intentions gone wrong... that at least in my playing Blender was handling this model fine. So if possible, JME should try to load them as well as it can... and yeah, definitely not crash. :) (Especially since crashing is a really new bug for this model.)

I agree.

The "applying transform" thing is that in blender you can transform an object in edit mode (transformations to the mesh) and you can transform and object in object mode (tranformation to...its transforms :p)
The edit mode JME equivalent would be for a translation to add a vector to each vertex of the mesh and update the vertex buffer. The object mode equivalent is to use setLocalTranslation.

What happens when you have an armature is that it can visually be at the same place as your skeleton...but both can have a different combination of edit/object transforms. And usually exporters (ogre was doing the same) just uses meshes vertex buffers.
Apply transform applies the object's transforms to the mesh.

Of course...there might be a way to take the object transforms into account when loading the mesh...but it can become silly with the combinations of local transforms in JME afterwards.

I’ve made a fix to ArmatureModifier class.

It will add AnimControl to the object if it has the skeleton with or without animations.



Try to load it now I hope it will help. :slight_smile:

1 Like

Excellent. Now I just have to wait for the next nightly… kind of like a kid on Christmas eve. :slight_smile:



Thanks, @Kaelthas. I’ll post here if I still have issues.

Just a follow-up…



Yes, the model now loads successfully with its skeleton. Though it doesn’t behave the same as the one through the ogre export path. I’m not sure why that is or if it’s the plug-ins fault or not.



when I rotate the head bone with this model… it moves the head also and stretches the neck in a really strange way. I’m not sure if it’s the model’s fault or not but the ogre mesh was working. (It’s not the right way to do the head anyway, but I thought I’d mention it in case it is a real bug.)

I’m going to try @nehon’s version just in case it’s better in this respect.



Edit: it is. So I may try remaking my mods to that one.