Skip to content

Commit

Permalink
Merge pull request #30 from nlebedenco/master
Browse files Browse the repository at this point in the history
Added PlaybackTypes, bumped to 4.18 and fixed crash on hot reload due to FObjectFinder being used in a Struct ctor
  • Loading branch information
nickdarnell authored Jan 7, 2019
2 parents 60c90bd + 8d81df5 commit ff47f42
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 30 deletions.
4 changes: 2 additions & 2 deletions LoadingScreen.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"CreatedByURL": "https://www.epicgames.com",
"DocsURL": "https://github.com/ue4plugins/LoadingScreen",
"SupportURL": "https://github.com/ue4plugins/LoadingScreen/issues",
"EngineVersion": "4.16.0",
"EngineVersion": "4.20.0",
"EnabledByDefault": false,
"CanContainContent": true,

Expand All @@ -21,4 +21,4 @@
"LoadingPhase": "PreLoadingScreen"
}
]
}
}
3 changes: 1 addition & 2 deletions Source/LoadingScreen/LoadingScreen.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public LoadingScreen(ReadOnlyTargetRules Target)
"SlateCore",
"InputCore",
"Engine"
}
);
});
}
}
}
6 changes: 1 addition & 5 deletions Source/LoadingScreen/Private/LoadingScreenSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ FLoadingScreenDescription::FLoadingScreenDescription()
, LoadingText(LOCTEXT("Loading", "LOADING"))
, ImageStretch(EStretch::ScaleToFit)
{
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 +26,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
28 changes: 14 additions & 14 deletions Source/LoadingScreen/Private/LoadingScreenSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,35 @@ struct LOADINGSCREEN_API 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. */
/** If true, the loading screen will disappear as soon as loading is done. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Loading)
bool bAutoCompleteWhenLoadingCompletes;

/** 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;

/** 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*/
/** 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;

/** */
/** 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;
Expand Down Expand Up @@ -84,6 +80,10 @@ class LOADINGSCREEN_API ULoadingScreenSettings : public UDeveloperSettings
UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Advice)
FSlateFontInfo TipFont;

/** The font to display on loading. */
UPROPERTY(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;
Expand Down
10 changes: 5 additions & 5 deletions Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr

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);

Expand Down Expand Up @@ -63,7 +63,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr

TipWidget = SNew(STextBlock)
.WrapTextAt(Settings->TipWrapAt)
//.Font(Settings->TipFont)
.Font(TipFont)
.Text(Settings->Tips[TipIndex]);
}

Expand Down Expand Up @@ -94,7 +94,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr
[
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((LoadingFont.Size * 96.0f/72.0f) / 2.0f)
]

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

+ SHorizontalBox::Slot()
Expand Down
5 changes: 3 additions & 2 deletions Source/LoadingScreen/Private/SSimpleLoadingScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ struct FLoadingScreenBrush : public FSlateDynamicImageBrush, public FGCObject

virtual void AddReferencedObjects(FReferenceCollector& Collector) override
{
if ( ResourceObject )
UObject* Object = GetResourceObject();
if (Object)
{
Collector.AddReferencedObject(ResourceObject);
Collector.AddReferencedObject(Object);
}
}
};
Expand Down

0 comments on commit ff47f42

Please sign in to comment.