mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-15 05:04:16 +01:00
Add editable mod state and priority.
This commit is contained in:
parent
6115d24775
commit
1cc7c2f0cd
3 changed files with 37 additions and 33 deletions
|
|
@ -112,6 +112,9 @@ public class ApiHelpers(ObjectManager objects, StateManager stateManager, ActorM
|
||||||
{
|
{
|
||||||
sb.Append(arguments[2 * i]);
|
sb.Append(arguments[2 * i]);
|
||||||
sb.Append(" = ");
|
sb.Append(" = ");
|
||||||
|
if (arguments[2 * i + 1] is IEnumerable e)
|
||||||
|
sb.Append($"[{string.Join(',', e)}]");
|
||||||
|
else
|
||||||
sb.Append(arguments[2 * i + 1]);
|
sb.Append(arguments[2 * i + 1]);
|
||||||
sb.Append(", ");
|
sb.Append(", ");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
|
using OtterGui.Text;
|
||||||
|
using OtterGui.Text.Widget;
|
||||||
|
using OtterGui.Widgets;
|
||||||
|
|
||||||
namespace Glamourer.Gui.Tabs.DesignTab;
|
namespace Glamourer.Gui.Tabs.DesignTab;
|
||||||
|
|
||||||
|
|
@ -124,20 +127,15 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
||||||
removedMod = null;
|
removedMod = null;
|
||||||
updatedMod = null;
|
updatedMod = null;
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
var buttonSize = new Vector2(ImGui.GetFrameHeight());
|
if (ImUtf8.IconButton(FontAwesomeIcon.Trash, "Delete this mod from associations."u8))
|
||||||
var spacing = ImGui.GetStyle().ItemInnerSpacing.X;
|
|
||||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), buttonSize,
|
|
||||||
"Delete this mod from associations.", false, true))
|
|
||||||
removedMod = mod;
|
removedMod = mod;
|
||||||
|
|
||||||
ImGui.SameLine(0, spacing);
|
ImUtf8.SameLineInner();
|
||||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Clipboard.ToIconString(), buttonSize,
|
if (ImUtf8.IconButton(FontAwesomeIcon.Clipboard, "Copy this mod setting to clipboard."u8))
|
||||||
"Copy this mod setting to clipboard.", false, true))
|
|
||||||
_copy = [(mod, settings)];
|
_copy = [(mod, settings)];
|
||||||
|
|
||||||
ImGui.SameLine(0, spacing);
|
ImUtf8.SameLineInner();
|
||||||
ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.RedoAlt.ToIconString(), buttonSize,
|
ImUtf8.IconButton(FontAwesomeIcon.RedoAlt, "Update the settings of this mod association."u8);
|
||||||
"Update the settings of this mod association.", false, true);
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
var newSettings = penumbra.GetModSettings(mod);
|
var newSettings = penumbra.GetModSettings(mod);
|
||||||
|
|
@ -145,16 +143,16 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
||||||
updatedMod = (mod, newSettings);
|
updatedMod = (mod, newSettings);
|
||||||
|
|
||||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.PopupBorderSize, 2 * ImGuiHelpers.GlobalScale);
|
using var style = ImRaii.PushStyle(ImGuiStyleVar.PopupBorderSize, 2 * ImGuiHelpers.GlobalScale);
|
||||||
using var tt = ImRaii.Tooltip();
|
using var tt = ImUtf8.Tooltip();
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
var namesDifferent = mod.Name != mod.DirectoryName;
|
var namesDifferent = mod.Name != mod.DirectoryName;
|
||||||
ImGui.Dummy(new Vector2(300 * ImGuiHelpers.GlobalScale, 0));
|
ImGui.Dummy(new Vector2(300 * ImGuiHelpers.GlobalScale, 0));
|
||||||
using (ImRaii.Group())
|
using (ImRaii.Group())
|
||||||
{
|
{
|
||||||
if (namesDifferent)
|
if (namesDifferent)
|
||||||
ImGui.TextUnformatted("Directory Name");
|
ImUtf8.Text("Directory Name"u8);
|
||||||
ImGui.TextUnformatted("Enabled");
|
ImUtf8.Text("Enabled"u8);
|
||||||
ImGui.TextUnformatted("Priority");
|
ImUtf8.Text("Priority"u8);
|
||||||
ModCombo.DrawSettingsLeft(newSettings);
|
ModCombo.DrawSettingsLeft(newSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,27 +160,30 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
||||||
using (ImRaii.Group())
|
using (ImRaii.Group())
|
||||||
{
|
{
|
||||||
if (namesDifferent)
|
if (namesDifferent)
|
||||||
ImGui.TextUnformatted(mod.DirectoryName);
|
ImUtf8.Text(mod.DirectoryName);
|
||||||
ImGui.TextUnformatted(newSettings.Enabled.ToString());
|
|
||||||
ImGui.TextUnformatted(newSettings.Priority.ToString());
|
ImUtf8.Text(newSettings.Enabled.ToString());
|
||||||
|
ImUtf8.Text(newSettings.Priority.ToString());
|
||||||
ModCombo.DrawSettingsRight(newSettings);
|
ModCombo.DrawSettingsRight(newSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
if (ImGui.Selectable($"{mod.Name}##name"))
|
if (ImUtf8.Selectable($"{mod.Name}##name"))
|
||||||
penumbra.OpenModPage(mod);
|
penumbra.OpenModPage(mod);
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip($"Mod Directory: {mod.DirectoryName}\n\nClick to open mod page in Penumbra.");
|
ImGui.SetTooltip($"Mod Directory: {mod.DirectoryName}\n\nClick to open mod page in Penumbra.");
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
using (var font = ImRaii.PushFont(UiBuilder.IconFont))
|
var enabled = settings.Enabled;
|
||||||
{
|
if (TwoStateCheckbox.Instance.Draw("##Enabled"u8, ref enabled))
|
||||||
ImGuiUtil.Center((settings.Enabled ? FontAwesomeIcon.Check : FontAwesomeIcon.Times).ToIconString());
|
updatedMod = (mod, settings with { Enabled = enabled });
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGuiUtil.RightAlign(settings.Priority.ToString());
|
var priority = settings.Priority;
|
||||||
|
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
|
||||||
|
if (ImUtf8.InputScalarOnDeactivated("##Priority"u8, ref priority))
|
||||||
|
updatedMod = (mod, settings with { Priority = priority });
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
if (ImGuiUtil.DrawDisabledButton("Apply", new Vector2(ImGui.GetContentRegionAvail().X, 0), string.Empty,
|
if (ImGuiUtil.DrawDisabledButton("Apply", new Vector2(ImGui.GetContentRegionAvail().X, 0), string.Empty,
|
||||||
!penumbra.Available))
|
!penumbra.Available))
|
||||||
|
|
|
||||||
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3a14692e38708ca9f18652898e6f5c8cc87b517b
|
Subproject commit 51bab6dd1bd7d98cc468e8122f410e1c79e3c92d
|
||||||
Loading…
Add table
Add a link
Reference in a new issue