Improved prototype of Importer & Exporter SetProperty* functions for better integration with tools such as SWIG
This commit is contained in:
@@ -483,7 +483,7 @@ ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szNam
|
||||
{
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
|
||||
SetGenericProperty<int>(pp->ints,szName,value,NULL);
|
||||
SetGenericProperty<int>(pp->ints,szName,value);
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName,
|
||||
{
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
|
||||
SetGenericProperty<float>(pp->floats,szName,value,NULL);
|
||||
SetGenericProperty<float>(pp->floats,szName,value);
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ ASSIMP_API void aiSetImportPropertyString(aiPropertyStore* p, const char* szName
|
||||
}
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
|
||||
SetGenericProperty<std::string>(pp->strings,szName,std::string(st->C_Str()),NULL);
|
||||
SetGenericProperty<std::string>(pp->strings,szName,std::string(st->C_Str()));
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore* p, const char* szName
|
||||
}
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
|
||||
SetGenericProperty<aiMatrix4x4>(pp->matrices,szName,*mat,NULL);
|
||||
SetGenericProperty<aiMatrix4x4>(pp->matrices,szName,*mat);
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
}
|
||||
|
||||
|
||||
@@ -507,34 +507,30 @@ ExportProperties::ExportProperties(const ExportProperties &other)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
void ExportProperties :: SetPropertyInteger(const char* szName, int iValue,
|
||||
bool* bWasExisting /*= NULL*/)
|
||||
bool ExportProperties :: SetPropertyInteger(const char* szName, int iValue)
|
||||
{
|
||||
SetGenericProperty<int>(mIntProperties, szName,iValue,bWasExisting);
|
||||
return SetGenericProperty<int>(mIntProperties, szName,iValue);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
void ExportProperties :: SetPropertyFloat(const char* szName, float iValue,
|
||||
bool* bWasExisting /*= NULL*/)
|
||||
bool ExportProperties :: SetPropertyFloat(const char* szName, float iValue)
|
||||
{
|
||||
SetGenericProperty<float>(mFloatProperties, szName,iValue,bWasExisting);
|
||||
return SetGenericProperty<float>(mFloatProperties, szName,iValue);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
void ExportProperties :: SetPropertyString(const char* szName, const std::string& value,
|
||||
bool* bWasExisting /*= NULL*/)
|
||||
bool ExportProperties :: SetPropertyString(const char* szName, const std::string& value)
|
||||
{
|
||||
SetGenericProperty<std::string>(mStringProperties, szName,value,bWasExisting);
|
||||
return SetGenericProperty<std::string>(mStringProperties, szName,value);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
void ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value,
|
||||
bool* bWasExisting /*= NULL*/)
|
||||
bool ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
|
||||
{
|
||||
SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value,bWasExisting);
|
||||
return SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -46,22 +46,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
inline void SetGenericProperty(std::map< unsigned int, T >& list,
|
||||
const char* szName, const T& value, bool* bWasExisting = NULL)
|
||||
inline bool SetGenericProperty(std::map< unsigned int, T >& list,
|
||||
const char* szName, const T& value)
|
||||
{
|
||||
ai_assert(NULL != szName);
|
||||
const uint32_t hash = SuperFastHash(szName);
|
||||
|
||||
typename std::map<unsigned int, T>::iterator it = list.find(hash);
|
||||
if (it == list.end()) {
|
||||
if (bWasExisting)
|
||||
*bWasExisting = false;
|
||||
list.insert(std::pair<unsigned int, T>( hash, value ));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
(*it).second = value;
|
||||
if (bWasExisting)
|
||||
*bWasExisting = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -919,42 +919,46 @@ void Importer::GetExtensionList(aiString& szOut) const
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
void Importer::SetPropertyInteger(const char* szName, int iValue,
|
||||
bool* bWasExisting /*= NULL*/)
|
||||
bool Importer::SetPropertyInteger(const char* szName, int iValue)
|
||||
{
|
||||
bool exising;
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
SetGenericProperty<int>(pimpl->mIntProperties, szName,iValue,bWasExisting);
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
exising = SetGenericProperty<int>(pimpl->mIntProperties, szName,iValue);
|
||||
ASSIMP_END_EXCEPTION_REGION(bool);
|
||||
return exising;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
void Importer::SetPropertyFloat(const char* szName, float iValue,
|
||||
bool* bWasExisting /*= NULL*/)
|
||||
bool Importer::SetPropertyFloat(const char* szName, float iValue)
|
||||
{
|
||||
bool exising;
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
SetGenericProperty<float>(pimpl->mFloatProperties, szName,iValue,bWasExisting);
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
exising = SetGenericProperty<float>(pimpl->mFloatProperties, szName,iValue);
|
||||
ASSIMP_END_EXCEPTION_REGION(bool);
|
||||
return exising;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
void Importer::SetPropertyString(const char* szName, const std::string& value,
|
||||
bool* bWasExisting /*= NULL*/)
|
||||
bool Importer::SetPropertyString(const char* szName, const std::string& value)
|
||||
{
|
||||
bool exising;
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value,bWasExisting);
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
exising = SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value);
|
||||
ASSIMP_END_EXCEPTION_REGION(bool);
|
||||
return exising;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
void Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value,
|
||||
bool* bWasExisting /*= NULL*/)
|
||||
bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
|
||||
{
|
||||
bool exising;
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
SetGenericProperty<aiMatrix4x4>(pimpl->mMatrixProperties, szName,value,bWasExisting);
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
exising = SetGenericProperty<aiMatrix4x4>(pimpl->mMatrixProperties, szName,value);
|
||||
ASSIMP_END_EXCEPTION_REGION(bool);
|
||||
return exising;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -556,7 +556,7 @@ bool MD3Importer::ReadMultipartFile()
|
||||
|
||||
// ensure we won't try to load ourselves recursively
|
||||
BatchLoader::PropertyMap props;
|
||||
SetGenericProperty( props.ints, AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART, 0, NULL);
|
||||
SetGenericProperty( props.ints, AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART, 0);
|
||||
|
||||
// now read these three files
|
||||
BatchLoader batch(mIOHandler);
|
||||
|
||||
Reference in New Issue
Block a user