Possible bug in com.jme3.scene.plugins.OBJLoader

Hi all!



I am currently testing makehuman. Exported a model as obj and tried to load it in jMonkey.

The loading failed. The reason is that makehuman writes the obj files with two spaces

between the faces, like this:

f 14849/16098/14849 14854/16100/14854 14853/16101/14853 14850/16099/14850


But the loader only looks for one space, in readFace, around line 238:
String[] verticies = line.split(" ");


I am using jMonkey 3 with a nightly snapshot of one of the prevous nights, if I am not mistaken.

Kind regards,
Stefan

I looked at the OBJ spec found online and it doesn’t seem to say anything about whitespace requirements/restrictions… Then again, I don’t believe I’ve seen any files using double spaces.



A pretty simple fix could be to just strip the whitespace off of the elements in vertices.

[java]

for(int i=0; i<vertices.length; i++){

vertices = vertices.trim();

}

[/java]



Edit: I also wouldn’t hesitate to ask in their forums about this. There’s a chance that you catch the ear of the developer who wrote the exporter and may be able to offer some rationale http://www.makehuman.org/forum/viewforum.php?f=3

Are you actually having issues with this? I’d have to try to see if java actually puts “null” strings in… Else we should go with some regex I guess…

Should be fixed in SVN now

@Momoko_Fan said:
Should be fixed in SVN now


It seems that this fix introduced a bug: http://hub.jmonkeyengine.org/groups/import-assets/forum/topic/obj-loader-is-broken/

Thanks for the quick fix!