소스 검색

Weights and bones count checks

Alexey Medvedev 5 년 전
부모
커밋
3ef46b0edd
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      code/PostProcessing/SplitByBoneCountProcess.cpp

+ 9 - 1
code/PostProcessing/SplitByBoneCountProcess.cpp

@@ -173,7 +173,15 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
         const aiBone* bone = pMesh->mBones[a];
         const aiBone* bone = pMesh->mBones[a];
         for( unsigned int b = 0; b < bone->mNumWeights; ++b)
         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!");
+            }
+          }
         }
         }
     }
     }