Add StepExporter.cpp(stp) Export

Fix XFile
This commit is contained in:
Madrich
2015-05-01 21:40:51 +02:00
parent 492fee282d
commit ca8a3909be
9 changed files with 540 additions and 12 deletions

View File

@@ -319,8 +319,8 @@ void XFileExporter::WriteNode( aiNode* pNode)
WriteMesh(mScene->mMeshes[pNode->mMeshes[i]]);
// recursive call the Nodes
for (size_t a = 0; a < pNode->mNumChildren; a++)
WriteNode( mScene->mRootNode->mChildren[a]);
for (size_t i = 0; i < pNode->mNumChildren; ++i)
WriteNode( mScene->mRootNode->mChildren[i]);
PopTag();
@@ -507,12 +507,16 @@ void XFileExporter::WriteMesh(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(), '>', '_');
std::replace(str.begin(), str.end(), '{', '_');
std::replace(str.begin(), str.end(), '}', '_');
std::replace(str.begin(), str.end(), '$', '_');
std::string pref = "NN_"; // node name prefix to prevent unexpected start of string
std::string str = pref + std::string(name.C_Str());
for (int i=0; i<str.length(); ++i)
{
if ((str[i] >= 48 && str[i] <= 57) || // 0-9
(str[i] >= 65 && str[i] <= 90) || // A-Z
(str[i] >= 97 && str[i] <= 122)) // a-z
continue;
str[i] = '_';
}
return str;
}