From 68983ad0d02d5ce4ea7b63f7964cb63743234ad7 Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Sun, 8 Apr 2018 17:54:42 -0700 Subject: [PATCH] Fix skinning edge case. A mesh with a single (skinning) deformer which had zero clusters would erroneously register as skinned, leading GetRoodNode() to an assertion failure. Fixed. --- src/Fbx2Raw.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Fbx2Raw.cpp b/src/Fbx2Raw.cpp index 671db6c..2b072d0 100644 --- a/src/Fbx2Raw.cpp +++ b/src/Fbx2Raw.cpp @@ -401,12 +401,14 @@ public: for (int deformerIndex = 0; deformerIndex < pMesh->GetDeformerCount(); deformerIndex++) { FbxSkin *skin = reinterpret_cast< FbxSkin * >( pMesh->GetDeformer(deformerIndex, FbxDeformer::eSkin)); if (skin != nullptr) { + const int clusterCount = skin->GetClusterCount(); + if (clusterCount == 0) { + continue; + } int controlPointCount = pMesh->GetControlPointsCount(); - vertexJointIndices.resize(controlPointCount, Vec4i(0, 0, 0, 0)); vertexJointWeights.resize(controlPointCount, Vec4f(0.0f, 0.0f, 0.0f, 0.0f)); - const int clusterCount = skin->GetClusterCount(); for (int clusterIndex = 0; clusterIndex < clusterCount; clusterIndex++) { FbxCluster *cluster = skin->GetCluster(clusterIndex); const int indexCount = cluster->GetControlPointIndicesCount();