I've loaded models before in jME, but I have since deleted the code and am trying to do it again. I am following HelloModelLoading.java in the TutorialGuide packaged with the source code, but I'm getting a very strange error.
Here is my code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package maploader;
import com.jme.app.SimpleGame;
import com.jme.scene.Node;
import com.jme.util.export.binary.BinaryImporter;
import com.jmex.model.converters.MilkToJme;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Student
*/
public class TestClass extends SimpleGame
{
public static void main(String args[])
{
TestClass app = new TestClass();
app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
@Override
protected void simpleInitGame()
{
try {
Node model;
URL fileName = TestClass.class.getClassLoader().getResource("meshes/tree1.ms3d");
MilkToJme converter = new MilkToJme();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
converter.convert(fileName.openStream(), baos);
model = (Node) BinaryImporter.getInstance().load(new ByteArrayInputStream(baos.toByteArray()));
} catch (IOException ex) {
Logger.getLogger(TestClass.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
And here is the error:
init:
deps-jar:
Compiling 1 source file to C:Documents and SettingsStudent.SCIDESK01-PCDesktopRTSProofOfConceptbuildclasses
compile-single:
run-single:
Feb 12, 2009 9:48:16 AM com.jme.app.BaseGame start
INFO: Application started.
Feb 12, 2009 9:48:16 AM com.jme.system.PropertiesIO <init>
INFO: PropertiesIO created
Feb 12, 2009 9:48:16 AM com.jme.system.PropertiesIO load
INFO: Read properties
Feb 12, 2009 9:48:19 AM com.jme.system.PropertiesIO save
INFO: Saved properties
Feb 12, 2009 9:48:19 AM com.jme.app.BaseSimpleGame initSystem
INFO: jME version 1.0
Feb 12, 2009 9:48:19 AM com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
Feb 12, 2009 9:48:19 AM com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created.
Feb 12, 2009 9:48:19 AM com.jme.renderer.lwjgl.LWJGLRenderer <init>
INFO: LWJGLRenderer created. W: 1024H: 768
Feb 12, 2009 9:48:19 AM com.jme.app.BaseSimpleGame initSystem
INFO: Running on: ati2dvag
Driver version: 6.14.10.6444
ATI Technologies Inc. - RADEON X300 x86/SSE2 - 1.5.4334 WinXP Release
Feb 12, 2009 9:48:19 AM com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
Feb 12, 2009 9:48:19 AM com.jme.util.lwjgl.LWJGLTimer <init>
INFO: Timer resolution: 1000 ticks per second
Feb 12, 2009 9:48:19 AM com.jme.scene.Node <init>
INFO: Node created.
Feb 12, 2009 9:48:20 AM com.jme.scene.Node <init>
INFO: Node created.
Feb 12, 2009 9:48:20 AM com.jme.scene.Node attachChild
INFO: Child (FPS label) attached to this node (FPS node)
Feb 12, 2009 9:48:20 AM com.jme.scene.Node <init>
INFO: Node created.
Feb 12, 2009 9:48:20 AM com.jme.scene.Node attachChild
INFO: Child (tree1.tga) attached to this node (ms3d file)
Feb 12, 2009 9:48:20 AM com.jme.util.resource.ResourceLocatorTool locateResource
WARNING: Unable to locate: tree1.tga
Feb 12, 2009 9:48:20 AM com.jme.scene.Node <init>
INFO: Node created.
Feb 12, 2009 9:48:20 AM class maploader.TestClass start()
SEVERE: Exception in game loop
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:546)
at java.util.ArrayList.get(ArrayList.java:321)
at com.jmex.model.animation.JointController.processController(Unknown Source)
at com.jmex.model.animation.JointController.read(Unknown Source)
at com.jme.util.export.binary.BinaryImporter.readObject(Unknown Source)
at com.jme.util.export.binary.BinaryInputCapsule.resolveIDs(Unknown Source)
at com.jme.util.export.binary.BinaryInputCapsule.readSavableArray(Unknown Source)
at com.jme.util.export.binary.BinaryInputCapsule.readSavableArrayList(Unknown Source)
at com.jme.scene.Spatial.read(Unknown Source)
at com.jme.scene.Node.read(Unknown Source)
at com.jme.util.export.binary.BinaryImporter.readObject(Unknown Source)
at com.jme.util.export.binary.BinaryImporter.load(Unknown Source)
at com.jme.util.export.binary.BinaryImporter.load(Unknown Source)
at maploader.TestClass.simpleInitGame(TestClass.java:46)
at com.jme.app.BaseSimpleGame.initGame(Unknown Source)
at com.jme.app.BaseGame.start(Unknown Source)
at maploader.TestClass.main(TestClass.java:30)
Feb 12, 2009 9:48:20 AM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Feb 12, 2009 9:48:20 AM com.jme.app.BaseGame start
INFO: Application ending.
BUILD SUCCESSFUL (total time: 6 seconds)
The model I'm trying to load is from the Loopix Project.