Files
UnrealEngineUWP/Engine/Source/Developer/Windows/LiveCoding/Private/LiveCodingModule.h
tim smith c440be643c Live coding now handles adding a feature pack as long as the project already contained source files. Otherwise it requests that the game be built from the IDE. Will also request that the game be built from the IDE when adding a class to a blueprint only project.
#rb none
#rnx
#jira UE-130744 UE-134701

#ushell-cherrypick of 18406025 by Tim.Smith
#preflight 61b0d7367177ccd1a130be05

#ROBOMERGE-AUTHOR: tim.smith
#ROBOMERGE-SOURCE: CL 18407173 in //UE5/Release-5.0/... via CL 18407182
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)

[CL 18407194 by tim smith in ue5-release-engine-test branch]
2021-12-08 11:50:54 -05:00

102 lines
2.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ILiveCodingModule.h"
#include "Delegates/Delegate.h"
#include "Modules/ModuleManager.h"
#include "Templates/SharedPointer.h"
#include "Internationalization/Text.h"
struct IConsoleCommand;
class IConsoleVariable;
class ISettingsSection;
class ULiveCodingSettings;
#if WITH_EDITOR
class FReload;
#else
class FNullReload;
#endif
class FLiveCodingModule final : public ILiveCodingModule
{
public:
FLiveCodingModule();
~FLiveCodingModule();
// IModuleInterface implementation
virtual void StartupModule() override;
virtual void ShutdownModule() override;
// ILiveCodingModule implementation
virtual void EnableByDefault(bool bInEnabled) override;
virtual bool IsEnabledByDefault() const override;
virtual void EnableForSession(bool bInEnabled) override;
virtual bool IsEnabledForSession() const override;
virtual const FText& GetEnableErrorText() const override;
virtual bool AutomaticallyCompileNewClasses() const override;
virtual bool CanEnableForSession() const override;
virtual bool HasStarted() const override;
virtual void ShowConsole() override;
virtual void Compile() override;
virtual bool Compile(ELiveCodingCompileFlags CompileFlags, ELiveCodingCompileResult* Result) override;
virtual bool IsCompiling() const override;
virtual void Tick() override;
virtual FOnPatchCompleteDelegate& GetOnPatchCompleteDelegate() override;
static void BeginReload();
private:
void AttemptSyncLivePatching();
private:
ULiveCodingSettings* Settings;
TSharedPtr<ISettingsSection> SettingsSection;
bool bEnabledLastTick = false;
bool bEnableReinstancingLastTick = false;
bool bEnabledForSession = false;
bool bStarted = false;
bool bUpdateModulesInTick = false;
bool bHasReinstancingOccurred = false;
bool bHasPatchBeenLoaded = false;
ELiveCodingCompileResult LastResults = ELiveCodingCompileResult::Success;
TSet<FName> ConfiguredModules;
TArray<void*> LppPendingTokens;
FText EnableErrorText;
const FString FullEnginePluginsDir;
const FString FullProjectDir;
const FString FullProjectPluginsDir;
IConsoleCommand* EnableCommand;
IConsoleCommand* CompileCommand;
IConsoleVariable* ConsolePathVariable;
IConsoleVariable* SourceProjectVariable;
FDelegateHandle EndFrameDelegateHandle;
FDelegateHandle ModulesChangedDelegateHandle;
FOnPatchCompleteDelegate OnPatchCompleteDelegate;
#if WITH_EDITOR
TUniquePtr<FReload> Reload;
#else
TUniquePtr<FNullReload> Reload;
#endif
bool StartLiveCoding();
void OnModulesChanged(FName ModuleName, EModuleChangeReason Reason);
void UpdateModules();
bool ShouldPreloadModule(const FName& Name, const FString& FullFilePath) const;
bool IsReinstancingEnabled() const;
#if WITH_EDITOR
void ShowNotification(bool Success, const FText& Title, const FText* SubText);
#endif
};