2
0

BaseImporter.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2025, assimp team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /** @file BaseImporter.cpp
  35. * @brief Implementation of BaseImporter
  36. */
  37. #include "FileSystemFilter.h"
  38. #include "Importer.h"
  39. #include <assimp/BaseImporter.h>
  40. #include <assimp/ByteSwapper.h>
  41. #include <assimp/ParsingUtils.h>
  42. #include <assimp/importerdesc.h>
  43. #include <assimp/postprocess.h>
  44. #include <assimp/scene.h>
  45. #include <assimp/Importer.hpp>
  46. #include <cctype>
  47. #include <ios>
  48. #include <list>
  49. #include <memory>
  50. #include <sstream>
  51. namespace {
  52. // Checks whether the passed string is a gcs version.
  53. bool IsGcsVersion(const std::string &s) {
  54. if (s.empty()) return false;
  55. return std::all_of(s.cbegin(), s.cend(), [](const char c) {
  56. // gcs only permits numeric characters.
  57. return std::isdigit(static_cast<int>(c));
  58. });
  59. }
  60. // Removes a possible version hash from a filename, as found for example in
  61. // gcs uris (e.g. `gs://bucket/model.glb#1234`), see also
  62. // https://github.com/GoogleCloudPlatform/gsutil/blob/c80f329bc3c4011236c78ce8910988773b2606cb/gslib/storage_url.py#L39.
  63. std::string StripVersionHash(const std::string &filename) {
  64. const std::string::size_type pos = filename.find_last_of('#');
  65. // Only strip if the hash is behind a possible file extension and the part
  66. // behind the hash is a version string.
  67. if (pos != std::string::npos && pos > filename.find_last_of('.') &&
  68. IsGcsVersion(filename.substr(pos + 1))) {
  69. return filename.substr(0, pos);
  70. }
  71. return filename;
  72. }
  73. } // namespace
  74. using namespace Assimp;
  75. // ------------------------------------------------------------------------------------------------
  76. // Constructor to be privately used by Importer
  77. BaseImporter::BaseImporter() AI_NO_EXCEPT
  78. : m_progress() {
  79. // empty
  80. }
  81. void BaseImporter::UpdateImporterScale(Importer *pImp) {
  82. ai_assert(pImp != nullptr);
  83. ai_assert(importerScale != 0.0);
  84. ai_assert(fileScale != 0.0);
  85. double activeScale = importerScale * fileScale;
  86. // Set active scaling
  87. pImp->SetPropertyFloat(AI_CONFIG_APP_SCALE_KEY, static_cast<float>(activeScale));
  88. ASSIMP_LOG_DEBUG("UpdateImporterScale scale set: ", activeScale);
  89. }
  90. // ------------------------------------------------------------------------------------------------
  91. // Imports the given file and returns the imported data.
  92. aiScene *BaseImporter::ReadFile(Importer *pImp, const std::string &pFile, IOSystem *pIOHandler) {
  93. m_progress = pImp->GetProgressHandler();
  94. if (nullptr == m_progress) {
  95. return nullptr;
  96. }
  97. ai_assert(m_progress);
  98. // Gather configuration properties for this run
  99. SetupProperties(pImp);
  100. // Construct a file system filter to improve our success ratio at reading external files
  101. FileSystemFilter filter(pFile, pIOHandler);
  102. // create a scene object to hold the data
  103. std::unique_ptr<aiScene> sc(new aiScene());
  104. // dispatch importing
  105. try {
  106. InternReadFile(pFile, sc.get(), &filter);
  107. // Calculate import scale hook - required because pImp not available anywhere else
  108. // passes scale into ScaleProcess
  109. UpdateImporterScale(pImp);
  110. } catch( const std::exception &err ) {
  111. // extract error description
  112. m_ErrorText = err.what();
  113. ASSIMP_LOG_ERROR(err.what());
  114. m_Exception = std::current_exception();
  115. return nullptr;
  116. }
  117. // return what we gathered from the import.
  118. return sc.release();
  119. }
  120. // ------------------------------------------------------------------------------------------------
  121. void BaseImporter::SetupProperties(const Importer *) {
  122. // the default implementation does nothing
  123. }
  124. // ------------------------------------------------------------------------------------------------
  125. void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
  126. const aiImporterDesc *desc = GetInfo();
  127. ai_assert(desc != nullptr);
  128. const char *ext = desc->mFileExtensions;
  129. ai_assert(ext != nullptr);
  130. const char *last = ext;
  131. do {
  132. if (!*ext || *ext == ' ') {
  133. extensions.insert(std::string(last, ext - last));
  134. ai_assert(ext - last > 0);
  135. last = ext;
  136. while (*last == ' ') {
  137. ++last;
  138. }
  139. }
  140. } while (*ext++);
  141. }
  142. // ------------------------------------------------------------------------------------------------
  143. /*static*/ bool BaseImporter::SearchFileHeaderForToken(IOSystem *pIOHandler,
  144. const std::string &pFile,
  145. const char **tokens,
  146. std::size_t numTokens,
  147. unsigned int searchBytes /* = 200 */,
  148. bool tokensSol /* false */,
  149. bool noGraphBeforeTokens /* false */) {
  150. ai_assert(nullptr != tokens);
  151. ai_assert(0 != numTokens);
  152. ai_assert(0 != searchBytes);
  153. if (nullptr == pIOHandler) {
  154. return false;
  155. }
  156. std::unique_ptr<IOStream> pStream(pIOHandler->Open(pFile));
  157. if (pStream) {
  158. // read 200 characters from the file
  159. std::unique_ptr<char[]> _buffer(new char[searchBytes + 1 /* for the '\0' */]);
  160. char *buffer(_buffer.get());
  161. const size_t read(pStream->Read(buffer, 1, searchBytes));
  162. if (0 == read) {
  163. return false;
  164. }
  165. for (size_t i = 0; i < read; ++i) {
  166. buffer[i] = static_cast<char>(::tolower((unsigned char)buffer[i]));
  167. }
  168. // It is not a proper handling of unicode files here ...
  169. // ehm ... but it works in most cases.
  170. char *cur = buffer, *cur2 = buffer, *end = &buffer[read];
  171. while (cur != end) {
  172. if (*cur) {
  173. *cur2++ = *cur;
  174. }
  175. ++cur;
  176. }
  177. *cur2 = '\0';
  178. std::string token;
  179. for (unsigned int i = 0; i < numTokens; ++i) {
  180. ai_assert(nullptr != tokens[i]);
  181. const size_t len(strlen(tokens[i]));
  182. token.clear();
  183. const char *ptr(tokens[i]);
  184. for (size_t tokIdx = 0; tokIdx < len; ++tokIdx) {
  185. token.push_back(static_cast<char>(tolower(static_cast<unsigned char>(*ptr))));
  186. ++ptr;
  187. }
  188. const char *r = strstr(buffer, token.c_str());
  189. if (!r) {
  190. continue;
  191. }
  192. // We need to make sure that we didn't accidentally identify the end of another token as our token,
  193. // e.g. in a previous version the "gltf " present in some gltf files was detected as "f ", or a
  194. // Blender-exported glb file containing "Khronos glTF Blender I/O " was detected as "o "
  195. if (noGraphBeforeTokens && (r != buffer && isgraph(static_cast<unsigned char>(r[-1])))) {
  196. continue;
  197. }
  198. // We got a match, either we don't care where it is, or it happens to
  199. // be in the beginning of the file / line
  200. if (!tokensSol || r == buffer || r[-1] == '\r' || r[-1] == '\n') {
  201. ASSIMP_LOG_DEBUG("Found positive match for header keyword: ", tokens[i]);
  202. return true;
  203. }
  204. }
  205. }
  206. return false;
  207. }
  208. // ------------------------------------------------------------------------------------------------
  209. // Simple check for file extension
  210. /*static*/ bool BaseImporter::SimpleExtensionCheck(const std::string &pFile,
  211. const char *ext0,
  212. const char *ext1,
  213. const char *ext2,
  214. const char *ext3) {
  215. std::set<std::string> extensions;
  216. for (const char* ext : {ext0, ext1, ext2, ext3}) {
  217. if (ext == nullptr) continue;
  218. extensions.emplace(ext);
  219. }
  220. return HasExtension(pFile, extensions);
  221. }
  222. // ------------------------------------------------------------------------------------------------
  223. // Check for file extension
  224. /*static*/ bool BaseImporter::HasExtension(const std::string &pFile, const std::set<std::string> &extensions) {
  225. const std::string file = StripVersionHash(pFile);
  226. // CAUTION: Do not just search for the extension!
  227. // GetExtension() returns the part after the *last* dot, but some extensions
  228. // have dots inside them, e.g. ogre.mesh.xml. Compare the entire end of the
  229. // string.
  230. for (const std::string& ext : extensions) {
  231. // Yay for C++<20 not having std::string::ends_with()
  232. const std::string dotExt = "." + ext;
  233. if (dotExt.length() > file.length()) continue;
  234. // Possible optimization: Fetch the lowercase filename!
  235. if (0 == ASSIMP_stricmp(file.c_str() + file.length() - dotExt.length(), dotExt.c_str())) {
  236. return true;
  237. }
  238. }
  239. return false;
  240. }
  241. // ------------------------------------------------------------------------------------------------
  242. // Get file extension from path
  243. std::string BaseImporter::GetExtension(const std::string &pFile) {
  244. const std::string file = StripVersionHash(pFile);
  245. std::string::size_type pos = file.find_last_of('.');
  246. // no file extension at all
  247. if (pos == std::string::npos) {
  248. return std::string();
  249. }
  250. // thanks to Andy Maloney for the hint
  251. std::string ret = file.substr(pos + 1);
  252. ret = ai_tolower(ret);
  253. return ret;
  254. }
  255. // ------------------------------------------------------------------------------------------------
  256. // Check for magic bytes at the beginning of the file.
  257. /* static */ bool BaseImporter::CheckMagicToken(IOSystem *pIOHandler, const std::string &pFile,
  258. const void *_magic, std::size_t num, unsigned int offset, unsigned int size) {
  259. ai_assert(size <= 16);
  260. ai_assert(_magic);
  261. if (!pIOHandler) {
  262. return false;
  263. }
  264. const char *magic = reinterpret_cast<const char *>(_magic);
  265. std::unique_ptr<IOStream> pStream(pIOHandler->Open(pFile));
  266. if (pStream) {
  267. // skip to offset
  268. pStream->Seek(offset, aiOrigin_SET);
  269. // read 'size' characters from the file
  270. union {
  271. char data[16];
  272. uint16_t data_u16[8];
  273. uint32_t data_u32[4];
  274. };
  275. if (size != pStream->Read(data, 1, size)) {
  276. return false;
  277. }
  278. for (unsigned int i = 0; i < num; ++i) {
  279. // also check against big endian versions of tokens with size 2,4
  280. // that's just for convenience, the chance that we cause conflicts
  281. // is quite low and it can save some lines and prevent nasty bugs
  282. if (2 == size) {
  283. uint16_t magic_u16;
  284. memcpy(&magic_u16, magic, 2);
  285. if (data_u16[0] == magic_u16 || data_u16[0] == ByteSwap::Swapped(magic_u16)) {
  286. return true;
  287. }
  288. } else if (4 == size) {
  289. uint32_t magic_u32;
  290. memcpy(&magic_u32, magic, 4);
  291. if (data_u32[0] == magic_u32 || data_u32[0] == ByteSwap::Swapped(magic_u32)) {
  292. return true;
  293. }
  294. } else {
  295. // any length ... just compare
  296. if (!memcmp(magic, data, size)) {
  297. return true;
  298. }
  299. }
  300. magic += size;
  301. }
  302. }
  303. return false;
  304. }
  305. #include "utf8.h"
  306. // ------------------------------------------------------------------------------------------------
  307. // Convert to UTF8 data
  308. void BaseImporter::ConvertToUTF8(std::vector<char> &data) {
  309. //ConversionResult result;
  310. if (data.size() < 8) {
  311. throw DeadlyImportError("File is too small");
  312. }
  313. // UTF 8 with BOM
  314. if ((uint8_t)data[0] == 0xEF && (uint8_t)data[1] == 0xBB && (uint8_t)data[2] == 0xBF) {
  315. ASSIMP_LOG_DEBUG("Found UTF-8 BOM ...");
  316. std::copy(data.begin() + 3, data.end(), data.begin());
  317. data.resize(data.size() - 3);
  318. return;
  319. }
  320. // UTF 32 BE with BOM
  321. if (*((uint32_t *)&data.front()) == 0xFFFE0000) {
  322. if (data.size() % sizeof(uint32_t) != 0) {
  323. throw DeadlyImportError("Not valid UTF-32 BE");
  324. }
  325. // swap the endianness ..
  326. for (uint32_t *p = (uint32_t *)&data.front(), *end = (uint32_t *)&data.back(); p <= end; ++p) {
  327. AI_SWAP4P(p);
  328. }
  329. }
  330. // UTF 32 LE with BOM
  331. if (*((uint32_t *)&data.front()) == 0x0000FFFE) {
  332. if (data.size() % sizeof(uint32_t) != 0) {
  333. throw DeadlyImportError("Not valid UTF-32 LE");
  334. }
  335. ASSIMP_LOG_DEBUG("Found UTF-32 BOM ...");
  336. std::vector<char> output;
  337. auto *ptr = (uint32_t *)&data[0];
  338. uint32_t *end = ptr + (data.size() / sizeof(uint32_t)) + 1;
  339. utf8::utf32to8(ptr, end, back_inserter(output));
  340. return;
  341. }
  342. // UTF 16 BE with BOM
  343. if (*((uint16_t *)&data.front()) == 0xFFFE) {
  344. // Check to ensure no overflow can happen
  345. if (data.size() % sizeof(uint16_t) != 0) {
  346. throw DeadlyImportError("Not valid UTF-16 BE");
  347. }
  348. // swap the endianness ..
  349. for (uint16_t *p = (uint16_t *)&data.front(), *end = (uint16_t *)&data.back(); p <= end; ++p) {
  350. ByteSwap::Swap2(p);
  351. }
  352. }
  353. // UTF 16 LE with BOM
  354. if (*((uint16_t *)&data.front()) == 0xFEFF) {
  355. if (data.size() % sizeof(uint16_t) != 0) {
  356. throw DeadlyImportError("Not valid UTF-16 LE");
  357. }
  358. ASSIMP_LOG_DEBUG("Found UTF-16 BOM ...");
  359. std::vector<unsigned char> output;
  360. utf8::utf16to8(data.begin(), data.end(), back_inserter(output));
  361. return;
  362. }
  363. }
  364. // ------------------------------------------------------------------------------------------------
  365. // Convert to UTF8 data to ISO-8859-1
  366. void BaseImporter::ConvertUTF8toISO8859_1(std::string &data) {
  367. size_t size = data.size();
  368. size_t i = 0, j = 0;
  369. while (i < size) {
  370. if ((unsigned char)data[i] < (size_t)0x80) {
  371. data[j] = data[i];
  372. } else if (i < size - 1) {
  373. if ((unsigned char)data[i] == 0xC2) {
  374. data[j] = data[++i];
  375. } else if ((unsigned char)data[i] == 0xC3) {
  376. data[j] = ((unsigned char)data[++i] + 0x40);
  377. } else {
  378. std::stringstream stream;
  379. stream << "UTF8 code " << std::hex << data[i] << data[i + 1] << " can not be converted into ISA-8859-1.";
  380. ASSIMP_LOG_ERROR(stream.str());
  381. data[j++] = data[i++];
  382. data[j] = data[i];
  383. }
  384. } else {
  385. ASSIMP_LOG_ERROR("UTF8 code but only one character remaining");
  386. data[j] = data[i];
  387. }
  388. i++;
  389. j++;
  390. }
  391. data.resize(j);
  392. }
  393. // ------------------------------------------------------------------------------------------------
  394. void BaseImporter::TextFileToBuffer(IOStream *stream,
  395. std::vector<char> &data,
  396. TextFileMode mode) {
  397. ai_assert(nullptr != stream);
  398. const size_t fileSize = stream->FileSize();
  399. if (mode == FORBID_EMPTY) {
  400. if (!fileSize) {
  401. throw DeadlyImportError("File is empty");
  402. }
  403. }
  404. data.reserve(fileSize + 1);
  405. data.resize(fileSize);
  406. if (fileSize > 0) {
  407. if (fileSize != stream->Read(&data[0], 1, fileSize)) {
  408. throw DeadlyImportError("File read error");
  409. }
  410. ConvertToUTF8(data);
  411. }
  412. // append a binary zero to simplify string parsing
  413. data.push_back(0);
  414. }
  415. // ------------------------------------------------------------------------------------------------
  416. namespace Assimp {
  417. // Represents an import request
  418. struct LoadRequest {
  419. LoadRequest(const std::string &_file, unsigned int _flags, const BatchLoader::PropertyMap *_map, unsigned int _id) :
  420. file(_file),
  421. flags(_flags),
  422. refCnt(1),
  423. scene(nullptr),
  424. loaded(false),
  425. id(_id) {
  426. if (_map) {
  427. map = *_map;
  428. }
  429. }
  430. bool operator==(const std::string &f) const {
  431. return file == f;
  432. }
  433. const std::string file;
  434. unsigned int flags;
  435. unsigned int refCnt;
  436. aiScene *scene;
  437. bool loaded;
  438. BatchLoader::PropertyMap map;
  439. unsigned int id;
  440. };
  441. } // namespace Assimp
  442. // ------------------------------------------------------------------------------------------------
  443. // BatchLoader::pimpl data structure
  444. struct Assimp::BatchData {
  445. BatchData(IOSystem *pIO, bool validate) :
  446. pIOSystem(pIO), pImporter(nullptr), next_id(0xffff), validate(validate) {
  447. ai_assert(nullptr != pIO);
  448. pImporter = new Importer();
  449. pImporter->SetIOHandler(pIO);
  450. }
  451. ~BatchData() {
  452. pImporter->SetIOHandler(nullptr); /* get pointer back into our possession */
  453. delete pImporter;
  454. }
  455. // IO system to be used for all imports
  456. IOSystem *pIOSystem;
  457. // Importer used to load all meshes
  458. Importer *pImporter;
  459. // List of all imports
  460. std::list<LoadRequest> requests;
  461. // Base path
  462. std::string pathBase;
  463. // Id for next item
  464. unsigned int next_id;
  465. // Validation enabled state
  466. bool validate;
  467. };
  468. typedef std::list<LoadRequest>::iterator LoadReqIt;
  469. // ------------------------------------------------------------------------------------------------
  470. BatchLoader::BatchLoader(IOSystem *pIO, bool validate) {
  471. ai_assert(nullptr != pIO);
  472. m_data = new BatchData(pIO, validate);
  473. }
  474. // ------------------------------------------------------------------------------------------------
  475. BatchLoader::~BatchLoader() {
  476. // delete all scenes what have not been polled by the user
  477. for (LoadReqIt it = m_data->requests.begin(); it != m_data->requests.end(); ++it) {
  478. delete (*it).scene;
  479. }
  480. delete m_data;
  481. }
  482. // ------------------------------------------------------------------------------------------------
  483. void BatchLoader::setValidation(bool enabled) {
  484. m_data->validate = enabled;
  485. }
  486. // ------------------------------------------------------------------------------------------------
  487. bool BatchLoader::getValidation() const {
  488. return m_data->validate;
  489. }
  490. // ------------------------------------------------------------------------------------------------
  491. unsigned int BatchLoader::AddLoadRequest(const std::string &file,
  492. unsigned int steps /*= 0*/, const PropertyMap *map /*= nullptr*/) {
  493. ai_assert(!file.empty());
  494. // check whether we have this loading request already
  495. for (LoadReqIt it = m_data->requests.begin(); it != m_data->requests.end(); ++it) {
  496. // Call IOSystem's path comparison function here
  497. if (m_data->pIOSystem->ComparePaths((*it).file, file)) {
  498. if (map) {
  499. if (!((*it).map == *map)) {
  500. continue;
  501. }
  502. } else if (!(*it).map.empty()) {
  503. continue;
  504. }
  505. (*it).refCnt++;
  506. return (*it).id;
  507. }
  508. }
  509. // no, we don't have it. So add it to the queue ...
  510. m_data->requests.emplace_back(file, steps, map, m_data->next_id);
  511. return m_data->next_id++;
  512. }
  513. // ------------------------------------------------------------------------------------------------
  514. aiScene *BatchLoader::GetImport(unsigned int which) {
  515. for (LoadReqIt it = m_data->requests.begin(); it != m_data->requests.end(); ++it) {
  516. if ((*it).id == which && (*it).loaded) {
  517. aiScene *sc = (*it).scene;
  518. if (!(--(*it).refCnt)) {
  519. m_data->requests.erase(it);
  520. }
  521. return sc;
  522. }
  523. }
  524. return nullptr;
  525. }
  526. // ------------------------------------------------------------------------------------------------
  527. void BatchLoader::LoadAll() {
  528. // no threaded implementation for the moment
  529. for (LoadReqIt it = m_data->requests.begin(); it != m_data->requests.end(); ++it) {
  530. // force validation in debug builds
  531. unsigned int pp = (*it).flags;
  532. if (m_data->validate) {
  533. pp |= aiProcess_ValidateDataStructure;
  534. }
  535. // setup config properties if necessary
  536. ImporterPimpl *pimpl = m_data->pImporter->Pimpl();
  537. pimpl->mFloatProperties = (*it).map.floats;
  538. pimpl->mIntProperties = (*it).map.ints;
  539. pimpl->mStringProperties = (*it).map.strings;
  540. pimpl->mMatrixProperties = (*it).map.matrices;
  541. if (!DefaultLogger::isNullLogger()) {
  542. ASSIMP_LOG_INFO("%%% BEGIN EXTERNAL FILE %%%");
  543. ASSIMP_LOG_INFO("File: ", (*it).file);
  544. }
  545. m_data->pImporter->ReadFile((*it).file, pp);
  546. (*it).scene = m_data->pImporter->GetOrphanedScene();
  547. (*it).loaded = true;
  548. ASSIMP_LOG_INFO("%%% END EXTERNAL FILE %%%");
  549. }
  550. }