Removed material num check

This commit is contained in:
Roel Algaba Brizuela 2021-06-14 10:23:21 +02:00 committed by bernat
parent 5d31f0d65e
commit efb538dab3
1 changed files with 7 additions and 17 deletions

View File

@ -216,26 +216,16 @@ TArray<AStaticMeshActor *> UPrepareAssetsForCookingCommandlet::SpawnMeshesToWorl
// tag
if (AssetName.Contains(SSTags::R_MARKING1) || AssetName.Contains(SSTags::R_MARKING2))
{
if (MeshActor->GetStaticMeshComponent()->GetNumMaterials() == 1)
for (int32 i = 0; i < MeshActor->GetStaticMeshComponent()->GetStaticMesh()->StaticMaterials.Num(); ++i)
{
bool FoundColorName = true;
for (int32 i = 0; i < MeshActor->GetStaticMeshComponent()->GetStaticMesh()->StaticMaterials.Num() && FoundColorName == false; ++i)
if (MeshActor->GetStaticMeshComponent()->GetStaticMesh()->StaticMaterials[i].ImportedMaterialSlotName.ToString().Contains("Yellow"))
{
if (MeshActor->GetStaticMeshComponent()->GetStaticMesh()->StaticMaterials[i].ImportedMaterialSlotName.ToString().Contains("Yellow"))
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeYellow);
FoundColorName = true;
}
else
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeWhite);
}
MeshActor->GetStaticMeshComponent()->SetMaterial(i, MarkingNodeYellow);
}
else
{
MeshActor->GetStaticMeshComponent()->SetMaterial(i, MarkingNodeWhite);
}
}
else
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeWhite);
MeshActor->GetStaticMeshComponent()->SetMaterial(1, MarkingNodeYellow);
}
}
else if (AssetName.Contains(SSTags::R_ROAD1) || AssetName.Contains(SSTags::R_ROAD2))