Skip to content

Commit

Permalink
Update FBXMeshGeometry.cpp (assimp#5624)
Browse files Browse the repository at this point in the history
Some FBXs do not have "Materials" information, which can cause parsing errors

Co-authored-by: Kim Kulling <[email protected]>
  • Loading branch information
ycn2022 and kimkulling committed Jun 20, 2024
1 parent 77f7706 commit 0afd366
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions code/AssetLib/FBX/FBXMeshGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,12 @@ void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, cons
return;
}

// materials are handled separately. First of all, they are assigned per-face
// and not per polyvert. Secondly, ReferenceInformationType=IndexToDirect
// has a slightly different meaning for materials.
ParseVectorDataArray(materials_out,GetRequiredElement(source,"Materials"));
if (source["Materials"]) {
// materials are handled separately. First of all, they are assigned per-face
// and not per polyvert. Secondly, ReferenceInformationType=IndexToDirect
// has a slightly different meaning for materials.
ParseVectorDataArray(materials_out, GetRequiredElement(source, "Materials"));
}

if (MappingInformationType == "AllSame") {
// easy - same material for all faces
Expand Down

0 comments on commit 0afd366

Please sign in to comment.