From c92ae50e4f7f9e576f6074d91953727ccc45ea1d Mon Sep 17 00:00:00 2001 From: Merwan Achibet Date: Wed, 10 Apr 2019 19:16:42 +0200 Subject: [PATCH] Fix FBX face materials not being properly loaded if the face count mismatches the material count --- code/FBXMeshGeometry.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/FBXMeshGeometry.cpp b/code/FBXMeshGeometry.cpp index d75476b82..2debfa651 100644 --- a/code/FBXMeshGeometry.cpp +++ b/code/FBXMeshGeometry.cpp @@ -630,10 +630,11 @@ void MeshGeometry::ReadVertexDataMaterials(std::vector& materials_out, cons materials_out.clear(); } - m_materials.assign(m_vertices.size(),materials_out[0]); + materials_out.resize(m_vertices.size()); + std::fill(materials_out.begin(), materials_out.end(), materials_out.at(0)); } else if (MappingInformationType == "ByPolygon" && ReferenceInformationType == "IndexToDirect") { - m_materials.resize(face_count); + materials_out.resize(face_count); if(materials_out.size() != face_count) { FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygon mapping: ")