Back PretransformVertice Change

Fix Node Name in XFileExport
pull/493/head
Madrich 2015-03-14 19:48:08 +01:00
parent 56da80bc6e
commit edd3ed9e8f
3 changed files with 15 additions and 5 deletions

View File

@ -625,7 +625,7 @@ void PretransformVertices::Execute( aiScene* pScene)
// flat node graph with a root node and some level 1 children // flat node graph with a root node and some level 1 children
delete pScene->mRootNode; delete pScene->mRootNode;
pScene->mRootNode = new aiNode(); pScene->mRootNode = new aiNode();
pScene->mRootNode->mName.Set("dummy_root"); pScene->mRootNode->mName.Set("<dummy_root>");
if (1 == pScene->mNumMeshes && !pScene->mNumLights && !pScene->mNumCameras) if (1 == pScene->mNumMeshes && !pScene->mNumLights && !pScene->mNumCameras)
{ {

View File

@ -307,7 +307,7 @@ void XFileExporter::WriteNode( aiNode* pNode)
ss << "Node_" << pNode; ss << "Node_" << pNode;
pNode->mName.Set(ss.str()); pNode->mName.Set(ss.str());
} }
mOutput << startstr << "Frame " << pNode->mName.C_Str() << " {" << endstr; mOutput << startstr << "Frame " << toXFileString(pNode->mName) << " {" << endstr;
PushTag(); PushTag();
@ -327,9 +327,9 @@ void XFileExporter::WriteNode( aiNode* pNode)
mOutput << startstr << "}" << endstr << endstr; 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(); 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) void XFileExporter::writePath(aiString path)
{ {

View File

@ -80,7 +80,7 @@ protected:
void WriteNode( aiNode* pNode ); void WriteNode( aiNode* pNode );
/// write a mesh entry of the scene /// 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 /// Enters a new xml element, which increases the indentation
void PushTag() { startstr.append( " "); } void PushTag() { startstr.append( " "); }
@ -94,6 +94,9 @@ public:
protected: protected:
/// normalize the name to be accepted by xfile readers
std::string toXFileString(aiString &name);
/// hold the properties pointer /// hold the properties pointer
const ExportProperties* mProperties; const ExportProperties* mProperties;