59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WingServer.h"
|
|
#include "WingHandler.h"
|
|
#include "WingFetcher.h"
|
|
#include "WingUtils.h"
|
|
#include "Engine/Blueprint.h"
|
|
#include "Blueprint_ListInterfaces.generated.h"
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
UCLASS()
|
|
class UWing_Blueprint_ListInterfaces : public UObject, public IWingHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(meta=(Description="Path to a blueprint, e.g. /Game/Foo/MyBlueprint"))
|
|
FString Blueprint;
|
|
|
|
virtual FString GetDescription() const override
|
|
{
|
|
return TEXT("List all Blueprint Interfaces implemented by a Blueprint, "
|
|
"including their function graphs.");
|
|
}
|
|
|
|
virtual void Handle() override
|
|
{
|
|
WingFetcher F;
|
|
F.Walk(Blueprint);
|
|
if (!F.Ok()) return;
|
|
UBlueprint* BP = F.Cast<UBlueprint>();
|
|
if (!BP) return;
|
|
|
|
bool bAny = false;
|
|
for (const FBPInterfaceDescription& IfaceDesc : BP->ImplementedInterfaces)
|
|
{
|
|
if (!IfaceDesc.Interface) continue;
|
|
bAny = true;
|
|
|
|
UWingServer::Printf(TEXT("Interface: %s\n"), *WingUtils::FormatName(IfaceDesc.Interface));
|
|
for (const UEdGraph* Graph : IfaceDesc.Graphs)
|
|
{
|
|
if (!Graph) continue;
|
|
UWingServer::Printf(TEXT(" %s\n"), *WingUtils::FormatName(Graph));
|
|
}
|
|
}
|
|
|
|
if (!bAny)
|
|
{
|
|
UWingServer::Print(TEXT("No interfaces implemented.\n"));
|
|
}
|
|
}
|
|
};
|