Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre Compiled 4.24 Version #68

Open
wants to merge 22 commits into
base: 4.17
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ec3f21c
Merge pull request #1 from vibgyor/PlaybackTypes
nlebedenco Nov 26, 2016
ffe515e
Corrected and rephrased comment about PlaybackType
nlebedenco Nov 27, 2016
0daeb43
Fix configuration to indicate the engine that a Content folder is not…
nlebedenco Jan 18, 2017
abd66c7
Pulled from upstream
nlebedenco Nov 6, 2017
06d4016
Merge branch 'ue4plugins-master'
nlebedenco Nov 6, 2017
adf32c8
Bumped to 4.18
nlebedenco Nov 13, 2017
489c375
Merge branch 'master' of github.com:nlebedenco/LoadingScreen
nlebedenco Nov 13, 2017
7f6430a
Fixed Editor crash during a HotReload due to FObjectFinder being used…
nlebedenco Dec 3, 2017
0a4a508
Improved comments and property grouping.
nlebedenco Feb 4, 2018
079e3ff
Bumped to 4.19
nlebedenco Apr 3, 2018
8d81df5
Updated for 4.20
nlebedenco Jul 19, 2018
ece5fdb
Copyright date
MrScottyPieey Jul 27, 2018
60c90bd
Merge pull request #36 from gamerpcx/patch-1
nickdarnell Jan 7, 2019
ff47f42
Merge pull request #30 from nlebedenco/master
nickdarnell Jan 7, 2019
e764e5a
Updated to 2019 Copyright date
MrScottyPieey Jan 19, 2019
97e7c7e
Updated the Copyright year to 2019
MrScottyPieey Jan 19, 2019
2dea2cc
LoadingFont config not-saving fix
morskoyzmey Jan 31, 2019
4c57786
Merge pull request #42 from MrScottyPieey/patch-3
nickdarnell May 2, 2019
effebef
Merge pull request #43 from MrScottyPieey/patch-4
nickdarnell May 2, 2019
df86b6f
Merge pull request #45 from morskoyzmey/patch-2
nickdarnell May 2, 2019
ccb162f
Upgrading the project to be 4.22 ready, adding a few more options for…
nickdarnell May 4, 2019
deed024
const correctness, making the tips multiline, simplifying the DPI sca…
nickdarnell May 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed Docs/plugins.png
Binary file not shown.
6 changes: 3 additions & 3 deletions LoadingScreen.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"CreatedByURL": "https://www.epicgames.com",
"DocsURL": "https://github.com/ue4plugins/LoadingScreen",
"SupportURL": "https://github.com/ue4plugins/LoadingScreen/issues",
"EngineVersion": "4.16.0",
"EnabledByDefault": false,
"EngineVersion": "4.22",
"EnabledByDefault": true,
"CanContainContent": true,

"Modules": [
Expand All @@ -21,4 +21,4 @@
"LoadingPhase": "PreLoadingScreen"
}
]
}
}
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ time to avoid needing to write a new loading screen manually.

## Supported Platforms

This plug-in was last built against **Unreal Engine 4.16**. It works on all platforms (probably).
This plug-in was last built against **Unreal Engine 4.22**. It works on all platforms (probably).


## Dependencies
Expand All @@ -33,15 +33,7 @@ If you use it as a project plug-in, clone this repository into your project's
*/Plugins* directory and compile your game in Visual Studio. A C++ code project
is required for this to work.

If you use it as an Engine plug-in, clone this repository into the
*/Engine/Plugins/Media* directory and compile your game. Full Unreal Engine 4
source code from GitHub (4.12 or higher) is required for this.

After compiling the plug-in, you have to **enable it** in Unreal Editor's
plug-in browser.

![plugin](Docs/plugins.png)

The plug-in configured to be enabled by default once it's in your game's plug-in directory.

## Support

Expand Down
5 changes: 2 additions & 3 deletions Source/LoadingScreen/LoadingScreen.Build.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

namespace UnrealBuildTool.Rules
{
Expand All @@ -21,8 +21,7 @@ public LoadingScreen(ReadOnlyTargetRules Target)
"SlateCore",
"InputCore",
"Engine"
}
);
});
}
}
}
3 changes: 2 additions & 1 deletion Source/LoadingScreen/Private/LoadingScreenModule.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

