You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This represents UE4/Main @ 16130047 and Dev-PerfTest @ 16126156 [CL 16163576 by aurel cordonnier in ue5-main branch]
74 lines
2.4 KiB
C++
74 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
#include "ContentBrowserModule.h"
|
|
#include "ContentBrowserLog.h"
|
|
#include "ContentBrowserSingleton.h"
|
|
#include "IContentBrowserDataModule.h"
|
|
#include "MRUFavoritesList.h"
|
|
#include "Settings/ContentBrowserSettings.h"
|
|
#include "ContentBrowserDataSubsystem.h"
|
|
|
|
IMPLEMENT_MODULE( FContentBrowserModule, ContentBrowser );
|
|
DEFINE_LOG_CATEGORY(LogContentBrowser);
|
|
const FName FContentBrowserModule::NumberOfRecentAssetsName(TEXT("NumObjectsInRecentList"));
|
|
|
|
void FContentBrowserModule::StartupModule()
|
|
{
|
|
// Ensure the data module is loaded
|
|
IContentBrowserDataModule::Get();
|
|
|
|
ContentBrowserSingleton = new FContentBrowserSingleton();
|
|
|
|
RecentlyOpenedAssets = MakeUnique<FMainMRUFavoritesList>(TEXT("ContentBrowserRecent"), GetDefault<UContentBrowserSettings>()->NumObjectsInRecentList);
|
|
RecentlyOpenedAssets->ReadFromINI();
|
|
|
|
UContentBrowserSettings::OnSettingChanged().AddRaw(this, &FContentBrowserModule::ContentBrowserSettingChanged);
|
|
}
|
|
|
|
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::ContentBrowserSettingChanged(FName InName)
|
|
{
|
|
if (UContentBrowserDataSubsystem* ContentBrowserData = IContentBrowserDataModule::Get().GetSubsystem())
|
|
{
|
|
ContentBrowserData->RefreshVirtualPathTreeIfNeeded();
|
|
}
|
|
|
|
// Resize the recently opened asset list
|
|
if (InName == NumberOfRecentAssetsName)
|
|
{
|
|
RecentlyOpenedAssets->WriteToINI();
|
|
RecentlyOpenedAssets = MakeUnique<FMainMRUFavoritesList>(TEXT("ContentBrowserRecent"), GetDefault<UContentBrowserSettings>()->NumObjectsInRecentList);
|
|
RecentlyOpenedAssets->ReadFromINI();
|
|
}
|
|
|
|
OnContentBrowserSettingChanged.Broadcast(InName);
|
|
}
|