This handler is unneeded
This commit is contained in:
@@ -1,82 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "WingServer.h"
|
|
||||||
#include "WingHandler.h"
|
|
||||||
#include "WingFetcher.h"
|
|
||||||
#include "WingProperty.h"
|
|
||||||
#include "WingTypes.h"
|
|
||||||
#include "WingUtils.h"
|
|
||||||
#include "WingActorComponent.h"
|
|
||||||
#include "Engine/SCS_Node.h"
|
|
||||||
#include "Engine/SimpleConstructionScript.h"
|
|
||||||
#include "ActorComponent_Dump.generated.h"
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
UCLASS()
|
|
||||||
class UWing_ActorComponent_Dump : public UObject, public IWingHandler
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
UPROPERTY(meta=(Description="Path to the component (e.g. '/Game/MyBP,component:MyComp')"))
|
|
||||||
FString Component;
|
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
|
||||||
{
|
|
||||||
return TEXT("Dump a component's class, parent, and editable properties.");
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Handle() override
|
|
||||||
{
|
|
||||||
WingFetcher F;
|
|
||||||
USCS_Node* Node = F.Walk(Component).Cast<USCS_Node>();
|
|
||||||
if (!Node) return;
|
|
||||||
|
|
||||||
UActorComponent* Template = Node->ComponentTemplate;
|
|
||||||
if (!Template)
|
|
||||||
{
|
|
||||||
UWingServer::Print(TEXT("ERROR: SCS node has no component template.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Header
|
|
||||||
UWingServer::Printf(TEXT("Component: %s\n"), *WingUtils::FormatName(Node));
|
|
||||||
UWingServer::Printf(TEXT("Class: %s\n"), *WingUtils::FormatName(Node->ComponentClass));
|
|
||||||
|
|
||||||
// Parent
|
|
||||||
if (Node->ParentComponentOrVariableName != NAME_None)
|
|
||||||
UWingServer::Printf(TEXT("Parent: %s\n"), *WingUtils::SanitizeName(Node->ParentComponentOrVariableName));
|
|
||||||
|
|
||||||
// Properties (already sorted and grouped by category)
|
|
||||||
TArray<FWingProperty> Props = FWingProperty::GetDetailsMutable(Template, CPF_Edit);
|
|
||||||
|
|
||||||
if (Props.IsEmpty())
|
|
||||||
{
|
|
||||||
UWingServer::Print(TEXT("\n (no editable properties found)\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FString CurrentCategory;
|
|
||||||
for (FWingProperty& P : Props)
|
|
||||||
{
|
|
||||||
FString Category = P.GetCategory();
|
|
||||||
if (Category != CurrentCategory)
|
|
||||||
{
|
|
||||||
CurrentCategory = Category;
|
|
||||||
UWingServer::Printf(TEXT("\n%s:\n"), *CurrentCategory);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool bEditable = !P->HasAnyPropertyFlags(CPF_EditConst);
|
|
||||||
UWingServer::Printf(TEXT(" %s %s %s = %s\n"),
|
|
||||||
bEditable ? TEXT("editable") : TEXT("readonly"),
|
|
||||||
*UWingTypes::TypeToText(P.Prop),
|
|
||||||
*WingUtils::FormatName(P.Prop),
|
|
||||||
*P.GetTruncatedText(100));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user