فهرست منبع

Creating the functionality to list all Importer descriptions and the number of importers available.

Jaime Machado Neto 10 سال پیش
والد
کامیت
de6f0f2a7d
3فایلهای تغییر یافته به همراه30 افزوده شده و 1 حذف شده
  1. 15 0
      code/Assimp.cpp
  2. 14 0
      include/assimp/cimport.h
  3. 1 1
      include/assimp/importerdesc.h

+ 15 - 0
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)

+ 14 - 0
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 <assimp/importerdesc.h>
 
 #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

+ 1 - 1
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