55 TArray<TSharedPtr<FJsonValue>> ResultPropJsonArray;
60 FFileHelper::LoadFileToString(JsonString, *DefaultPropFilePath);
61 TSharedPtr<FJsonObject> JsonObject = MakeShareable(
new FJsonObject());
62 TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(JsonString);
64 TMap<FString, int> PropIndexes;
65 if (FJsonSerializer::Deserialize(JsonReader, JsonObject) && JsonObject.IsValid())
79 for (
auto &PropParameter : PropParametersArray)
81 TSharedPtr<FJsonObject> PropJsonObject;
83 int *PropIndex = PropIndexes.Find(PropParameter.Name);
86 PropJsonObject = ResultPropJsonArray[*PropIndex]->AsObject();
90 PropJsonObject = MakeShareable(
new FJsonObject);
97 TSharedRef<FJsonValue> PropJsonValue = MakeShareable(
new FJsonValueObject(PropJsonObject));
100 ResultPropJsonArray[*PropIndex] = PropJsonValue;
104 ResultPropJsonArray.Add(PropJsonValue);
105 PropIndexes.Add(PropParameter.Name, ResultPropJsonArray.Num() - 1);
121 TArray<FString> PropFileNames;
122 IFileManager::Get().FindFilesRecursive(PropFileNames,
129 PropFileNames.Sort();
130 FString DefaultFileName;
131 for (int32 i = 0; i < PropFileNames.Num() && DefaultFileName.IsEmpty(); ++i)
135 DefaultFileName = PropFileNames[i];
136 PropFileNames.RemoveAt(i);
139 if (!DefaultFileName.IsEmpty())
141 PropFileNames.Insert(DefaultFileName, 0);
145 TMap<FString, int> PropIndexes;
146 for (int32 i = 0; i < PropFileNames.Num(); ++i)
148 FString FileJsonContent;
149 if (FFileHelper::LoadFileToString(FileJsonContent, *PropFileNames[i]))
151 TSharedPtr<FJsonObject> JsonParsed;
152 TSharedRef<TJsonReader<TCHAR>> JsonReader = TJsonReaderFactory<TCHAR>::Create(FileJsonContent);
153 if (FJsonSerializer::Deserialize(JsonReader, JsonParsed))
156 for (
auto &PropJsonValue : PropJsonArray)
159 TSharedPtr<FJsonObject> PropJsonObject = PropJsonValue->AsObject();
164 UStaticMesh *PropMesh = LoadObject<UStaticMesh>(
nullptr, *PropMeshPath);
168 if (PropIndexes.Contains(PropName))
170 PropParametersArray[PropIndexes[PropName]] = Params;
174 PropParametersArray.Add(Params);
175 PropIndexes.Add(Params.Name, PropParametersArray.Num() - 1);