Importing from Blender issue

Hi guys, I am importing models from Blender (.obj) to Jme using the following function



[java]



public void create3dModel(float trigger_time, String id, String type,

float x, float y, float z) {



/** update the enum type with the string read (type of created object) */

CreatedObject = PhysicalObjects.valueOf(type);



if (assetManager == null) {

System.out.println("WARNING: Asset Manager is null");

}



// create appropriate object type

switch (CreatedObject) // enum switch case

{

case CAR_F: // every spatial has 2 geometries where each has to have <<< 2 geom object

// one material making the drive one node with 2

// geometries



System.out.println("Creating F Car: " + type

  • " now creating createDrive event: ");

    mySpatial = assetManager.loadModel("/Models/F_Car.obj");

    break;



    case KEEP_POD:



    System.out.println("Creating Keep Pod: " + type + "…"); <<<< a single geom object

    mySpatial = assetManager.loadModel("/Models/F_pod.obj");

    break;



    }





    drive_node = (Node) mySpatial;

    drive_node.setLocalTranslation(x, y, z); // sets the 3d translation

    drive_node.setName(id);

    rootNode.attachChild(mySpatial); // attach to root node to make visible



    }



    [/java]



    As everything works fine, I am limited by the fact that my model can only be formed out of two geometries (in Blender language: 2 separate materials). Otherwise, if I want to import a single geom object (e.g. a cube) , I get the following error:



    [java]

    SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

    com.jme3.asset.AssetNotFoundException: /Models/F_pod.obj

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

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

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

    at com.garnaout.sim.animation.Jme3Cinematics.create3dModel(Jme3Cinematics.java:772)

    at com.garnaout.sim.Jme3animation.CreateTrack.<init>(CreateTrack.java:68)

    at com.garnaout.sim.animation.Jme3Cinematics.createDrives(Jme3Cinematics.java:729)

    at com.garnaout.sim.animation.driveFunctions.Jme3CreateEvent.run(Jme3CreateEvent.java:88)

    at com.garnaout.sim.animation.Jme3Adapter.readTraceFile(Jme3Adapter.java:187)

    at com.garnaout.sim.animation.Jme3Adapter.<init>(Jme3Adapter.java:82)

    at com.garnaout.sim.animation.Jme3Cinematics.readFile(Jme3Cinematics.java:345)

    at com.garnaout.sim.animation.Jme3Cinematics.simpleInitApp(Jme3Cinematics.java:172)

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

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

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

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

    Feb 1, 2012 12:05:31 PM com.jme3.renderer.lwjgl.LwjglRenderer cleanup

    INFO: Deleting objects and invalidating state

    Feb 1, 2012 12:05:31 PM com.jme3.input.lwjgl.LwjglMouseInput destroy

    INFO: Mouse destroyed.

    Feb 1, 2012 12:05:31 PM com.jme3.input.lwjgl.LwjglKeyInput destroy

    INFO: Keyboard destroyed.

    Feb 1, 2012 12:05:31 PM com.jme3.system.lwjgl.LwjglAbstractDisplay deinitInThread

    INFO: Display destroyed.

    [/java]





    Any ideas on what am I doing wrong and how to fix this?

Eclipse? assets folder not on class path?

then why would it work if I add another geom to it. Say in Blender I add another Mesh +material to that obj and import it, it works fine…

is it called pod? or Pod?

It is case sensitive.

I think i missed an important part of the log:

[java]

INFO: Child (Box) attached to this node (Root Node)

Feb 1, 2012 3:19:48 PM com.jme3.app.Application handleError

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

com.jme3.asset.AssetNotFoundException: /Models/F_pod.obj[/java]





something to do with this part of the code that wants the spatial to have two geometries and not one. Again the interesting part that if I add another mesh to it in imports it just fine.



[java]

drive_node = (Node) mySpatial;

drive_node.setLocalTranslation(x, y, z); // sets the 3d translation

drive_node.setName(id);

rootNode.attachChild(mySpatial); // attach to root node to make visible

[/java]

Maybe the file is divided into multiple somehow or the texture name is referenced differently? No idea really… Didn’t use the obj importer much.

could you upload your problematic model somewhere so we could try to load it?



maybe there is an issue with the obj loader