Fixes for large maps (#4271)

* Changed material routes and import.py

* Changed decal process for large maps

* Fixed spaces

* Removed unnecesary file

* Fixes for PR

* Updated materials for curbs and gutters

* Fix parsing of tiles by name

* Updated marking nodes materials and names

* New content version

Co-authored-by: bernat <bernatx@gmail.com>
This commit is contained in:
Roel Algaba Brizuela 2021-06-07 15:34:01 +02:00 committed by GitHub
parent 4ee1f63314
commit 34084f272f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 24 deletions

View File

@ -49,21 +49,28 @@ 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> MarkingNode(TEXT(
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(
"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'"));
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> RoadNodeAux(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/RoadPainterMaterials/M_Road_03_LMY.M_Road_03_LMY'"));
static ConstructorHelpers::FObjectFinder<UMaterial> TerrainNodeMaterial(TEXT(
"Material'/Game/Carla/Static/GenericMaterials/Grass/M_Grass01.M_Grass01'"));
static ConstructorHelpers::FObjectFinder<UMaterial> SidewalkNode(TEXT(
"Material'/Game/Carla/Static/GenericMaterials/CheapMaterials/M_SideWalkCheap01'"));
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> TerrainNodeMaterial(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/Grass/MI_Grass.MI_Grass'"));
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> CurbNodeMaterial(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/LargeMap_materials/largeM_curb/MI_largeM_curb01.MI_largeM_curb01'"));
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> GutterNodeMaterial(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/LargeMap_materials/largeM_gutter/MI_largeM_gutter01.MI_largeM_gutter01'"));
static ConstructorHelpers::FObjectFinder<UMaterialInstanceConstant> SidewalkNode(TEXT(
"MaterialInstanceConstant'/Game/Carla/Static/GenericMaterials/LargeMap_materials/largeM_sidewalk/tile01/MI_largeM_tile02.MI_largeM_tile02'"));
MarkingNodeMaterial = (UMaterialInstance *) MarkingNode.Object;
GutterNodeMaterialInstance = (UMaterialInstance *) GutterNodeMaterial.Object;
CurbNodeMaterialInstance = (UMaterialInstance *) CurbNodeMaterial.Object;
TerrainNodeMaterialInstance = (UMaterialInstance *) TerrainNodeMaterial.Object;
MarkingNodeCenter = (UMaterialInstance *) MarkingNodeCenterMaterial.Object;
MarkingNodeExterior = (UMaterialInstance *) MarkingNodeExteriorMaterial.Object;
RoadNodeMaterial = (UMaterialInstance *) RoadNode.Object;
MarkingNodeMaterialAux = (UMaterialInstance *) RoadNodeAux.Object;
SidewalkNodeMaterial = (UMaterial *) SidewalkNode.Object;
SidewalkNodeMaterialInstance = (UMaterialInstance *) SidewalkNode.Object;
#endif
}
#if WITH_EDITORONLY_DATA
@ -166,7 +173,7 @@ TArray<AStaticMeshActor *> UPrepareAssetsForCookingCommandlet::SpawnMeshesToWorl
MapAsset.AssetName.ToString(AssetName);
// check to ignore meshes from other tiles
if (i == -1 || (i != -1 && AssetName.Contains(TileName)))
if (i == -1 || (i != -1 && (AssetName.EndsWith(TileName) || AssetName.Contains(TileName + "_"))))
{
MeshActor = World->SpawnActor<AStaticMeshActor>(AStaticMeshActor::StaticClass(), ZeroTransform);
UStaticMeshComponent *MeshComponent = MeshActor->GetStaticMeshComponent();
@ -189,8 +196,8 @@ TArray<AStaticMeshActor *> UPrepareAssetsForCookingCommandlet::SpawnMeshesToWorl
// tag
if (AssetName.Contains(SSTags::R_MARKING1) || AssetName.Contains(SSTags::R_MARKING2))
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeMaterial);
MeshActor->GetStaticMeshComponent()->SetMaterial(1, MarkingNodeMaterialAux);
MeshActor->GetStaticMeshComponent()->SetMaterial(0, MarkingNodeExterior);
MeshActor->GetStaticMeshComponent()->SetMaterial(1, MarkingNodeCenter);
}
else if (AssetName.Contains(SSTags::R_ROAD1) || AssetName.Contains(SSTags::R_ROAD2))
{
@ -198,12 +205,22 @@ TArray<AStaticMeshActor *> UPrepareAssetsForCookingCommandlet::SpawnMeshesToWorl
}
else if (AssetName.Contains(SSTags::R_TERRAIN))
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, TerrainNodeMaterial);
MeshActor->GetStaticMeshComponent()->SetMaterial(0, TerrainNodeMaterialInstance);
MeshActor->GetStaticMeshComponent()->bReceivesDecals = false;
}
else if (AssetName.Contains(SSTags::R_SIDEWALK1) || AssetName.Contains(SSTags::R_SIDEWALK2))
{
MeshActor->GetStaticMeshComponent()->SetMaterial(0, SidewalkNodeMaterial);
MeshActor->GetStaticMeshComponent()->SetMaterial(0, SidewalkNodeMaterialInstance);
MeshActor->GetStaticMeshComponent()->bReceivesDecals = false;
}
else if (AssetName.Contains(SSTags::R_CURB1) || AssetName.Contains(SSTags::R_CURB2)) {
MeshActor->GetStaticMeshComponent()->SetMaterial(0, CurbNodeMaterialInstance);
MeshActor->GetStaticMeshComponent()->bReceivesDecals = false;
}
else if (AssetName.Contains(SSTags::R_GUTTER1) || AssetName.Contains(SSTags::R_GUTTER2)) {
MeshActor->GetStaticMeshComponent()->SetMaterial(0, GutterNodeMaterialInstance);
MeshActor->GetStaticMeshComponent()->bReceivesDecals = false;
}
}

View File

@ -157,25 +157,33 @@ private:
UPROPERTY()
UWorld *World;
/// Workaround material for MarkingNodes mesh
UPROPERTY()
UMaterialInstance *MarkingNodeMaterial;
/// Workaround material for the RoadNode mesh
UPROPERTY()
UMaterialInstance *RoadNodeMaterial;
/// Workaround material for the second material for the MarkingNodes
/// Material to apply to curbs on the road
UPROPERTY()
UMaterialInstance *MarkingNodeMaterialAux;
UMaterialInstance *CurbNodeMaterialInstance;
/// Material to apply to gutters on the road
UPROPERTY()
UMaterialInstance *GutterNodeMaterialInstance;
/// Workaround material for the center lane markings
UPROPERTY()
UMaterialInstance *MarkingNodeCenter;
/// Workaround material for exterior lane markings
UPROPERTY()
UMaterialInstance *MarkingNodeExterior;
/// Workaround material for the TerrainNodes
UPROPERTY()
UMaterial *TerrainNodeMaterial;
UMaterialInstance *TerrainNodeMaterialInstance;
/// Workaround material for the SidewalkNodes
UPROPERTY()
UMaterial *SidewalkNodeMaterial;
UMaterialInstance *SidewalkNodeMaterialInstance;
/// Saves @a Package in .umap format in path @a PackagePath inside Unreal
/// Content folder

View File

@ -34,4 +34,4 @@
0.9.9: 20200422_ea5179a
0.9.10: 20200925_88f9ceb
0.9.11: 20201222_232b876
Latest: 20210526_3fc5f2c
Latest: 20210601_c3a5f36