[SOLVED] AssetLoadException: Blender 2.63 –> Ogre –> JME3

I know it’s a common problem, but I’ve dug around for a couple hours and none of the advice I can find is helping. Here are the details of my setup:



-Using Blender 2.63

-Export plugin is io_export_ogreDotScene version 0.5.7, acquired here.

-I’m trying to import using the JME3 SDK ‘Import Model’ feature.



Details on the asset to be imported:



-Mesh is UV mapped with a single material and texture.

-Mesh and armature have the same origin, which is at the center/bottom of the model.

-The parent of the mesh is the armature.

-The armature’s root bone is not at the origin. It is several units above it on the Z axis. Explanation below.

-Aside from the above, I went down the checklist in this thread and made sure everything was compliant.



The problem: The usual cryptic “AssetLoadException” when trying to import the .mesh file. No problems are reported by the exporter.



Things I have tried that don’t have any effect:



-Triangulating the mesh.

-Unchecking “Separate materials” in the exporter.

-Playing with the “swap axis” choices in the exporter.

-Applying all modifiers.





The explanation about the root bone: I’m trying to make a simple game where the player articulates the legs of a character through a Kinect controller. I didn’t place a root bone at the mesh/armature origin because I was concerned that doing this would corrupt the way that the mesh deforms when being moves around by the controller. If this is the likely cause of the error, how do I designate a new root bone?



Thanks!

Are you using jME3 nightly, stable, or beta? Can you try using 0.5.8 export script instead of 0.5.7? I’ve exported countless OgreXML models from Blender 2.63 and exporter 0.5.8, all of them worked.

I’m using JME3 Beta.



I grabbed the 0.5.8 export script from here. The export script still succeeds without reporting any problems, but I’m still getting an AssetLoadException, and the error message says that the trouble is with WalkChar.mesh.xml (WalkChar is the mesh attached to my armature).



Tried with and without triangulating, but that doesn’t seem to change anything.



I also tried adding a new root bone to the armature, whose base was at the origin. I did this by creating a new bone, naming it “root” (the old root bone was named “pelvis”), and then parenting pelvis to root. In the hierarchy shown on the left side menu, “Root” is now at the top, followed by the armature for the rest of the skeleton, which is the parent of the mesh. Instead of being two levels deep, it is now three. Anyway, that didn’t work either.



Should I be using the JME nightly or stable?

jME3 beta is not compatible with the blender2ogre script you’re using. You need to update your jMP to latest stable version. Nightly does have some fixes but they are mostly in the dotScene importing, if you’re not using dotScene then just update to stable.

I’m a little confused. When you say “update to the latest stable version”, do you mean JME2, available here? I could not find any version of JME3 labeled stable. Does JME2 include the SDK? Is Nightly the version available over SVN?



Back when I used JME2, I imported it as a stock eclipse project. If I’m changing to JME2, then does my workflow change back to Eclipse? If not, how do I tell the JME SDK to build using JME2?



Thanks.

JME3 Beta has both Nightly and Stable releases. Nightly are just that, Stable is updated when the Nightly is in a stable position (i.e. changes tested, bugs fixed etc)…

Sorry for asking what might be obvious, but I’m having a hard time finding it. Are JME3 stable and nightly offered only over SVN?

I think I found it. I didn’t realize that the JME is updated through the SDK itself.



The SDK told me there were updates available. I installed them. This did not fix the problem.



If I fire up the JME and go to Tools->Plugins, I get a window that shows my installed plugins. Looking at my installed plugins, I can see that lots of them are from the stable SDK, and a few are from the beta. Here are a few from the list that look relevant:



IDE Platform: beta

Java: beta

OgreXML Tools: beta

SDK core: stable

SDK Engine: Stable

JME3 external libraries: Stable

OgreXMl support: stable

SDK libraries: stable

Blender support: beta

JME3 library: stable



Update: After restarting the JME and trying again, it still fails, but this time with better output! At first it was just complaining that it couldn’t find “WalkChar.material” (my material was named “Green” for some reason). I renamed the material file, and the new failure complains like this:



Unsupported pass directive: alpha_to_coverage

Unsupported pass directive: colour_write

Unsupported pass directive: depth_check

Unsupported pass directive: depth_func

Unsupported pass directive: depth_write

Unsupported pass directive: illumination_stage

Unsupported pass directive: light_clip_planes

Unsupported pass directive: light_scissor

Unsupported pass directive: normalise_normals

Unsupported pass directive: polygon_mode

Unsupported pass directive: scene_blend_op

Unsupported pass directive: shading

Unsupported pass directive: transparent_sorting

Unsupported texture_unit directive: scale

Unsupported texture_unit directive: colour_op

Also: Found the exception stack trace. This is what I get after I tried the whole import process again after renaming my material in Blender (i.e. not just renaming the file):





