Files
UnrealEngineUWP/Engine/Source/Editor/DataLayerEditor/Private/DataLayer/DataLayerDragDropOp.cpp
richard malo 6583fa5db3 Allow editing data layers of level instance when editing the level instance
- When editing level instance, only show loaded/unloaded actors of this level
- When editing level instance, don't prefix actor label with parent level instance(s)
- Replaced import data layer menu option by drag and dropping level instance data layers into main world AWorldDataLayers
- Removed menu option "Create Data Layer under <other> DataLayer" as it will never be allowed for DataLayerInstanceWithAsset since created without any valid DataLayerAsset.
- Disabled changing visibility and editor loading of DataLayerInstances of editing level instance
- Allow editing data layer of level instance when editing the level instance even when main world is not partitioned
- Changed font from bold to bold+italic on DataLayerInstances containing actors part of editor selection
- Removed suffix "- WorldDataLayers" on parent node of DataLayerInstances in the DataLayer Outliner
- Colorize and append "(Current)" to WorldDataLayer of editing Level Instance in the DataLayer Outliner
- Support Make Current on Level instance DataLayerInstances when editing level instance
#rb patrick.enfedaque
#jira UE-178410
#jira UE-177386
#preflight 63f8f0f19009dd70d7b87224

[CL 24441128 by richard malo in ue5-main branch]
2023-02-28 08:35:38 -05:00

56 lines
1.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "DataLayer/DataLayerDragDropOp.h"
#include "Algo/Transform.h"
#include "ClassIconFinder.h"
#include "GameFramework/Actor.h"
#include "HAL/Platform.h"
#include "HAL/PlatformCrt.h"
#include "Internationalization/Internationalization.h"
#include "Internationalization/Text.h"
#include "Styling/AppStyle.h"
#include "Templates/Tuple.h"
class UClass;
struct FSlateBrush;
void FDataLayerDragDropOp::Construct()
{
const FSlateBrush* Icon = FAppStyle::GetBrush(TEXT("DataLayer.Editor"));
if (DataLayerInstances.Num() == 1 && DataLayerInstances[0].IsValid())
{
SetToolTip(FText::FromString(DataLayerInstances[0]->GetDataLayerShortName()), Icon);
}
else
{
FText Text = FText::Format(NSLOCTEXT("FDataLayerDragDropOp", "MultipleFormat", "{0} DataLayers"), DataLayerInstances.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();
}