Prop Get2/Set2
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "WingActorComponent.h"
|
||||
#include "WingUtils.h"
|
||||
#include "WingTypes.h"
|
||||
#include "Dom/JsonValue.h"
|
||||
#include "PropertyEditorModule.h"
|
||||
#include "IDetailTreeNode.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
@@ -339,6 +340,43 @@ bool WingPropHandle::SetText(IPropertyHandle& Handle, const FString& Text)
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SetJson
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool WingPropHandle::SetJson(IPropertyHandle& Handle, const TSharedPtr<FJsonValue>& JsonValue)
|
||||
{
|
||||
FPropertyAccess::Result Result;
|
||||
|
||||
switch (JsonValue->Type)
|
||||
{
|
||||
case EJson::String:
|
||||
return SetText(Handle, JsonValue->AsString());
|
||||
|
||||
case EJson::Boolean:
|
||||
Result = Handle.SetValue(JsonValue->AsBool());
|
||||
break;
|
||||
|
||||
case EJson::Number:
|
||||
Result = Handle.SetValue(JsonValue->AsNumber());
|
||||
break;
|
||||
|
||||
default:
|
||||
Result = FPropertyAccess::Fail;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Result != FPropertyAccess::Success)
|
||||
{
|
||||
UWingServer::Printf(TEXT("ERROR: Failed to set property '%s'\n"),
|
||||
*WingUtils::FormatName(Handle.GetProperty()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Print
|
||||
|
||||
Reference in New Issue
Block a user