47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WingServer.h"
|
|
#include "WingHandler.h"
|
|
#include "WingFetcher.h"
|
|
#include "WingProperty.h"
|
|
#include "WingUtils.h"
|
|
#include "Property_Get.generated.h"
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
UCLASS()
|
|
class UWing_Property_Get : public UWingHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(meta=(Description="Target object"))
|
|
FString Object;
|
|
|
|
UPROPERTY(meta=(Description="Property name"))
|
|
FString Property;
|
|
|
|
virtual void Register() override
|
|
{
|
|
UWingServer::AddHandler(this,
|
|
TEXT("Get the value of a single property."));
|
|
}
|
|
virtual void Handle() override
|
|
{
|
|
WingFetcher F;
|
|
UObject* Obj = F.Walk(Object).Cast<UObject>();
|
|
if (!Obj) return;
|
|
|
|
TArray<FWingProperty> All = FWingProperty::GetDetailsMutable(Obj, CPF_Edit);
|
|
FWingProperty *P = WingUtils::FindOneWithExternalID(Property, All, TEXT("Property"));
|
|
if (!P) return;
|
|
|
|
UWingServer::Print(P->GetText());
|
|
UWingServer::Print(TEXT("\n"));
|
|
}
|
|
};
|