Fix IOSFixed

Fix Author/AuthoringTool in Collada by MetaData
pull/298/head
Madrich 2014-06-20 00:08:11 +02:00
parent edc7a950c4
commit 1cb01c54a3
4 changed files with 18 additions and 15 deletions

View File

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

View File

@ -58,7 +58,7 @@ namespace Assimp
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp // 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 path = "";
std::string file = pFile; std::string file = pFile;
@ -230,8 +230,22 @@ void ColladaExporter::WriteHeader()
PushTag(); PushTag();
mOutput << startstr << "<contributor>" << endstr; mOutput << startstr << "<contributor>" << endstr;
PushTag(); 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(); PopTag();
mOutput << startstr << "</contributor>" << endstr; mOutput << startstr << "</contributor>" << endstr;
mOutput << startstr << "<created>" << date_str << "</created>" << endstr; mOutput << startstr << "<created>" << date_str << "</created>" << endstr;

View File

@ -125,7 +125,7 @@ XFileExporter::~XFileExporter()
void XFileExporter::WriteFile() void XFileExporter::WriteFile()
{ {
// note, that all realnumber values must be comma separated in x files // 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 mOutput.precision(6); // precission for float
// entry of writing the file // entry of writing the file

View File

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