From 3ef46b0eddbfdcd914da75c06b299e494a093317 Mon Sep 17 00:00:00 2001 From: Alexey Medvedev Date: Mon, 30 Mar 2020 16:56:33 -0700 Subject: [PATCH] Weights and bones count checks --- code/PostProcessing/SplitByBoneCountProcess.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/PostProcessing/SplitByBoneCountProcess.cpp b/code/PostProcessing/SplitByBoneCountProcess.cpp index 3ac0fe557..015ba9bf6 100644 --- a/code/PostProcessing/SplitByBoneCountProcess.cpp +++ b/code/PostProcessing/SplitByBoneCountProcess.cpp @@ -173,7 +173,15 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vectormBones[a]; for( unsigned int b = 0; b < bone->mNumWeights; ++b) { - vertexBones[ bone->mWeights[b].mVertexId ].push_back( BoneWeight( a, bone->mWeights[b].mWeight)); + if (bone->mWeights[b].mWeight > 0.0f) + { + int vertexId = bone->mWeights[b].mVertexId; + vertexBones[vertexId].push_back( BoneWeight( a, bone->mWeights[b].mWeight)); + if (vertexBones[vertexId].size() > mMaxBoneCount) + { + throw DeadlyImportError("SplitByBoneCountProcess: Single face requires more bones than specified max bone count!"); + } + } } }