From d6366083a7ff1b00d3f531f1b4297beb4dd1f290 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 12 Oct 2017 18:29:11 -0700 Subject: [PATCH] Fix baking bug with single-part FBX + multiple materials In FBXBaker we were not packing in material IDs if there was only 1 part in the mesh. This was unintentionally making the assumption that there was only 1 material at index 0 - if there are more materials, the material index that the part references may not be 0. The change ensures that we pack material IDs if there are multiple parts or if the sole part uses a material ID other than 0 (0 is the default). --- libraries/baking/src/FBXBaker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/baking/src/FBXBaker.cpp b/libraries/baking/src/FBXBaker.cpp index 017f11c680..140b7867dc 100644 --- a/libraries/baking/src/FBXBaker.cpp +++ b/libraries/baking/src/FBXBaker.cpp @@ -377,7 +377,8 @@ void FBXBaker::rewriteAndBakeSceneModels() { bool hasColors { mesh.colors.size() > 0 }; bool hasTexCoords { mesh.texCoords.size() > 0 }; bool hasTexCoords1 { mesh.texCoords1.size() > 0 }; - bool hasPerFaceMaterials { mesh.parts.size() > 1 }; + bool hasPerFaceMaterials { mesh.parts.size() > 1 + || extractedMesh.partMaterialTextures[0].first != 0 }; bool needsOriginalIndices { hasDeformers }; int normalsAttributeID { -1 };