diff --git a/code/Assimp.cpp b/code/Assimp.cpp index b11951854..89b62d110 100644 --- a/code/Assimp.cpp +++ b/code/Assimp.cpp @@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "GenericProperty.h" #include "CInterfaceIOWrapper.h" +#include "../include/assimp/importerdesc.h" #include "Importer.h" // ------------------------------------------------------------------------------------------------ @@ -84,7 +85,11 @@ namespace Assimp /** Verbose logging active or not? */ static aiBool gVerboseLogging = false; -} + + /** will return all registered importers. */ + void GetImporterInstanceList(std::vector< BaseImporter* >& out); + +} // namespace assimp #ifndef ASSIMP_BUILD_SINGLETHREADED @@ -606,4 +611,22 @@ ASSIMP_API void aiIdentityMatrix4( *mat = aiMatrix4x4(); } +// ------------------------------------------------------------------------------------------------ +ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc( const char *extension ) { + if( NULL == extension ) { + return NULL; + } + const aiImporterDesc *desc( NULL ); + std::vector< BaseImporter* > out; + GetImporterInstanceList( out ); + for( size_t i = 0; i < out.size(); ++i ) { + if( 0 == strncmp( out[ i ]->GetInfo()->mFileExtensions, extension, strlen( extension ) ) ) { + desc = out[ i ]->GetInfo(); + break; + } + } + return desc; +} + +// ------------------------------------------------------------------------------------------------ diff --git a/code/BaseImporter.h b/code/BaseImporter.h index 23dc88523..c12ff256e 100644 --- a/code/BaseImporter.h +++ b/code/BaseImporter.h @@ -91,6 +91,7 @@ struct ScopeGuard private: // no copying allowed. + ScopeGuard(); ScopeGuard( const ScopeGuard & ); ScopeGuard &operator = ( const ScopeGuard & ); diff --git a/include/assimp/cimport.h b/include/assimp/cimport.h index adc27502b..9080c16b6 100644 --- a/include/assimp/cimport.h +++ b/include/assimp/cimport.h @@ -247,7 +247,7 @@ ASSIMP_API C_STRUCT aiLogStream aiGetPredefinedLogStream( * Attaching a log stream can slightly reduce Assimp's overall import * performance. Multiple log-streams can be attached. * @param stream Describes the new log stream. - * @note To ensure proepr destruction of the logging system, you need to manually + * @note To ensure proper destruction of the logging system, you need to manually * call aiDetachLogStream() on every single log stream you attach. * Alternatively (for the lazy folks) #aiDetachAllLogStreams is provided. */ diff --git a/include/assimp/importerdesc.h b/include/assimp/importerdesc.h index 32b0013ae..2f888b5aa 100644 --- a/include/assimp/importerdesc.h +++ b/include/assimp/importerdesc.h @@ -133,4 +133,6 @@ struct aiImporterDesc const char* mFileExtensions; }; +ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc( const char *extension ); + #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d9407634d..8c03192ac 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,7 +16,8 @@ SOURCE_GROUP( unit FILES ) SET( TEST_SRCS - unit/utFastAtof.cpp + unit/AssimpAPITest.cpp + unit/utFastAtof.cpp unit/utFindDegenerates.cpp unit/utFindInvalidData.cpp unit/utFixInfacingNormals.cpp