54 TArray<TSharedPtr<FJsonValue>> ResultPropJsonArray;
60 FFileHelper::LoadFileToString(JsonString, *DefaultPropFilePath);
62 TSharedPtr<FJsonObject> JsonObject = MakeShareable(
new FJsonObject());
63 TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(JsonString);
66 TMap<FString, int> PropIndexes;
67 if (FJsonSerializer::Deserialize(JsonReader, JsonObject) && JsonObject.IsValid())
70 for (int32 i = 0; i < ResultPropJsonArray.Num(); ++i)
72 TSharedPtr<FJsonObject> PropJsonObject = ResultPropJsonArray[i]->AsObject();
76 PropIndexes.Add(Name, i);
81 for (
auto &PropParameter : PropParametersArray)
83 TSharedPtr<FJsonObject> PropJsonObject;
86 int *PropIndex = PropIndexes.Find(PropParameter.Name);
89 PropJsonObject = ResultPropJsonArray[*PropIndex]->AsObject();
93 PropJsonObject = MakeShareable(
new FJsonObject);
102 TSharedRef<FJsonValue> PropJsonValue = MakeShareable(
new FJsonValueObject(PropJsonObject));
105 ResultPropJsonArray[*PropIndex] = PropJsonValue;
109 ResultPropJsonArray.Add(PropJsonValue);
111 PropIndexes.Add(PropParameter.Name, ResultPropJsonArray.Num() - 1);
119 FString OutputString;
120 TSharedRef<TJsonWriter<>> Writer = TJsonWriterFactory<>::Create(&OutputString);
121 FJsonSerializer::Serialize(JsonObject.ToSharedRef(), Writer);
124 FFileHelper::SaveStringToFile(OutputString, *DefaultPropFilePath);
134 TArray<FString> PropFileNames;
135 IFileManager::Get().FindFilesRecursive(PropFileNames,
143 PropFileNames.Sort();
144 FString DefaultFileName;
145 for (int32 i = 0; i < PropFileNames.Num() && DefaultFileName.IsEmpty(); ++i)
149 DefaultFileName = PropFileNames[i];
150 PropFileNames.RemoveAt(i);
153 if (!DefaultFileName.IsEmpty())
155 PropFileNames.Insert(DefaultFileName, 0);
167 TArray<FString> PropFileNames;
171 for (
const FString &PackContentDir : ContentPacks->GetPackContentDirs())
173 TArray<FString> PackPropFileNames;
174 IFileManager::Get().FindFilesRecursive(PackPropFileNames,
175 *(PackContentDir / TEXT(
"Config")),
180 PackPropFileNames.Sort();
181 PropFileNames.Append(PackPropFileNames);
184 return PropFileNames;
188 const TArray<FString> &PropFileNames,
189 TArray<FPropParameters> &PropParametersArray)
193 TMap<FString, int> PropIndexes;
194 for (int32 i = 0; i < PropParametersArray.Num(); ++i)
196 PropIndexes.Add(PropParametersArray[i].Name, i);
199 for (int32 i = 0; i < PropFileNames.Num(); ++i)
201 FString FileJsonContent;
202 if (FFileHelper::LoadFileToString(FileJsonContent, *PropFileNames[i]))
204 TSharedPtr<FJsonObject> JsonParsed;
205 TSharedRef<TJsonReader<TCHAR>> JsonReader = TJsonReaderFactory<TCHAR>::Create(FileJsonContent);
206 if (FJsonSerializer::Deserialize(JsonReader, JsonParsed))
210 for (
auto &PropJsonValue : PropJsonArray)
213 TSharedPtr<FJsonObject> PropJsonObject = PropJsonValue->AsObject();
224 TSoftObjectPtr<UStaticMesh>(FSoftObjectPath(PropMeshPath)),
228 if (PropIndexes.Contains(PropName))
230 PropParametersArray[PropIndexes[PropName]] = Params;
234 PropParametersArray.Add(Params);
235 PropIndexes.Add(Params.
Name, PropParametersArray.Num() - 1);
Mounts CARLA content packs (content-only Unreal plugins cooked as DLC against a base release,...
static UCarlaContentPackManager * Get()