From dd103aecb601344f75f3718f2ae65a9aa2ff14d1 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Wed, 6 Nov 2024 21:15:27 +0100 Subject: [PATCH] Alpakit: Generalise hiding editor-only mods Instead of having a hardcoded list of editor-only mods to not show in the Alpakit mod list, allow mods to set an "EditorOnly" bool property in the .uplugin to hide them in Alpakit. Signed-off-by: Angel Pons --- .../Source/Alpakit/Private/AlpakitModEntryList.cpp | 10 ++++++++-- Mods/SMLEditor/SMLEditor.uplugin | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Mods/Alpakit/Source/Alpakit/Private/AlpakitModEntryList.cpp b/Mods/Alpakit/Source/Alpakit/Private/AlpakitModEntryList.cpp index 0f3fc9798b..a55786f6ac 100644 --- a/Mods/Alpakit/Source/Alpakit/Private/AlpakitModEntryList.cpp +++ b/Mods/Alpakit/Source/Alpakit/Private/AlpakitModEntryList.cpp @@ -146,13 +146,19 @@ bool DoesPluginHaveRuntime(const IPlugin& Plugin) { return false; } -const TSet HiddenMods = { TEXT("SMLEditor") }; +static bool IsPluginEditorOnly(const IPlugin& Plugin) { + if (TSharedPtr Json = Plugin.GetDescriptor().CachedJson) { + bool Result = false; + return Json->TryGetBoolField("EditorOnly", Result) && Result; + } + return false; +} void SAlpakitModEntryList::LoadMods() { Mods.Empty(); const TArray> EnabledPlugins = IPluginManager::Get().GetEnabledPlugins(); for (TSharedRef Plugin : EnabledPlugins) { - if (HiddenMods.Contains(Plugin->GetName())) { + if (IsPluginEditorOnly(Plugin.Get())) { continue; } diff --git a/Mods/SMLEditor/SMLEditor.uplugin b/Mods/SMLEditor/SMLEditor.uplugin index 5c1cc2ea1c..ce67f41ba3 100644 --- a/Mods/SMLEditor/SMLEditor.uplugin +++ b/Mods/SMLEditor/SMLEditor.uplugin @@ -11,6 +11,7 @@ "DocsURL": "https://docs.ficsit.app", "MarketplaceURL": "", "SupportURL": "", + "EditorOnly": true, "CanContainContent": true, "IsBetaVersion": false, "IsExperimentalVersion": false,