2014-03-14 14:13:41 -04:00
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
# 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
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. " ) ,
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 ( )
) ,
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 ) ;
}
TSharedRef < class SWidget > FGameProjectGenerationModule : : CreateNewClassDialog ( class UClass * InClass )
{
return SNew ( SNewClassDialog ) . Class ( InClass ) ;
}
void FGameProjectGenerationModule : : OpenAddCodeToProjectDialog ( )
{
GameProjectUtils : : OpenAddCodeToProjectDialog ( ) ;
AddCodeToProjectDialogOpenedEvent . Broadcast ( ) ;
}
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
}
bool FGameProjectGenerationModule : : UpdateCodeProject ( FText & OutFailReason )
{
const bool bAllowNewSlowTask = true ;
2014-06-09 15:41:37 -04:00
FScopedSlowTask SlowTaskMessage ( LOCTEXT ( " UpdatingCodeProject " , " Updating code project... " ) , bAllowNewSlowTask ) ;
2014-03-14 14:13:41 -04:00
return GameProjectUtils : : GenerateCodeProjectFiles ( FPaths : : GetProjectFilePath ( ) , OutFailReason ) ;
}
int32 FGameProjectGenerationModule : : GetProjectCodeFileCount ( )
{
return GameProjectUtils : : GetProjectCodeFileCount ( ) ;
}
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
bool FGameProjectGenerationModule : : UpdateCodeResourceFiles ( TArray < FString > & OutCreatedFiles , FText & OutFailReason )
{
const FString GameModuleSourcePath = FPaths : : GetPath ( FPaths : : GetProjectFilePath ( ) ) / TEXT ( " Source " ) / FApp : : GetGameName ( ) ;
return GameProjectUtils : : GenerateGameResourceFiles ( GameModuleSourcePath , FApp : : GetGameName ( ) , OutCreatedFiles , OutFailReason ) ;
}
2014-05-29 17:37:19 -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-18 06:48:04 -04:00
bool FGameProjectGenerationModule : : RegisterTemplateCategory ( FName Type , FText Name , FText Description , const FSlateBrush * Thumbnail )
{
if ( TemplateCategories . Contains ( Type ) )
{
return false ;
}
FTemplateCategory Category = { Name , Description , Thumbnail , Type } ;
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