divemasterbill / saitoobjloader

Automatically exported from code.google.com/p/saitoobjloader
0 stars 0 forks source link

Material files are not interpreted relatively #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If you want to reference .mtl files relative to .obj files this seems to be 
impossible making it really hard to manage the complexity of multiple objects.

Initially I have these in the Processing data directory. They reference each 
other by name and will load correctly...

confused.obj
confused.mtl
confused_texture1.png
confused_texture2.png

However, if I try to separate out the Obj files into subdirectories (e.g. one 
collection of .obj, .mtl and any .png textures for that object), then ObjModel 
refuses to load the .mtl or .png files which are alongside the .obj file. That 
is to say the paths are not interpreted relatively and I can't work out how to 
force this.

The new filesystem looks as follows, and loading the .obj containing either the 
reference 'confused.mtl' or './confused.mtl' means ObjModel can't load the 
materials.

confused/confused.obj
confused/confused.mtl
confused/confused_texture1.png
confused/confused_texture2.png

Any workaround would be welcome as I think I'm going to get a load of obj files 
with madly named textures and materials which will be impossible to manage 
without giving them a directory each.

Original issue reported on code.google.com by c...@cefn.com on 5 Feb 2012 at 8:41

GoogleCodeExporter commented 8 years ago
Please note, this is not the same sense of "relative" as suggested in the 
OBJModel Javadoc. The javadoc means relative to Processing data directory, 
whereas I mean relative to the .obj file loaded. This would allow you to move 
models without breaking their internal consistency.

Original comment by c...@cefn.com on 5 Feb 2012 at 8:47