Copy constructor for ExportProperties

Export Propertie defines in config.h
Remove unnecessary
pull/493/head
Madrich 2015-03-14 16:31:33 +01:00
parent 37572f0f52
commit 290a16eea5
4 changed files with 47 additions and 33 deletions

View File

@ -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); ExportProperties :: ExportProperties(const ExportProperties* source)
dest->mMatrixProperties = MatrixPropertyMap(source->mMatrixProperties); {
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, void ExportProperties :: SetPropertyInteger(const char* szName, int iValue,
bool* bWasExisting /*= NULL*/) bool* bWasExisting /*= NULL*/)
{ {
ASSIMP_BEGIN_EXCEPTION_REGION(); SetGenericProperty<int>(mIntProperties, szName,iValue,bWasExisting);
SetGenericProperty<int>(mIntProperties, szName,iValue,bWasExisting);
ASSIMP_END_EXCEPTION_REGION(void);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -517,9 +520,7 @@ void ExportProperties :: SetPropertyInteger(const char* szName, int iValue,
void ExportProperties :: SetPropertyFloat(const char* szName, float iValue, void ExportProperties :: SetPropertyFloat(const char* szName, float iValue,
bool* bWasExisting /*= NULL*/) bool* bWasExisting /*= NULL*/)
{ {
ASSIMP_BEGIN_EXCEPTION_REGION(); SetGenericProperty<float>(mFloatProperties, szName,iValue,bWasExisting);
SetGenericProperty<float>(mFloatProperties, szName,iValue,bWasExisting);
ASSIMP_END_EXCEPTION_REGION(void);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -527,9 +528,7 @@ void ExportProperties :: SetPropertyFloat(const char* szName, float iValue,
void ExportProperties :: SetPropertyString(const char* szName, const std::string& value, void ExportProperties :: SetPropertyString(const char* szName, const std::string& value,
bool* bWasExisting /*= NULL*/) bool* bWasExisting /*= NULL*/)
{ {
ASSIMP_BEGIN_EXCEPTION_REGION(); SetGenericProperty<std::string>(mStringProperties, szName,value,bWasExisting);
SetGenericProperty<std::string>(mStringProperties, szName,value,bWasExisting);
ASSIMP_END_EXCEPTION_REGION(void);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -537,9 +536,7 @@ void ExportProperties :: SetPropertyString(const char* szName, const std::string
void ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value, void ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value,
bool* bWasExisting /*= NULL*/) bool* bWasExisting /*= NULL*/)
{ {
ASSIMP_BEGIN_EXCEPTION_REGION();
SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value,bWasExisting); SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value,bWasExisting);
ASSIMP_END_EXCEPTION_REGION(void);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -79,12 +79,11 @@ void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pSce
} }
// create/copy Properties // create/copy Properties
ExportProperties props; ExportProperties props(pProperties);
ExportProperties::CopyProperties(&props, pProperties);
// set standard properties if not set // 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_EXPORT_XFILE_64BIT)) props.SetPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT, false);
if (!props.HasPropertyBool("AI_CONFIG_XFILE_BAKETRANSFORM")) props.SetPropertyBool("AI_CONFIG_XFILE_BAKETRANSFORM", false); if (!props.HasPropertyBool(AI_CONFIG_EXPORT_XFILE_BAKETRANSFORM)) props.SetPropertyBool(AI_CONFIG_EXPORT_XFILE_BAKETRANSFORM, false);
// invoke the exporter // invoke the exporter
XFileExporter iDoTheExportThing( pScene, pIOSystem, path, file, &props); 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 // 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) 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 // make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") ); mOutput.imbue( std::locale("C") );
@ -159,7 +155,7 @@ void XFileExporter::WriteFile()
// Writes the asset header // Writes the asset header
void XFileExporter::WriteHeader() 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; mOutput << startstr << "xof 0303txt 0064" << endstr;
else else
mOutput << startstr << "xof 0303txt 0032" << endstr; mOutput << startstr << "xof 0303txt 0032" << endstr;

View File

@ -328,13 +328,17 @@ public:
public: public:
// ------------------------------------------------------------------- /** Standard constructor
/** Get a deep copy of a scene * @see ExportProperties()
* */
* @param dest Receives a pointer to the destination scene
* @param src Source scene - remains unmodified. ExportProperties();
*/
static void CopyProperties(ExportProperties* dest,const ExportProperties* source); /** Copy constructor
* @see ExportProperties(const ExportProperties* source)
*/
ExportProperties(const ExportProperties* source);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set an integer configuration property. /** Set an integer configuration property.

View File

@ -879,4 +879,21 @@ enum aiComponent
#define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION "IMPORT_COLLADA_IGNORE_UP_DIRECTION" #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 #endif // !! AI_CONFIG_H_INC