better expression of class properties
This commit is contained in:
@@ -157,6 +157,21 @@ bool FWingProperty::SetText(FString Value, WingOut Errors) const
|
||||
return true;
|
||||
}
|
||||
|
||||
// Class properties get parsed by UWingTypes.
|
||||
if (FClassProperty *CProp = CastField<FClassProperty>(Prop))
|
||||
{
|
||||
UWingTypes::Requirements Req;
|
||||
Req.IsChildOf = CProp->MetaClass;
|
||||
if (CProp->MetaClass == nullptr) Req.IsChildOf = UObject::StaticClass();
|
||||
Req.AllowNone = true;
|
||||
Req.AllowContainer = false;
|
||||
FEdGraphPinType PinType;
|
||||
if (!UWingTypes::TextToType(Value, PinType, Req, Errors)) return false;
|
||||
CProp->SetObjectPropertyValue_InContainer(Container,
|
||||
Cast<UClass>(PinType.PinSubCategoryObject.Get()));
|
||||
return true;
|
||||
}
|
||||
|
||||
// If it's an enum type, use our parsing routine which is smarter about
|
||||
// prefixes than ImportText. We canonicalize the string, and then send
|
||||
// it onward to ImportText.
|
||||
@@ -322,6 +337,12 @@ FString FWingProperty::GetText() const
|
||||
FEdGraphPinType *PinType = Prop->ContainerPtrToValuePtr<FEdGraphPinType>(Container);
|
||||
return UWingTypes::TypeToText(*PinType);
|
||||
}
|
||||
if (FClassProperty *CProp = CastField<FClassProperty>(Prop))
|
||||
{
|
||||
UObject *Obj = CProp->GetObjectPropertyValue_InContainer(Container);
|
||||
if (Obj) return UWingTypes::TypeToText(Obj);
|
||||
return TEXT("None");
|
||||
}
|
||||
FString Result;
|
||||
Prop->ExportTextItem_InContainer(Result, Container, nullptr, nullptr, PPF_None);
|
||||
return Result;
|
||||
|
||||
Reference in New Issue
Block a user