Files
UnrealEngineUWP/Engine/Source/Editor/ContentBrowser/Private/ContentBrowserModule.cpp
ryan durand 627baf970a Updating copyright for Engine Editor.
#rnx
#rb none


#ROBOMERGE-SOURCE: CL 10869241 via CL 10869527 via CL 10869904
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870586 by ryan durand in Main branch]
2019-12-26 15:33:43 -05:00

61 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ContentBrowserModule.h"
#include "ContentBrowserLog.h"
#include "ContentBrowserSingleton.h"
#include "MRUFavoritesList.h"
#include "Settings/ContentBrowserSettings.h"
IMPLEMENT_MODULE( FContentBrowserModule, ContentBrowser );
DEFINE_LOG_CATEGORY(LogContentBrowser);
const FName FContentBrowserModule::NumberOfRecentAssetsName(TEXT("NumObjectsInRecentList"));
void FContentBrowserModule::StartupModule()
{
ContentBrowserSingleton = new FContentBrowserSingleton();
RecentlyOpenedAssets = MakeUnique<FMainMRUFavoritesList>(TEXT("ContentBrowserRecent"), GetDefault<UContentBrowserSettings>()->NumObjectsInRecentList);
RecentlyOpenedAssets->ReadFromINI();
UContentBrowserSettings::OnSettingChanged().AddRaw(this, &FContentBrowserModule::ResizeRecentAssetList);
}
void FContentBrowserModule::ShutdownModule()
{
if ( ContentBrowserSingleton )
{
delete ContentBrowserSingleton;
ContentBrowserSingleton = NULL;
}
UContentBrowserSettings::OnSettingChanged().RemoveAll(this);
RecentlyOpenedAssets.Reset();
}
IContentBrowserSingleton& FContentBrowserModule::Get() const
{
check(ContentBrowserSingleton);
return *ContentBrowserSingleton;
}
FDelegateHandle FContentBrowserModule::AddAssetViewExtraStateGenerator(const FAssetViewExtraStateGenerator& Generator)
{
AssetViewExtraStateGenerators.Add(Generator);
return Generator.Handle;
}
void FContentBrowserModule::RemoveAssetViewExtraStateGenerator(const FDelegateHandle& GeneratorHandle)
{
AssetViewExtraStateGenerators.RemoveAll([&GeneratorHandle](const FAssetViewExtraStateGenerator& Generator) { return Generator.Handle == GeneratorHandle; });
}
void FContentBrowserModule::ResizeRecentAssetList(FName InName)
{
if (InName == NumberOfRecentAssetsName)
{
RecentlyOpenedAssets->WriteToINI();
RecentlyOpenedAssets = MakeUnique<FMainMRUFavoritesList>(TEXT("ContentBrowserRecent"), GetDefault<UContentBrowserSettings>()->NumObjectsInRecentList);
RecentlyOpenedAssets->ReadFromINI();
}
}