43 lines
933 B
C++
43 lines
933 B
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WingServer.h"
|
|
#include "WingHandler.h"
|
|
#include "WingFetcher.h"
|
|
#include "WingPropHandle.h"
|
|
#include "WingUtils.h"
|
|
#include "Details_Get.generated.h"
|
|
|
|
UCLASS()
|
|
class UWing_Details_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;
|
|
|
|
WingPropHandle Props;
|
|
WingPropHandle::Handles Handles = Props.GetDetails(Obj, false);
|
|
TSharedPtr<IPropertyHandle>* P = WingUtils::FindOneWithExternalID(Property, Handles, TEXT("Property"));
|
|
if (!P) return;
|
|
|
|
UWingServer::Print(WingPropHandle::GetText(**P));
|
|
}
|
|
};
|