mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Apply mod associations from design links
This commit is contained in:
parent
be9c3eab40
commit
895d9f0963
1 changed files with 24 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ using Dalamud.Interface.ImGuiNotification;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using Glamourer.Designs;
|
using Glamourer.Designs;
|
||||||
|
using Glamourer.Designs.Links;
|
||||||
using Glamourer.Interop.Penumbra;
|
using Glamourer.Interop.Penumbra;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
|
|
@ -82,7 +83,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
||||||
|
|
||||||
public void ApplyAll()
|
public void ApplyAll()
|
||||||
{
|
{
|
||||||
foreach (var (mod, settings) in selector.Selected!.AssociatedMods)
|
foreach (var (mod, settings) in GetAllAssociatedMods(selector.Selected!))
|
||||||
penumbra.SetMod(mod, settings);
|
penumbra.SetMod(mod, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,4 +243,26 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
||||||
_modCombo.Draw("##new", currentName.IsNullOrEmpty() ? "Select new Mod..." : currentName, string.Empty,
|
_modCombo.Draw("##new", currentName.IsNullOrEmpty() ? "Select new Mod..." : currentName, string.Empty,
|
||||||
ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight());
|
ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Dictionary<Mod, ModSettings> GetAllAssociatedMods(Design design)
|
||||||
|
{
|
||||||
|
var associatedMods = new Dictionary<Mod, ModSettings>();
|
||||||
|
var designLinks = design.Links;
|
||||||
|
|
||||||
|
foreach (var (mod, settings) in designLinks.Before.SelectMany(GetAllLinkAssociatedMods))
|
||||||
|
associatedMods.TryAdd(mod, settings);
|
||||||
|
|
||||||
|
foreach (var (mod, settings) in design.AssociatedMods)
|
||||||
|
associatedMods.TryAdd(mod, settings);
|
||||||
|
|
||||||
|
foreach (var (mod, settings) in designLinks.After.SelectMany(GetAllLinkAssociatedMods))
|
||||||
|
associatedMods.TryAdd(mod, settings);
|
||||||
|
|
||||||
|
return associatedMods;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dictionary<Mod, ModSettings> GetAllLinkAssociatedMods(DesignLink designLink)
|
||||||
|
{
|
||||||
|
return GetAllAssociatedMods(designLink.Link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue