Skip to content

Commit

Permalink
Alpakit: Generalise hiding editor-only mods
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Th3Fanbus committed Nov 6, 2024
1 parent 97a23bf commit dd103ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Mods/Alpakit/Source/Alpakit/Private/AlpakitModEntryList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,19 @@ bool DoesPluginHaveRuntime(const IPlugin& Plugin) {
return false;
}

const TSet<FString> HiddenMods = { TEXT("SMLEditor") };
static bool IsPluginEditorOnly(const IPlugin& Plugin) {
if (TSharedPtr<FJsonObject> Json = Plugin.GetDescriptor().CachedJson) {
bool Result = false;
return Json->TryGetBoolField("EditorOnly", Result) && Result;
}
return false;
}

void SAlpakitModEntryList::LoadMods() {
Mods.Empty();
const TArray<TSharedRef<IPlugin>> EnabledPlugins = IPluginManager::Get().GetEnabledPlugins();
for (TSharedRef<IPlugin> Plugin : EnabledPlugins) {
if (HiddenMods.Contains(Plugin->GetName())) {
if (IsPluginEditorOnly(Plugin.Get())) {
continue;
}

Expand Down
1 change: 1 addition & 0 deletions Mods/SMLEditor/SMLEditor.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"DocsURL": "https://docs.ficsit.app",
"MarketplaceURL": "",
"SupportURL": "",
"EditorOnly": true,
"CanContainContent": true,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
Expand Down

0 comments on commit dd103ae

Please sign in to comment.