diff --git a/code/PretransformVertices.cpp b/code/PretransformVertices.cpp index 5cb661405..007897c93 100644 --- a/code/PretransformVertices.cpp +++ b/code/PretransformVertices.cpp @@ -625,7 +625,7 @@ void PretransformVertices::Execute( aiScene* pScene) // flat node graph with a root node and some level 1 children delete pScene->mRootNode; pScene->mRootNode = new aiNode(); - pScene->mRootNode->mName.Set("dummy_root"); + pScene->mRootNode->mName.Set(""); if (1 == pScene->mNumMeshes && !pScene->mNumLights && !pScene->mNumCameras) { diff --git a/code/XFileExporter.cpp b/code/XFileExporter.cpp index 8c2d9b55b..981d8a4c1 100644 --- a/code/XFileExporter.cpp +++ b/code/XFileExporter.cpp @@ -307,7 +307,7 @@ void XFileExporter::WriteNode( aiNode* pNode) ss << "Node_" << pNode; pNode->mName.Set(ss.str()); } - mOutput << startstr << "Frame " << pNode->mName.C_Str() << " {" << endstr; + mOutput << startstr << "Frame " << toXFileString(pNode->mName) << " {" << endstr; PushTag(); @@ -327,9 +327,9 @@ void XFileExporter::WriteNode( aiNode* pNode) mOutput << startstr << "}" << endstr << endstr; } -void XFileExporter::WriteMesh(const aiMesh* mesh) +void XFileExporter::WriteMesh(aiMesh* mesh) { - mOutput << startstr << "Mesh " << mesh->mName.C_Str() << "_mShape" << " {" << endstr; + mOutput << startstr << "Mesh " << toXFileString(mesh->mName) << "_mShape" << " {" << endstr; PushTag(); @@ -505,6 +505,13 @@ void XFileExporter::WriteMesh(const aiMesh* mesh) } +std::string XFileExporter::toXFileString(aiString &name) +{ + std::string str = std::string(name.C_Str()); + std::replace(str.begin(), str.end(), '<', '_'); + std::replace(str.begin(), str.end(), '>', '_'); + return str; +} void XFileExporter::writePath(aiString path) { diff --git a/code/XFileExporter.h b/code/XFileExporter.h index 1b59e4461..5c9f56701 100644 --- a/code/XFileExporter.h +++ b/code/XFileExporter.h @@ -80,7 +80,7 @@ protected: void WriteNode( aiNode* pNode ); /// write a mesh entry of the scene - void WriteMesh(const aiMesh* mesh); + void WriteMesh( aiMesh* mesh); /// Enters a new xml element, which increases the indentation void PushTag() { startstr.append( " "); } @@ -94,6 +94,9 @@ public: protected: + /// normalize the name to be accepted by xfile readers + std::string toXFileString(aiString &name); + /// hold the properties pointer const ExportProperties* mProperties;