From 6118f77d3babf8adbc56456552a6629224118075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20D=C3=A4hne?= Date: Thu, 22 Jun 2017 16:29:26 +0200 Subject: [PATCH] X3D importer: Fixed handling of inlined files --- code/X3DImporter.cpp | 4 +++- code/X3DImporter.hpp | 2 +- code/X3DImporter_Networking.cpp | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/code/X3DImporter.cpp b/code/X3DImporter.cpp index 1b2387f91..921734f32 100644 --- a/code/X3DImporter.cpp +++ b/code/X3DImporter.cpp @@ -1666,8 +1666,10 @@ const aiImporterDesc* X3DImporter::GetInfo () const void X3DImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) { + mpIOHandler = pIOHandler; + Clear();// delete old graph. - mFileDir = DefaultIOSystem::absolutePath(pFile); + pIOHandler->PushDirectory(DefaultIOSystem::absolutePath(pFile)); ParseFile(pFile, pIOHandler); // // Assimp use static arrays of objects for fast speed of rendering. That's good, but need some additional operations/ diff --git a/code/X3DImporter.hpp b/code/X3DImporter.hpp index 6514ab5ca..2d21fe8f2 100644 --- a/code/X3DImporter.hpp +++ b/code/X3DImporter.hpp @@ -833,7 +833,7 @@ private: /***********************************************/ CX3DImporter_NodeElement* NodeElement_Cur;///< Current element. irr::io::IrrXMLReader* mReader;///< Pointer to XML-reader object - std::string mFileDir; + IOSystem *mpIOHandler; };// class X3DImporter }// namespace Assimp diff --git a/code/X3DImporter_Networking.cpp b/code/X3DImporter_Networking.cpp index 69987e0ff..9d55900cb 100644 --- a/code/X3DImporter_Networking.cpp +++ b/code/X3DImporter_Networking.cpp @@ -89,12 +89,13 @@ void X3DImporter::ParseNode_Networking_Inline() if(load && (url.size() > 0)) { - DefaultIOSystem io_handler; std::string full_path; - full_path = mFileDir + "/" + url.front(); + full_path = mpIOHandler->CurrentDirectory() + "/" + url.front(); // Attribute "url" can contain list of strings. But we need only one - first. - ParseFile(full_path, &io_handler); + mpIOHandler->PushDirectory(DefaultIOSystem::absolutePath(full_path)); + ParseFile(full_path, mpIOHandler); + mpIOHandler->PopDirectory(); } // check for X3DMetadataObject childs.