Add search location for textures in FBX plugin
The FBX plugin may fail texture lookup even if the texture is located in the same folder as the model file. This change tries, as a last resort, to check if the texture filename is available in the same folder as the model.
This commit is contained in:
committed by
Robert Osfield
parent
6d5c6ad6cc
commit
9905b90a18
@@ -184,14 +184,18 @@ osg::ref_ptr<osg::Texture2D> FbxMaterialToOsgStateSet::fbxTextureToOsgTexture(co
|
||||
{
|
||||
filename = osgDB::concatPaths(_dir, fbx->GetFileName());
|
||||
}
|
||||
else if (osgDB::fileExists(fbx->GetFileName())) // Then try "name" (if absolute)
|
||||
else if (osgDB::fileExists(fbx->GetFileName())) // Then try "name" (if absolute)
|
||||
{
|
||||
filename = fbx->GetFileName();
|
||||
}
|
||||
else if (osgDB::fileExists(osgDB::concatPaths(_dir, fbx->GetRelativeFileName()))) // Else try "current dir/name"
|
||||
else if (osgDB::fileExists(osgDB::concatPaths(_dir, fbx->GetRelativeFileName()))) // Else try "current dir + relative filename"
|
||||
{
|
||||
filename = osgDB::concatPaths(_dir, fbx->GetRelativeFileName());
|
||||
}
|
||||
else if (osgDB::fileExists(osgDB::concatPaths(_dir, osgDB::getSimpleFileName(fbx->GetFileName())))) // Else try "current dir + simple filename"
|
||||
{
|
||||
filename = osgDB::concatPaths(_dir, osgDB::getSimpleFileName(fbx->GetFileName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN << "Could not find valid file for " << fbx->GetFileName() << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user