You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
FScopedSlowTask has been refactored to better allow for nesting of slow operations. This allows us to cascade nested scopes and provide accurate feedback on slow tasks. FScopedSlowTasks now work together when nested inside sub functions. Break up long functions that contain calls to multiple nested FScopedSlowTasks with FScopedSlowTask::EnterProgressFrame().
Example Usage:
void DoSlowWork()
{
FScopedSlowTask Progress(2.f, LOCTEXT("DoingSlowWork", "Doing Slow Work..."));
// Optionally make this show a dialog if not already shown
Progress.MakeDialog();
// Indicate that we are entering a frame representing 1 unit of work
Progress.EnterProgressFrame(1.f);
// DoFirstThing() can follow a similar pattern of creating a scope divided into frames. These contribute to their parent's progress frame proportionately.
DoFirstThing();
Progress.EnterProgressFrame(1.f);
DoSecondThing();
}
This addresses TTP#338602 - NEEDS REVIEW: Editor progress bars nearly always just show 100%, don't offer useful indication of progress
[CL 2322391 by Andrew Rodham in Main branch]
134 lines
4.4 KiB
C++
134 lines
4.4 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "GameProjectGenerationPrivatePCH.h"
|
|
#include "ModuleManager.h"
|
|
#include "GameProjectGenerationModule.h"
|
|
#include "TemplateCategory.h"
|
|
#include "SourceCodeNavigation.h"
|
|
|
|
IMPLEMENT_MODULE( FGameProjectGenerationModule, GameProjectGeneration );
|
|
DEFINE_LOG_CATEGORY(LogGameProjectGeneration);
|
|
|
|
#define LOCTEXT_NAMESPACE "GameProjectGeneration"
|
|
|
|
FName FTemplateCategory::BlueprintCategoryName = "Blueprint";
|
|
FName FTemplateCategory::CodeCategoryName = "C++";
|
|
|
|
void FGameProjectGenerationModule::StartupModule()
|
|
{
|
|
RegisterTemplateCategory(
|
|
FTemplateCategory::BlueprintCategoryName,
|
|
LOCTEXT("BlueprintCategory_Name", "Blueprint"),
|
|
LOCTEXT("BlueprintCategory_Description", "Blueprint templates require no programming knowledge.\nAll game mechanics can be implemented using Blueprint visual scripting.\nEach template includes a basic set of blueprints to use as a starting point for your game."),
|
|
FEditorStyle::GetBrush("GameProjectDialog.BlueprintIcon"),
|
|
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.\nYou still have the option of adding your own blueprints to the project at a later date if you want.\nChoosing this template type requires you to have {0} installed."),
|
|
FSourceCodeNavigation::GetSuggestedSourceCodeIDE()
|
|
),
|
|
FEditorStyle::GetBrush("GameProjectDialog.CodeIcon"),
|
|
FEditorStyle::GetBrush("GameProjectDialog.CodeImage"));
|
|
}
|
|
|
|
|
|
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();
|
|
}
|
|
|
|
void FGameProjectGenerationModule::TryMakeProjectFileWriteable(const FString& ProjectFile)
|
|
{
|
|
GameProjectUtils::TryMakeProjectFileWriteable(ProjectFile);
|
|
}
|
|
|
|
void FGameProjectGenerationModule::CheckForOutOfDateGameProjectFile()
|
|
{
|
|
GameProjectUtils::CheckForOutOfDateGameProjectFile();
|
|
}
|
|
|
|
|
|
bool FGameProjectGenerationModule::UpdateGameProject(const FString& ProjectFile, const FString& EngineIdentifier, FText& OutFailReason)
|
|
{
|
|
return GameProjectUtils::UpdateGameProject(ProjectFile, EngineIdentifier, OutFailReason);
|
|
}
|
|
|
|
|
|
bool FGameProjectGenerationModule::UpdateCodeProject(FText& OutFailReason)
|
|
{
|
|
FScopedSlowTask SlowTask(0, LOCTEXT( "UpdatingCodeProject", "Updating code project..." ) );
|
|
SlowTask.MakeDialog();
|
|
|
|
return GameProjectUtils::GenerateCodeProjectFiles(FPaths::GetProjectFilePath(), OutFailReason);
|
|
}
|
|
|
|
|
|
int32 FGameProjectGenerationModule::GetProjectCodeFileCount()
|
|
{
|
|
return GameProjectUtils::GetProjectCodeFileCount();
|
|
}
|
|
|
|
void FGameProjectGenerationModule::GetProjectSourceDirectoryInfo(int32& OutNumFiles, int64& OutDirectorySize)
|
|
{
|
|
GameProjectUtils::GetProjectSourceDirectoryInfo(OutNumFiles, OutDirectorySize);
|
|
}
|
|
|
|
void FGameProjectGenerationModule::CheckAndWarnProjectFilenameValid()
|
|
{
|
|
GameProjectUtils::CheckAndWarnProjectFilenameValid();
|
|
}
|
|
|
|
|
|
void FGameProjectGenerationModule::UpdateSupportedTargetPlatforms(const FName& InPlatformName, const bool bIsSupported)
|
|
{
|
|
GameProjectUtils::UpdateSupportedTargetPlatforms(InPlatformName, bIsSupported);
|
|
}
|
|
|
|
void FGameProjectGenerationModule::ClearSupportedTargetPlatforms()
|
|
{
|
|
GameProjectUtils::ClearSupportedTargetPlatforms();
|
|
}
|
|
|
|
bool FGameProjectGenerationModule::RegisterTemplateCategory(FName Type, FText Name, FText Description, const FSlateBrush* Icon, const FSlateBrush* Image)
|
|
{
|
|
if (TemplateCategories.Contains(Type))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
FTemplateCategory Category = { Name, Description, Icon, Image, Type };
|
|
TemplateCategories.Add(Type, MakeShareable(new FTemplateCategory(Category)));
|
|
return true;
|
|
}
|
|
|
|
void FGameProjectGenerationModule::UnRegisterTemplateCategory(FName Type)
|
|
{
|
|
TemplateCategories.Remove(Type);
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|