46 lines
1.1 KiB
C++
46 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 "Details_Set.generated.h"
|
|
|
|
UCLASS()
|
|
class UWing_Details_Set : public UWingHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(EditAnywhere, meta=(Description="Target object"))
|
|
FString Object;
|
|
|
|
UPROPERTY(EditAnywhere, meta=(Description="Property name"))
|
|
FString Property;
|
|
|
|
UPROPERTY(EditAnywhere, meta=(Description="New value in Unreal text format"))
|
|
FString Value;
|
|
|
|
virtual void Register() override
|
|
{
|
|
UWingServer::AddHandler(this,
|
|
TEXT("Set a single editable property. Value uses Unreal text format."));
|
|
}
|
|
|
|
virtual void Handle() override
|
|
{
|
|
WingFetcher F(WingOut::Stdout);
|
|
UObject* Obj = F.Walk(Object).Cast<UObject>();
|
|
if (!Obj) return;
|
|
|
|
TArray<FWingProperty> Props = FWingProperty::GetDetails(Obj, true);
|
|
FWingProperty* P = WingUtils::FindOneWithExternalID(Property, Props, TEXT("Property"), WingOut::Stdout);
|
|
if (!P) return;
|
|
|
|
if (P->SetText(Value, WingOut::Stdout))
|
|
WingOut::Stdout.Print(TEXT("OK\n"));
|
|
}
|
|
};
|