Files
integration/Plugins/UEWingman/Deprecated/Class_ShowProperties.h

77 lines
2.6 KiB
C
Raw Normal View History

2026-03-08 22:17:14 -04:00
#pragma once
#include "CoreMinimal.h"
2026-03-18 10:17:58 -04:00
#include "WingServer.h"
#include "WingHandler.h"
#include "WingTypes.h"
#include "WingUtils.h"
2026-03-12 00:44:17 -04:00
#include "Class_ShowProperties.generated.h"
2026-03-08 22:17:14 -04:00
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
2026-03-15 19:32:09 -04:00
UCLASS()
2026-03-18 10:17:58 -04:00
class UWing_Class_ShowProperties : public UObject, public IWingHandler
2026-03-08 22:17:14 -04:00
{
GENERATED_BODY()
public:
UPROPERTY(meta=(Description="Class name to list properties for"))
FString ClassName;
UPROPERTY(meta=(Optional, Description="Substring filter for property names"))
2026-03-10 20:15:59 -04:00
FString Query;
2026-03-08 22:17:14 -04:00
virtual FString GetDescription() const override
{
return TEXT("List properties on a UClass, including type, owning class, and property flags.");
}
virtual void Handle() override
2026-03-08 22:17:14 -04:00
{
2026-03-18 23:20:10 -04:00
UClass* FoundClass = UWingTypes::TextToOneObjectType(ClassName);
if (!FoundClass) return;
2026-03-08 22:17:14 -04:00
2026-03-18 10:17:58 -04:00
UWingServer::Printf(TEXT("Properties of %s:\n"), *WingUtils::FormatName(FoundClass));
2026-03-08 22:17:14 -04:00
2026-03-10 07:17:42 -04:00
int32 Count = 0;
2026-03-08 22:17:14 -04:00
for (TFieldIterator<FProperty> PropIt(FoundClass); PropIt; ++PropIt)
{
FProperty* Prop = *PropIt;
if (!Prop) continue;
FString PropName = Prop->GetName();
2026-03-10 20:15:59 -04:00
if (!Query.IsEmpty() && !PropName.Contains(Query, ESearchCase::IgnoreCase))
2026-03-08 22:17:14 -04:00
continue;
2026-03-10 07:17:42 -04:00
// Build compact flags string
TStringBuilder<256> Flags;
if (Prop->HasAnyPropertyFlags(CPF_BlueprintVisible)) Flags.Append(TEXT(" BlueprintVisible"));
if (Prop->HasAnyPropertyFlags(CPF_BlueprintReadOnly)) Flags.Append(TEXT(" BlueprintReadOnly"));
if (Prop->HasAnyPropertyFlags(CPF_Edit)) Flags.Append(TEXT(" EditAnywhere"));
if (Prop->HasAnyPropertyFlags(CPF_EditConst)) Flags.Append(TEXT(" VisibleOnly"));
if (Prop->HasAnyPropertyFlags(CPF_Config)) Flags.Append(TEXT(" Config"));
if (Prop->HasAnyPropertyFlags(CPF_SaveGame)) Flags.Append(TEXT(" SaveGame"));
if (Prop->HasAnyPropertyFlags(CPF_Transient)) Flags.Append(TEXT(" Transient"));
if (Prop->HasAnyPropertyFlags(CPF_RepNotify)) Flags.Append(TEXT(" RepNotify"));
2026-03-08 22:17:14 -04:00
UClass* OwnerClass = Prop->GetOwnerClass();
2026-03-18 10:17:58 -04:00
UWingServer::Printf(TEXT(" %s %s"), *UWingTypes::TypeToText(Prop), *PropName);
2026-03-10 07:17:42 -04:00
if (OwnerClass && OwnerClass != FoundClass)
2026-03-18 10:17:58 -04:00
UWingServer::Printf(TEXT(" [%s]"), *WingUtils::FormatName(OwnerClass));
2026-03-10 07:17:42 -04:00
if (Flags.Len() > 0)
2026-03-18 10:17:58 -04:00
UWingServer::Printf(TEXT(" (%s)"), Flags.ToString() + 1); // skip leading space
UWingServer::Print(TEXT("\n"));
2026-03-10 07:17:42 -04:00
Count++;
2026-03-08 22:17:14 -04:00
}
2026-03-10 07:17:42 -04:00
if (Count == 0)
{
2026-03-18 10:17:58 -04:00
UWingServer::Print(TEXT("No properties found.\n"));
2026-03-10 07:17:42 -04:00
}
2026-03-08 22:17:14 -04:00
}
};