Re-upload lane markings color fix

This commit is contained in:
Roel Algaba Brizuela 2021-06-14 09:53:47 +02:00 committed by bernat
parent 643043fb8f
commit 5d31f0d65e
2 changed files with 28 additions and 9 deletions

View File

@ -50,9 +50,9 @@ UPrepareAssetsForCookingCommandlet::UPrepareAssetsForCookingCommandlet()
#if WITH_EDITORONLY_DATA
// Get Carla Default materials, these will be used for maps that need to use
// Carla materials
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> MarkingNodeCenterMaterial(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/RoadPainterMaterials/LargeMaps/M_Road_03_Tiled_V3.M_Road_03_Tiled_V3'"));
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> MarkingNodeExteriorMaterial(TEXT(
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> MarkingNodeYellowMaterial(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/RoadPainterMaterials/LargeMaps/M_Road_03_Tiled_V3.M_Road_03_Tiled_V3'"));
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> MarkingNodeWhiteMaterial(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/RoadPainterMaterials/M_Road_03_LMW.M_Road_03_LMW'"));
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> RoadNode(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/RoadPainterMaterials/LargeMaps/M_Road_03_Tiled_V2.M_Road_03_Tiled_V2'"));
@ -68,8 +68,8 @@ UPrepareAssetsForCookingCommandlet::UPrepareAssetsForCookingCommandlet()
GutterNodeMaterialInstance = (UMaterialInstance *) GutterNodeMaterial.Object;
CurbNodeMaterialInstance = (UMaterialInstance *) CurbNodeMaterial.Object;
TerrainNodeMaterialInstance = (UMaterialInstance *) TerrainNodeMaterial.Object;
MarkingNodeCenter = (UMaterialInstance *) MarkingNodeCenterMaterial.Object;
MarkingNodeExterior = (UMaterialInstance *) MarkingNodeExteriorMaterial.Object;
MarkingNodeYellow = (UMaterialInstance *)MarkingNodeYellowMaterial.Object;
MarkingNodeWhite = (UMaterialInstance *)MarkingNodeWhiteMaterial.Object;
RoadNodeMaterial = (UMaterialInstance *) RoadNode.Object;
SidewalkNodeMaterialInstance = (UMaterialInstance *) SidewalkNode.Object;
#endif
@ -216,8 +216,27 @@ TArray<AStaticMeshActor *> UPrepareAssetsForCookingCommandlet::SpawnMeshesToWorl
// tag
if (AssetName.Contains(SSTags::R_MARKING1) || AssetName.Contains(SSTags::R_MARKING2))
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeExterior);
MeshActor->GetStaticMeshComponent()->SetMaterial(1, MarkingNodeCenter);
if (MeshActor->GetStaticMeshComponent()->GetNumMaterials() == 1)
{
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"))
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeYellow);
FoundColorName = true;
}
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))
{

View File

@ -174,11 +174,11 @@ private:
/// Workaround material for the center lane markings
UPROPERTY()
UMaterialInstance *MarkingNodeCenter;
UMaterialInstance *MarkingNodeYellow;
/// Workaround material for exterior lane markings
UPROPERTY()
UMaterialInstance *MarkingNodeExterior;
UMaterialInstance *MarkingNodeWhite;
/// Workaround material for the TerrainNodes
UPROPERTY()