Working on Asset_Create
This commit is contained in:
@@ -107,9 +107,27 @@ bool FWingProperty::SetText(FString Value)
|
||||
*Value, *WingUtils::FormatName(Prop), *Prop->GetCPPType());
|
||||
return false;
|
||||
}
|
||||
if (!CheckImportTextResult(Value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FWingProperty::CheckImportTextResult(const FString &Value)
|
||||
{
|
||||
uint8 *VP = Prop->ContainerPtrToValuePtr<uint8>(Container);
|
||||
if (FObjectPropertyBase *OProp = CastField<FObjectPropertyBase>(Prop))
|
||||
{
|
||||
UObject *Obj = OProp->GetObjectPropertyValue(VP);
|
||||
if (Obj == nullptr && Value.TrimStartAndEnd().Compare(TEXT("None"), ESearchCase::IgnoreCase) != 0)
|
||||
{
|
||||
UWingServer::Printf(TEXT("ERROR: Failed to parse '%s' for property '%s'\n"),
|
||||
*Value, *WingUtils::FormatName(Prop));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool FWingProperty::SetJson(const TSharedPtr<FJsonValue> &JsonValue)
|
||||
{
|
||||
if (JsonValue->Type == EJson::String)
|
||||
@@ -235,6 +253,41 @@ void FWingProperty::Collect(UStruct* StructType, void* Container, TArray<FWingPr
|
||||
}
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::GetAll(UObject* Object, EPropertyFlags Flags)
|
||||
{
|
||||
return GetAll(Object->GetClass(), Object, Flags);
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::GetAll(UStruct* StructType, void* Container, EPropertyFlags Flags)
|
||||
{
|
||||
TArray<FWingProperty> Result;
|
||||
Collect(StructType, Container, Result, Flags);
|
||||
return Result;
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::GetNamed(UStruct* StructType, void* Container, const TArray<FName> &Names)
|
||||
{
|
||||
TArray<FWingProperty> Result;
|
||||
for (FName Name : Names)
|
||||
{
|
||||
FProperty *Prop = StructType->FindPropertyByName(Name);
|
||||
if (Prop != nullptr) Result.Emplace(Prop, Container);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
TArray<FName> FWingProperty::GetNames(UStruct *StructType, EPropertyFlags Flags)
|
||||
{
|
||||
TArray<FName> Result;
|
||||
for (TFieldIterator<FProperty> It(StructType); It; ++It)
|
||||
{
|
||||
if (Flags != 0 && !It->HasAnyPropertyFlags(Flags)) continue;
|
||||
Result.Add(It->GetFName());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
void FWingProperty::Remove(TArray<FWingProperty>& Props, const FString& Name)
|
||||
{
|
||||
Props.RemoveAll([&](const FWingProperty& P) { return P.Prop->GetName() == Name; });
|
||||
@@ -312,17 +365,6 @@ TArray<FWingProperty> FWingProperty::GetDetailsGeneral(UObject* Obj, EPropertyFl
|
||||
return Result;
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::GetAll(UObject* Object, EPropertyFlags Flags)
|
||||
{
|
||||
return GetAll(Object->GetClass(), Object, Flags);
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::GetAll(UStruct* StructType, void* Container, EPropertyFlags Flags)
|
||||
{
|
||||
TArray<FWingProperty> Result;
|
||||
Collect(StructType, Container, Result, Flags);
|
||||
return Result;
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::FindAllSubstring(const TArray<FWingProperty>& Props, const FString& Substring)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user