diff --git a/code/Exporter.cpp b/code/Exporter.cpp index 07f92de4c..3eb406c35 100644 --- a/code/Exporter.cpp +++ b/code/Exporter.cpp @@ -492,13 +492,18 @@ void Exporter :: UnregisterExporter(const char* id) } } -void ExportProperties :: CopyProperties(ExportProperties* dest,const ExportProperties* source) +ExportProperties :: ExportProperties() { - if (!source || !dest) return; - dest->mIntProperties = IntPropertyMap(source->mIntProperties); - dest->mFloatProperties = FloatPropertyMap(source->mFloatProperties); - dest->mStringProperties = StringPropertyMap(source->mStringProperties); - dest->mMatrixProperties = MatrixPropertyMap(source->mMatrixProperties); + +} + +ExportProperties :: ExportProperties(const ExportProperties* source) +{ + if (!source) return; + mIntProperties = IntPropertyMap(source->mIntProperties); + mFloatProperties = FloatPropertyMap(source->mFloatProperties); + mStringProperties = StringPropertyMap(source->mStringProperties); + mMatrixProperties = MatrixPropertyMap(source->mMatrixProperties); } @@ -507,9 +512,7 @@ void ExportProperties :: CopyProperties(ExportProperties* dest,const ExportPrope void ExportProperties :: SetPropertyInteger(const char* szName, int iValue, bool* bWasExisting /*= NULL*/) { - ASSIMP_BEGIN_EXCEPTION_REGION(); - SetGenericProperty(mIntProperties, szName,iValue,bWasExisting); - ASSIMP_END_EXCEPTION_REGION(void); + SetGenericProperty(mIntProperties, szName,iValue,bWasExisting); } // ------------------------------------------------------------------------------------------------ @@ -517,9 +520,7 @@ void ExportProperties :: SetPropertyInteger(const char* szName, int iValue, void ExportProperties :: SetPropertyFloat(const char* szName, float iValue, bool* bWasExisting /*= NULL*/) { - ASSIMP_BEGIN_EXCEPTION_REGION(); - SetGenericProperty(mFloatProperties, szName,iValue,bWasExisting); - ASSIMP_END_EXCEPTION_REGION(void); + SetGenericProperty(mFloatProperties, szName,iValue,bWasExisting); } // ------------------------------------------------------------------------------------------------ @@ -527,9 +528,7 @@ void ExportProperties :: SetPropertyFloat(const char* szName, float iValue, void ExportProperties :: SetPropertyString(const char* szName, const std::string& value, bool* bWasExisting /*= NULL*/) { - ASSIMP_BEGIN_EXCEPTION_REGION(); - SetGenericProperty(mStringProperties, szName,value,bWasExisting); - ASSIMP_END_EXCEPTION_REGION(void); + SetGenericProperty(mStringProperties, szName,value,bWasExisting); } // ------------------------------------------------------------------------------------------------ @@ -537,9 +536,7 @@ void ExportProperties :: SetPropertyString(const char* szName, const std::string void ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value, bool* bWasExisting /*= NULL*/) { - ASSIMP_BEGIN_EXCEPTION_REGION(); - SetGenericProperty(mMatrixProperties, szName,value,bWasExisting); - ASSIMP_END_EXCEPTION_REGION(void); + SetGenericProperty(mMatrixProperties, szName,value,bWasExisting); } // ------------------------------------------------------------------------------------------------ diff --git a/code/XFileExporter.cpp b/code/XFileExporter.cpp index 8e95be289..bb9579708 100644 --- a/code/XFileExporter.cpp +++ b/code/XFileExporter.cpp @@ -79,12 +79,11 @@ void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pSce } // create/copy Properties - ExportProperties props; - ExportProperties::CopyProperties(&props, pProperties); + ExportProperties props(pProperties); // set standard properties if not set - if (!props.HasPropertyBool("AI_CONFIG_XFILE_64BIT")) props.SetPropertyBool("AI_CONFIG_XFILE_64BIT", false); - if (!props.HasPropertyBool("AI_CONFIG_XFILE_BAKETRANSFORM")) props.SetPropertyBool("AI_CONFIG_XFILE_BAKETRANSFORM", false); + if (!props.HasPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT)) props.SetPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT, false); + if (!props.HasPropertyBool(AI_CONFIG_EXPORT_XFILE_BAKETRANSFORM)) props.SetPropertyBool(AI_CONFIG_EXPORT_XFILE_BAKETRANSFORM, false); // invoke the exporter XFileExporter iDoTheExportThing( pScene, pIOSystem, path, file, &props); @@ -106,9 +105,6 @@ void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pSce // Constructor for a specific scene to export XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mIOSystem(pIOSystem), mPath(path), mFile(file), mProperties(pProperties) { - //DefaultLogger::get()->debug(boost::str( boost::format( "AI_CONFIG_XFILE_64BIT <%i>.") % mProperties->GetPropertyBool("AI_CONFIG_XFILE_64BIT", false))); - //DefaultLogger::get()->debug(boost::str( boost::format( "AI_CONFIG_XFILE_BAKETRANSFORM <%i>.") % mProperties->GetPropertyBool("AI_CONFIG_XFILE_BAKETRANSFORM", false))); - // make sure that all formatting happens using the standard, C locale and not the user's current locale mOutput.imbue( std::locale("C") ); @@ -159,7 +155,7 @@ void XFileExporter::WriteFile() // Writes the asset header void XFileExporter::WriteHeader() { - if (mProperties->GetPropertyBool("AI_CONFIG_XFILE_64BIT") == true) + if (mProperties->GetPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT) == true) mOutput << startstr << "xof 0303txt 0064" << endstr; else mOutput << startstr << "xof 0303txt 0032" << endstr; diff --git a/include/assimp/Exporter.hpp b/include/assimp/Exporter.hpp index 0e32d4397..fb88f8e16 100644 --- a/include/assimp/Exporter.hpp +++ b/include/assimp/Exporter.hpp @@ -328,13 +328,17 @@ public: public: - // ------------------------------------------------------------------- - /** Get a deep copy of a scene - * - * @param dest Receives a pointer to the destination scene - * @param src Source scene - remains unmodified. - */ - static void CopyProperties(ExportProperties* dest,const ExportProperties* source); + /** Standard constructor + * @see ExportProperties() + */ + + ExportProperties(); + + /** Copy constructor + * @see ExportProperties(const ExportProperties* source) + */ + ExportProperties(const ExportProperties* source); + // ------------------------------------------------------------------- /** Set an integer configuration property. diff --git a/include/assimp/config.h b/include/assimp/config.h index abe3f1102..0e8457995 100644 --- a/include/assimp/config.h +++ b/include/assimp/config.h @@ -879,4 +879,21 @@ enum aiComponent #define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION "IMPORT_COLLADA_IGNORE_UP_DIRECTION" + +// ---------- All the Export defines ------------ + +/** @brief Specifies the xfile use double for real values of float + * + * Property type: Bool. Default value: false. + */ + +#define AI_CONFIG_EXPORT_XFILE_64BIT "EXPORT_XFILE_64BIT" + +/** @brief Specifies the xfile applies all transformations to the coordinates, normals + * so all motions are identities + * Property type: Bool. Default value: false. + */ + +#define AI_CONFIG_EXPORT_XFILE_BAKETRANSFORM "EXPORT_XFILE_BAKETRANSFORM" + #endif // !! AI_CONFIG_H_INC