Files
integration/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Remove.h

40 lines
1.1 KiB
C++

#pragma once
#include "CoreMinimal.h"
#include "WingBasics.h"
#include "WingFetcher.h"
#include "WingServer.h"
#include "WingComponent.h"
#include "ActorComponent_Remove.generated.h"
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
UCLASS()
class UWing_ActorComponent_Remove : public UWingHandler
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, meta=(Description="Path to the component (e.g. '/Game/MyBP,component:MyComp')"))
FString Component;
virtual void Register() override
{
UWingServer::AddHandler(this,
TEXT("Remove a component from a Blueprint's SimpleConstructionScript."));
}
virtual void Handle() override
{
WingFetcher F(WingOut::Stdout);
UWingComponentReference* CompRef = F.Walk(Component).Cast<UWingComponentReference>();
if (!CompRef) return;
if (!UWingComponent::DeleteComponent(CompRef, WingOut::Stdout)) return;
WingOut::Stdout.Printf(TEXT("Removed component.\n"));
}
};