#include "ILoadingScreenModule.h"
#include "LoadingScreenSettings.h"
Expand Down Expand Up @@ -43,6 +43,7 @@ void FLoadingScreenModule::StartupModule()
{
Ref.TryLoad();
}

for ( const FStringAssetReference& Ref : Settings->DefaultScreen.Images )
{
Ref.TryLoad();
Expand Down
16 changes: 3 additions & 13 deletions Source/LoadingScreen/Private/LoadingScreenSettings.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

#include "LoadingScreenSettings.h"
#include "UObject/ConstructorHelpers.h"
Expand All @@ -7,19 +7,8 @@
#define LOCTEXT_NAMESPACE "LoadingScreen"

FLoadingScreenDescription::FLoadingScreenDescription()
: MinimumLoadingScreenDisplayTime(-1)
, bAutoCompleteWhenLoadingCompletes(true)
, bMoviesAreSkippable(true)
, bWaitForManualStop(false)
, bShowUIOverlay(true)
, LoadingText(LOCTEXT("Loading", "LOADING"))
, ImageStretch(EStretch::ScaleToFit)
: LoadingText(LOCTEXT("Loading", "LOADING"))
{
if ( !IsRunningDedicatedServer() )
{
static ConstructorHelpers::FObjectFinder<UFont> RobotoFontObj(TEXT("/Engine/EngineFonts/Roboto"));
LoadingFont = FSlateFontInfo(RobotoFontObj.Object, 32, FName("Bold"));
}
}

ULoadingScreenSettings::ULoadingScreenSettings(const FObjectInitializer& Initializer)
Expand All @@ -31,6 +20,7 @@ ULoadingScreenSettings::ULoadingScreenSettings(const FObjectInitializer& Initial
{
static ConstructorHelpers::FObjectFinder<UFont> RobotoFontObj(TEXT("/Engine/EngineFonts/Roboto"));
TipFont = FSlateFontInfo(RobotoFontObj.Object, 20, FName("Normal"));
LoadingFont = FSlateFontInfo(RobotoFontObj.Object, 32, FName("Bold"));
}
}

Expand Down
68 changes: 38 additions & 30 deletions Source/LoadingScreen/Private/LoadingScreenSettings.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

#pragma once

Expand All @@ -18,48 +18,52 @@ struct LOADINGSCREEN_API FLoadingScreenDescription
FLoadingScreenDescription();

/** The minimum time that a loading screen should be opened for, -1 if there is no minimum time. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Loading)
float MinimumLoadingScreenDisplayTime;

/** If true, the loading screen will disappear as soon as all movies are played and loading is done. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Loading)
bool bAutoCompleteWhenLoadingCompletes;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Loading)
float MinimumLoadingScreenDisplayTime = -1;
/** If true, the loading screen will disappear as soon as loading is done. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Loading)
bool bAutoCompleteWhenLoadingCompletes = true;
/** If true, movies can be skipped by clicking the loading screen as long as loading is done. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Loading)
bool bMoviesAreSkippable;

/** If true, movie playback continues until Stop is called. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Loading)
bool bWaitForManualStop;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Loading)
bool bMoviesAreSkippable = true;

/** Should we just play back, loop, etc. NOTE: if the playback type is MT_LoopLast, then bAutoCompleteWhenLoadingCompletes will be togged on when the last movie is hit*/
/** If true, movie playback continues until Stop is called. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Loading)
bool bWaitForManualStop = false;

/** Should we just play back, loop, etc. NOTE: if playback type is MT_LoadingLoop, then MoviePlayer will auto complete when in the last movie and load finishes regardless of bAutoCompleteWhenLoadingCompletes */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Loading)
TEnumAsByte<EMoviePlaybackType> PlaybackType;

/** The movie paths local to the game's Content/Movies/ directory without extension. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Movies)
TArray<FString> MoviePaths;

/** Should we show the images/tips/loading text? Generally you'll want to set this to false if you just want to show a movie. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Display)
bool bShowUIOverlay;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Display)
bool bShowUIOverlay = true;

/** */
/** Text displayed beside the animated icon */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Display)
FText LoadingText;

