Files
UnrealEngineUWP/Engine/Source/Editor/DataLayerEditor/Private/DataLayer/DataLayerDragDropOp.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

47 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "DataLayer/DataLayerDragDropOp.h"
#include "GameFramework/Actor.h"
#include "Textures/SlateIcon.h"
#include "ClassIconFinder.h"
#include "Algo/Transform.h"
void FDataLayerDragDropOp::Construct()
{
const FSlateBrush* Icon = FAppStyle::GetBrush(TEXT("DataLayer.Editor"));
if (DataLayerDragDropInfos.Num() == 1)
{
SetToolTip(FText::FromString(DataLayerDragDropInfos[0].DataLayerShortName), Icon);
}
else
{
FText Text = FText::Format(NSLOCTEXT("FDataLayerDragDropOp", "MultipleFormat", "{0} DataLayers"), DataLayerDragDropInfos.Num());
SetToolTip(Text, Icon);
}
SetupDefaults();
FDecoratedDragDropOp::Construct();
}
void FDataLayerActorMoveOp::Construct()
{
// Set text and icon
TArray< TWeakObjectPtr< AActor > > Actors;
Algo::TransformIf(DataLayerActorMoveElements, Actors, [](const FDataLayerActorMoveElement& MoveElement) { return MoveElement.Key.IsValid(); }, [](const FDataLayerActorMoveElement& MoveElement) { return MoveElement.Key; });
UClass* CommonSelClass = nullptr;
const FSlateBrush* Icon = FClassIconFinder::FindIconForActors(Actors, CommonSelClass);
if (DataLayerActorMoveElements.Num() == 1)
{
SetToolTip(FText::FromString(DataLayerActorMoveElements[0].Key->GetActorLabel()), Icon);
}
else
{
const FText Text = FText::Format(NSLOCTEXT("FDataLayerActorDragDropOp", "FormatActors", "{0} Actors"), DataLayerActorMoveElements.Num());
SetToolTip(Text, Icon);
}
SetupDefaults();
FDecoratedDragDropOp::Construct();
}