-
Notifications
You must be signed in to change notification settings - Fork 51
Customizing Tooltips
Valentin Plyasinov edited this page Aug 12, 2022
·
2 revisions
Plugin supports customizing tooltips for table items.
To customize tooltip generation follow these steps:
- Add
SubsystemBrowser
module dependency in Build.cs
Since Subsystem Browser is an editor module it is recommended to access it only from other editor modules
When using a regular game module dependency has to be guarded with
if (Target.bBuildEditor)
PrivateDependencyModuleNames.Add("SubsystemBrowser");
- Declare functions for category registration and subsystem selector in your module
Since Subsystem Browser is an editor module it is recommended to access it only from other editor modules
When using a regular game module access to editor-only types and headers has to be guarded with
#if WITH_EDITOR
#include "SubsystemBrowserModule.h"
void RegisterSubsystemGlobalCustomizations();
struct FMyEditorModule : public IModuleInterface
{
virtual void StartupModule() override
{ // Call it on startup of your editor module
RegisterSubsystemCategoryCustomizations();
}
};
- Subscribe to delegates
void RegisterSubsystemGlobalCustomizations()
{
// Customize tooltips for each type of item (Category or Subsystem)
FSubsystemBrowserModule::OnGenerateTooltip.AddLambda([](TSharedRef<const ISubsystemTreeItem> Item, FSubsystemTableItemTooltipBuilder& Builder)
{
if (const FSubsystemTreeSubsystemItem* AsSubsystem = Item->GetAsSubsystemDescriptor())
{
UClass* ParentClass = AsSubsystem->Class.IsValid() ? AsSubsystem->Class->GetSuperClass() : nullptr;
if (ParentClass)
{
Builder.AddSecondary(INVTEXT("Parent Class Name"), FText::FromName(ParentClass->GetFName()));
}
}
});
FSubsystemBrowserModule::OnGetSubsystemOwnerName.BindLambda([](UObject* Instance)
{
// Implement your "GetOwner" behavior or use default
return FSubsystemBrowserUtils::GetDefaultSubsystemOwnerName(Instance);
});
}
- Enjoy working with subsystems