Merge pull request #2608 from RevoluPowered/feature/fix-removal-of-bones

Stop JoinVerticiesProcess removing bones from mesh as per #2596
pull/2620/head^2 v.5.0.0.rc2
Kim Kulling 2019-08-26 21:20:59 +02:00 committed by GitHub
commit 5fe728345f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 25 deletions

View File

@ -431,31 +431,6 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
bone->mWeights = new aiVertexWeight[bone->mNumWeights];
memcpy( bone->mWeights, &newWeights[0], bone->mNumWeights * sizeof( aiVertexWeight));
}
else {
/* NOTE:
*
* In the algorithm above we're assuming that there are no vertices
* with a different bone weight setup at the same position. That wouldn't
* make sense, but it is not absolutely impossible. SkeletonMeshBuilder
* for example generates such input data if two skeleton points
* share the same position. Again this doesn't make sense but is
* reality for some model formats (MD5 for example uses these special
* nodes as attachment tags for its weapons).
*
* Then it is possible that a bone has no weights anymore .... as a quick
* workaround, we're just removing these bones. If they're animated,
* model geometry might be modified but at least there's no risk of a crash.
*/
delete bone;
--pMesh->mNumBones;
for (unsigned int n = a; n < pMesh->mNumBones; ++n) {
pMesh->mBones[n] = pMesh->mBones[n+1];
}
--a;
ASSIMP_LOG_WARN("Removing bone -> no weights remaining");
}
}
return pMesh->mNumVertices;
}