24#if WITH_EDITORONLY_DATA
28 TArray<AActor*> MeshActors;
29 UGameplayStatics::GetAllActorsOfClass(GetWorld(), AStaticMeshActor::StaticClass(), MeshActors);
30 for (int32 i = 0; i < MeshActors.Num(); ++i) {
32 AStaticMeshActor *StaticMeshActor = Cast<AStaticMeshActor>(MeshActors[i]);
33 if (StaticMeshActor) {
35 if (StaticMeshActor->GetName().Contains(
"Curb", ESearchCase::Type::IgnoreCase) || StaticMeshActor->GetName().Contains(
"Gutter", ESearchCase::Type::IgnoreCase)) {
37 StaticMeshActor->GetStaticMeshComponent()->bReceivesDecals =
false;
54 FString JsonConfigFile;
56 TArray<FString> FileList;
57 IFileManager::Get().FindFilesRecursive(FileList, *(FPaths::ProjectContentDir()),
58 *(FString(
"roadpainter_decals.json")),
true,
false,
false);
60 if(FFileHelper::LoadFileToString(JsonConfigFile, *(IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*FileList[0]))))
62 TSharedPtr<FJsonObject> JsonParsed;
63 TSharedRef<TJsonReader<TCHAR>> JsonReader = TJsonReaderFactory<TCHAR>::Create(JsonConfigFile);
64 if(FJsonSerializer::Deserialize(JsonReader, JsonParsed))
67 auto DecalJsonArray = JsonParsed->GetArrayField(TEXT(
"decals"));
68 for(
auto &DecalJsonValue : DecalJsonArray)
70 const auto DecalJsonObject = DecalJsonValue->AsObject();
74 FString JsonMapName = DecalJsonObject->GetStringField(TEXT(
"map_name"));
75 if(JsonMapName.Equals(CurrentMapName) ==
true)
79 for (
const TPair<FString, FString>& Pair : DecalNamesMap) {
80 if (DecalJsonObject->HasField(Pair.Key) ==
true) {