/** */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Display)
FSlateFontInfo LoadingFont;

/** The movie paths local to the game's Content/Movies/ directory we will play. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Movies)
TArray<FString> MoviePaths;

/** The texture display while in the loading screen on top of the movie. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Images, meta=(AllowedClasses="Texture2D"))
TArray<FStringAssetReference> Images;
TArray<FSoftObjectPath> Images;

/** The scaling type to apply to images. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Images)
TEnumAsByte<EStretch::Type> ImageStretch;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Images)
TEnumAsByte<EStretch::Type> ImageStretch = EStretch::ScaleToFit;

/** The background color to use */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Images)
FLinearColor BackgroundColor = FLinearColor::Black;

/** The background color to use for tips */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Images)
FLinearColor TipBackgroundColor = FLinearColor(0, 0, 0, 0.75f);
};

/**
Expand All @@ -84,11 +88,15 @@ class LOADINGSCREEN_API ULoadingScreenSettings : public UDeveloperSettings
UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Advice)
FSlateFontInfo TipFont;

/** The font to display on loading. */
UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category = Display)
FSlateFontInfo LoadingFont;

/** The size of the tip before it's wrapped to the next line. */
UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Advice)
float TipWrapAt;

/** The tips to display on the load screen. */
UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Advice)
UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Advice, meta = (MultiLine = "true"))
TArray<FText> Tips;
};
87 changes: 48 additions & 39 deletions Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp
Original file line number Diff line number Diff line change
@@ -1,56 +1,71 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

#include "SSimpleLoadingScreen.h"

#include "SScaleBox.h"
#include "Widgets/Images/SImage.h"
#include "Widgets/Layout/SSpacer.h"
#include "Widgets/SOverlay.h"
#include "Widgets/SBoxPanel.h"
#include "Widgets/Text/STextBlock.h"
#include "Widgets/Layout/SScaleBox.h"
#include "Widgets/Layout/SSpacer.h"
#include "Widgets/Layout/SBorder.h"
#include "SSafeZone.h"
#include "SThrobber.h"
#include "SDPIScaler.h"
#include "Widgets/Layout/SSafeZone.h"
#include "Widgets/Layout/SDPIScaler.h"
#include "Widgets/Text/STextBlock.h"
#include "Widgets/Images/SImage.h"
#include "Widgets/Images/SThrobber.h"
#include "Engine/Texture2D.h"
#include "Engine/UserInterfaceSettings.h"
#include "Slate/DeferredCleanupSlateBrush.h"

#define LOCTEXT_NAMESPACE "LoadingScreen"

/////////////////////////////////////////////////////
// SSimpleLoadingScreen

void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScreenDescription& InScreenDescription)
static float PointSizeToSlateUnits(float PointSize)
{
LastComputedDPIScale = 1.0f;
//FreeTypeConstants::HorizontalDPI = 96;
const float SlateFreeTypeHorizontalResolutionDPI = 96.0f;
const float FreeTypeNativeDPI = 72.0f;
const float PixelSize = PointSize * (SlateFreeTypeHorizontalResolutionDPI / FreeTypeNativeDPI);

return PixelSize;
}

