Milkshape model texture bug

if i dont have textures for my milkshape model,jMe refuses to load model.(jMeException)



corrections needed to:

com.jme.scene.model.msascii.MilkshapeASCIIModel



::loadTexture(String file)

-check if file is null(or does it send ""?)



::parseMaterials(BufferedReader reader, int numberMaterials)

-when assigning check if texture is not null and assign after that

Can you provide a stack trace? Also, if you can provide the model you are testing with, that would be great.

22.3.2004 20:14:21 com.jme.app.SimpleGame start
INFO: Application started.
22.3.2004 20:14:21 com.jme.system.PropertiesIO
INFO: PropertiesIO created
22.3.2004 20:14:21 com.jme.system.PropertiesIO load
INFO: Read properties
22.3.2004 20:14:23 com.jme.system.LWJGLDisplaySystem
INFO: LWJGL Display System created.
22.3.2004 20:14:23 com.jme.system.PropertiesIO save
INFO: Saved properties
22.3.2004 20:14:23 com.jme.system.LWJGLDisplaySystem
INFO: LWJGL Display System created.
NOTICE: GL_EXT_vertex_shader disabled because of missing driver symbols
NOTICE: GL_ATI_vertex_streams disabled because of missing driver symbols
22.3.2004 20:14:24 com.jme.renderer.LWJGLRenderer
INFO: LWJGLRenderer created. W: 800H: 600
22.3.2004 20:14:24 com.jme.renderer.AbstractCamera
INFO: Camera created.
22.3.2004 20:14:24 com.jme.util.LWJGLTimer
INFO: Timer resolution: 3064570000 ticks per second
22.3.2004 20:14:24 com.jme.scene.Node
INFO: Node created.
22.3.2004 20:14:25 com.jme.scene.Node
INFO: Node created.
22.3.2004 20:14:25 com.jme.scene.Node attachChild
INFO: Child (particles) attached to this node (Particle node)
22.3.2004 20:14:25 com.jme.scene.Node
INFO: Node created.
22.3.2004 20:14:25 com.jme.scene.Node attachChild
INFO: Child (Sphere02) attached to this node (Milkshape Model)
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at java.lang.String.substring(Unknown Source)
at com.jme.util.TextureManager.loadTexture(Unknown Source)
at com.jme.util.TextureManager.loadTexture(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.loadTexture(Unknown S
ource)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.parseMaterials(Unknow
n Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at Main.initGame(Main.java:210)
at com.jme.app.SimpleGame.start(Unknown Source)
at Main.main(Main.java:250)
com.jme.system.JmeException: Error loading Milkshape ASCII file:/E:/java/asteroi
d_demo/data/model.txt
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at Main.initGame(Main.java:210)
at com.jme.app.SimpleGame.start(Unknown Source)
at Main.main(Main.java:250)
22.3.2004 20:14:25 com.jme.app.SimpleGame start
INFO: Application ending.


i will upload model to my homepage tomorrow,i cant currently,looks like my internet provider doesnt allow connecting to ftp outside their network

but i guess only important lines are material lines in ascii file and they are
Materials: 1
"foomaterial"
0.000000 0.000000 0.000000 0.540000
1.000000 1.000000 1.000000 0.540000
0.000000 0.000000 1.000000 0.540000
0.000000 0.000000 0.000000 0.540000
128.000000
0.540000
""
""


i dont give texture filename because this model doesnt need any textures
and it's not checked on loader it just parses and passes it to texture readed but doesnt check if its null

Checked in a quick update to TextureManager that will fix the error in the stacktrace. Please try again and fwd any more stacktraces.

new stacktrace:

INFO: Child (Sphere02) attached to this node (Milkshape Model)
java.lang.NullPointerException
at com.jme.util.TextureManager.hasAlpha(Unknown Source)
at com.jme.util.TextureManager.loadImage(Unknown Source)
at com.jme.util.TextureManager.loadTexture(Unknown Source)
at com.jme.util.TextureManager.loadTexture(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.loadTexture(Unknown S
ource)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.parseMaterials(Unknow
n Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at Main.initGame(Main.java:210)
at com.jme.app.SimpleGame.start(Unknown Source)
at Main.main(Main.java:250)
com.jme.system.JmeException: Error loading Milkshape ASCII file:/E:/java/asteroi
d_demo/data/model.txt
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at Main.initGame(Main.java:210)
at com.jme.app.SimpleGame.start(Unknown Source)
at Main.main(Main.java:250)
23.3.2004 7:56:59 com.jme.app.SimpleGame start
INFO: Application ending.

I’ll take care of this today. I’ve known about this for a bit now. Just never got around to resolving.

Ok, I have checked in TextureManager and MilkshapeASCII. These should handle non-existant textures better. If you are still having trouble, reply and perhaps send me your milkshape file.

java.lang.NullPointerException
at com.jme.util.TextureManager.hasAlpha(Unknown Source)
at com.jme.util.TextureManager.loadImage(Unknown Source)
at com.jme.util.TextureManager.loadTexture(Unknown Source)
at com.jme.util.TextureManager.loadTexture(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.loadTexture(Unknown S
ource)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.parseMaterials(Unknow
n Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at Main.initGame(Main.java:210)
at com.jme.app.SimpleGame.start(Unknown Source)
at Main.main(Main.java:250)
com.jme.system.JmeException: Error loading Milkshape ASCII file:/E:/java/asteroi
d_demo/data/model.txt
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at com.jme.scene.model.msascii.MilkshapeASCIIModel.load(Unknown Source)
at Main.initGame(Main.java:210)
at com.jme.app.SimpleGame.start(Unknown Source)
at Main.main(Main.java:250)
23.3.2004 18:27:01 com.jme.app.SimpleGame start
INFO: Application ending.


model can be found at http://www.netikka.net/mika.pesu/model.txt

Hmm, that link seems to have an invalid milkshape file format. Specifically, it reports 120 triangles: but the 111th triangle is incomplete and the rest are missing. That is, the file ends with:



1 82 25 83 56 15 57 1

1 25 29 83 15 17 57 1

1 83 29

http://www.netikka.net/mika.pesu/model.zip



i’m not sure why this happens,looks like it gets corrupted if i send plain text files. new one is zipped

ok, found the issue and fixed it. Your model is loaded on my computer. Update cvs and try it out.

yep,it works now,thanks.