Hi,

This change is sent as pull request #710 

The FBX plugin may fail texture lookup even if the texture is located in the 
same folder as the model file. Currently the plugin checks the following 
locations:

1. The absolute filename appended to the current directory (Works well when the 
absolute filename is a pure filename, but fails when the absolute filename is a 
complete path)

2. The absolute filename only. (Works well assuming the texture can be found at 
exactly this complete path).

3. The relative filename appended to the current directory (requires that the 
texture is placed at exactly in the same relative location to the model as the 
file was saved in).

Some examples of success and failure:
In all examples below I assume we load the FBX file from the path: 
"D:\application\models\cow.fbx"

Case 1: The author of the FBX model have saved the model in such way that the 
stored absolute filename is "cowskin.tga". The plugin will then try to find the 
model in path: D:\application\models\cowskin.tga". 
- Potential failure case: The author of the FBX model have saved the model with 
a full absolute path such as "c:\model\cow\texture\cowskin.tga" and our plugin 
will then try to lookup path 
"D:\application\models\c:\model\cow\texture\cowskin.tga" which will fail.


Case 2: The author of the FBX file have included a full path in the absolute 
path "c:\model\cow\texture\cowskin.tga" and this is the path the second option 
will try.


Case 3: The author of the FBX file have saved the file to the path 
"c:\model\cow\cow.fbx" while the texture was stored in 
"c:\model\cow\texture\cowskin.tga". This usually results in the FBX exporter 
assigning the relative path: "texture\cowskin.tga". The plugin will then try to 
lookup the texture in the folder "D:\application\models\texture\cowskin.tga"
- Potential failure case: The author of the FBX file have stored the texture in 
a far away folder, for example "c:\textures\animals\cow\cowskin.tga". This will 
result in the relative path: "..\..\..\textures\cow\cowskin.tga". The plugin 
will then try to lookup the texture in the folder: 
"D:\application\models\..\..\..\textures\cow\cowskin.tga" which will be an 
invalid location (i.e. one more parent folder than what is available).


This pull request adds a fourth option as a last resort:

4. The pure filename part of the absolute filename (i.e. without any paths) 
appended to the current directory. This will look in the same folder as the 
model is stored in.


Regards,
Björn

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75584#75584





_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to