Start for combining groups.

This commit is contained in:
Ottermandias 2025-01-10 15:42:23 +01:00
parent 9559bd7358
commit e77fa18c61
9 changed files with 468 additions and 26 deletions

View file

@ -452,19 +452,17 @@ public partial class ModEditWindow : Window, IDisposable, IUiService
private bool DrawOptionSelectHeader()
{
const string defaultOption = "Default Option";
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero).Push(ImGuiStyleVar.FrameRounding, 0);
var width = new Vector2(ImGui.GetContentRegionAvail().X / 3, 0);
var ret = false;
if (ImGuiUtil.DrawDisabledButton(defaultOption, width, "Switch to the default option for the mod.\nThis resets unsaved changes.",
_editor.Option is DefaultSubMod))
if (ImUtf8.ButtonEx("Default Option"u8, "Switch to the default option for the mod.\nThis resets unsaved changes."u8, width, _editor.Option is DefaultSubMod))
{
_editor.LoadOption(-1, 0).Wait();
ret = true;
}
ImGui.SameLine();
if (ImGuiUtil.DrawDisabledButton("Refresh Data", width, "Refresh data for the current option.\nThis resets unsaved changes.", false))
if (ImUtf8.ButtonEx("Refresh Data"u8, "Refresh data for the current option.\nThis resets unsaved changes."u8, width))
{
_editor.LoadMod(_editor.Mod!, _editor.GroupIdx, _editor.DataIdx).Wait();
ret = true;
@ -474,7 +472,7 @@ public partial class ModEditWindow : Window, IDisposable, IUiService
ImGui.SetNextItemWidth(width.X);
style.Push(ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale);
using var color = ImRaii.PushColor(ImGuiCol.Border, ColorId.FolderLine.Value());
using var combo = ImRaii.Combo("##optionSelector", _editor.Option!.GetFullName());
using var combo = ImUtf8.Combo("##optionSelector"u8, _editor.Option!.GetFullName());
if (!combo)
return ret;

View file

@ -48,6 +48,7 @@ public class AddGroupDrawer : IUiService
DrawSingleGroupButton(mod, buttonWidth);
ImUtf8.SameLineInner();
DrawMultiGroupButton(mod, buttonWidth);
DrawCombiningGroupButton(mod, buttonWidth);
}
private void DrawSingleGroupButton(Mod mod, Vector2 width)
@ -76,6 +77,18 @@ public class AddGroupDrawer : IUiService
_groupNameValid = false;
}
private void DrawCombiningGroupButton(Mod mod, Vector2 width)
{
if (!ImUtf8.ButtonEx("Add Combining Group"u8, _groupNameValid
? "Add a new combining option group to this mod."u8
: "Can not add a new group of this name."u8,
width, !_groupNameValid))
return;
_modManager.OptionEditor.AddModGroup(mod, GroupType.Combining, _groupName);
_groupName = string.Empty;
_groupNameValid = false;
}
private void DrawImcInput(float width)
{
var change = ImcMetaDrawer.DrawObjectType(ref _imcIdentifier, width);

View file

@ -0,0 +1,11 @@
using Penumbra.Mods.Groups;
namespace Penumbra.UI.ModsTab.Groups;
public readonly struct CombiningModGroupEditDrawer(ModGroupEditDrawer editor, CombiningModGroup group) : IModGroupEditDrawer
{
public void Draw()
{
}
}