Files
UnrealEngineUWP/Engine/Source/Editor/DataLayerEditor/Private/DataLayer/DataLayerDragDropOp.cpp
vincent beauchemin 00965af9e8 Add feature to move actors from data layer(s) to another data layer in the Data Layers Outliner
* This is perform on Left Alt down.
* Mouse cursor is changed during the operation.
* SceneOutliner CreateDragDropOperation has now info on FPointerEvent.

#rb richard.malo
#preflight 620d2bb501253d2e19175c1c

[CL 19016197 by vincent beauchemin in ue5-main branch]
2022-02-16 11:58:08 -05: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 = FEditorStyle::GetBrush(TEXT("DataLayer.Editor"));
if (DataLayerLabels.Num() == 1)
{
SetToolTip(FText::FromName(DataLayerLabels[0]), Icon);
}
else
{
FText Text = FText::Format(NSLOCTEXT("FDataLayerDragDropOp", "MultipleFormat", "{0} DataLayerLabels"), DataLayerLabels.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();
}