X3D importer: Fixed path handling

This commit is contained in:
Patrick Dähne
2017-07-11 19:41:24 +02:00
parent 457dff1bf1
commit 8959bcb847
2 changed files with 10 additions and 3 deletions

4
code/X3DImporter.cpp Executable file → Normal file
View File

@@ -1610,8 +1610,10 @@ void X3DImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy
mpIOHandler = pIOHandler;
Clear();// delete old graph.
pIOHandler->PushDirectory(DefaultIOSystem::absolutePath(pFile));
std::string::size_type slashPos = pFile.find_last_of("\\/");
pIOHandler->PushDirectory(slashPos == std::string::npos ? std::string() : pFile.substr(0, slashPos + 1));
ParseFile(pFile, pIOHandler);
pIOHandler->PopDirectory();
//
// Assimp use static arrays of objects for fast speed of rendering. That's good, but need some additional operations/
// We know that geometry objects(meshes) are stored in <Shape>, also in <Shape>-><Appearance> materials(in Assimp logical view)