Files
UnrealEngineUWP/Engine/Source/Editor/EditorStyle/Private/EditorStyleModule.cpp
2020-05-26 10:06:20 -04:00

64 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IEditorStyleModule.h"
#include "SlateEditorStyle.h"
#include "StarshipStyle.h"
#include "Styling/CoreStyle.h"
#include "Styling/StyleColors.h"
/**
* Implements the Editor style module, loaded by SlateApplication dynamically at startup.
*/
class FEditorStyleModule
: public IEditorStyleModule
{
public:
// IEditorStyleModule interface
virtual void StartupModule( ) override
{
if (FCoreStyle::IsStarshipStyle())
{
// This is necessary because the core style loads the color table before ProcessNewlyLoadedUObjects is called which means none of the config properties are in the classs property link at that time.
UStyleColorTable::Get().ReloadConfig();
bUsingStarshipStyle = true;
FStarshipEditorStyle::Initialize();
// set the application style to be the editor style
FAppStyle::SetAppStyleSetName(FStarshipEditorStyle::GetStyleSetName());
}
else
{
FSlateEditorStyle::Initialize();
// set the application style to be the editor style
FAppStyle::SetAppStyleSetName(FEditorStyle::GetStyleSetName());
}
}
virtual void ShutdownModule( ) override
{
if (bUsingStarshipStyle)
{
FStarshipEditorStyle::Shutdown();
}
else
{
FSlateEditorStyle::Shutdown();
}
}
// End IModuleInterface interface
private:
bool bUsingStarshipStyle = false;
};
IMPLEMENT_MODULE(FEditorStyleModule, EditorStyle)