You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[REVIEW] [at]ui-editor-systems #ROBOMERGE-AUTHOR: nick.darnell #ROBOMERGE-SOURCE: CL 20383614 via CL 20384610 via CL 20384741 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246) [CL 20386425 by nick darnell in ue5-main branch]
68 lines
1.2 KiB
C++
68 lines
1.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "WidgetReference.h"
|
|
#include "WidgetBlueprintEditor.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "UMG"
|
|
|
|
FWidgetHandle::FWidgetHandle(UWidget* InWidget)
|
|
: Widget(InWidget)
|
|
{
|
|
|
|
}
|
|
|
|
// FWidgetReference
|
|
|
|
FWidgetReference::FWidgetReference()
|
|
: WidgetEditor()
|
|
, TemplateHandle()
|
|
{
|
|
|
|
}
|
|
|
|
FWidgetReference::FWidgetReference(TSharedPtr<FWidgetBlueprintEditor> InWidgetEditor, TSharedPtr< FWidgetHandle > InTemplateHandle)
|
|
: WidgetEditor(InWidgetEditor)
|
|
, TemplateHandle(InTemplateHandle)
|
|
{
|
|
|
|
}
|
|
|
|
bool FWidgetReference::IsValid() const
|
|
{
|
|
if ( TemplateHandle.IsValid() )
|
|
{
|
|
return TemplateHandle->Widget.Get() != nullptr && GetPreview();
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
UWidget* FWidgetReference::GetTemplate() const
|
|
{
|
|
if ( TemplateHandle.IsValid() )
|
|
{
|
|
return TemplateHandle->Widget.Get();
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
UWidget* FWidgetReference::GetPreview() const
|
|
{
|
|
if ( WidgetEditor.IsValid() && TemplateHandle.IsValid() )
|
|
{
|
|
if ( UUserWidget* PreviewRoot = WidgetEditor.Pin()->GetPreview() )
|
|
{
|
|
if ( UWidget* TemplateWidget = TemplateHandle->Widget.Get() )
|
|
{
|
|
UWidget* PreviewWidget = PreviewRoot->GetWidgetFromName(TemplateWidget->GetFName());
|
|
return PreviewWidget;
|
|
}
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|