Files
UnrealEngineUWP/Engine/Source/Editor/DataLayerEditor/Private/DataLayerEditorModule.cpp
richard malo 14620f45a3 External Data Layer V1
- Allows for plugins to inject/remove content (actors) in a partitioned world
- Serves as a replacement for the experimental 'Content Bundle' feature
- Added new External Data Layer (EDL) Asset
- Added new Game Feature Action 'AddWorldPartitionContent' to control activation of an EDL asset
- Supports Data Layers inside a plugin (child of an EDL)
- Added builder to convert content bundles to EDL (UGameFeatureActionConvertContentBundleWorldPartitionBuilder)
- Feature is temporarily disabled by default and can be turned on using Editor Experimental Settings 'Enable World Partition External Data Layers' flag
#jira UE-204248
#rb JeanFrancois.Dube, Patrick.Enfedaque, Sebastien.Lussier
#tests QAGame PIE/-game/cooked, Regression test PIE/cook of latest game map, Tested PIE/cook of latest game map converted to EDL

[CL 31015614 by richard malo in ue5-main branch]
2024-01-30 14:18:27 -05:00

71 lines
2.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "DataLayerEditorModule.h"
#include "DataLayer/DataLayerEditorSubsystem.h"
#include "DataLayer/DataLayerInstanceCustomization.h"
#include "DataLayer/DataLayerNameEditSink.h"
#include "DataLayer/DataLayerPropertyTypeCustomization.h"
#include "DataLayer/SDataLayerBrowser.h"
#include "WorldPartition/DataLayer/ExternalDataLayerAsset.h"
#include "EditorWidgetsModule.h"
#include "HAL/Platform.h"
#include "Modules/ModuleManager.h"
#include "ObjectNameEditSinkRegistry.h"
#include "PropertyEditorDelegates.h"
#include "PropertyEditorModule.h"
#include "UObject/NameTypes.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Widgets/SWidget.h"
class AActor;
IMPLEMENT_MODULE(FDataLayerEditorModule, DataLayerEditor );
static const FName NAME_ActorDataLayer(TEXT("ActorDataLayer"));
static const FName NAME_DataLayerInstance(TEXT("DataLayerInstance"));
void FDataLayerEditorModule::StartupModule()
{
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.RegisterCustomPropertyTypeLayout(NAME_ActorDataLayer, FOnGetPropertyTypeCustomizationInstance::CreateLambda([] { return MakeShared<FDataLayerPropertyTypeCustomization>(); }));
PropertyModule.RegisterCustomClassLayout(NAME_DataLayerInstance, FOnGetDetailCustomizationInstance::CreateStatic(&FDataLayerInstanceDetails::MakeInstance));
FEditorWidgetsModule& EditorWidgetsModule = FModuleManager::LoadModuleChecked<FEditorWidgetsModule>("EditorWidgets");
EditorWidgetsModule.GetObjectNameEditSinkRegistry()->RegisterObjectNameEditSink(MakeShared<FDataLayerNameEditSink>());
}
void FDataLayerEditorModule::ShutdownModule()
{
if (FPropertyEditorModule* PropertyModule = FModuleManager::GetModulePtr<FPropertyEditorModule>("PropertyEditor"))
{
PropertyModule->UnregisterCustomPropertyTypeLayout(NAME_ActorDataLayer);
PropertyModule->UnregisterCustomPropertyTypeLayout(NAME_DataLayerInstance);
}
}
TSharedRef<SWidget> FDataLayerEditorModule::CreateDataLayerBrowser()
{
TSharedRef<SWidget> NewDataLayerBrowser = SNew(SDataLayerBrowser);
DataLayerBrowser = NewDataLayerBrowser;
return NewDataLayerBrowser;
}
void FDataLayerEditorModule::SyncDataLayerBrowserToDataLayer(const UDataLayerInstance* DataLayerInstance)
{
if (DataLayerBrowser.IsValid())
{
TSharedRef<SDataLayerBrowser> Browser = StaticCastSharedRef<SDataLayerBrowser>(DataLayerBrowser.Pin().ToSharedRef());
Browser->SyncDataLayerBrowserToDataLayer(DataLayerInstance);
}
}
bool FDataLayerEditorModule::AddActorToDataLayers(AActor* Actor, const TArray<UDataLayerInstance*>& DataLayers)
{
return UDataLayerEditorSubsystem::Get()->AddActorToDataLayers(Actor, DataLayers);
}
void FDataLayerEditorModule::SetActorEditorContextCurrentExternalDataLayer(const UExternalDataLayerAsset* InExternalDataLayerAsset)
{
UDataLayerEditorSubsystem::Get()->SetActorEditorContextCurrentExternalDataLayer(InExternalDataLayerAsset);
}