2019-12-26 15:33:43 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
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 "CoreMinimal.h"
|
|
|
|
|
#include "Frame/MainFrameActions.h"
|
|
|
|
|
#include "Widgets/SWidget.h"
|
|
|
|
|
#include "Framework/Commands/UICommandList.h"
|
|
|
|
|
#include "Framework/MultiBox/MultiBoxExtender.h"
|
|
|
|
|
#include "Interfaces/IMainFrameModule.h"
|
|
|
|
|
#include "UnrealEdMisc.h"
|
|
|
|
|
#include "Frame/MainFrameHandler.h"
|
|
|
|
|
#include "Misc/CompilationResult.h"
|
2022-09-20 15:34:49 -04:00
|
|
|
#include "Interfaces/IEditorMainFrameProvider.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Utility class, which hooks into the editor's main window startup and
|
|
|
|
|
* supplies a project dialog window if the project hasn't been set.
|
|
|
|
|
*/
|
|
|
|
|
class FProjectDialogProvider : public IEditorMainFrameProvider
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
void Register();
|
|
|
|
|
void UnRegister();
|
|
|
|
|
|
|
|
|
|
//~ Begin IEditorMainFrameProvider interface
|
|
|
|
|
virtual bool IsRequestingMainFrameControl() const override;
|
|
|
|
|
virtual FMainFrameWindowOverrides GetDesiredWindowConfiguration() const override;
|
|
|
|
|
virtual TSharedRef<SWidget> CreateMainFrameContentWidget() const override;
|
|
|
|
|
//~ End IEditorMainFrameProvider interface
|
|
|
|
|
};
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Editor main frame module
|
|
|
|
|
*/
|
|
|
|
|
class FMainFrameModule
|
|
|
|
|
: public IMainFrameModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// IMainFrameModule interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-02-03 21:14:05 -04:00
|
|
|
virtual void CreateDefaultMainFrame(const bool bStartImmersive, const bool bStartPIE) override;
|
2019-09-10 11:35:20 -04:00
|
|
|
virtual void RecreateDefaultMainFrame(const bool bStartImmersive, const bool bStartPIE) override;
|
2021-02-03 21:14:05 -04:00
|
|
|
private:
|
|
|
|
|
/**
|
|
|
|
|
* Shared code between CreateDefaultMainFrame and RecreateDefaultMainFrame
|
|
|
|
|
* @param bIsBeingRecreated False if it is being called by first time (CreateDefaultMainFrame), and true if it is being recreated (RecreateDefaultMainFrame). If recreated, it will also display
|
|
|
|
|
*/
|
|
|
|
|
virtual void CreateDefaultMainFrameAuxiliary(const bool bStartImmersive, const bool bStartPIE, const bool bIsBeingRecreated);
|
|
|
|
|
|
|
|
|
|
public:
|
2020-09-10 16:35:26 -04:00
|
|
|
virtual bool IsRecreatingDefaultMainFrame() const override;
|
2019-09-10 11:35:20 -04:00
|
|
|
virtual TSharedRef<SWidget> MakeMainMenu(const TSharedPtr<FTabManager>& TabManager, const FName MenuName, FToolMenuContext& ToolMenuContext) const override;
|
2020-10-19 16:13:57 -04:00
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
|
2019-06-07 11:22:52 -04:00
|
|
|
virtual TSharedRef<SWidget> MakeDeveloperTools( const TArray<FMainFrameDeveloperTool>& AdditionalTools ) const override;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual bool IsWindowInitialized( ) const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return MainFrameHandler->GetParentWindow().IsValid();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual TSharedPtr<SWindow> GetParentWindow( ) const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return MainFrameHandler->GetParentWindow();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void SetMainTab(const TSharedRef<SDockTab>& MainTab) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
MainFrameHandler->SetMainTab(MainTab);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void EnableTabClosedDelegate( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
MainFrameHandler->EnableTabClosedDelegate();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void DisableTabClosedDelegate( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
MainFrameHandler->DisableTabClosedDelegate();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void RequestCloseEditor( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2020-03-03 09:05:40 -05:00
|
|
|
ClearDelayedShowMainFrameDelegate();
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
if ( MainFrameHandler->CanCloseEditor() )
|
|
|
|
|
{
|
|
|
|
|
MainFrameHandler->ShutDownEditor();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FUnrealEdMisc::Get().ClearPendingProjectName();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void SetLevelNameForWindowTitle( const FString& InLevelFileName ) override;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual FString GetLoadedLevelName( ) const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return LoadedLevelName;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
virtual TSharedRef<FUICommandList>& GetMainFrameCommandBindings( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return FMainFrameCommands::ActionList;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual class FMainMRUFavoritesList* GetMRUFavoritesList() const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return MRUFavoritesList;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual const FText GetApplicationTitle( const bool bIncludeGameName ) const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2020-01-15 14:44:42 -05:00
|
|
|
return OverriddenWindowTitle.IsEmpty() ? StaticGetApplicationTitle( bIncludeGameName ) : OverriddenWindowTitle;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2020-01-15 14:44:42 -05:00
|
|
|
virtual void SetApplicationTitleOverride(const FText& NewOverriddenApplicationTitle) override;
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void ShowAboutWindow( ) const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
FMainFrameActionCallbacks::AboutUnrealEd_Execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DECLARE_DERIVED_EVENT(FMainFrameModule, IMainFrameModule::FMainFrameCreationFinishedEvent, FMainFrameCreationFinishedEvent);
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual FMainFrameCreationFinishedEvent& OnMainFrameCreationFinished( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return MainFrameCreationFinishedEvent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DECLARE_DERIVED_EVENT(FMainFrameModule, IMainFrameModule::FMainFrameSDKNotInstalled, FMainFrameSDKNotInstalled);
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual FMainFrameSDKNotInstalled& OnMainFrameSDKNotInstalled( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return MainFrameSDKNotInstalled;
|
|
|
|
|
}
|
2014-06-13 06:14:46 -04:00
|
|
|
void BroadcastMainFrameSDKNotInstalled(const FString& PlatformName, const FString& DocLink) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return MainFrameSDKNotInstalled.Broadcast(PlatformName, DocLink);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-01 12:29:13 -05:00
|
|
|
DECLARE_DERIVED_EVENT(FMainFrameModule, IMainFrameModule::FMainFrameRequestResource, FMainFrameRequestResource);
|
|
|
|
|
virtual FMainFrameRequestResource& OnMainFrameRequestResource() override
|
|
|
|
|
{
|
|
|
|
|
return MainFrameRequestResource;
|
|
|
|
|
}
|
|
|
|
|
void BroadcastMainFrameRequestResource(const FString& Category, const FString& ResourceName) override
|
|
|
|
|
{
|
|
|
|
|
return MainFrameRequestResource.Broadcast(Category, ResourceName);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-03 09:05:40 -05:00
|
|
|
virtual void EnableDelayedShowMainFrame() override
|
|
|
|
|
{
|
|
|
|
|
bDelayedShowMainFrame = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void ShowDelayedMainFrame() override
|
|
|
|
|
{
|
|
|
|
|
bDelayedShowMainFrame = false;
|
|
|
|
|
|
|
|
|
|
if (DelayedShowMainFrameDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
DelayedShowMainFrameDelegate.Execute();
|
|
|
|
|
ClearDelayedShowMainFrameDelegate();
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-24 00:43:27 -04:00
|
|
|
|
|
|
|
|
virtual FDelegateHandle RegisterCanCloseEditor(const FMainFrameCanCloseEditor& InDelegate) override
|
|
|
|
|
{
|
|
|
|
|
return CanCloseEditorDelegates.Add_GetRef(InDelegate).GetHandle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void UnregisterCanCloseEditor(FDelegateHandle InHandle) override
|
|
|
|
|
{
|
|
|
|
|
CanCloseEditorDelegates.RemoveAll([InHandle](const FMainFrameCanCloseEditor& Delegate) { return Delegate.GetHandle() == InHandle; });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual bool ExecuteCanCloseEditorDelegates() override
|
|
|
|
|
{
|
|
|
|
|
for (const FMainFrameCanCloseEditor& It : CanCloseEditorDelegates)
|
|
|
|
|
{
|
|
|
|
|
if (It.IsBound() && !It.Execute())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2020-03-03 09:05:40 -05:00
|
|
|
|
2022-06-23 18:50:14 -04:00
|
|
|
virtual void SetEditorSettingsDefaultSelectionOverride(FName CategoryName = FName(), FName SectionName = FName()) override
|
|
|
|
|
{
|
|
|
|
|
EditorSettingsDefaultCategoryOverride = CategoryName;
|
|
|
|
|
EditorSettingsDefaultSectionOverride = SectionName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void GetEditorSettingsDefaultSelectionOverride(FName& OutCategoryName, FName& OutSectionName) override
|
|
|
|
|
{
|
|
|
|
|
OutCategoryName = EditorSettingsDefaultCategoryOverride;
|
|
|
|
|
OutSectionName = EditorSettingsDefaultSectionOverride;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// IModuleInterface interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void StartupModule( ) override;
|
|
|
|
|
virtual void ShutdownModule( ) override;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual bool SupportsDynamicReloading( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return true; // @todo: Eventually, this should probably not be allowed.
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
static void HandleResizeMainFrameCommand(const TArray<FString>& Args);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-08-18 06:48:04 -04:00
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/** Get the size of the project browser window */
|
2022-08-26 14:21:24 -04:00
|
|
|
static FVector2D GetProjectBrowserWindowSize() { return FVector2D(1190, 822); }
|
2014-08-18 06:48:04 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// Handles the level editor module starting to recompile.
|
2015-02-09 06:44:30 -05:00
|
|
|
void HandleLevelEditorModuleCompileStarted( bool bIsAsyncCompile );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// Handles the user requesting the current compilation to be canceled
|
|
|
|
|
void OnCancelCodeCompilationClicked();
|
|
|
|
|
|
|
|
|
|
// Handles the level editor module finishing to recompile.
|
2014-04-23 18:36:17 -04:00
|
|
|
void HandleLevelEditorModuleCompileFinished( const FString& LogDump, ECompilationResult::Type CompilationResult, bool bShowLog );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-03-18 08:13:59 -04:00
|
|
|
/** Called when Reload completes */
|
|
|
|
|
void HandleReloadFinished( EReloadCompleteReason Reason );
|
2014-08-20 13:58:31 -04:00
|
|
|
|
2014-04-23 19:19:51 -04:00
|
|
|
// Handles the code accessor having finished launching its editor
|
|
|
|
|
void HandleCodeAccessorLaunched( const bool WasSuccessful );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-04-23 19:19:51 -04:00
|
|
|
// Handle an open file operation failing
|
|
|
|
|
void HandleCodeAccessorOpenFileFailed(const FString& Filename);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-04-23 19:19:51 -04:00
|
|
|
// Handles launching code accessor
|
|
|
|
|
void HandleCodeAccessorLaunching( );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2020-03-03 09:05:40 -05:00
|
|
|
// Reset delegate
|
|
|
|
|
void ClearDelayedShowMainFrameDelegate()
|
|
|
|
|
{
|
|
|
|
|
DelayedShowMainFrameDelegate.Unbind();
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// Weak pointer to the level editor's compile notification item.
|
|
|
|
|
TWeakPtr<SNotificationItem> CompileNotificationPtr;
|
|
|
|
|
|
|
|
|
|
// Friendly name for persistently level name currently loaded. Used for window and tab titles.
|
|
|
|
|
FString LoadedLevelName;
|
|
|
|
|
|
2020-01-15 14:44:42 -05:00
|
|
|
// Override window title, or empty to not override
|
|
|
|
|
FText OverriddenWindowTitle;
|
|
|
|
|
|
2022-06-23 18:50:14 -04:00
|
|
|
// Overrides the category that gets selected by default when opening editor settings
|
|
|
|
|
FName EditorSettingsDefaultCategoryOverride;
|
|
|
|
|
|
|
|
|
|
// Overrides the section that gets selected by default when editor settings
|
|
|
|
|
FName EditorSettingsDefaultSectionOverride;
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/// Event to be called when the mainframe is fully created.
|
|
|
|
|
FMainFrameCreationFinishedEvent MainFrameCreationFinishedEvent;
|
|
|
|
|
|
|
|
|
|
/// Event to be called when the editor tried to use a platform, but it wasn't installed
|
|
|
|
|
FMainFrameSDKNotInstalled MainFrameSDKNotInstalled;
|
|
|
|
|
|
2022-03-01 12:29:13 -05:00
|
|
|
/// Event to be called to make an open-ended request for a resource from any registered listeners
|
|
|
|
|
FMainFrameRequestResource MainFrameRequestResource;
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
// Commands used by main frame in menus and key bindings.
|
|
|
|
|
TSharedPtr<class FMainFrameCommands> MainFrameActions;
|
|
|
|
|
|
|
|
|
|
// Holds the main frame handler.
|
|
|
|
|
TSharedPtr<class FMainFrameHandler> MainFrameHandler;
|
|
|
|
|
|
|
|
|
|
// Absolute real time that we started compiling modules. Used for stats tracking.
|
|
|
|
|
double ModuleCompileStartTime;
|
|
|
|
|
|
|
|
|
|
// Holds the collection of most recently used favorites.
|
|
|
|
|
class FMainMRUFavoritesList* MRUFavoritesList;
|
|
|
|
|
|
2014-04-23 19:19:51 -04:00
|
|
|
// Weak pointer to the code accessor's notification item.
|
|
|
|
|
TWeakPtr<class SNotificationItem> CodeAccessorNotificationPtr;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2020-03-03 09:05:40 -05:00
|
|
|
// Delegate that holds a delayed call to ShowMainFrameWindow
|
|
|
|
|
FSimpleDelegate DelayedShowMainFrameDelegate;
|
2020-09-24 00:43:27 -04:00
|
|
|
|
|
|
|
|
// List of delegates that are called after user requests the editor to close that can stop the close
|
|
|
|
|
TArray<FMainFrameCanCloseEditor> CanCloseEditorDelegates;
|
2020-03-03 09:05:40 -05:00
|
|
|
|
|
|
|
|
// Allow delaying when to show main frame's window
|
|
|
|
|
bool bDelayedShowMainFrame;
|
2020-09-10 16:35:26 -04:00
|
|
|
|
|
|
|
|
// Is recreating Default Main Frame
|
|
|
|
|
bool bRecreatingDefaultMainFrame;
|
2022-09-20 15:34:49 -04:00
|
|
|
|
|
|
|
|
// Instantiation of the object responsible for spawning the editor's project dialog on startup
|
|
|
|
|
FProjectDialogProvider ProjectDialogProvider;
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|