org.xml.sax.SAXException: Expected a decimal

at com.jme3.util.xml.SAXUtil.parseFloat(SAXUtil.java:92)

at com.jme3.scene.plugins.ogre.MeshLoader.pushTexCoord(MeshLoader.java:479)

at com.jme3.scene.plugins.ogre.MeshLoader.startElement(MeshLoader.java:611)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)

at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)

at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)

at com.jme3.scene.plugins.ogre.MeshLoader.load(MeshLoader.java:872)

Caused: java.io.IOException: Error while parsing Ogre3D mesh.xml

at com.jme3.scene.plugins.ogre.MeshLoader.load(MeshLoader.java:881)

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

Caused: com.jme3.asset.AssetLoadException: An exception has occured while loading asset: WalkChar.mesh.xml

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

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

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

at com.jme3.gde.ogretools.OgreBinaryMeshDataObject.loadAsset(OgreBinaryMeshDataObject.java:56)

at com.jme3.gde.ogretools.OgreBinaryMeshDataObject.loadAsset(OgreBinaryMeshDataObject.java:24)

at com.jme3.gde.core.assets.AssetData.loadAsset(AssetData.java:84)

[catch] at com.jme3.gde.modelimporter.ModelImporterVisualPanel1.loadModel(ModelImporterVisualPanel1.java:95)

at com.jme3.gde.modelimporter.ModelImporterVisualPanel1.loadModel(ModelImporterVisualPanel1.java:74)

at com.jme3.gde.modelimporter.ModelImporterVisualPanel1$8.run(ModelImporterVisualPanel1.java:305)

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

@eubarch: Can you provide the mesh.xml file with the exception? The “unsupported directives” can be ignored in most cases.

Sure. Here’s a Dropbox link that you should be able to access:



https://dl.dropbox.com/u/106825941/WalkChar.mesh.xml



Thanks for the help.

The exporter produced a corrupted file.



Can you try removing any extra UV layers (if you have any)?

I don’t think I have multiple UV layers. Here is my setup in Blender:



http://i.imgur.com/xFBKt.png

The UV layers are shown in the mesh properties

Sorry. It took some digging to figure out how to display how many UV layers I have in blender. Regardless, I only ever made one UV map and loaded only a single image. This should show that I have a single UV layer in my blender file:





http://i.imgur.com/CBvWh.png





Also, interestingly, somewhere along the way the JME IDE gained the ability to load my .blend file, but I only get a blackness in the preview. When I try to view the imported model in the IDE (I think my double clicking on it), I can see a light source and the three-arrow origin marker, but nothing else.

Blender 2.63 changed the internal format of blend files. The jme3 blender importer has been updated to cope but you need a very recent version - you may need to go to nightlies for direct import to work.

Nightly loads the Blender model!



Thanks Zarch and Momoko_Fan.

…I spoke too soon. The imported models from Blender look like they don’t have skeletons. Here is a snippet from my code:



[java]



Spatial walkChar = assetManager.loadModel(“Models/WalkCharDecimate/WalkCharDecimate.j3o”);



CollisionShape walkCharCollisionShape = CollisionShapeFactory.createDynamicMeshShape(walkChar);

walkChar_phy = new RigidBodyControl(walkCharCollisionShape, 5f);

walkChar_phy.setFriction(1.0f);

walkChar_phy.setRestitution(0.0f);

walkChar.addControl(walkChar_phy);

bulletAppState.getPhysicsSpace().add(walkChar_phy);







SkeletonControl skeletonControl = walkChar.getControl(SkeletonControl.class);

AnimControl anim = walkChar.getControl(AnimControl.class);

[/java]



…Both skeletonControl and anim are null after these lines execute. Does the Blender import not support skeletons yet? If so, I guess it’s back to trying to get the Ogre exporter to work.



Thanks again.

Solved again. Here’s what’s going on: The skeleton is indeed imported through the Blender model, but the relevant controls and objects are buried in the child hierachy. Here is my solution:



[java]

Node walkChar = (Node)assetManager.loadModel(“Models/WalkCharDecimateBone/WalkCharDecimateBone.j3o”);



wcMesh = ((Geometry)((Node)((Node)walkChar.getChild(“Armature”)).getChild(“Cylinder”)).getChild(“WalkChar1”)).getMesh();



SkeletonControl skeletonControl = ((Node)walkChar.getChild(“Armature”)).getChild(“Cylinder”).getControl(SkeletonControl.class);



[/java]



To get the sequence of child names, I had to stop the program in debug mode, and dig through the object hierarchy. Is this really the only way to get controls / meshes from an imported model? It seems tedious.

Open the model in scene composer and there is a tree style graphical display that lets you browse all the objects within it.