------------------------------------------------------------------------------------------------ Imports the given file and returns the imported data.
| 109 | // ------------------------------------------------------------------------------------------------ |
| 110 | // Imports the given file and returns the imported data. |
| 111 | aiScene *BaseImporter::ReadFile(Importer *pImp, const std::string &pFile, IOSystem *pIOHandler) { |
| 112 | |
| 113 | m_progress = pImp->GetProgressHandler(); |
| 114 | if (nullptr == m_progress) { |
| 115 | return nullptr; |
| 116 | } |
| 117 | |
| 118 | ai_assert(m_progress); |
| 119 | |
| 120 | // Gather configuration properties for this run |
| 121 | SetupProperties(pImp); |
| 122 | |
| 123 | // Construct a file system filter to improve our success ratio at reading external files |
| 124 | FileSystemFilter filter(pFile, pIOHandler); |
| 125 | |
| 126 | // create a scene object to hold the data |
| 127 | std::unique_ptr<aiScene> sc(new aiScene()); |
| 128 | |
| 129 | // dispatch importing |
| 130 | try { |
| 131 | InternReadFile(pFile, sc.get(), &filter); |
| 132 | |
| 133 | // Calculate import scale hook - required because pImp not available anywhere else |
| 134 | // passes scale into ScaleProcess |
| 135 | UpdateImporterScale(pImp); |
| 136 | |
| 137 | } catch( const std::exception &err ) { |
| 138 | // extract error description |
| 139 | m_ErrorText = err.what(); |
| 140 | ASSIMP_LOG_ERROR(err.what()); |
| 141 | m_Exception = std::current_exception(); |
| 142 | return nullptr; |
| 143 | } |
| 144 | |
| 145 | // return what we gathered from the import. |
| 146 | return sc.release(); |
| 147 | } |
| 148 | |
| 149 | // ------------------------------------------------------------------------------------------------ |
| 150 | void BaseImporter::SetupProperties(const Importer *) { |
no test coverage detected