void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScreenDescription& InScreenDescription)
{
const ULoadingScreenSettings* Settings = GetDefault<ULoadingScreenSettings>();

//Settings->TipFont;
//InScreenDescription.LoadingFont.GetCompositeFont()->SubTypefaces[0]->Typeface.Fonts[0].Font.BulkDataPtr->GetLinker()->GetOwnerThreadId()
const FSlateFontInfo& TipFont = Settings->TipFont;
const FSlateFontInfo& LoadingFont = Settings->LoadingFont;

TSharedRef<SOverlay> Root = SNew(SOverlay);

// If there's an image defined
if ( InScreenDescription.Images.Num() > 0 )
{
int32 ImageIndex = FMath::RandRange(0, InScreenDescription.Images.Num() - 1);
const int32 ImageIndex = FMath::RandRange(0, InScreenDescription.Images.Num() - 1);
const FStringAssetReference& ImageAsset = InScreenDescription.Images[ImageIndex];
UObject* ImageObject = ImageAsset.TryLoad();
if ( UTexture2D* LoadingImage = Cast<UTexture2D>(ImageObject) )
{
FVector2D Size = FVector2D(LoadingImage->GetSizeX(), LoadingImage->GetSizeY());
LoadingScreenBrush = MakeShareable(new FLoadingScreenBrush(LoadingImage, Size, FName(*ImageAsset.ToString())));
LoadingScreenBrush = FDeferredCleanupSlateBrush::CreateBrush(LoadingImage);

Root->AddSlot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SScaleBox)
.Stretch(InScreenDescription.ImageStretch)
SNew(SBorder)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.BorderBackgroundColor(InScreenDescription.BackgroundColor)
.BorderImage(FCoreStyle::Get().GetBrush("WhiteBrush"))
[
SNew(SImage)
.Image(LoadingScreenBrush.Get())
SNew(SScaleBox)
.Stretch(InScreenDescription.ImageStretch)
[
SNew(SImage)
.Image(LoadingScreenBrush.IsValid() ? LoadingScreenBrush->GetSlateBrush() : nullptr)
]
]
];
}
Expand All @@ -59,13 +74,19 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr
TSharedRef<SWidget> TipWidget = SNullWidget::NullWidget;
if ( Settings->Tips.Num() > 0 )
{
int32 TipIndex = FMath::RandRange(0, Settings->Tips.Num() - 1);
const int32 TipIndex = FMath::RandRange(0, Settings->Tips.Num() - 1);

TipWidget = SNew(STextBlock)
.WrapTextAt(Settings->TipWrapAt)
//.Font(Settings->TipFont)
.Font(TipFont)
.Text(Settings->Tips[TipIndex]);
}
else
{
// Need to use a spacer when being rendered on another thread, incrementing the SNullWidget will
// lead to shared ptr crashes.
TipWidget = SNew(SSpacer);
}

Root->AddSlot()
.HAlign(HAlign_Fill)
Expand All @@ -74,7 +95,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr
SNew(SBorder)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.BorderBackgroundColor(FLinearColor(0, 0, 0, 0.75))
.BorderBackgroundColor(InScreenDescription.TipBackgroundColor)
.BorderImage(FCoreStyle::Get().GetBrush("WhiteBrush"))
[
SNew(SSafeZone)
Expand All @@ -93,8 +114,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr
.AutoWidth()
[
SNew(SCircularThrobber)
// Convert font size to pixels, pixel_size = point_size * resolution / 72, then half it to get radius
.Radius((InScreenDescription.LoadingFont.Size * 96.0f/72.0f) / 2.0f)
.Radius(PointSizeToSlateUnits(LoadingFont.Size) / 2.0f)
]

+ SHorizontalBox::Slot()
Expand All @@ -104,7 +124,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr
[
SNew(STextBlock)
.Text(InScreenDescription.LoadingText)
//.Font(InScreenDescription.LoadingFont)
.Font(LoadingFont)
]

+ SHorizontalBox::Slot()
Expand Down Expand Up @@ -134,22 +154,11 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr
];
}

void SSimpleLoadingScreen::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
{
const FVector2D& LocalSize = AllottedGeometry.GetLocalSize();
FIntPoint Size((int32)LocalSize.X, (int32)LocalSize.Y);
const float NewScale = GetDefault<UUserInterfaceSettings>()->GetDPIScaleBasedOnSize(Size);

if ( NewScale != LastComputedDPIScale )
{
LastComputedDPIScale = NewScale;
SlatePrepass(1.0f);
}
}

float SSimpleLoadingScreen::GetDPIScale() const
{
return LastComputedDPIScale;
const FVector2D& DrawSize = GetCachedGeometry().ToPaintGeometry().GetLocalSize();
const FIntPoint Size((int32)DrawSize.X, (int32)DrawSize.Y);
return GetDefault<UUserInterfaceSettings>()->GetDPIScaleBasedOnSize(Size);
}

#undef LOCTEXT_NAMESPACE
Loading