Prop Get2/Set2

This commit is contained in:
2026-04-03 11:41:21 -04:00
parent 78a3ca3e72
commit fe4a4d5646
4 changed files with 142 additions and 0 deletions

View File

@@ -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