Files
UnrealEngineUWP/Engine/Source/Editor/UMGEditor/Private/Components/PropertyViewBase.cpp
Lauren Barnes 6248f8d412 Replacing legacy EditorStyle calls with AppStyle
#preflight 6272a74d2f6d177be3c6fdda
#rb Matt.Kuhlenschmidt

#ROBOMERGE-OWNER: Lauren.Barnes
#ROBOMERGE-AUTHOR: lauren.barnes
#ROBOMERGE-SOURCE: CL 20057269 via CL 20070159 via CL 20072035 via CL 20072203
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)
#ROBOMERGE-CONFLICT from-shelf

[CL 20105363 by Lauren Barnes in ue5-main branch]
2022-05-09 13:12:28 -04:00

97 lines
1.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Components/PropertyViewBase.h"
#include "Async/Async.h"
#include "Editor.h"
#include "Engine/World.h"
#include "PropertyEditorModule.h"
#include "Widgets/Layout/SBorder.h"
#include "UObject/UObjectGlobals.h"
#define LOCTEXT_NAMESPACE "UMG"
/////////////////////////////////////////////////////
// UPropertyViewBase
void UPropertyViewBase::ReleaseSlateResources(bool bReleaseChildren)
{
Super::ReleaseSlateResources(bReleaseChildren);
DisplayedWidget.Reset();
}
TSharedRef<SWidget> UPropertyViewBase::RebuildWidget()
{
DisplayedWidget = SNew(SBorder)
.Padding(0.0f)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.BorderImage(FAppStyle::GetBrush("NoBorder"));
BuildContentWidget();
return DisplayedWidget.ToSharedRef();
}
UObject* UPropertyViewBase::GetObject() const
{
return Object.Get();
}
void UPropertyViewBase::SetObject(UObject* InObject)
{
if (Object.Get() != InObject)
{
Object = InObject;
OnObjectChanged();
}
}
void UPropertyViewBase::OnPropertyChangedBroadcast(FName PropertyName)
{
OnPropertyChanged.Broadcast(PropertyName);
}
void UPropertyViewBase::PostLoad()
{
Super::PostLoad();
if (Object.IsNull() && !SoftObjectPath_DEPRECATED.IsNull())
{
Object = SoftObjectPath_DEPRECATED;
}
if(!Object.IsValid() && Object.ToSoftObjectPath().IsAsset() && bAutoLoadAsset && !HasAnyFlags(RF_BeginDestroyed))
{
Object.LoadSynchronous();
BuildContentWidget();
}
}
void UPropertyViewBase::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
if (PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(UPropertyViewBase, Object))
{
OnObjectChanged();
}
Super::PostEditChangeProperty(PropertyChangedEvent);
}
const FText UPropertyViewBase::GetPaletteCategory()
{
return LOCTEXT("Editor", "Editor");
}
/////////////////////////////////////////////////////
#undef LOCTEXT_NAMESPACE