27 lines
766 B
C++
27 lines
766 B
C++
#include "WingWidgets.h"
|
|
#include "WingServer.h"
|
|
#include "WingUtils.h"
|
|
#include "Blueprint/WidgetTree.h"
|
|
#include "Components/Widget.h"
|
|
#include "Components/PanelWidget.h"
|
|
#include "Components/PanelSlot.h"
|
|
|
|
void WingWidgets::PrintWidgetTree(UWidget* Widget, int32 Depth)
|
|
{
|
|
FString Indent = FString::ChrN(Depth * 2, TEXT(' '));
|
|
if (Widget == nullptr)
|
|
{
|
|
UWingServer::Printf(TEXT("%s[null]\n"), *Indent);
|
|
return;
|
|
}
|
|
FString TypeName = WingUtils::FormatName(Widget->GetClass());
|
|
FString WidgetName = WingUtils::FormatName(Widget);
|
|
UWingServer::Printf(TEXT("%s%s %s\n"), *Indent, *TypeName, *WidgetName);
|
|
|
|
if (UPanelWidget* Panel = Cast<UPanelWidget>(Widget))
|
|
{
|
|
for (UPanelSlot* Slot : Panel->GetSlots())
|
|
PrintWidgetTree(Slot->Content, Depth + 1);
|
|
}
|
|
}
|