Fix for road materials assignment from plugin quality preferences to static meshes using slotnames.
This commit is contained in:
parent
01d0f1c570
commit
918f0c4e17
|
@ -415,12 +415,21 @@ void UCarlaSettings::SetAllRoadsLowQuality(UWorld* world) const
|
||||||
UStaticMeshComponent* staticmesh = Cast<UStaticMeshComponent>(components[j]);
|
UStaticMeshComponent* staticmesh = Cast<UStaticMeshComponent>(components[j]);
|
||||||
if(staticmesh)
|
if(staticmesh)
|
||||||
{
|
{
|
||||||
for(int32 k=0; k<staticmesh->GetNumMaterials(); k++)
|
TArray<FName> slotsnames = staticmesh->GetMaterialSlotNames();
|
||||||
|
for(int32 k=0; k<slotsnames.Num(); k++)
|
||||||
{
|
{
|
||||||
if(LowRoadMaterials.IsValidIndex(k) && LowRoadMaterials[k].MaterialInterface && LowRoadMaterials[k].MaterialInterface->IsValidLowLevel())
|
const FName &slotname = slotsnames[k];
|
||||||
|
bool found = LowRoadMaterials.ContainsByPredicate([staticmesh,slotname](const FStaticMaterial& material)
|
||||||
{
|
{
|
||||||
staticmesh->SetMaterial(k, LowRoadMaterials[k].MaterialInterface);
|
if(material.MaterialSlotName.IsEqual(slotname))
|
||||||
}
|
{
|
||||||
|
staticmesh->SetMaterial(
|
||||||
|
staticmesh->GetMaterialIndex(slotname),
|
||||||
|
material.MaterialInterface
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
} else return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue