.3ds model and textures


I am trying to load a .3ds file using the maxtojme converter. The model loads just fine but i can not seem to get it to load the texture.

The only clue given is: com.jme.util.TextureManager loadTexture WARNING: TextureKey is null, cannot load.

I did some debugging and found that the write method of Texture writes out null for this particular field. Now i have no idea as to why this is, but the same seems to be happening in lesson 7 where the bike model is loaded. However write does write out an imageLocation which is read back by the read method only nothing is done with it. So i tried the following modification (might not be completely generic for everybody)

 if(!storeTexture) {

TextureKey has a static methid for overriding the texture path.

TextureKey has a static methid for overriding the texture path.

Yeah but unless you override Texture, there is no way you can set it. Since the textureKey is automaticly created at the read and write methods as far as i could see.

Since the method is static you can call it before the loading process begins.

how stupid of me, completely missed that. however using the following code i still can not get my texture to show up and i still get the "TextureKey is null, can not load" message.

MaxToJme converter = new MaxToJme();
ByteArrayOutputStream BO = new ByteArrayOutputStream();
BinaryImporter importer = BinaryImporter.getInstance();
   TextureKey.setOverridingLocation(new URL("file:/D:/workspaces/home/HeroQuest/target/classes/"));
   converter.convert(getClass().getResource("/texturedwall.3ds").openStream(), BO);
   Node wallNode=(Node)importer.load(new ByteArrayInputStream(BO.toByteArray()));
catch (IOException e)

Any thoughts anyone ?

Well, it appears that readTextureMap* methods in com.jmex.model.XMLparser.Converters.TDSChunkingFiles.MaterialBlock never creates a TextureKey, which in turn means it can't be stored properly. It's mostly an upgrade issue, if you are adventurous enough you might play around with it, just create a new TextureKey object, set the values that should be set and call t.setTextureKey().

If not, you'll have to wait awhile before I get around to playing with it.

Thanks, Mojo

I managed to get the texture to show using

TextureKey key=new TextureKey(new URL(t.getImageLocation()),Texture.MM_LINEAR,Texture.FM_LINEAR,t.getAnisoLevel(),false,Image.GUESS_FORMAT);

Like you said. However since i have no idea as to where to get the actual values to initialize the key with, i'll leave it to you guys to fix this properly.


We fixed this locally. I expect to commit it the coming week.

Issue updated.