2021-09-02 16:45:15 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "DerivedDataEditorModule.h"
|
2021-09-13 08:04:41 -04:00
|
|
|
#include "DerivedDataCacheNotifications.h"
|
2022-12-09 16:11:41 -05:00
|
|
|
#include "DerivedDataInformation.h"
|
|
|
|
|
#include "Experimental/ZenServerInterface.h"
|
2021-09-13 08:04:41 -04:00
|
|
|
#include "Framework/Application/SlateApplication.h"
|
2022-12-09 16:11:41 -05:00
|
|
|
#include "Modules/ModuleManager.h"
|
|
|
|
|
#include "SDerivedDataDialogs.h"
|
|
|
|
|
#include "SDerivedDataStatusBar.h"
|
|
|
|
|
#include "Styling/AppStyle.h"
|
2021-09-13 08:04:41 -04:00
|
|
|
#include "Widgets/DeclarativeSyntaxSupport.h"
|
2021-09-02 16:45:15 -04:00
|
|
|
#include "Widgets/Docking/SDockTab.h"
|
|
|
|
|
#include "WorkspaceMenuStructure.h"
|
|
|
|
|
#include "WorkspaceMenuStructureModule.h"
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "DerivedDataEditor"
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(FDerivedDataEditorModule, DerivedDataEditor );
|
|
|
|
|
|
|
|
|
|
static const FName DerivedDataResourceUsageTabName = FName(TEXT("DerivedDataResourceUsage"));
|
|
|
|
|
static const FName DerivedDataCacheStatisticsTabName = FName(TEXT("DerivedDataCacheStatistics"));
|
|
|
|
|
|
|
|
|
|
void FDerivedDataEditorModule::StartupModule()
|
|
|
|
|
{
|
2022-05-09 13:12:28 -04:00
|
|
|
const FSlateIcon ResourceUsageIcon(FAppStyle::GetAppStyleSetName(), "DerivedData.ResourceUsage");
|
2021-09-02 16:45:15 -04:00
|
|
|
|
|
|
|
|
FGlobalTabmanager::Get()->RegisterNomadTabSpawner(DerivedDataResourceUsageTabName, FOnSpawnTab::CreateRaw(this, &FDerivedDataEditorModule::CreateResourceUsageTab))
|
|
|
|
|
.SetDisplayName(LOCTEXT("DerivedDataResourceUsageTabTitle", "Resource Usage"))
|
|
|
|
|
.SetTooltipText(LOCTEXT("DerivedDataResourceUsageTabToolTipText", "Derived Data Resource Usage"))
|
|
|
|
|
.SetGroup(WorkspaceMenu::GetMenuStructure().GetToolsCategory())
|
|
|
|
|
.SetIcon(ResourceUsageIcon);
|
|
|
|
|
|
2022-05-09 13:12:28 -04:00
|
|
|
const FSlateIcon CacheStatisticsIcon(FAppStyle::GetAppStyleSetName(), "DerivedData.Cache.Statistics");
|
2021-09-02 16:45:15 -04:00
|
|
|
|
|
|
|
|
FGlobalTabmanager::Get()->RegisterNomadTabSpawner(DerivedDataCacheStatisticsTabName, FOnSpawnTab::CreateRaw(this, &FDerivedDataEditorModule::CreateCacheStatisticsTab))
|
|
|
|
|
.SetDisplayName(LOCTEXT("DerivedDataCacheStatisticsTabTitle", "Cache Statistics"))
|
|
|
|
|
.SetTooltipText(LOCTEXT("DerivedDataCacheStatisticsTabToolTipText", "Derived Data Cache Statistics"))
|
|
|
|
|
.SetGroup(WorkspaceMenu::GetMenuStructure().GetToolsCategory())
|
|
|
|
|
.SetIcon(CacheStatisticsIcon);
|
|
|
|
|
|
|
|
|
|
#if WITH_RELOAD
|
|
|
|
|
// This code attempts to relaunch the tabs when you reload this module
|
|
|
|
|
if (IsReloadActive() && FSlateApplication::IsInitialized())
|
|
|
|
|
{
|
|
|
|
|
ShowCacheStatisticsTab();
|
|
|
|
|
ShowResourceUsageTab();
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_RELOAD
|
|
|
|
|
|
|
|
|
|
FDerivedDataStatusBarMenuCommands::Register();
|
2021-09-13 08:04:41 -04:00
|
|
|
|
|
|
|
|
DerivedDataCacheNotifications.Reset(new FDerivedDataCacheNotifications);
|
2021-09-02 16:45:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FDerivedDataEditorModule::ShutdownModule()
|
|
|
|
|
{
|
|
|
|
|
if (FSlateApplication::IsInitialized())
|
|
|
|
|
{
|
|
|
|
|
FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(DerivedDataResourceUsageTabName);
|
|
|
|
|
|
|
|
|
|
if (ResourceUsageTab.IsValid())
|
|
|
|
|
{
|
|
|
|
|
ResourceUsageTab.Pin()->RequestCloseTab();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(DerivedDataCacheStatisticsTabName);
|
|
|
|
|
|
|
|
|
|
if (CacheStatisticsTab.IsValid())
|
|
|
|
|
{
|
|
|
|
|
CacheStatisticsTab.Pin()->RequestCloseTab();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FDerivedDataStatusBarMenuCommands::Unregister();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedRef<SWidget> FDerivedDataEditorModule::CreateStatusBarWidget()
|
|
|
|
|
{
|
|
|
|
|
return SNew(SDerivedDataStatusBarWidget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedPtr<SWidget> FDerivedDataEditorModule::CreateResourceUsageDialog()
|
|
|
|
|
{
|
|
|
|
|
return SNew(SDerivedDataResourceUsageDialog);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-18 14:37:34 -05:00
|
|
|
TSharedRef<SDockTab> FDerivedDataEditorModule::CreateResourceUsageTab(const FSpawnTabArgs& Args)
|
|
|
|
|
{
|
|
|
|
|
return SAssignNew(ResourceUsageTab, SDockTab)
|
|
|
|
|
.TabRole(ETabRole::NomadTab)
|
|
|
|
|
[
|
|
|
|
|
CreateResourceUsageDialog().ToSharedRef()
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FDerivedDataEditorModule::ShowResourceUsageTab()
|
|
|
|
|
{
|
|
|
|
|
FGlobalTabmanager::Get()->TryInvokeTab(FTabId(DerivedDataResourceUsageTabName));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-09-02 16:45:15 -04:00
|
|
|
TSharedPtr<SWidget> FDerivedDataEditorModule::CreateCacheStatisticsDialog()
|
|
|
|
|
{
|
2021-12-16 19:56:35 -05:00
|
|
|
return SNew(SDerivedDataCacheStatisticsDialog);
|
2021-09-02 16:45:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TSharedRef<SDockTab> FDerivedDataEditorModule::CreateCacheStatisticsTab(const FSpawnTabArgs& Args)
|
|
|
|
|
{
|
|
|
|
|
return SAssignNew(CacheStatisticsTab, SDockTab)
|
|
|
|
|
.TabRole(ETabRole::NomadTab)
|
|
|
|
|
[
|
|
|
|
|
CreateCacheStatisticsDialog().ToSharedRef()
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-18 14:37:34 -05:00
|
|
|
void FDerivedDataEditorModule::ShowCacheStatisticsTab()
|
|
|
|
|
{
|
|
|
|
|
FGlobalTabmanager::Get()->TryInvokeTab(FTabId(DerivedDataCacheStatisticsTabName));
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-24 23:16:52 -05:00
|
|
|
#undef LOCTEXT_NAMESPACE
|