2018-01-02 15:30:26 -05:00
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# include "GameProjectGenerationModule.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 "Misc/Paths.h"
# include "Misc/ScopedSlowTask.h"
# include "Widgets/DeclarativeSyntaxSupport.h"
# include "EditorStyleSet.h"
# include "GameProjectGenerationLog.h"
# include "GameProjectUtils.h"
# include "SGameProjectDialog.h"
# include "SNewClassDialog.h"
2014-08-18 06:48:04 -04:00
# include "TemplateCategory.h"
# include "SourceCodeNavigation.h"
2014-03-14 14:13:41 -04:00
2015-02-16 04:29:11 -05:00
2014-03-14 14:13:41 -04:00
IMPLEMENT_MODULE ( FGameProjectGenerationModule , GameProjectGeneration ) ;
DEFINE_LOG_CATEGORY ( LogGameProjectGeneration ) ;
# define LOCTEXT_NAMESPACE "GameProjectGeneration"
2014-08-18 06:48:04 -04:00
FName FTemplateCategory : : BlueprintCategoryName = " Blueprint " ;
FName FTemplateCategory : : CodeCategoryName = " C++ " ;
2017-11-21 16:14:55 -05:00
FName FTemplateCategory : : EnterpriseCategoryName = " Enterprise " ;
2014-08-18 06:48:04 -04:00
2014-03-14 14:13:41 -04:00
void FGameProjectGenerationModule : : StartupModule ( )
{
2014-08-18 06:48:04 -04:00
RegisterTemplateCategory (
FTemplateCategory : : BlueprintCategoryName ,
LOCTEXT ( " BlueprintCategory_Name " , " Blueprint " ) ,
LOCTEXT ( " BlueprintCategory_Description " , " Blueprint templates require no programming knowledge. \n All game mechanics can be implemented using Blueprint visual scripting. \n Each template includes a basic set of blueprints to use as a starting point for your game. " ) ,
2014-08-28 06:52:46 -04:00
FEditorStyle : : GetBrush ( " GameProjectDialog.BlueprintIcon " ) ,
2014-08-18 06:48:04 -04:00
FEditorStyle : : GetBrush ( " GameProjectDialog.BlueprintImage " ) ) ;
RegisterTemplateCategory (
FTemplateCategory : : CodeCategoryName ,
LOCTEXT ( " CodeCategory_Name " , " C++ " ) ,
FText : : Format (
LOCTEXT ( " CodeCategory_Description " , " C++ templates offer a good example of how to work with some of the core concepts of the Engine from code. \n You still have the option of adding your own blueprints to the project at a later date if you want. \n Choosing this template type requires you to have {0} installed. " ) ,
FSourceCodeNavigation : : GetSuggestedSourceCodeIDE ( )
) ,
2014-08-28 06:52:46 -04:00
FEditorStyle : : GetBrush ( " GameProjectDialog.CodeIcon " ) ,
2014-08-18 06:48:04 -04:00
FEditorStyle : : GetBrush ( " GameProjectDialog.CodeImage " ) ) ;
2017-11-21 16:14:55 -05:00
RegisterTemplateCategory (
FTemplateCategory : : EnterpriseCategoryName ,
LOCTEXT ( " EnterpriseCategory_Name " , " Enterprise " ) ,
LOCTEXT ( " EnterpriseCategory_Description " , " Enterprise blueprint templates require no programming knowledge. \n Each template include a basic set of blueprints to use as a starting point for your enterprise project. " ) ,
FEditorStyle : : GetBrush ( " GameProjectDialog.BlueprintIcon " ) ,
FEditorStyle : : GetBrush ( " GameProjectDialog.BlueprintImage " ) ) ;
2014-03-14 14:13:41 -04:00
}
void FGameProjectGenerationModule : : ShutdownModule ( )
{
}
TSharedRef < class SWidget > FGameProjectGenerationModule : : CreateGameProjectDialog ( bool bAllowProjectOpening , bool bAllowProjectCreate )
{
return SNew ( SGameProjectDialog )
. AllowProjectOpening ( bAllowProjectOpening )
. AllowProjectCreate ( bAllowProjectCreate ) ;
}
2015-01-16 15:39:47 -05:00
TSharedRef < class SWidget > FGameProjectGenerationModule : : CreateNewClassDialog ( const UClass * InClass )
2014-03-14 14:13:41 -04:00
{
return SNew ( SNewClassDialog ) . Class ( InClass ) ;
}
2015-02-16 04:29:11 -05:00
void FGameProjectGenerationModule : : OpenAddCodeToProjectDialog ( const FAddToProjectConfig & Config )
2014-03-14 14:13:41 -04:00
{
2015-02-16 04:29:11 -05:00
GameProjectUtils : : OpenAddToProjectDialog ( Config , EClassDomain : : Native ) ;
2015-01-16 15:39:47 -05:00
AddCodeToProjectDialogOpenedEvent . Broadcast ( ) ;
}
2015-02-16 04:29:11 -05:00
void FGameProjectGenerationModule : : OpenAddBlueprintToProjectDialog ( const FAddToProjectConfig & Config )
2015-01-16 15:39:47 -05:00
{
2015-02-16 04:29:11 -05:00
GameProjectUtils : : OpenAddToProjectDialog ( Config , EClassDomain : : Blueprint ) ;
2014-03-14 14:13:41 -04:00
}
2014-07-22 15:58:02 -04:00
void FGameProjectGenerationModule : : TryMakeProjectFileWriteable ( const FString & ProjectFile )
2014-06-27 15:23:15 -04:00
{
2014-07-22 15:58:02 -04:00
GameProjectUtils : : TryMakeProjectFileWriteable ( ProjectFile ) ;
2014-06-27 15:23:15 -04:00
}
2014-03-14 14:13:41 -04:00
void FGameProjectGenerationModule : : CheckForOutOfDateGameProjectFile ( )
{
GameProjectUtils : : CheckForOutOfDateGameProjectFile ( ) ;
}
2014-07-22 15:58:02 -04:00
bool FGameProjectGenerationModule : : UpdateGameProject ( const FString & ProjectFile , const FString & EngineIdentifier , FText & OutFailReason )
2014-03-14 14:13:41 -04:00
{
2014-07-22 15:58:02 -04:00
return GameProjectUtils : : UpdateGameProject ( ProjectFile , EngineIdentifier , OutFailReason ) ;
2014-03-14 14:13:41 -04:00
}
2015-04-09 11:11:48 -04:00
bool FGameProjectGenerationModule : : UpdateCodeProject ( FText & OutFailReason , FText & OutFailLog )
2014-03-14 14:13:41 -04:00
{
2014-10-08 04:42:34 -04:00
FScopedSlowTask SlowTask ( 0 , LOCTEXT ( " UpdatingCodeProject " , " Updating code project... " ) ) ;
SlowTask . MakeDialog ( ) ;
2014-03-14 14:13:41 -04:00
2015-04-09 11:11:48 -04:00
return GameProjectUtils : : GenerateCodeProjectFiles ( FPaths : : GetProjectFilePath ( ) , OutFailReason , OutFailLog ) ;
2014-03-14 14:13:41 -04:00
}
2014-10-13 11:47:21 -04:00
bool FGameProjectGenerationModule : : GenerateBasicSourceCode ( TArray < FString > & OutCreatedFiles , FText & OutFailReason )
2014-03-14 14:13:41 -04:00
{
2014-10-13 11:47:21 -04:00
return GameProjectUtils : : GenerateBasicSourceCode ( OutCreatedFiles , OutFailReason ) ;
}
bool FGameProjectGenerationModule : : ProjectHasCodeFiles ( )
{
return GameProjectUtils : : ProjectHasCodeFiles ( ) ;
}
2015-05-01 14:00:34 -04:00
bool FGameProjectGenerationModule : : ProjectRequiresBuild ( const FName InPlatformName )
{
return GameProjectUtils : : ProjectRequiresBuild ( InPlatformName ) ;
}
2014-10-13 11:47:21 -04:00
FString FGameProjectGenerationModule : : DetermineModuleIncludePath ( const FModuleContextInfo & ModuleInfo , const FString & FileRelativeTo )
{
return GameProjectUtils : : DetermineModuleIncludePath ( ModuleInfo , FileRelativeTo ) ;
}
TArray < FModuleContextInfo > FGameProjectGenerationModule : : GetCurrentProjectModules ( )
{
return GameProjectUtils : : GetCurrentProjectModules ( ) ;
2014-03-14 14:13:41 -04:00
}
2015-01-16 15:39:47 -05:00
bool FGameProjectGenerationModule : : IsValidBaseClassForCreation ( const UClass * InClass , const FModuleContextInfo & InModuleInfo )
{
return GameProjectUtils : : IsValidBaseClassForCreation ( InClass , InModuleInfo ) ;
}
bool FGameProjectGenerationModule : : IsValidBaseClassForCreation ( const UClass * InClass , const TArray < FModuleContextInfo > & InModuleInfoArray )
{
return GameProjectUtils : : IsValidBaseClassForCreation ( InClass , InModuleInfoArray ) ;
}
2014-08-22 11:35:01 -04:00
void FGameProjectGenerationModule : : GetProjectSourceDirectoryInfo ( int32 & OutNumFiles , int64 & OutDirectorySize )
{
GameProjectUtils : : GetProjectSourceDirectoryInfo ( OutNumFiles , OutDirectorySize ) ;
}
2014-03-14 14:13:41 -04:00
2014-05-01 10:58:35 -04:00
void FGameProjectGenerationModule : : CheckAndWarnProjectFilenameValid ( )
{
GameProjectUtils : : CheckAndWarnProjectFilenameValid ( ) ;
}
2014-05-29 17:37:19 -04:00
void FGameProjectGenerationModule : : UpdateSupportedTargetPlatforms ( const FName & InPlatformName , const bool bIsSupported )
{
GameProjectUtils : : UpdateSupportedTargetPlatforms ( InPlatformName , bIsSupported ) ;
}
2014-06-05 12:13:44 -04:00
void FGameProjectGenerationModule : : ClearSupportedTargetPlatforms ( )
{
GameProjectUtils : : ClearSupportedTargetPlatforms ( ) ;
}
2014-08-28 06:52:46 -04:00
bool FGameProjectGenerationModule : : RegisterTemplateCategory ( FName Type , FText Name , FText Description , const FSlateBrush * Icon , const FSlateBrush * Image )
2014-08-18 06:48:04 -04:00
{
if ( TemplateCategories . Contains ( Type ) )
{
return false ;
}
2014-08-28 06:52:46 -04:00
FTemplateCategory Category = { Name , Description , Icon , Image , Type } ;
2014-08-18 06:48:04 -04:00
TemplateCategories . Add ( Type , MakeShareable ( new FTemplateCategory ( Category ) ) ) ;
return true ;
}
void FGameProjectGenerationModule : : UnRegisterTemplateCategory ( FName Type )
{
TemplateCategories . Remove ( Type ) ;
}
2014-03-14 14:13:41 -04:00
# undef LOCTEXT_NAMESPACE