Browse Source

Copy constructor for ExportProperties
Export Propertie defines in config.h
Remove unnecessary

Madrich 10 years ago
parent
commit
290a16eea5
4 changed files with 47 additions and 33 deletions
  1. 15 18
      code/Exporter.cpp
  2. 4 8
      code/XFileExporter.cpp
  3. 11 7
      include/assimp/Exporter.hpp
  4. 17 0
      include/assimp/config.h

+ 15 - 18
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<int>(mIntProperties, szName,iValue,bWasExisting);	
-	ASSIMP_END_EXCEPTION_REGION(void);
+	SetGenericProperty<int>(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<float>(mFloatProperties, szName,iValue,bWasExisting);	
-	ASSIMP_END_EXCEPTION_REGION(void);
+	SetGenericProperty<float>(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<std::string>(mStringProperties, szName,value,bWasExisting);	
-	ASSIMP_END_EXCEPTION_REGION(void);
+	SetGenericProperty<std::string>(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<aiMatrix4x4>(mMatrixProperties, szName,value,bWasExisting);	
-	ASSIMP_END_EXCEPTION_REGION(void);
+	SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value,bWasExisting);
 }
 
 // ------------------------------------------------------------------------------------------------

+ 4 - 8
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;

+ 11 - 7
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.

+ 17 - 0
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