ObjToJme ArrayOutOfBounds

Hi all,

I am exporting a model from max to obj, then I want to convert that to .jme. However, thats throwing an ArrayOutOfBounds Exception @ ObjToJme.java : 152



Ive looked at the source, and its to do with MaterialGrouping…



But No fear! DP is here! :smiley:



I figured since .obj are just text files, lets have a little peak. So i removed all of the “g”'s in there (there were only two, near the normals and at the far end). And the model loaded fine! So i started experimenting again…



There were to “g” instances. One in:


415 vertex normalsg 01_-_Defaults 1f


And another in:

# 150 facesg

So i removed the facesg one and renamed it to just faces. And it also loaded just fine.

I dont understand the .obj format fully, but it seems like the convertor is misinterpreting a comment for a command.

I can upload the file somewhere if you want to have a look at it?

DP

Is the obj format correct? The converter uses String.split to parse a line. Any line that begins with a “g” followed by a whitespace is assumed it will have a name following it. If there is just a “g” by itself, then that’s either

  1. An error in the format
  2. A “feature” of obj. I’ld assume a “g” with no name is just a default material(?)

the format is correct. It complies with V 4.0 of the obj format. Not sure which one we can import.



My file has no material attached to it, because im doing that in a different format. So you might be right about the default material thing.



The only reason I am doing this is because the 3ds importer is a bit weird…il post about it somewhere…



DP

Please see the Code Review forum for the bug fix.



DP