File size: 2,597 Bytes
7fd553e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | // Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraEditorEngine.h"
#include "Development/LyraDeveloperSettings.h"
#include "Development/LyraPlatformEmulationSettings.h"
#include "Engine/GameInstance.h"
#include "Framework/Notifications/NotificationManager.h"
#include "GameModes/LyraWorldSettings.h"
#include "Settings/ContentBrowserSettings.h"
#include "Settings/LevelEditorPlaySettings.h"
#include "Widgets/Notifications/SNotificationList.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(LyraEditorEngine)
class IEngineLoop;
#define LOCTEXT_NAMESPACE "LyraEditor"
ULyraEditorEngine::ULyraEditorEngine(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
void ULyraEditorEngine::Init(IEngineLoop* InEngineLoop)
{
Super::Init(InEngineLoop);
}
void ULyraEditorEngine::Start()
{
Super::Start();
}
void ULyraEditorEngine::Tick(float DeltaSeconds, bool bIdleMode)
{
Super::Tick(DeltaSeconds, bIdleMode);
FirstTickSetup();
}
void ULyraEditorEngine::FirstTickSetup()
{
if (bFirstTickSetup)
{
return;
}
bFirstTickSetup = true;
// Force show plugin content on load.
GetMutableDefault<UContentBrowserSettings>()->SetDisplayPluginFolders(true);
}
FGameInstancePIEResult ULyraEditorEngine::PreCreatePIEInstances(const bool bAnyBlueprintErrors, const bool bStartInSpectatorMode, const float PIEStartTime, const bool bSupportsOnlinePIE, int32& InNumOnlinePIEInstances)
{
if (const ALyraWorldSettings* LyraWorldSettings = Cast<ALyraWorldSettings>(EditorWorld->GetWorldSettings()))
{
if (LyraWorldSettings->ForceStandaloneNetMode)
{
EPlayNetMode OutPlayNetMode;
PlaySessionRequest->EditorPlaySettings->GetPlayNetMode(OutPlayNetMode);
if (OutPlayNetMode != PIE_Standalone)
{
PlaySessionRequest->EditorPlaySettings->SetPlayNetMode(PIE_Standalone);
FNotificationInfo Info(LOCTEXT("ForcingStandaloneForFrontend", "Forcing NetMode: Standalone for the Frontend"));
Info.ExpireDuration = 2.0f;
FSlateNotificationManager::Get().AddNotification(Info);
}
}
}
//@TODO: Should add delegates that a *non-editor* module could bind to for PIE start/stop instead of poking directly
GetDefault<ULyraDeveloperSettings>()->OnPlayInEditorStarted();
GetDefault<ULyraPlatformEmulationSettings>()->OnPlayInEditorStarted();
//
FGameInstancePIEResult Result = Super::PreCreatePIEServerInstance(bAnyBlueprintErrors, bStartInSpectatorMode, PIEStartTime, bSupportsOnlinePIE, InNumOnlinePIEInstances);
return Result;
}
#undef LOCTEXT_NAMESPACE
|