MCPcopy Create free account
hub / github.com/assimp/assimp / RegisterLoader

Method RegisterLoader

code/Common/Importer.cpp:216–247  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------ Register a custom loader plugin

Source from the content-addressed store, hash-verified

214// ------------------------------------------------------------------------------------------------
215// Register a custom loader plugin
216aiReturn Importer::RegisterLoader(BaseImporter* pImp) {
217 ai_assert(nullptr != pImp);
218
219 ASSIMP_BEGIN_EXCEPTION_REGION();
220
221 // --------------------------------------------------------------------
222 // Check whether we would have two loaders for the same file extension
223 // This is absolutely OK, but we should warn the developer of the new
224 // loader that his code will probably never be called if the first
225 // loader is a bit too lazy in his file checking.
226 // --------------------------------------------------------------------
227 std::set<std::string> st;
228 std::string baked;
229 pImp->GetExtensionList(st);
230
231 for(std::set<std::string>::const_iterator it = st.begin(); it != st.end(); ++it) {
232
233#ifdef ASSIMP_BUILD_DEBUG
234 if (IsExtensionSupported(*it)) {
235 ASSIMP_LOG_WARN("The file extension ", *it, " is already in use");
236 }
237#endif
238 baked += *it;
239 }
240
241 // add the loader
242 pimpl->mImporter.push_back(pImp);
243 ASSIMP_LOG_INFO("Registering custom importer for these file extensions: ", baked);
244 ASSIMP_END_EXCEPTION_REGION(aiReturn);
245
246 return AI_SUCCESS;
247}
248
249// ------------------------------------------------------------------------------------------------
250// Unregister a custom loader plugin

Callers 1

TEST_FFunction · 0.80

Calls 4

GetExtensionListMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected