IndexOutOfBoundsException when loading a model?

Hey Guys,



I was hoping that one of you could help me with a problem I’ve been having loading models. When trying to load a model(OGRE xml) using the AssetManager (assetManager.loadModel(…)), I get a IndexOutOfBoundsException on a particular model. I’ve tested another model using the exact same code and that model was able to be loaded and displayed without a problem, and looking at the stack trace it seems like it is some sort of more internal error. Could this be due saving the file incorrectly? We’re using blender to create the models and export them using the OGRExml converter, which of course worked with the other model. Below is the stack trace, hopefully someone can make sense of it.



java.lang.IndexOutOfBoundsException: 8380

at java.nio.HeapFloatBuffer.put(Unknown Source)

at com.jme3.scene.plugins.ogre.MeshLoader.pushBoneAssign(MeshLoader.java:552)

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

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)

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

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

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

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

at EntitiesandComponents.GraphicalComponent.setModel(GraphicalComponent.java:32)

at core.ObjectCreation.createGirl(ObjectCreation.java:20)

at core.Main.simpleInitApp(Main.java:72)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:223)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:123)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:199)

at java.lang.Thread.run(Unknown Source)



Any help would be much appreciated…

Which version of Blender and the exporter are you using?

We’re using Blender version 2.49B and I believe the most up to date version of the OGREXml exporter, there does not seem to be a version number…



Upon some further investigation after we tweaked the model a little it we were able to get it into the game but after rigging and texturing we ran into the same error again. The model was worked on a little more and now we can successfully load it into the game, however when we try to apply a subsurf modifier we get the same error… which needless to say is a bit frustrating…

Could you provide the exported OgreXML model that causes the issue?

Yeah, this is it http://www.megaupload.com/?d=JEDQU632



We also just found out that the model can be loaded without the skeleton. That is, when the model is exported without the skeleton.

Sorry it took a while … Its fixed in SVN now.

The issue is because your model is using more than 4 bones per vertex. Now jME3 will log a warning when it encounters a vertex with more than 4 weights. In some cases it could cause an animation to appear incorrect so its best to avoid it