diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp index 39c701bd2..b045d378f 100644 --- a/src/osgPlugins/flt/flt2osg.cpp +++ b/src/osgPlugins/flt/flt2osg.cpp @@ -1854,13 +1854,30 @@ osg::Group* ConvertFromFLT::visitMatrix(osg::Group& osgParent, const osg::Group& return transform; } - osg::Group* ConvertFromFLT::visitExternal(osg::Group& osgParent, ExternalRecord* rec) { // SExternalReference *pSExternal = (SExternalReference*)rec->getData(); - osgDB::PushAndPopDataPath tmpfile(osgDB::getFilePath(rec->getFilename())); - + std::string filePath = osgDB::getFilePath(rec->getFilename()); + std::string pushAndPopPath; + //If absolute path + if( (filePath.length()>0 && filePath.find_first_of("/\\")==0) || + (filePath.length()>2 && filePath.substr(1,1)==":" && filePath.find_first_of("/\\")==2) ) + { + pushAndPopPath = filePath; + } + else + { + osgDB::FilePathList fpl = osgDB::getDataFilePathList(); + pushAndPopPath = fpl.empty() ? "." : fpl.front(); + if(pushAndPopPath.empty()) pushAndPopPath = "."; + pushAndPopPath += "/" + filePath; + } + + osgDB::PushAndPopDataPath tmpfile(pushAndPopPath); + //osgDB::PushAndPopDataPath tmpfile(osgDB::getFilePath(rec->getFilename())); + + FltFile* pFile = rec->getExternal(); osg::Group* external = NULL; if (pFile)