Browse Source

Fix X importer breakage introduced in commit f844c33 (#5372)

* Update XFileImporter.cpp

Comment out boneIdx conditional which caused massive breakage

* Update XFileImporter.cpp

Fix typo

* Update XFileImporter.cpp

Dummy whitespace change to attempt to re-trigger failing CI tests

---------

Co-authored-by: Steve M <[email protected]>
Co-authored-by: Kim Kulling <[email protected]>
Steve M 1 year ago
parent
commit
005399a671
1 changed files with 11 additions and 3 deletions
  1. 11 3
      code/AssetLib/X/XFileImporter.cpp

+ 11 - 3
code/AssetLib/X/XFileImporter.cpp

@@ -359,10 +359,18 @@ void XFileImporter::CreateMeshes(aiScene *pScene, aiNode *pNode, const std::vect
                 // set up a vertex-linear array of the weights for quick searching if a bone influences a vertex
                 // set up a vertex-linear array of the weights for quick searching if a bone influences a vertex
                 std::vector<ai_real> oldWeights(sourceMesh->mPositions.size(), 0.0);
                 std::vector<ai_real> oldWeights(sourceMesh->mPositions.size(), 0.0);
                 for (unsigned int d = 0; d < obone.mWeights.size(); ++d) {
                 for (unsigned int d = 0; d < obone.mWeights.size(); ++d) {
-                    const unsigned int boneIdx = obone.mWeights[d].mVertex;
-                    if (boneIdx < obone.mWeights.size()) {
+                    // TODO  The conditional against boneIdx which was added in commit f844c33
+                    // TODO      (https://github.com/assimp/assimp/commit/f844c3397d7726477ab0fdca8efd3df56c18366b)
+                    // TODO  causes massive breakage as detailed in:
+                    // TODO      https://github.com/assimp/assimp/issues/5332
+                    // TODO  In cases like this unit tests are less useful, since the model still has
+                    // TODO  meshes, textures, animations etc. and asserts against these values may pass;
+                    // TODO  when touching importer code, it is crucial that developers also run manual, visual
+                    // TODO  checks to ensure there's no obvious breakage _before_ commiting to main branch 
+                    //const unsigned int boneIdx = obone.mWeights[d].mVertex;
+                    //if (boneIdx < obone.mWeights.size()) {
                         oldWeights[obone.mWeights[d].mVertex] = obone.mWeights[d].mWeight;
                         oldWeights[obone.mWeights[d].mVertex] = obone.mWeights[d].mWeight;
-                    }
+                    //}
                 }
                 }
 
 
                 // collect all vertex weights that influence a vertex in the new mesh
                 // collect all vertex weights that influence a vertex in the new mesh