From a95877b9e45d7b77a1188df03ec99c65a7fa71c2 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 1 Aug 2023 13:11:33 +0200 Subject: [PATCH] Add priority display to mod selector. --- Penumbra/Configuration.cs | 1 + Penumbra/Mods/ModCreator.cs | 1 - Penumbra/UI/Classes/Colors.cs | 4 ++- Penumbra/UI/ModsTab/ModFileSystemSelector.cs | 28 +++++++++++++++++++- Penumbra/UI/Tabs/SettingsTab.cs | 3 +++ 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Penumbra/Configuration.cs b/Penumbra/Configuration.cs index da2fd935..beaf1960 100644 --- a/Penumbra/Configuration.cs +++ b/Penumbra/Configuration.cs @@ -50,6 +50,7 @@ public class Configuration : IPluginConfiguration, ISavable public bool UseNoModsInInspect { get; set; } = false; public bool HideChangedItemFilters { get; set; } = false; + public bool HidePrioritiesInSelector { get; set; } = false; public bool HideRedrawBar { get; set; } = false; public int OptionGroupCollapsibleMin { get; set; } = 5; diff --git a/Penumbra/Mods/ModCreator.cs b/Penumbra/Mods/ModCreator.cs index ce63fd42..d63627f5 100644 --- a/Penumbra/Mods/ModCreator.cs +++ b/Penumbra/Mods/ModCreator.cs @@ -18,7 +18,6 @@ using Penumbra.Mods.Manager; using Penumbra.Mods.Subclasses; using Penumbra.Services; using Penumbra.String.Classes; -using Penumbra.Util; namespace Penumbra.Mods; diff --git a/Penumbra/UI/Classes/Colors.cs b/Penumbra/UI/Classes/Colors.cs index 42577034..450f3787 100644 --- a/Penumbra/UI/Classes/Colors.cs +++ b/Penumbra/UI/Classes/Colors.cs @@ -23,7 +23,8 @@ public enum ColorId SelectedCollection, RedundantAssignment, NoModsAssignment, - NoAssignment, + NoAssignment, + SelectorPriority, } public static class Colors @@ -62,6 +63,7 @@ public static class Colors ColorId.RedundantAssignment => ( 0x6050D0D0, "Redundant Collection Assignment", "A collection assignment that currently has no effect as it is redundant with more general assignments."), ColorId.NoModsAssignment => ( 0x50000080, "'Use No Mods' Collection Assignment", "A collection assignment set to not use any mods at all."), ColorId.NoAssignment => ( 0x00000000, "Unassigned Collection Assignment", "A collection assignment that is not configured to any collection and thus just has no specific treatment."), + ColorId.SelectorPriority => ( 0xFF808080, "Mod Selector Priority", "The priority displayed for non-zero priority mods in the mod selector."), _ => throw new ArgumentOutOfRangeException( nameof( color ), color, null ), // @formatter:on }; diff --git a/Penumbra/UI/ModsTab/ModFileSystemSelector.cs b/Penumbra/UI/ModsTab/ModFileSystemSelector.cs index 2b943f82..f3ea815a 100644 --- a/Penumbra/UI/ModsTab/ModFileSystemSelector.cs +++ b/Penumbra/UI/ModsTab/ModFileSystemSelector.cs @@ -168,6 +168,27 @@ public sealed class ModFileSystemSelector : FileSystemSelector ImGui.GetStyle().ItemSpacing.X) + { + c.Push(ImGuiCol.Text, ColorId.SelectorPriority.Value()); + ImGui.SetCursorPosX(ImGui.GetCursorPosX() + offset); + ImGui.TextUnformatted(priorityString); + } + else + { + ImGui.NewLine(); + } + } } @@ -468,6 +489,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector Combined wrapper for handling all filters and setting state. private bool ApplyFiltersAndState(ModFileSystem.Leaf leaf, out ModState state) { - state = new ModState { Color = ColorId.EnabledMod }; var mod = leaf.Value; var (settings, collection) = _collectionManager.Active.Current[mod.Index]; + state = new ModState + { + Color = ColorId.EnabledMod, + Priority = settings?.Priority ?? 0, + }; if (ApplyStringFilters(leaf, mod)) return true; diff --git a/Penumbra/UI/Tabs/SettingsTab.cs b/Penumbra/UI/Tabs/SettingsTab.cs index 84432ce6..375ada2d 100644 --- a/Penumbra/UI/Tabs/SettingsTab.cs +++ b/Penumbra/UI/Tabs/SettingsTab.cs @@ -379,6 +379,9 @@ public class SettingsTab : ITab if (v) _config.ChangedItemFilter = ChangedItemDrawer.AllFlags; }); + Checkbox("Hide Priority Numbers in Mod Selector", + "Hides the bracketed non-zero priority numbers displayed in the mod selector when there is enough space for them.", + _config.HidePrioritiesInSelector, v => _config.HidePrioritiesInSelector = v); DrawSingleSelectRadioMax(); DrawCollapsibleGroupMin(); }