Add Apply Mod Associations button to design header.

This commit is contained in:
Ottermandias 2023-09-29 03:17:43 +02:00
parent a0396ec0e0
commit 5ca0aa403c
2 changed files with 16 additions and 2 deletions

View file

@ -387,6 +387,8 @@ public class DesignPanel
ImGui.SameLine(); ImGui.SameLine();
DrawApplyToTarget(); DrawApplyToTarget();
ImGui.SameLine(); ImGui.SameLine();
_modAssociations.DrawApplyButton();
ImGui.SameLine();
DrawSaveToDat(); DrawSaveToDat();
} }

View file

@ -43,10 +43,22 @@ public class ModAssociationsTab
private void DrawApplyAllButton() private void DrawApplyAllButton()
{ {
var current = _penumbra.CurrentCollection; var current = _penumbra.CurrentCollection;
if (!ImGuiUtil.DrawDisabledButton($"Try Applying All Associated Mods to {current}##applyAll", if (ImGuiUtil.DrawDisabledButton($"Try Applying All Associated Mods to {current}##applyAll",
new Vector2(ImGui.GetContentRegionAvail().X, 0), string.Empty, current is "<Unavailable>")) new Vector2(ImGui.GetContentRegionAvail().X, 0), string.Empty, current is "<Unavailable>"))
return; ApplyAll();
}
public void DrawApplyButton()
{
var current = _penumbra.CurrentCollection;
if (ImGuiUtil.DrawDisabledButton("Apply Mod Associations", Vector2.Zero,
$"Try to apply all associated mod settings to Penumbras current collection {current}",
_selector.Selected!.AssociatedMods.Count == 0 || current is "<Unavailable>"))
ApplyAll();
}
public void ApplyAll()
{
foreach (var (mod, settings) in _selector.Selected!.AssociatedMods) foreach (var (mod, settings) in _selector.Selected!.AssociatedMods)
_penumbra.SetMod(mod, settings); _penumbra.SetMod(mod, settings);
} }