Merge pull request #78 from sherief/master

Fix for Collada mesh naming bug
pull/79/head
Kim Kulling 2013-08-15 00:59:43 -07:00
commit 9fc1a96494
3 changed files with 15 additions and 1 deletions

View File

@ -322,6 +322,8 @@ struct Mesh
mNumUVComponents[i] = 2;
}
std::string mName;
// just to check if there's some sophisticated addressing involved...
// which we don't support, and therefore should warn about.
std::string mVertexID;

View File

@ -521,7 +521,10 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
// assign the material index
dstMesh->mMaterialIndex = matIdx;
dstMesh->mName = mid.mMeshOrController;
if(dstMesh->mName.length == 0)
{
dstMesh->mName = mid.mMeshOrController;
}
}
}
}
@ -542,6 +545,8 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
{
aiMesh* dstMesh = new aiMesh;
dstMesh->mName = pSrcMesh->mName;
// count the vertices addressed by its faces
const size_t numVertices = std::accumulate( pSrcMesh->mFaceSize.begin() + pStartFace,
pSrcMesh->mFaceSize.begin() + pStartFace + pSubMesh.mNumFaces, 0);

View File

@ -1493,6 +1493,13 @@ void ColladaParser::ReadGeometryLibrary()
Mesh* mesh = new Mesh;
mMeshLibrary[id] = mesh;
// read the mesh name if it exists
const int nameIndex = TestAttribute("name");
if(nameIndex != -1)
{
mesh->mName = mReader->getAttributeValue(nameIndex);
}
// read on from there
ReadGeometry( mesh);
} else