- fbx: strip prefixes from Material and Mesh names. Don't set empty material names.

pull/14/head
Alexander Gessler 2012-07-06 17:08:02 +02:00
parent 72f1734f82
commit 6441f9d984
1 changed files with 19 additions and 4 deletions

View File

@ -145,7 +145,13 @@ private:
aiNode* nd = new aiNode(); aiNode* nd = new aiNode();
nodes.push_back(nd); nodes.push_back(nd);
nd->mName.Set(model->Name()); // strip Model:: prefix
std::string name = model->Name();
if(name.substr(0,7) == "Model::") {
name = name.substr(7);
}
nd->mName.Set(name);
nd->mParent = &parent; nd->mParent = &parent;
ConvertTransformation(*model,*nd); ConvertTransformation(*model,*nd);
@ -639,9 +645,18 @@ private:
aiString str; aiString str;
// set material name // stip Material:: prefix
str.Set(material.Name()); std::string name = material.Name();
if(name.substr(0,10) == "Material::") {
name = name.substr(10);
}
// set material name if not empty - this could happen
// and there should be no key for it in this case.
if(name.length()) {
str.Set(name);
out_mat->AddProperty(&str,AI_MATKEY_NAME); out_mat->AddProperty(&str,AI_MATKEY_NAME);
}
// shading stuff and colors // shading stuff and colors
SetShadingPropertiesCommon(out_mat,props); SetShadingPropertiesCommon(out_mat,props);