From de6f0f2a7d810c8e4cae8e28d77b2a9c312f27c9 Mon Sep 17 00:00:00 2001 From: Jaime Machado Neto Date: Tue, 26 May 2015 08:40:43 -0300 Subject: [PATCH] Creating the functionality to list all Importer descriptions and the number of importers available. --- code/Assimp.cpp | 15 +++++++++++++++ include/assimp/cimport.h | 14 ++++++++++++++ include/assimp/importerdesc.h | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/code/Assimp.cpp b/code/Assimp.cpp index f8df73415..ec5fd7ab7 100644 --- a/code/Assimp.cpp +++ b/code/Assimp.cpp @@ -423,6 +423,21 @@ const char* aiGetErrorString() return gLastErrorString.c_str(); } +// ----------------------------------------------------------------------------------------------- +// Return the description of a importer given its index +const aiImporterDesc* aiGetImportFormatDescription( size_t pIndex) +{ + return Importer().GetImporterInfo(pIndex); +} + +// ----------------------------------------------------------------------------------------------- +// Return the number of importers +size_t aiGetImportFormatCount(void) +{ + return Importer().GetImporterCount(); +} + + // ------------------------------------------------------------------------------------------------ // Returns the error text of the last failed import process. aiBool aiIsExtensionSupported(const char* szExtension) diff --git a/include/assimp/cimport.h b/include/assimp/cimport.h index 6e85882d1..3dc95c00b 100644 --- a/include/assimp/cimport.h +++ b/include/assimp/cimport.h @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_ASSIMP_H_INC #define AI_ASSIMP_H_INC #include "types.h" +#include #ifdef __cplusplus extern "C" { @@ -539,7 +540,20 @@ ASSIMP_API void aiIdentityMatrix3( ASSIMP_API void aiIdentityMatrix4( C_STRUCT aiMatrix4x4* mat); +// -------------------------------------------------------------------------------- +/** Returns the number of import file formats available in the current Assimp build. + * Use aiGetImportFormatDescription() to retrieve infos of a specific import format. + */ +ASSIMP_API size_t aiGetImportFormatCount(void); +// -------------------------------------------------------------------------------- +/** Returns a description of the nth import file format. Use #aiGetImportFormatCount() + * to learn how many import formats are supported. + * @param pIndex Index of the import format to retrieve information for. Valid range is + * 0 to #aiGetImportFormatCount() + * @return A description of that specific import format. NULL if pIndex is out of range. + */ +ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImportFormatDescription( size_t pIndex); #ifdef __cplusplus } #endif diff --git a/include/assimp/importerdesc.h b/include/assimp/importerdesc.h index e61112a17..a7bbb4da1 100644 --- a/include/assimp/importerdesc.h +++ b/include/assimp/importerdesc.h @@ -138,6 +138,6 @@ Will return a NULL-pointer if no assigned importer desc. was found for the given \param extension [in] The extension to look for \return A pointer showing to the ImporterDesc, \see aiImporterDesc. */ -ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc( const char *extension ); +ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension ); #endif