Save relative pathname for textures in .jme files?


I use com.jmex.model.util.ModelLoader to convert my .3ds files into .jme format.

This works great and I can load them into the engine, as long as the path to the textures remains unchanged.

However, if we try to run the app on a different computer (where path names are different), the app can no longer find the textures and throws an exception.

It seems that the absolute path name to the textures is hard coded into the .jme files. It this true?

How can I tell JME to load the textures from the same directory where the .jme file is located, independent of the absolute path name?

My loading code looks like this:

File f = new File("res/gfx3d/ships/Shuttle01/Shuttle01.jme");

Node s = (Node)BinaryImporter.getInstance().load(f);


Solved in this thread  :slight_smile:

awesome! thank you.

here's my code, working like a breeze:


import com.jme.util.TextureKey;

//workaround to load textures from same directory as the model

File modeldir = new File("res/gfx3d/ships/Shuttle01/");

TextureKey.setOverridingLocation( modeldir.toURI().toURL() );

Node s = (Node)BinaryImporter.getInstance().load(f);

Glad I could help beeing a "Newbie" myself :wink: