Current state.

This commit is contained in:
Ottermandias 2024-12-27 16:02:50 +01:00
parent 67305d507a
commit 98a89bb2b4
28 changed files with 606 additions and 265 deletions

View file

@ -15,6 +15,7 @@ using Penumbra.Collections.Manager;
using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums;
using Penumbra.Mods.Manager;
using Penumbra.Mods.Settings;
using Penumbra.Services;
using Penumbra.UI.Classes;
@ -497,7 +498,7 @@ public sealed class CollectionPanel(
ImGui.Separator();
var buttonHeight = 2 * ImGui.GetTextLineHeightWithSpacing();
if (_inUseCache.Count == 0 && collection.DirectParentOf.Count == 0)
if (_inUseCache.Count == 0 && collection.Inheritance.DirectlyInheritedBy.Count == 0)
{
ImGui.Dummy(Vector2.One);
using var f = _nameFont.Push();
@ -559,7 +560,7 @@ public sealed class CollectionPanel(
private void DrawInheritanceStatistics(ModCollection collection, Vector2 buttonWidth)
{
if (collection.DirectParentOf.Count <= 0)
if (collection.Inheritance.DirectlyInheritedBy.Count <= 0)
return;
using (var _ = ImRaii.PushStyle(ImGuiStyleVar.FramePadding, Vector2.Zero))
@ -570,11 +571,11 @@ public sealed class CollectionPanel(
using var f = _nameFont.Push();
using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale);
using var color = ImRaii.PushColor(ImGuiCol.Border, Colors.MetaInfoText);
ImGuiUtil.DrawTextButton(Name(collection.DirectParentOf[0]), Vector2.Zero, 0);
ImGuiUtil.DrawTextButton(Name(collection.Inheritance.DirectlyInheritedBy[0]), Vector2.Zero, 0);
var constOffset = (ImGui.GetStyle().FramePadding.X + ImGuiHelpers.GlobalScale) * 2
+ ImGui.GetStyle().ItemSpacing.X
+ ImGui.GetStyle().WindowPadding.X;
foreach (var parent in collection.DirectParentOf.Skip(1))
foreach (var parent in collection.Inheritance.DirectlyInheritedBy.Skip(1))
{
var name = Name(parent);
var size = ImGui.CalcTextSize(name).X;
@ -602,7 +603,7 @@ public sealed class CollectionPanel(
ImGui.TableSetupColumn("State", ImGuiTableColumnFlags.WidthFixed, 1.75f * ImGui.GetFrameHeight());
ImGui.TableSetupColumn("Priority", ImGuiTableColumnFlags.WidthFixed, 2.5f * ImGui.GetFrameHeight());
ImGui.TableHeadersRow();
foreach (var (mod, (settings, parent)) in mods.Select(m => (m, collection[m.Index]))
foreach (var (mod, (settings, parent)) in mods.Select(m => (m, collection.GetInheritedSettings(m.Index)))
.Where(t => t.Item2.Settings != null)
.OrderBy(t => t.m.Name))
{
@ -625,12 +626,12 @@ public sealed class CollectionPanel(
private void DrawInactiveSettingsList(ModCollection collection)
{
if (collection.UnusedSettings.Count == 0)
if (collection.Settings.Unused.Count == 0)
return;
ImGui.Dummy(Vector2.One);
var text = collection.UnusedSettings.Count > 1
? $"Clear all {collection.UnusedSettings.Count} unused settings from deleted mods."
var text = collection.Settings.Unused.Count > 1
? $"Clear all {collection.Settings.Unused.Count} unused settings from deleted mods."
: "Clear the currently unused setting from a deleted mods.";
if (ImGui.Button(text, new Vector2(ImGui.GetContentRegionAvail().X, 0)))
_collections.CleanUnavailableSettings(collection);
@ -638,7 +639,7 @@ public sealed class CollectionPanel(
ImGui.Dummy(Vector2.One);
var size = new Vector2(ImGui.GetContentRegionAvail().X,
Math.Min(10, collection.UnusedSettings.Count + 1) * ImGui.GetFrameHeightWithSpacing());
Math.Min(10, collection.Settings.Unused.Count + 1) * ImGui.GetFrameHeightWithSpacing());
using var table = ImRaii.Table("##inactiveSettings", 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY, size);
if (!table)
return;
@ -650,7 +651,7 @@ public sealed class CollectionPanel(
ImGui.TableSetupColumn("Priority", ImGuiTableColumnFlags.WidthFixed, 2.5f * ImGui.GetFrameHeight());
ImGui.TableHeadersRow();
string? delete = null;
foreach (var (name, settings) in collection.UnusedSettings.OrderBy(n => n.Key))
foreach (var (name, settings) in collection.Settings.Unused.OrderBy(n => n.Key))
{
using var id = ImRaii.PushId(name);
ImGui.TableNextColumn();