Переглянути джерело

Fix IOSFixed
Fix Author/AuthoringTool in Collada by MetaData

Madrich 11 роки тому
батько
коміт
1cb01c54a3
4 змінених файлів з 18 додано та 15 видалено
  1. 0 2
      code/AssimpPCH.cpp
  2. 17 3
      code/ColladaExporter.cpp
  3. 1 1
      code/XFileExporter.cpp
  4. 0 9
      include/assimp/scene.h

+ 0 - 2
code/AssimpPCH.cpp

@@ -88,8 +88,6 @@ ASSIMP_API aiScene::aiScene()
 	, mNumCameras(0)
 	, mCameras(NULL)
 	, mPrivate(new Assimp::ScenePrivateData())
-	, author("Assimp")
-	, authoringTool("Assimp Importer-Exporter")
 	{
 	}
 

+ 17 - 3
code/ColladaExporter.cpp

@@ -58,7 +58,7 @@ namespace Assimp
 
 // ------------------------------------------------------------------------------------------------
 // Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp
-void ExportSceneCollada(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene)
+void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene)
 {
 	std::string path = "";
 	std::string file = pFile;
@@ -230,8 +230,22 @@ void ColladaExporter::WriteHeader()
 	PushTag();
 	mOutput << startstr << "<contributor>" << endstr;
 	PushTag();
-	mOutput << startstr << "<author>" << mScene->author.C_Str() << "</author>" << endstr;
-	mOutput << startstr << "<authoring_tool>" << mScene->authoringTool.C_Str() << "</authoring_tool>" << endstr;
+
+	aiMetadata* meta = mScene->mRootNode->mMetaData;
+	aiString value;
+	if (!meta || !meta->Get("Author", value))		
+		mOutput << startstr << "<author>" << "Assimp" << "</author>" << endstr;
+	else		
+		mOutput << startstr << "<author>" << value.C_Str() << "</author>" << endstr;
+
+	if (!meta || !meta->Get("AuthoringTool", value))
+		mOutput << startstr << "<authoring_tool>" << "Assimp Exporter" << "</authoring_tool>" << endstr;
+	else		
+		mOutput << startstr << "<authoring_tool>" << value.C_Str() << "</authoring_tool>" << endstr;
+
+	//mOutput << startstr << "<author>" << mScene->author.C_Str() << "</author>" << endstr;
+	//mOutput << startstr << "<authoring_tool>" << mScene->authoringTool.C_Str() << "</authoring_tool>" << endstr;
+	
 	PopTag();
 	mOutput << startstr << "</contributor>" << endstr;
 	mOutput << startstr << "<created>" << date_str << "</created>" << endstr;

+ 1 - 1
code/XFileExporter.cpp

@@ -125,7 +125,7 @@ XFileExporter::~XFileExporter()
 void XFileExporter::WriteFile()
 {
 	// note, that all realnumber values must be comma separated in x files
-	mOutput.setf(_IOSfixed);
+	mOutput.setf(std::ios::fixed);
 	mOutput.precision(6); // precission for float
 
 	// entry of writing the file

+ 0 - 9
include/assimp/scene.h

@@ -375,15 +375,6 @@ struct aiScene
 	*/
 	C_STRUCT aiCamera** mCameras;
 
-
-	/** a string representing the author
-	*/
-	aiString author;
-
-	/** a string representing the authoringtool
-	*/
-	aiString authoringTool;
-
 #ifdef __cplusplus
 
 	//! Default constructor - set everything to 0/NULL