Merge pull request #4707 from Gargaj/patch-1

fix vertices being joined duplicating weights
pull/4702/head
Kim Kulling 2022-09-04 10:51:07 +02:00 committed by GitHub
commit fd6c534efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -390,6 +390,16 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
const aiVertexWeight& ow = bone->mWeights[ b ]; const aiVertexWeight& ow = bone->mWeights[ b ];
// if the vertex is a unique one, translate it // if the vertex is a unique one, translate it
if ( !( replaceIndex[ ow.mVertexId ] & 0x80000000 ) ) { if ( !( replaceIndex[ ow.mVertexId ] & 0x80000000 ) ) {
bool weightAlreadyExists = false;
for (std::vector<aiVertexWeight>::iterator vit = newWeights.begin(); vit != newWeights.end(); ++vit) {
if (vit->mVertexId == replaceIndex[ow.mVertexId]) {
weightAlreadyExists = true;
break;
}
}
if (weightAlreadyExists) {
continue;
}
aiVertexWeight nw; aiVertexWeight nw;
nw.mVertexId = replaceIndex[ ow.mVertexId ]; nw.mVertexId = replaceIndex[ ow.mVertexId ];
nw.mWeight = ow.mWeight; nw.mWeight = ow.mWeight;