closes https://github.com/assimp/assimp/issues/3198: make aiMaterial::GetName const.

pull/3494/head
Kim Kulling 2020-11-10 12:50:17 +01:00
parent 957e468c8a
commit 8c91d1a3cd
3 changed files with 440 additions and 479 deletions

View File

@ -402,7 +402,7 @@ aiMaterial::~aiMaterial() {
}
// ------------------------------------------------------------------------------------------------
aiString aiMaterial::GetName() {
aiString aiMaterial::GetName() const {
aiString name;
Get(AI_MATKEY_NAME, name);

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -80,8 +78,7 @@ extern "C" {
* @endcode
* where 'diffContrib' is the intensity of the incoming light for that pixel.
*/
enum aiTextureOp
{
enum aiTextureOp {
/** T = T1 * T2 */
aiTextureOp_Multiply = 0x0,
@ -100,7 +97,6 @@ enum aiTextureOp
/** T = T1 + (T2-0.5) */
aiTextureOp_SignedAdd = 0x5,
#ifndef SWIG
_aiTextureOp_Force32Bit = INT_MAX
#endif
@ -111,8 +107,7 @@ enum aiTextureOp
*
* Commonly referred to as 'wrapping mode'.
*/
enum aiTextureMapMode
{
enum aiTextureMapMode {
/** A texture coordinate u|v is translated to u%1|v%1
*/
aiTextureMapMode_Wrap = 0x0,
@ -146,8 +141,7 @@ enum aiTextureMapMode
* how the mapping should look like (e.g spherical) is given.
* See the #AI_MATKEY_MAPPING property for more details.
*/
enum aiTextureMapping
{
enum aiTextureMapping {
/** The mapping coordinates are taken from an UV channel.
*
* The #AI_MATKEY_UVWSRC key specifies from which UV channel
@ -171,7 +165,6 @@ enum aiTextureMapping
/** Undefined mapping. Have fun. */
aiTextureMapping_OTHER = 0x5,
#ifndef SWIG
_aiTextureMapping_Force32Bit = INT_MAX
#endif
@ -192,8 +185,7 @@ enum aiTextureMapping
* and the artists working on models have to conform to this specification,
* regardless which 3D tool they're using.
*/
enum aiTextureType
{
enum aiTextureType {
/** Dummy value.
*
* No texture, but the value to be used as 'texture semantic'
@ -304,7 +296,6 @@ enum aiTextureType
*/
aiTextureType_UNKNOWN = 18,
#ifndef SWIG
_aiTextureType_Force32Bit = INT_MAX
#endif
@ -326,10 +317,9 @@ ASSIMP_API const char* TextureTypeToString(enum aiTextureType in);
* undefined). <br>
* Again, this value is just a hint. Assimp tries to select the shader whose
* most common implementation matches the original rendering results of the
* 3D modeller which wrote a particular model as closely as possible.
* 3D modeler which wrote a particular model as closely as possible.
*/
enum aiShadingMode
{
enum aiShadingMode {
/** Flat shading. Shading is done on per-face base,
* diffuse only. Also known as 'faceted shading'.
*/
@ -381,13 +371,11 @@ enum aiShadingMode
*/
aiShadingMode_Fresnel = 0xa,
#ifndef SWIG
_aiShadingMode_Force32Bit = INT_MAX
#endif
};
// ---------------------------------------------------------------------------
/** @brief Defines some mixed flags for a particular texture.
*
@ -399,8 +387,7 @@ enum aiShadingMode
*
* This corresponds to the #AI_MATKEY_TEXFLAGS property.
*/
enum aiTextureFlags
{
enum aiTextureFlags {
/** The texture's color values have to be inverted (component-wise 1-n)
*/
aiTextureFlags_Invert = 0x1,
@ -428,7 +415,6 @@ enum aiTextureFlags
#endif
};
// ---------------------------------------------------------------------------
/** @brief Defines alpha-blend flags.
*
@ -440,13 +426,12 @@ enum aiTextureFlags
* @code
* SourceColor * SourceBlend + DestColor * DestBlend
* @endcode
* where DestColor is the previous color in the framebuffer at this
* where DestColor is the previous color in the frame-buffer at this
* position and SourceColor is the material color before the transparency
* calculation.<br>
* This corresponds to the #AI_MATKEY_BLEND_FUNC property.
*/
enum aiBlendMode
{
enum aiBlendMode {
/**
* Formula:
* @code
@ -472,7 +457,6 @@ enum aiBlendMode
#endif
};
#include "./Compiler/pushpack1.h"
// ---------------------------------------------------------------------------
@ -485,8 +469,7 @@ enum aiBlendMode
* we keep separate scaling/translation/rotation values to make it
* easier to process and optimize UV transformations internally.
*/
struct aiUVTransform
{
struct aiUVTransform {
/** Translation on the u and v axes.
*
* The default value is (0|0).
@ -507,17 +490,14 @@ struct aiUVTransform
*/
ai_real mRotation;
#ifdef __cplusplus
aiUVTransform() AI_NO_EXCEPT
: mTranslation (0.0,0.0)
, mScaling (1.0,1.0)
, mRotation (0.0)
{
: mTranslation(0.0, 0.0),
mScaling(1.0, 1.0),
mRotation(0.0) {
// nothing to be done here ...
}
#endif
};
#include "./Compiler/poppack1.h"
@ -527,8 +507,7 @@ struct aiUVTransform
/** @brief A very primitive RTTI system for the contents of material
* properties.
*/
enum aiPropertyTypeInfo
{
enum aiPropertyTypeInfo {
/** Array of single-precision (32 Bit) floats
*
* It is possible to use aiGetMaterialInteger[Array]() (or the C++-API
@ -560,12 +539,10 @@ enum aiPropertyTypeInfo
*/
aiPTI_Integer = 0x4,
/** Simple binary buffer, content undefined. Not convertible to anything.
*/
aiPTI_Buffer = 0x5,
/** This value is not used. It is just there to force the
* compiler to map this enum to a 32 Bit integer.
*/
@ -594,8 +571,7 @@ enum aiPropertyTypeInfo
* @endcode
* @see aiMaterial
*/
struct aiMaterialProperty
{
struct aiMaterialProperty {
/** Specifies the name of the property (key)
* Keys are generally case insensitive.
*/
@ -634,11 +610,11 @@ struct aiMaterialProperty
#ifdef __cplusplus
aiMaterialProperty() AI_NO_EXCEPT
: mSemantic( 0 )
, mIndex( 0 )
, mDataLength( 0 )
, mType( aiPTI_Float )
, mData(nullptr) {
: mSemantic(0),
mIndex(0),
mDataLength(0),
mType(aiPTI_Float),
mData(nullptr) {
// empty
}
@ -674,7 +650,6 @@ struct aiMaterial
#ifdef __cplusplus
public:
aiMaterial();
~aiMaterial();
@ -684,7 +659,7 @@ public:
* @return The name of the material.
*/
// -------------------------------------------------------------------
aiString GetName();
aiString GetName() const;
// -------------------------------------------------------------------
/** @brief Retrieve an array of Type values with a specific key
@ -722,7 +697,6 @@ public:
aiReturn Get(const char *pKey, unsigned int type,
unsigned int idx, Type &pOut) const;
aiReturn Get(const char *pKey, unsigned int type,
unsigned int idx, int &pOut) const;
@ -788,10 +762,8 @@ public:
aiTextureOp *op = NULL,
aiTextureMapMode *mapmode = NULL) const;
// Setters
// ------------------------------------------------------------------------------
/** @brief Add a property with a given key and type info to the material
* structure
@ -903,7 +875,6 @@ public:
static void CopyPropertyList(aiMaterial *pcDest,
const aiMaterial *pcSrc);
#endif
/** List of all material properties loaded. */
@ -1414,7 +1385,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray(
ai_real *pOut,
unsigned int *pMax);
#ifdef __cplusplus
// ---------------------------------------------------------------------------
@ -1440,8 +1410,7 @@ inline aiReturn aiGetMaterialFloat(const aiMaterial* pMat,
const char *pKey,
unsigned int type,
unsigned int index,
ai_real* pOut)
{
ai_real *pOut) {
return aiGetMaterialFloatArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0);
}
@ -1453,7 +1422,6 @@ inline aiReturn aiGetMaterialFloat(const aiMaterial* pMat,
#endif //!__cplusplus
// ---------------------------------------------------------------------------
/** @brief Retrieve an array of integer values with a specific key
* from a material
@ -1466,7 +1434,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial*
int *pOut,
unsigned int *pMax);
#ifdef __cplusplus
// ---------------------------------------------------------------------------
@ -1478,8 +1445,7 @@ inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial* pMat,
const char *pKey,
unsigned int type,
unsigned int index,
int* pOut)
{
int *pOut) {
return aiGetMaterialIntegerArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0);
}
@ -1502,7 +1468,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial* pMat,
unsigned int index,
C_STRUCT aiColor4D *pOut);
// ---------------------------------------------------------------------------
/** @brief Retrieve a aiUVTransform value from the material property table
*
@ -1514,7 +1479,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialUVTransform(const C_STRUCT aiMaterial* p
unsigned int index,
C_STRUCT aiUVTransform *pOut);
// ---------------------------------------------------------------------------
/** @brief Retrieve a string from the material property table
*
@ -1597,7 +1561,6 @@ C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
unsigned int *flags /*= NULL*/);
#endif // !#ifdef __cplusplus
#ifdef __cplusplus
}

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,