------------------------------------------------------------------------------------------------
| 177 | |
| 178 | // ------------------------------------------------------------------------------------------------ |
| 179 | const aiScene *aiImportFileExWithProperties(const char *pFile, unsigned int pFlags, |
| 180 | aiFileIO *pFS, const aiPropertyStore *props) { |
| 181 | ai_assert(nullptr != pFile); |
| 182 | |
| 183 | const aiScene *scene = nullptr; |
| 184 | ASSIMP_BEGIN_EXCEPTION_REGION(); |
| 185 | |
| 186 | // create an Importer for this file |
| 187 | Assimp::Importer *imp = new Assimp::Importer(); |
| 188 | |
| 189 | // copy properties |
| 190 | if (props) { |
| 191 | const PropertyMap *pp = reinterpret_cast<const PropertyMap *>(props); |
| 192 | ImporterPimpl *pimpl = imp->Pimpl(); |
| 193 | pimpl->mIntProperties = pp->ints; |
| 194 | pimpl->mFloatProperties = pp->floats; |
| 195 | pimpl->mStringProperties = pp->strings; |
| 196 | pimpl->mMatrixProperties = pp->matrices; |
| 197 | } |
| 198 | // setup a custom IO system if necessary |
| 199 | if (pFS) { |
| 200 | imp->SetIOHandler(new CIOSystemWrapper(pFS)); |
| 201 | } |
| 202 | |
| 203 | // and have it read the file |
| 204 | scene = imp->ReadFile(pFile, pFlags); |
| 205 | |
| 206 | // if succeeded, store the importer in the scene and keep it alive |
| 207 | if (scene) { |
| 208 | ScenePrivateData *priv = const_cast<ScenePrivateData *>(ScenePriv(scene)); |
| 209 | priv->mOrigImporter = imp; |
| 210 | } else { |
| 211 | // if failed, extract error code and destroy the import |
| 212 | gLastErrorString = imp->GetErrorString(); |
| 213 | delete imp; |
| 214 | } |
| 215 | |
| 216 | // return imported data. If the import failed the pointer is nullptr anyways |
| 217 | ASSIMP_END_EXCEPTION_REGION(const aiScene *); |
| 218 | |
| 219 | return scene; |
| 220 | } |
| 221 | |
| 222 | // ------------------------------------------------------------------------------------------------ |
| 223 | const aiScene *aiImportFileFromMemory( |
no test coverage detected