49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WingBasics.h"
|
|
#include "WingServer.h"
|
|
#include "WingFetcher.h"
|
|
#include "WingVariables.h"
|
|
#include "Variables_Modify.generated.h"
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
UCLASS()
|
|
class UWing_Variables_Modify : public UWingHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(EditAnywhere, meta=(Description="Path to a blueprint, graph, or custom event node"))
|
|
FString Object;
|
|
|
|
UPROPERTY(EditAnywhere, meta=(Description="Variable descriptions"))
|
|
FWingRestOfArgv Variables;
|
|
|
|
virtual void Register() override
|
|
{
|
|
UWingServer::AddHandler(this,
|
|
TEXT("Add variables to a blueprint, function graph, "
|
|
"macro graph, event dispatcher graph, or custom event node. "
|
|
"Each variable must be expressed as: 'kind type name (flags) = default'. "
|
|
"Kind can be blueprint, input, output, or local."));
|
|
}
|
|
virtual void Handle() override
|
|
{
|
|
WingFetcher F(WingOut::Stdout);
|
|
UObject* Obj = F.Walk(Object).Cast<UObject>();
|
|
if (!Obj) return;
|
|
|
|
WingVariables Vars;
|
|
if (!Vars.SetBackingStore(Obj, WingOut::Stdout)) return;
|
|
if (!Vars.Parse(Variables.Argv, false, WingOut::Stdout)) return;
|
|
if (!Vars.Check(WingOut::Stdout)) return;
|
|
if (!Vars.Modify(WingOut::Stdout)) return;
|
|
WingOut::Stdout.Printf(TEXT("Success.\n"));
|
|
}
|
|
};
|