Add potential hidden priorities.

This commit is contained in:
Ottermandias 2024-09-19 22:50:00 +02:00
parent 9b958a9d37
commit af2a14826c
3 changed files with 13 additions and 2 deletions

View file

@ -66,4 +66,10 @@ public readonly record struct ModPriority(int Value) :
public int CompareTo(ModPriority other)
=> Value.CompareTo(other.Value);
public const int HiddenMin = -84037;
public const int HiddenMax = HiddenMin + 1000;
public bool IsHidden
=> Value is > HiddenMin and < HiddenMax;
}

View file

@ -25,7 +25,7 @@ public class ModPanelConflictsTab(CollectionManager collectionManager, ModFileSy
=> "Conflicts"u8;
public bool IsVisible
=> collectionManager.Active.Current.Conflicts(selector.Selected!).Count > 0;
=> collectionManager.Active.Current.Conflicts(selector.Selected!).Any(c => !GetPriority(c).IsHidden);
private readonly ConditionalWeakTable<IMod, object> _expandedMods = [];
@ -58,7 +58,8 @@ public class ModPanelConflictsTab(CollectionManager collectionManager, ModFileSy
// Can not be null because otherwise the tab bar is never drawn.
var mod = selector.Selected!;
foreach (var (conflict, index) in collectionManager.Active.Current.Conflicts(mod).OrderByDescending(GetPriority)
foreach (var (conflict, index) in collectionManager.Active.Current.Conflicts(mod).Where(c => !c.Mod2.Priority.IsHidden)
.OrderByDescending(GetPriority)
.ThenBy(c => c.Mod2.Name.Lower).WithIndex())
{
using var id = ImRaii.PushId(index);

View file

@ -2,6 +2,7 @@ using ImGuiNET;
using OtterGui.Raii;
using OtterGui;
using OtterGui.Services;
using OtterGui.Text;
using OtterGui.Widgets;
using Penumbra.UI.Classes;
using Penumbra.Collections.Manager;
@ -96,6 +97,9 @@ public class ModPanelSettingsTab(
ImGui.SetNextItemWidth(50 * UiHelpers.Scale);
if (ImGui.InputInt("##Priority", ref priority, 0, 0))
_currentPriority = priority;
if (new ModPriority(priority).IsHidden)
ImUtf8.HoverTooltip($"This priority is special-cased to hide this mod in conflict tabs ({ModPriority.HiddenMin}, {ModPriority.HiddenMax}).");
if (ImGui.IsItemDeactivatedAfterEdit() && _currentPriority.HasValue)
{