2019-12-26 15:33:43 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-11-10 10:09:21 -05:00
|
|
|
|
|
|
|
|
#include "ActorTreeItem.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "Widgets/DeclarativeSyntaxSupport.h"
|
|
|
|
|
#include "Layout/WidgetPath.h"
|
|
|
|
|
#include "Framework/Application/MenuStack.h"
|
|
|
|
|
#include "Framework/Application/SlateApplication.h"
|
|
|
|
|
#include "Editor.h"
|
2014-11-10 10:09:21 -05:00
|
|
|
#include "ScopedTransaction.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "SceneOutlinerPublicTypes.h"
|
|
|
|
|
#include "SceneOutlinerDragDrop.h"
|
|
|
|
|
#include "SceneOutlinerStandaloneTypes.h"
|
2020-07-22 09:35:57 -04:00
|
|
|
#include "Widgets/Text/SInlineEditableTextBlock.h"
|
|
|
|
|
#include "ActorEditorUtils.h"
|
|
|
|
|
#include "ClassIconFinder.h"
|
|
|
|
|
#include "ISceneOutliner.h"
|
|
|
|
|
#include "ISceneOutlinerMode.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "Logging/MessageLog.h"
|
|
|
|
|
#include "SSocketChooser.h"
|
2022-03-29 09:19:22 -04:00
|
|
|
#include "LevelInstance/LevelInstanceInterface.h"
|
2021-05-03 15:49:00 -04:00
|
|
|
#include "WorldPartition/WorldPartition.h"
|
2021-11-23 14:43:39 -05:00
|
|
|
#include "ToolMenu.h"
|
2021-12-13 13:32:13 -05:00
|
|
|
#include "Engine/Level.h"
|
2014-11-10 10:09:21 -05:00
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "SceneOutliner_ActorTreeItem"
|
|
|
|
|
|
2022-05-20 10:13:02 -04:00
|
|
|
const FSceneOutlinerTreeItemType FActorTreeItem::Type(&IActorBaseTreeItem::Type);
|
2014-11-10 10:09:21 -05:00
|
|
|
|
2020-07-28 09:25:56 -04:00
|
|
|
struct SActorTreeLabel : FSceneOutlinerCommonLabelData, public SCompoundWidget
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2020-07-22 09:35:57 -04:00
|
|
|
SLATE_BEGIN_ARGS(SActorTreeLabel) {}
|
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
|
|
2020-07-28 09:25:56 -04:00
|
|
|
void Construct(const FArguments& InArgs, FActorTreeItem& ActorItem, ISceneOutliner& SceneOutliner, const STableRow<FSceneOutlinerTreeItemPtr>& InRow)
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2020-07-22 09:35:57 -04:00
|
|
|
WeakSceneOutliner = StaticCastSharedRef<ISceneOutliner>(SceneOutliner.AsShared());
|
|
|
|
|
|
|
|
|
|
TreeItemPtr = StaticCastSharedRef<FActorTreeItem>(ActorItem.AsShared());
|
|
|
|
|
ActorPtr = ActorItem.Actor;
|
|
|
|
|
|
|
|
|
|
HighlightText = SceneOutliner.GetFilterHighlightText();
|
|
|
|
|
|
|
|
|
|
TSharedPtr<SInlineEditableTextBlock> InlineTextBlock;
|
|
|
|
|
|
|
|
|
|
auto MainContent = SNew(SHorizontalBox)
|
|
|
|
|
|
|
|
|
|
// Main actor label
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
[
|
|
|
|
|
SAssignNew(InlineTextBlock, SInlineEditableTextBlock)
|
|
|
|
|
.Text(this, &SActorTreeLabel::GetDisplayText)
|
|
|
|
|
.ToolTipText(this, &SActorTreeLabel::GetTooltipText)
|
|
|
|
|
.HighlightText(HighlightText)
|
|
|
|
|
.ColorAndOpacity(this, &SActorTreeLabel::GetForegroundColor)
|
|
|
|
|
.OnTextCommitted(this, &SActorTreeLabel::OnLabelCommitted)
|
|
|
|
|
.OnVerifyTextChanged(this, &SActorTreeLabel::OnVerifyItemLabelChanged)
|
2021-02-15 14:17:16 -04:00
|
|
|
.OnEnterEditingMode(this, &SActorTreeLabel::OnEnterEditingMode)
|
|
|
|
|
.OnExitEditingMode(this, &SActorTreeLabel::OnExitEditingMode)
|
2020-07-28 09:25:56 -04:00
|
|
|
.IsSelected(FIsSelected::CreateSP(&InRow, &STableRow<FSceneOutlinerTreeItemPtr>::IsSelectedExclusively))
|
2020-07-22 09:35:57 -04:00
|
|
|
.IsReadOnly_Lambda([Item = ActorItem.AsShared(), this]()
|
|
|
|
|
{
|
|
|
|
|
return !CanExecuteRenameRequest(Item.Get());
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
|
2020-11-19 18:25:17 -04:00
|
|
|
+ SHorizontalBox::Slot()
|
2020-07-22 09:35:57 -04:00
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
.Padding(0.0f, 0.f, 3.0f, 0.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(STextBlock)
|
|
|
|
|
.Text(this, &SActorTreeLabel::GetTypeText)
|
2020-11-19 18:25:17 -04:00
|
|
|
.Visibility(this, &SActorTreeLabel::GetTypeTextVisibility)
|
|
|
|
|
.HighlightText(HighlightText)
|
2020-07-22 09:35:57 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (WeakSceneOutliner.Pin()->GetMode()->IsInteractive())
|
|
|
|
|
{
|
|
|
|
|
ActorItem.RenameRequestEvent.BindSP(InlineTextBlock.Get(), &SInlineEditableTextBlock::EnterEditingMode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ChildSlot
|
|
|
|
|
[
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
.VAlign(VAlign_Center)
|
2020-07-28 09:25:56 -04:00
|
|
|
.Padding(FSceneOutlinerDefaultTreeItemMetrics::IconPadding())
|
2020-07-22 09:35:57 -04:00
|
|
|
[
|
|
|
|
|
SNew(SBox)
|
2020-07-28 09:25:56 -04:00
|
|
|
.WidthOverride(FSceneOutlinerDefaultTreeItemMetrics::IconSize())
|
|
|
|
|
.HeightOverride(FSceneOutlinerDefaultTreeItemMetrics::IconSize())
|
2020-07-22 09:35:57 -04:00
|
|
|
[
|
|
|
|
|
SNew(SImage)
|
|
|
|
|
.Image(this, &SActorTreeLabel::GetIcon)
|
|
|
|
|
.ToolTipText(this, &SActorTreeLabel::GetIconTooltip)
|
2020-09-14 15:07:08 -04:00
|
|
|
.ColorAndOpacity(FSlateColor::UseForeground())
|
2020-07-22 09:35:57 -04:00
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.FillWidth(1.0f)
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
.Padding(0.0f, 0.0f)
|
|
|
|
|
[
|
|
|
|
|
MainContent
|
|
|
|
|
]
|
|
|
|
|
];
|
2014-11-10 10:09:21 -05:00
|
|
|
}
|
|
|
|
|
|
2020-07-22 09:35:57 -04:00
|
|
|
private:
|
|
|
|
|
TWeakPtr<FActorTreeItem> TreeItemPtr;
|
|
|
|
|
TWeakObjectPtr<AActor> ActorPtr;
|
|
|
|
|
TAttribute<FText> HighlightText;
|
2021-03-23 19:03:31 -04:00
|
|
|
|
2020-07-22 09:35:57 -04:00
|
|
|
FText GetDisplayText() const
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2021-03-23 19:03:31 -04:00
|
|
|
if (const FSceneOutlinerTreeItemPtr TreeItem = TreeItemPtr.Pin())
|
2020-08-13 10:46:40 -04:00
|
|
|
{
|
2021-03-23 19:03:31 -04:00
|
|
|
const AActor* Actor = ActorPtr.Get();
|
2022-03-29 09:19:22 -04:00
|
|
|
if (const ILevelInstanceInterface* LevelInstance = Cast<ILevelInstanceInterface>(Actor))
|
2020-08-13 10:46:40 -04:00
|
|
|
{
|
2022-05-02 11:00:12 -04:00
|
|
|
if (!bInEditingMode)
|
2021-03-23 19:03:31 -04:00
|
|
|
{
|
2022-05-02 11:00:12 -04:00
|
|
|
FText DirtySuffixText = LevelInstance->IsDirty() ? FText(LOCTEXT("IsDirtySuffix", "*")) : FText::GetEmpty();
|
|
|
|
|
FText IsCurrentSuffixText = LevelInstance->GetLoadedLevel() && LevelInstance->GetLoadedLevel()->IsCurrentLevel() ? FText(LOCTEXT("IsCurrentSuffix", " (Current)")) : FText::GetEmpty();
|
|
|
|
|
return FText::Format(LOCTEXT("LevelInstanceDisplay", "{0}{1}{2}"), FText::FromString(TreeItem->GetDisplayString()), DirtySuffixText, IsCurrentSuffixText);
|
2021-03-23 19:03:31 -04:00
|
|
|
}
|
2020-08-13 10:46:40 -04:00
|
|
|
}
|
2021-03-23 19:03:31 -04:00
|
|
|
return FText::FromString(TreeItem->GetDisplayString());
|
2020-08-13 10:46:40 -04:00
|
|
|
}
|
|
|
|
|
|
2021-03-23 19:03:31 -04:00
|
|
|
return FText();
|
2020-07-22 09:35:57 -04:00
|
|
|
}
|
2014-11-10 10:09:21 -05:00
|
|
|
|
2020-07-22 09:35:57 -04:00
|
|
|
FText GetTooltipText() const
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2021-04-15 11:12:23 -04:00
|
|
|
if (const FSceneOutlinerTreeItemPtr TreeItem = TreeItemPtr.Pin())
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2021-04-15 11:12:23 -04:00
|
|
|
return FText::FromString(TreeItem->GetDisplayString());
|
2020-07-22 09:35:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FText GetTypeText() const
|
|
|
|
|
{
|
|
|
|
|
if (const AActor* Actor = ActorPtr.Get())
|
|
|
|
|
{
|
|
|
|
|
return FText::FromName(Actor->GetClass()->GetFName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EVisibility GetTypeTextVisibility() const
|
|
|
|
|
{
|
|
|
|
|
return HighlightText.Get().IsEmpty() ? EVisibility::Collapsed : EVisibility::Visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* GetIcon() const
|
|
|
|
|
{
|
|
|
|
|
if (const AActor* Actor = ActorPtr.Get())
|
|
|
|
|
{
|
|
|
|
|
if (WeakSceneOutliner.IsValid())
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2020-07-22 09:35:57 -04:00
|
|
|
FName IconName = Actor->GetCustomIconName();
|
|
|
|
|
if (IconName == NAME_None)
|
2015-02-18 10:08:12 -05:00
|
|
|
{
|
2020-07-22 09:35:57 -04:00
|
|
|
IconName = Actor->GetClass()->GetFName();
|
2015-02-18 10:08:12 -05:00
|
|
|
}
|
2020-07-22 09:35:57 -04:00
|
|
|
|
|
|
|
|
const FSlateBrush* CachedBrush = WeakSceneOutliner.Pin()->GetCachedIconForClass(IconName);
|
|
|
|
|
if (CachedBrush != nullptr)
|
2015-02-18 10:08:12 -05:00
|
|
|
{
|
2020-07-22 09:35:57 -04:00
|
|
|
return CachedBrush;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* FoundSlateBrush = FClassIconFinder::FindIconForActor(Actor);
|
|
|
|
|
WeakSceneOutliner.Pin()->CacheIconForClass(IconName, FoundSlateBrush);
|
|
|
|
|
return FoundSlateBrush;
|
2015-02-18 10:08:12 -05:00
|
|
|
}
|
2014-11-10 10:09:21 -05:00
|
|
|
}
|
2020-07-22 09:35:57 -04:00
|
|
|
else
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2020-07-22 09:35:57 -04:00
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-23 19:03:31 -04:00
|
|
|
return FSlateIconFinder::FindIconForClass(AActor::StaticClass()).GetOptionalIcon();
|
2020-07-22 09:35:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* GetIconOverlay() const
|
|
|
|
|
{
|
|
|
|
|
static const FName SequencerActorTag(TEXT("SequencerActor"));
|
|
|
|
|
|
|
|
|
|
if (const AActor* Actor = ActorPtr.Get())
|
|
|
|
|
{
|
|
|
|
|
if (Actor->ActorHasTag(SequencerActorTag))
|
|
|
|
|
{
|
2022-05-09 13:12:28 -04:00
|
|
|
return FAppStyle::GetBrush("Sequencer.SpawnableIconOverlay");
|
2020-07-22 09:35:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FText GetIconTooltip() const
|
|
|
|
|
{
|
|
|
|
|
auto TreeItem = TreeItemPtr.Pin();
|
|
|
|
|
if (!TreeItem.IsValid())
|
|
|
|
|
{
|
|
|
|
|
return FText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FText ToolTipText;
|
|
|
|
|
if (AActor* Actor = ActorPtr.Get())
|
|
|
|
|
{
|
|
|
|
|
ToolTipText = FText::FromString(Actor->GetClass()->GetName());
|
|
|
|
|
if (WeakSceneOutliner.Pin()->GetMode()->IsInteractive())
|
|
|
|
|
{
|
|
|
|
|
USceneComponent* RootComponent = Actor->GetRootComponent();
|
|
|
|
|
if (RootComponent)
|
|
|
|
|
{
|
|
|
|
|
FFormatNamedArguments Args;
|
|
|
|
|
Args.Add(TEXT("ActorClassName"), ToolTipText);
|
|
|
|
|
|
|
|
|
|
if (RootComponent->Mobility == EComponentMobility::Static)
|
|
|
|
|
{
|
|
|
|
|
ToolTipText = FText::Format(LOCTEXT("ComponentMobility_Static", "{ActorClassName} with static mobility"), Args);
|
|
|
|
|
}
|
|
|
|
|
else if (RootComponent->Mobility == EComponentMobility::Stationary)
|
|
|
|
|
{
|
|
|
|
|
ToolTipText = FText::Format(LOCTEXT("ComponentMobility_Stationary", "{ActorClassName} with stationary mobility"), Args);
|
|
|
|
|
}
|
|
|
|
|
else if (RootComponent->Mobility == EComponentMobility::Movable)
|
|
|
|
|
{
|
|
|
|
|
ToolTipText = FText::Format(LOCTEXT("ComponentMobility_Movable", "{ActorClassName} with movable mobility"), Args);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ToolTipText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSlateColor GetForegroundColor() const
|
|
|
|
|
{
|
2020-08-13 10:46:40 -04:00
|
|
|
AActor* Actor = ActorPtr.Get();
|
|
|
|
|
|
2021-11-24 09:56:41 -05:00
|
|
|
// Color LevelInstances differently if they are being edited
|
2022-03-29 09:19:22 -04:00
|
|
|
if (const ILevelInstanceInterface* LevelInstance = Cast<ILevelInstanceInterface>(Actor))
|
2021-11-24 09:56:41 -05:00
|
|
|
{
|
2022-03-29 09:19:22 -04:00
|
|
|
if (LevelInstance->IsEditing())
|
2021-11-24 09:56:41 -05:00
|
|
|
{
|
|
|
|
|
return FAppStyle::Get().GetSlateColor("Colors.AccentGreen");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-22 09:35:57 -04:00
|
|
|
auto TreeItem = TreeItemPtr.Pin();
|
2020-07-28 09:25:56 -04:00
|
|
|
if (auto BaseColor = FSceneOutlinerCommonLabelData::GetForegroundColor(*TreeItem))
|
2020-07-22 09:35:57 -04:00
|
|
|
{
|
|
|
|
|
return BaseColor.GetValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Actor)
|
|
|
|
|
{
|
|
|
|
|
// Deleted actor!
|
|
|
|
|
return FLinearColor(0.2f, 0.2f, 0.25f);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 09:25:56 -04:00
|
|
|
UWorld* OwningWorld = Actor->GetWorld();
|
2020-07-22 09:35:57 -04:00
|
|
|
if (!OwningWorld)
|
|
|
|
|
{
|
2020-07-28 09:25:56 -04:00
|
|
|
// Deleted world!
|
2020-07-22 09:35:57 -04:00
|
|
|
return FLinearColor(0.2f, 0.2f, 0.25f);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 09:25:56 -04:00
|
|
|
const bool bRepresentingPIEWorld = TreeItem->Actor->GetWorld()->IsPlayInEditor();
|
2020-07-22 09:35:57 -04:00
|
|
|
if (bRepresentingPIEWorld && !TreeItem->bExistsInCurrentWorldAndPIE)
|
|
|
|
|
{
|
|
|
|
|
// Highlight actors that are exclusive to PlayWorld
|
|
|
|
|
return FLinearColor(0.9f, 0.8f, 0.4f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// also darken items that are non selectable in the active mode(s)
|
|
|
|
|
const bool bInSelected = true;
|
|
|
|
|
const bool bSelectEvenIfHidden = true; // @todo outliner: Is this actually OK?
|
|
|
|
|
if (!GEditor->CanSelectActor(Actor, bInSelected, bSelectEvenIfHidden))
|
|
|
|
|
{
|
2020-07-28 09:25:56 -04:00
|
|
|
return FSceneOutlinerCommonLabelData::DarkColor;
|
2020-07-22 09:35:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FSlateColor::UseForeground();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool OnVerifyItemLabelChanged(const FText& InLabel, FText& OutErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
return FActorEditorUtils::ValidateActorName(InLabel, OutErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OnLabelCommitted(const FText& InLabel, ETextCommit::Type InCommitInfo)
|
|
|
|
|
{
|
|
|
|
|
auto* Actor = ActorPtr.Get();
|
|
|
|
|
if (Actor && Actor->IsActorLabelEditable() && !InLabel.ToString().Equals(Actor->GetActorLabel(), ESearchCase::CaseSensitive))
|
|
|
|
|
{
|
|
|
|
|
const FScopedTransaction Transaction(LOCTEXT("SceneOutlinerRenameActorTransaction", "Rename Actor"));
|
|
|
|
|
FActorLabelUtilities::RenameExistingActor(Actor, InLabel.ToString());
|
|
|
|
|
|
|
|
|
|
auto Outliner = WeakSceneOutliner.Pin();
|
|
|
|
|
if (Outliner.IsValid())
|
|
|
|
|
{
|
|
|
|
|
Outliner->SetKeyboardFocus();
|
2014-11-10 10:09:21 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-15 14:17:16 -04:00
|
|
|
|
|
|
|
|
void OnEnterEditingMode()
|
|
|
|
|
{
|
|
|
|
|
bInEditingMode = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OnExitEditingMode()
|
|
|
|
|
{
|
|
|
|
|
bInEditingMode = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bInEditingMode = false;
|
2020-07-22 09:35:57 -04:00
|
|
|
};
|
2014-11-10 10:09:21 -05:00
|
|
|
|
|
|
|
|
FActorTreeItem::FActorTreeItem(AActor* InActor)
|
2022-05-20 10:13:02 -04:00
|
|
|
: IActorBaseTreeItem(Type)
|
2020-07-22 09:35:57 -04:00
|
|
|
, Actor(InActor)
|
2014-11-13 04:01:53 -05:00
|
|
|
, ID(InActor)
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2021-03-23 19:03:31 -04:00
|
|
|
check(InActor);
|
2022-05-10 10:22:54 -04:00
|
|
|
|
|
|
|
|
UpdateDisplayStringInternal();
|
2022-01-25 11:02:09 -05:00
|
|
|
|
|
|
|
|
Flags.bIsExpanded = InActor->bDefaultOutlinerExpansionState;
|
2021-03-23 19:03:31 -04:00
|
|
|
|
2014-11-10 10:09:21 -05:00
|
|
|
bExistsInCurrentWorldAndPIE = GEditor->ObjectsThatExistInEditorWorld.Get(InActor);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 09:25:56 -04:00
|
|
|
FSceneOutlinerTreeItemID FActorTreeItem::GetID() const
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2014-11-13 04:01:53 -05:00
|
|
|
return ID;
|
2014-11-10 10:09:21 -05:00
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:43:39 -05:00
|
|
|
FFolder::FRootObject FActorTreeItem::GetRootObject() const
|
|
|
|
|
{
|
|
|
|
|
AActor* ActorPtr = Actor.Get();
|
|
|
|
|
return ActorPtr ? ActorPtr->GetFolderRootObject() : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-10 10:09:21 -05:00
|
|
|
FString FActorTreeItem::GetDisplayString() const
|
|
|
|
|
{
|
2022-05-10 10:22:54 -04:00
|
|
|
return DisplayString;
|
2014-11-10 10:09:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FActorTreeItem::CanInteract() const
|
|
|
|
|
{
|
|
|
|
|
AActor* ActorPtr = Actor.Get();
|
2014-11-13 09:58:00 -05:00
|
|
|
if (!ActorPtr || !Flags.bInteractive)
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bool bInSelected = true;
|
|
|
|
|
const bool bSelectEvenIfHidden = true; // @todo outliner: Is this actually OK?
|
|
|
|
|
if (!GEditor->CanSelectActor(ActorPtr, bInSelected, bSelectEvenIfHidden))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 09:25:56 -04:00
|
|
|
TSharedRef<SWidget> FActorTreeItem::GenerateLabelWidget(ISceneOutliner& Outliner, const STableRow<FSceneOutlinerTreeItemPtr>& InRow)
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2020-07-22 09:35:57 -04:00
|
|
|
return SNew(SActorTreeLabel, *this, Outliner, InRow);
|
2014-11-10 10:09:21 -05:00
|
|
|
}
|
|
|
|
|
|
2021-12-13 13:32:13 -05:00
|
|
|
bool FActorTreeItem::ShouldShowPinnedState() const
|
|
|
|
|
{
|
|
|
|
|
if (const AActor* ActorPtr = Actor.Get())
|
|
|
|
|
{
|
|
|
|
|
const ULevel* Level = ActorPtr->GetLevel();
|
2022-05-19 10:51:44 -04:00
|
|
|
const UWorld* World = Level->GetWorld();
|
|
|
|
|
return !World->IsGameWorld() && !!Level->GetWorldPartition();
|
2021-12-13 13:32:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FActorTreeItem::ShouldShowVisibilityState() const
|
|
|
|
|
{
|
|
|
|
|
if (const AActor* ActorPtr = Actor.Get())
|
|
|
|
|
{
|
|
|
|
|
const ULevel* Level = ActorPtr->GetLevel();
|
|
|
|
|
return Level->IsPersistentLevel() || !Level->IsInstancedLevel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-22 09:35:57 -04:00
|
|
|
void FActorTreeItem::OnVisibilityChanged(const bool bNewVisibility)
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2020-07-22 09:35:57 -04:00
|
|
|
// Save the actor to the transaction buffer to support undo/redo, but do
|
|
|
|
|
// not call Modify, as we do not want to dirty the actor's package and
|
|
|
|
|
// we're only editing temporary, transient values
|
|
|
|
|
SaveToTransactionBuffer(Actor.Get(), false);
|
|
|
|
|
Actor->SetIsTemporarilyHiddenInEditor(!bNewVisibility);
|
2014-11-10 10:09:21 -05:00
|
|
|
}
|
|
|
|
|
|
2020-07-22 09:35:57 -04:00
|
|
|
bool FActorTreeItem::GetVisibility() const
|
2014-11-10 10:09:21 -05:00
|
|
|
{
|
2021-03-23 19:03:31 -04:00
|
|
|
// We want deleted actors to appear as if they are visible to minimize visual clutter.
|
|
|
|
|
return !Actor.IsValid() || !Actor->IsTemporarilyHiddenInEditor(true);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-03 15:49:00 -04:00
|
|
|
bool FActorTreeItem::GetPinnedState() const
|
|
|
|
|
{
|
|
|
|
|
if (Actor.IsValid())
|
|
|
|
|
{
|
|
|
|
|
if (const UWorld* const World = Actor->GetWorld())
|
|
|
|
|
{
|
|
|
|
|
if (const UWorldPartition* const WorldPartition = World->GetWorldPartition())
|
|
|
|
|
{
|
|
|
|
|
return WorldPartition->IsActorPinned(Actor->GetActorGuid());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-23 19:03:31 -04:00
|
|
|
void FActorTreeItem::OnLabelChanged()
|
|
|
|
|
{
|
2022-05-10 10:22:54 -04:00
|
|
|
UpdateDisplayString();
|
2014-11-10 10:09:21 -05:00
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:43:39 -05:00
|
|
|
void FActorTreeItem::GenerateContextMenu(UToolMenu* Menu, SSceneOutliner& Outliner)
|
|
|
|
|
{
|
|
|
|
|
const AActor* ActorPtr = Actor.Get();
|
2022-03-29 09:19:22 -04:00
|
|
|
const ILevelInstanceInterface* LevelInstance = Cast<ILevelInstanceInterface>(ActorPtr);
|
|
|
|
|
if (LevelInstance && LevelInstance->IsEditing())
|
2021-11-23 14:43:39 -05:00
|
|
|
{
|
|
|
|
|
auto SharedOutliner = StaticCastSharedRef<SSceneOutliner>(Outliner.AsShared());
|
2022-05-09 13:12:28 -04:00
|
|
|
const FSlateIcon NewFolderIcon(FAppStyle::GetAppStyleSetName(), "SceneOutliner.NewFolderIcon");
|
2021-11-23 14:43:39 -05:00
|
|
|
FToolMenuSection& Section = Menu->AddSection("Section");
|
|
|
|
|
Section.AddMenuEntry("CreateFolder", LOCTEXT("CreateFolder", "Create Folder"), FText(), NewFolderIcon, FUIAction(FExecuteAction::CreateSP(&Outliner, &SSceneOutliner::CreateFolder)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-20 10:13:02 -04:00
|
|
|
const FGuid& FActorTreeItem::GetGuid() const
|
|
|
|
|
{
|
|
|
|
|
static const FGuid InvalidGuid;
|
|
|
|
|
return Actor.IsValid() ? Actor->GetActorGuid() : InvalidGuid;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-10 10:22:54 -04:00
|
|
|
void FActorTreeItem::UpdateDisplayString()
|
|
|
|
|
{
|
|
|
|
|
UpdateDisplayStringInternal();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FActorTreeItem::UpdateDisplayStringInternal()
|
|
|
|
|
{
|
|
|
|
|
DisplayString = Actor.IsValid() ? Actor->GetActorLabel() : TEXT("None");
|
|
|
|
|
}
|
|
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#undef LOCTEXT_NAMESPACE
|