43 lines
981 B
C++
43 lines
981 B
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WingServer.h"
|
|
#include "WingBasics.h"
|
|
#include "WingFetcher.h"
|
|
#include "WingProperty.h"
|
|
#include "WingUtils.h"
|
|
#include "Details_Get.generated.h"
|
|
|
|
UCLASS()
|
|
class UWing_Details_Get : public UWingHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(EditAnywhere, meta=(Description="Target object"))
|
|
FString Object;
|
|
|
|
UPROPERTY(EditAnywhere, 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(WingOut::Stdout);
|
|
UObject* Obj = F.Walk(Object).Cast<UObject>();
|
|
if (!Obj) return;
|
|
|
|
TArray<FWingProperty> Props = FWingProperty::GetDetails(Obj, false);
|
|
FWingProperty* P = WingUtils::FindOneWithExternalID(Property, Props, TEXT("Property"), WingOut::Stdout);
|
|
if (!P) return;
|
|
|
|
WingOut::Stdout.Print(P->GetText());
|
|
WingOut::Stdout.Print(TEXT("\n"));
|
|
}
|
|
};
|