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 // tag
if (AssetName.Contains(SSTags::R_MARKING1) || AssetName.Contains(SSTags::R_MARKING2)) 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; if (MeshActor->GetStaticMeshComponent()->GetStaticMesh()->StaticMaterials[i].ImportedMaterialSlotName.ToString().Contains("Yellow"))
for (int32 i = 0; i < MeshActor->GetStaticMeshComponent()->GetStaticMesh()->StaticMaterials.Num() && FoundColorName == false; ++i)
{ {
if (MeshActor->GetStaticMeshComponent()->GetStaticMesh()->StaticMaterials[i].ImportedMaterialSlotName.ToString().Contains("Yellow")) MeshActor->GetStaticMeshComponent()->SetMaterial(i, MarkingNodeYellow);
{ }
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeYellow); else
FoundColorName = true; {
} MeshActor->GetStaticMeshComponent()->SetMaterial(i, MarkingNodeWhite);
else
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeWhite);
}
} }
}
else
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeWhite);
MeshActor->GetStaticMeshComponent()->SetMaterial(1, MarkingNodeYellow);
} }
} }
else if (AssetName.Contains(SSTags::R_ROAD1) || AssetName.Contains(SSTags::R_ROAD2)) else if (AssetName.Contains(SSTags::R_ROAD1) || AssetName.Contains(SSTags::R_ROAD2))