File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -2092,16 +2092,19 @@ void USkeletalMesh4::ConvertMesh()
2092
2092
const FSkelMeshSection4 &S = SrcLod.Sections [Sec];
2093
2093
CMeshSection *Dst = new (Lod->Sections ) CMeshSection;
2094
2094
2095
- // remap material for LOD
2095
+ // Remap material for LOD
2096
+ // In comment for LODMaterialMap, INDEX_NONE means "no remap", so let's use this logic here.
2097
+ // Actually, INDEX_NONE in LODMaterialMap seems hides the mesh section in game.
2098
+ // Reference: FSkeletalMeshSceneProxy
2096
2099
int MaterialIndex = S.MaterialIndex ;
2097
- if (Info.LODMaterialMap .IsValidIndex (MaterialIndex ))
2098
- MaterialIndex = Info. LODMaterialMap [MaterialIndex];
2099
- if ( MaterialIndex < 0 ) // UE4 using Clamp(0, Materials.Num()), not Materials.Num()-1
2100
- MaterialIndex = 0 ;
2100
+ if (Info.LODMaterialMap .IsValidIndex (Sec) && Materials. IsValidIndex (Info. LODMaterialMap [Sec] ))
2101
+ {
2102
+ MaterialIndex = Info. LODMaterialMap [Sec];
2103
+ }
2101
2104
2102
- Dst->Material = Materials.IsValidIndex (MaterialIndex) ? Materials[MaterialIndex].Material : NULL ;
2105
+ Dst->Material = Materials.IsValidIndex (MaterialIndex) ? Materials[MaterialIndex].Material : NULL ;
2103
2106
Dst->FirstIndex = S.BaseIndex ;
2104
- Dst->NumFaces = S.NumTriangles ;
2107
+ Dst->NumFaces = S.NumTriangles ;
2105
2108
}
2106
2109
2107
2110
unguard; // ProcessSections
You can’t perform that action at this time.
0 commit comments