Loading 3DS max image - jME Crashing - Help please [Resolved]

I was doing the tutorials and changed around what I was supposed to (or did) to load .max files. I had made a pyramid and really want to load it! Can someone help me? Thanks


import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.jme.app.AbstractGame;
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingSphere;
import com.jme.scene.Node;
import com.jme.util.export.binary.BinaryImporter;
import com.jmex.model.converters.FormatConverter;
import com.jmex.model.converters.MaxToJme;

/**
 * Started Date: Jul 22, 2004<br><br>
 *
 * Demonstrates loading formats.
 *
 * @author Jack Lindamood
 */
public class HelloModelLoading extends SimpleGame {
    private static final Logger logger = Logger
            .getLogger(HelloModelLoading.class.getName());
   
    public static void main(String[] args) {
        HelloModelLoading app = new HelloModelLoading();
        app.setDialogBehaviour(AbstractGame.ALWAYS_SHOW_PROPS_DIALOG);
        // Turn the logger off so we can see the XML later on
        app.start();
    }

    protected void simpleInitGame() {
        // Point to a URL of my model
        URL model=HelloModelLoading.class.getClassLoader().getResource("C/pyramid.max");

        // Create something to convert .max format to .jme
        FormatConverter converter=new MaxToJme();
        // Point the converter to where it will find the .mtl file from
        converter.setProperty("mtllib",model);

        // This byte array will hold my .jme file
        ByteArrayOutputStream BO=new ByteArrayOutputStream();
        try {
            // Use the format converter to convert .obj to .jme
            converter.convert(model.openStream(), BO);
            Node pyramid=(Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
            // shrink this baby down some
            pyramid.setLocalScale(.1f);
            pyramid.setModelBound(new BoundingSphere());
            pyramid.updateModelBound();
            // Put her on the scene graph
            rootNode.attachChild(pyramid);
        } catch (IOException e) {   // Just in case anything happens
            logger.logp(Level.SEVERE, this.getClass().toString(),
                    "simpleInitGame()", "Exception", e);
            System.exit(0);
        }
    }
}



Console:

Nov 25, 2007 6:16:11 AM com.jme.app.BaseGame start
INFO: Application started.
Nov 25, 2007 6:16:11 AM com.jme.system.PropertiesIO <init>
INFO: PropertiesIO created
Nov 25, 2007 6:16:11 AM com.jme.system.PropertiesIO load
INFO: Read properties
Nov 25, 2007 6:16:13 AM com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
Nov 25, 2007 6:16:13 AM com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created.
Nov 25, 2007 6:16:13 AM com.jme.system.lwjgl.LWJGLDisplaySystem getValidDisplayMode
INFO: Selected DisplayMode: 800 x 600 x 32 @60Hz
Nov 25, 2007 6:16:13 AM com.jme.system.PropertiesIO save
INFO: Saved properties
Nov 25, 2007 6:16:13 AM com.jme.app.BaseSimpleGame initSystem
INFO: jME version 1.0
Nov 25, 2007 6:16:14 AM com.jme.renderer.lwjgl.LWJGLRenderer <init>
INFO: LWJGLRenderer created. W:  800H: 600
Nov 25, 2007 6:16:14 AM com.jme.app.BaseSimpleGame initSystem
INFO: Running on: ati2dvag
Driver version: 6.14.10.6727
ATI Technologies Inc. - Radeon X1300/X1550 Series x86/SSE2 - 2.0.6956 WinXP Release
Nov 25, 2007 6:16:14 AM com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
Nov 25, 2007 6:16:14 AM com.jme.util.lwjgl.LWJGLTimer <init>
INFO: Timer resolution: 1000 ticks per second
Nov 25, 2007 6:16:14 AM com.jme.scene.Node <init>
INFO: Node created.
Nov 25, 2007 6:16:14 AM com.jme.scene.Node <init>
INFO: Node created.
Nov 25, 2007 6:16:14 AM com.jme.scene.Node attachChild
INFO: Child (FPS label) attached to this node (FPS node)
Nov 25, 2007 6:16:14 AM class HelloModelLoading start()
SEVERE: Exception in game loop
java.lang.NullPointerException
   at HelloModelLoading.simpleInitGame(HelloModelLoading.java:47)
   at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:503)
   at com.jme.app.BaseGame.start(BaseGame.java:69)
   at HelloModelLoading.main(HelloModelLoading.java:31)
Nov 25, 2007 6:16:14 AM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Nov 25, 2007 6:16:14 AM com.jme.app.BaseGame start
INFO: Application ending.

I had thought the problem was that I didn't export it… But apparently not…

see jmetest.renderer.loader.TestMaxJmeWrite - the misnamed MaxToJme class is actually for loading 3ds files.



@developers: Maybe this naming confusion should be cleared up by

  1. renaming MaxToJme to ThreeDSToJme
  2. renaming TestMaxJmeWrite to TestThreeDSToJme
  3. creating a deprecated subclass MaxToJme extends ThreeDSToJme for legacy?

Resolved