mansrz / pymt

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

Filepath relativity problem with OBJWidget #336

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Right now, the Obj Widget included in the examples fails to load any texture 
that isn't in the project root folder. This makes it impossible to put textures 
inside subfolders, as in root/assets/textures/myTexture.jpg

What steps will reproduce the problem?
1. Modify the 3Dviewer example to load an obj model file that has textures (the 
default monkey has none)
2. place model and textures in an 'assets' subfolder (relative to your module's 
path)
3. Start up the 3Dviewer example, giving it the filepath to the model (which 
should include the 'assets' subfolder)

What is the expected output? What do you see instead?
The model should load with it's textures, but pygame throws an error saying it 
couldn't load the texture file. Note that the filename is stripped of any 
subfolders in the error message (it should be prefixed with subfolders relative 
to the module's path).

What version of the product are you using? On what operating system?
PyMT 0.5 Portable on Win7 64-bit

Please provide any additional information below.
I believe that at some point in the texture loading routines, the filename is 
being stripped of it's subfolder prefixes. Any subfolders specified with the 
model name when calling the ObjWidget constructor should be also used for 
textures. This would allow us to at least place the models and textures in 
their own subfolders and not mess up the project's file structure 

Cheers

Original issue reported on code.google.com by vanquish...@gmail.com on 7 Sep 2010 at 1:07