RealtimeStyleTransferRuntime/Source/LyraGame/UI/Common/LyraWidgetFactory_Class.cpp

18 lines
638 B
C++
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraWidgetFactory_Class.h"
TSubclassOf<UUserWidget> ULyraWidgetFactory_Class::FindWidgetClassForData_Implementation(const UObject* Data) const
{
// Starting with the current class, work backwards to see if there are any construction rules for this class.
for (UClass* Class = Data->GetClass(); Class; Class = Class->GetSuperClass())
{
TSoftClassPtr<UObject> ClassPtr(Class);
if (const TSubclassOf<UUserWidget> EntryWidgetClassPtr = EntryWidgetForClass.FindRef(ClassPtr))
{
return EntryWidgetClassPtr;
}
}
return TSubclassOf<UUserWidget>();
}