From Alberto Farre, fix to nested OpenFlight file problem.
This commit is contained in:
parent
1b805f7bdb
commit
1223e4c8ca
@ -240,44 +240,36 @@ bool FltFile::readFile(const std::string& fileName)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
pExternalFltFile = registerFLT ? Registry::instance()->getFltFile(filename) : NULL;
|
pExternalFltFile = registerFLT ? Registry::instance()->getFltFile(filename) : NULL;
|
||||||
|
|
||||||
if (pExternalFltFile == NULL)
|
if (pExternalFltFile == NULL)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgDB::ReaderWriter::Options> options = new osgDB::ReaderWriter::Options;
|
osg::ref_ptr<osgDB::ReaderWriter::Options> options =
|
||||||
|
_pFltFile->getOptions() ? _pFltFile->getOptions() :
|
||||||
|
new osgDB::ReaderWriter::Options;
|
||||||
|
|
||||||
if (_pFltFile->getOptions())
|
//Path for Nested external references
|
||||||
|
osgDB::FilePathList& fpl = options->getDatabasePathList();
|
||||||
|
std::string filePath = osgDB::getFilePath(filename);
|
||||||
|
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) )
|
||||||
{
|
{
|
||||||
options = _pFltFile->getOptions();
|
pushAndPopPath = filePath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
options = new osgDB::ReaderWriter::Options;
|
pushAndPopPath = (fpl.empty() ? "." : fpl.back()) + "/" + filePath;
|
||||||
|
|
||||||
//Path for Nested external references
|
|
||||||
std::string filePath = osgDB::getFilePath(filename);
|
|
||||||
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();
|
|
||||||
pushAndPopPath += "/" + filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
char optionsString[256];
|
|
||||||
sprintf(optionsString,"FLT_VER %d",rec.getFlightVersion());
|
|
||||||
options->setOptionString(optionsString);
|
|
||||||
|
|
||||||
osg::notify(osg::NOTICE)<<"Create local path"<<pushAndPopPath<<std::endl;
|
|
||||||
|
|
||||||
options->getDatabasePathList().push_back(pushAndPopPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char optionsString[256];
|
||||||
|
sprintf(optionsString,"FLT_VER %d",rec.getFlightVersion());
|
||||||
|
options->setOptionString(optionsString);
|
||||||
|
|
||||||
|
//osg::notify(osg::NOTICE)<<"Create local path"<<pushAndPopPath<<std::endl;
|
||||||
|
|
||||||
|
fpl.push_back(pushAndPopPath);
|
||||||
|
|
||||||
|
|
||||||
pExternalFltFile = new FltFile( pColorPool, pTexturePool, pMaterialPool,
|
pExternalFltFile = new FltFile( pColorPool, pTexturePool, pMaterialPool,
|
||||||
pLtPtAppearancePool, pLtPtAnimationPool, options.get() );
|
pLtPtAppearancePool, pLtPtAnimationPool, options.get() );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user