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).
This commit is contained in:
Ryan Huffman 2017-10-12 18:29:11 -07:00
parent 8a331e29a2
commit d6366083a7

View file

@ -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 };