2016-01-07 08:17:16 -05:00
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# include "GameProjectGenerationPrivatePCH.h"
# include "ModuleManager.h"
# include "GameProjectGenerationModule.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
# include "MainFrame.h"
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++ " ;
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 " ) ) ;
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