Back in business
This commit is contained in:
@@ -347,11 +347,10 @@ FString FWingProperty::GetCategory() const
|
||||
|
||||
void FWingProperty::GetAll(FWingStructAndUStruct Obj, EPropertyFlags Flags, TArray<FWingProperty> &Props)
|
||||
{
|
||||
TArray<FWingProperty> Result;
|
||||
for (TFieldIterator<FProperty> It(Obj.UStructPtr); It; ++It)
|
||||
{
|
||||
if (Flags != 0 && !It->HasAnyPropertyFlags(Flags)) continue;
|
||||
Result.Add(FWingProperty(*It, Obj.StructPtr));
|
||||
Props.Add(FWingProperty(*It, Obj.StructPtr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,24 +443,16 @@ TArray<FWingProperty> FWingProperty::GetDetails(UObject* Obj, EPropertyFlags Fla
|
||||
}
|
||||
|
||||
|
||||
bool FWingProperty::PopulateFromJson(TArray<FWingProperty>& Props, const FJsonValue& Json, bool AllOptional, WingOut Errors)
|
||||
bool FWingProperty::PopulateFromJson(TArray<FWingProperty>& Props, const FJsonObject& Json, bool AllOptional, WingOut Errors)
|
||||
{
|
||||
bool Ok = true;
|
||||
|
||||
// Make sure they passed in a JSON object.
|
||||
TSharedPtr<FJsonObject> Obj = Json.AsObject();
|
||||
if (Obj == nullptr)
|
||||
{
|
||||
Errors.Printf(TEXT("property data should be stored in a json object\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build a set of known property names for the unknown-field check.
|
||||
TSet<FName> KnownKeys;
|
||||
for (const FWingProperty& P : Props) KnownKeys.Add(P->GetFName());
|
||||
|
||||
// Check for unknown fields in the JSON
|
||||
for (const auto& KV : Obj->Values)
|
||||
for (const auto& KV : Json.Values)
|
||||
{
|
||||
FName Name = WingUtils::CheckInternalizeID(KV.Key, Errors);
|
||||
if (!KnownKeys.Contains(Name))
|
||||
@@ -475,7 +466,7 @@ bool FWingProperty::PopulateFromJson(TArray<FWingProperty>& Props, const FJsonVa
|
||||
for (FWingProperty& P : Props)
|
||||
{
|
||||
FString JsonKey = WingUtils::FormatName(P.Prop);
|
||||
TSharedPtr<FJsonValue> Value = Obj->TryGetField(JsonKey);
|
||||
TSharedPtr<FJsonValue> Value = Json.TryGetField(JsonKey);
|
||||
if (!Value)
|
||||
{
|
||||
bool Optional = AllOptional || P.Prop->HasMetaData(TEXT("Optional"));
|
||||
@@ -491,6 +482,18 @@ bool FWingProperty::PopulateFromJson(TArray<FWingProperty>& Props, const FJsonVa
|
||||
return Ok;
|
||||
}
|
||||
|
||||
bool FWingProperty::PopulateFromJson(TArray<FWingProperty>& Props, const FJsonValue& Json, bool AllOptional, WingOut Errors)
|
||||
{
|
||||
// Make sure they passed in a JSON object.
|
||||
TSharedPtr<FJsonObject> Obj = Json.AsObject();
|
||||
if (Obj == nullptr)
|
||||
{
|
||||
Errors.Printf(TEXT("property data should be stored in a json object\n"));
|
||||
return false;
|
||||
}
|
||||
return PopulateFromJson(Props, *Obj, AllOptional, Errors);
|
||||
}
|
||||
|
||||
|
||||
bool FWingProperty::IsPinTypeProperty(FProperty* Prop)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user