Files
UnrealEngineUWP/Engine/Source/Editor/ContentBrowser/Private/ContentBrowserModule.cpp
scott nelson a35dcfe58b Dirty folder paths showing Private Content when All/ folder is hidden
[FYI] Rex.Hill
#rb Jason.Stasik
#preflight 62421f3c470aff98e94617b8

#ROBOMERGE-AUTHOR: scott.nelson
#ROBOMERGE-SOURCE: CL 19534459 via CL 19534474 via CL 19534482 via CL 19534492
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v937-19513599)

[CL 19535470 by scott nelson in ue5-main branch]
2022-03-28 19:37:57 -04:00

76 lines
2.5 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();
}
ContentBrowserSingleton->SetPrivateContentPermissionListDirty();
// Resize the recently opened asset list
if (InName == NumberOfRecentAssetsName)
{
RecentlyOpenedAssets->WriteToINI();
RecentlyOpenedAssets = MakeUnique<FMainMRUFavoritesList>(TEXT("ContentBrowserRecent"), GetDefault<UContentBrowserSettings>()->NumObjectsInRecentList);
RecentlyOpenedAssets->ReadFromINI();
}
OnContentBrowserSettingChanged.Broadcast(InName);
}