From 6b7b1c5040c2d9ce6f73baa5296cd83589c704b3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 2 Oct 2020 16:23:00 +1300 Subject: [PATCH] Fix handling of missing glTF blendshape target meshes --- libraries/fbx/src/GLTFSerializer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/fbx/src/GLTFSerializer.cpp b/libraries/fbx/src/GLTFSerializer.cpp index 3a0271945b..4f730fe03e 100755 --- a/libraries/fbx/src/GLTFSerializer.cpp +++ b/libraries/fbx/src/GLTFSerializer.cpp @@ -1586,12 +1586,16 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash& int targetIndex = weightedIndex; hfmModel.blendshapeChannelNames.push_back("target_" + QString::number(weightedIndex)); - if (!names.isEmpty() && names.contains(keys[weightedIndex])) { + if (!names.isEmpty()) { targetIndex = names.indexOf(keys[weightedIndex]); + if (targetIndex == -1) { + continue; // Ignore blendshape targets not present in glTF file. + } indexFromMapping = values[weightedIndex].first; weight = values[weightedIndex].second; hfmModel.blendshapeChannelNames[weightedIndex] = keys[weightedIndex]; } + HFMBlendshape& blendshape = mesh.blendshapes[indexFromMapping]; auto target = primitive.targets[targetIndex];