| 541 | } |
| 542 | |
| 543 | void MaterialLoader::loadLibrary(const std::shared_ptr<MaterialLibraryLocal>& library) |
| 544 | { |
| 545 | if (_materialEntryMap == nullptr) { |
| 546 | _materialEntryMap = std::make_unique<std::map<QString, std::shared_ptr<MaterialEntry>>>(); |
| 547 | } |
| 548 | |
| 549 | QDirIterator it(library->getDirectory(), QDirIterator::Subdirectories); |
| 550 | while (it.hasNext()) { |
| 551 | auto pathname = it.next(); |
| 552 | QFileInfo file(pathname); |
| 553 | if (file.isFile()) { |
| 554 | if (file.suffix().toStdString() == "FCMat") { |
| 555 | try { |
| 556 | auto model = getMaterialFromPath(library, file.canonicalFilePath()); |
| 557 | if (model) { |
| 558 | (*_materialEntryMap)[model->getUUID()] = model; |
| 559 | } |
| 560 | } |
| 561 | catch (const MaterialReadError&) { |
| 562 | // Ignore the file. Error messages should have already been logged |
| 563 | } |
| 564 | } |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | for (auto& it : *_materialEntryMap) { |
| 569 | it.second->addToTree(_materialMap); |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | void MaterialLoader::loadLibraries( |
| 574 | const std::shared_ptr<std::list<std::shared_ptr<MaterialLibrary>>>& libraryList) |
nothing calls this directly
no test coverage detected