From f41e106efc016f7ecef13fd8f02ac4317205f93d Mon Sep 17 00:00:00 2001 From: ulfjorensen Date: Fri, 17 Feb 2012 10:48:25 +0000 Subject: [PATCH] - ColladaExporter filters empty meshes which fooled certain loaders - specifically Assimp's Collada Loader :-) - Bugfix: ColladaExporter now writes proper URLs when referencing materials in meshes git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1170 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ColladaExporter.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index 005700145..982c7c489 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -298,6 +298,9 @@ void ColladaExporter::WriteGeometry( size_t pIndex) const aiMesh* mesh = mScene->mMeshes[pIndex]; std::string idstr = GetMeshId( pIndex); + if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 ) + return; + // opening tag mOutput << startstr << "" << endstr; PushTag(); @@ -503,14 +506,18 @@ void ColladaExporter::WriteNode( const aiNode* pNode) // instance every geometry for( size_t a = 0; a < pNode->mNumMeshes; ++a ) { - // const aiMesh* mesh = mScene->mMeshes[pNode->mMeshes[a]]; + const aiMesh* mesh = mScene->mMeshes[pNode->mMeshes[a]]; + // do not instanciate mesh if empty. I wonder how this could happen + if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 ) + continue; + mOutput << startstr << "mMeshes[a]) << "\">" << endstr; PushTag(); mOutput << startstr << "" << endstr; PushTag(); mOutput << startstr << "" << endstr; PushTag(); - mOutput << startstr << "mMeshes[pNode->mMeshes[a]]->mMaterialIndex].name << "\" />" << endstr; + mOutput << startstr << "mMaterialIndex].name << "\" />" << endstr; PopTag(); mOutput << startstr << "" << endstr; PopTag();