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();