From 170063643cfaf86514b2d28d0c2d1ceae7df4791 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Wed, 23 Jun 2021 18:11:52 -0400 Subject: [PATCH 1/2] include/material.h: Fixed broken C support - The aiGetMaterialFloat() and aiGetMaterialInteger() C preprocessor definitions were broken because: - They had a space before the opening parenthesis - Using material key definitions expanding 1 to argument into 3 breaks the invocation of macros expecting 5 parameters --- include/assimp/material.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/assimp/material.h b/include/assimp/material.h index 2024be07f..9b0c92b0d 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -1499,7 +1499,7 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray( ai_real *pOut, unsigned int *pMax); -#ifdef __cplusplus +#if 1 //def __cplusplus // --------------------------------------------------------------------------- /** @brief Retrieve a single float property with a specific key from the material. @@ -1520,7 +1520,7 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray( * @return Specifies whether the key has been found. If not, the output * float remains unmodified.*/ // --------------------------------------------------------------------------- -inline aiReturn aiGetMaterialFloat(const aiMaterial *pMat, +inline aiReturn aiGetMaterialFloat(const C_STRUCT aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, @@ -1530,8 +1530,8 @@ inline aiReturn aiGetMaterialFloat(const aiMaterial *pMat, #else -// Use our friend, the C preprocessor -#define aiGetMaterialFloat (pMat, type, index, pKey, pOut) \ +// Use our friend, the C preprocessor // The macro does not work with e.g. AI_MATKEY_OPACITY expanding into 3 args +#define aiGetMaterialFloat(pMat, type, index, pKey, pOut) \ aiGetMaterialFloatArray(pMat, type, index, pKey, pOut, NULL) #endif //!__cplusplus @@ -1548,7 +1548,7 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial * int *pOut, unsigned int *pMax); -#ifdef __cplusplus +#if 1 //def __cplusplus // --------------------------------------------------------------------------- /** @brief Retrieve an integer property with a specific key from a material @@ -1566,7 +1566,7 @@ inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial *pMat, #else // use our friend, the C preprocessor -#define aiGetMaterialInteger (pMat, type, index, pKey, pOut) \ +#define aiGetMaterialInteger(pMat, type, index, pKey, pOut) \ aiGetMaterialIntegerArray(pMat, type, index, pKey, pOut, NULL) #endif //!__cplusplus From 00bf7576883d7cf3edfffe51390855d293848a4e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 24 Jun 2021 13:28:49 +0200 Subject: [PATCH 2/2] Update material.h --- include/assimp/material.h | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/include/assimp/material.h b/include/assimp/material.h index 9b0c92b0d..f0207c6de 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -1499,8 +1499,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray( ai_real *pOut, unsigned int *pMax); -#if 1 //def __cplusplus - // --------------------------------------------------------------------------- /** @brief Retrieve a single float property with a specific key from the material. * @@ -1528,14 +1526,6 @@ inline aiReturn aiGetMaterialFloat(const C_STRUCT aiMaterial *pMat, return aiGetMaterialFloatArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0); } -#else - -// Use our friend, the C preprocessor // The macro does not work with e.g. AI_MATKEY_OPACITY expanding into 3 args -#define aiGetMaterialFloat(pMat, type, index, pKey, pOut) \ - aiGetMaterialFloatArray(pMat, type, index, pKey, pOut, NULL) - -#endif //!__cplusplus - // --------------------------------------------------------------------------- /** @brief Retrieve an array of integer values with a specific key * from a material @@ -1548,8 +1538,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial * int *pOut, unsigned int *pMax); -#if 1 //def __cplusplus - // --------------------------------------------------------------------------- /** @brief Retrieve an integer property with a specific key from a material * @@ -1563,14 +1551,6 @@ inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial *pMat, return aiGetMaterialIntegerArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0); } -#else - -// use our friend, the C preprocessor -#define aiGetMaterialInteger(pMat, type, index, pKey, pOut) \ - aiGetMaterialIntegerArray(pMat, type, index, pKey, pOut, NULL) - -#endif //!__cplusplus - // --------------------------------------------------------------------------- /** @brief Retrieve a color value from the material property table *