Improve vertical space for automated design sets.

This commit is contained in:
Ottermandias 2023-09-26 23:17:54 +02:00
parent ee34f37446
commit ad577c7005
2 changed files with 40 additions and 15 deletions

View file

@ -31,6 +31,7 @@ public class Configuration : IPluginConfiguration, ISavable
public byte DisableFestivals { get; set; } = 1; public byte DisableFestivals { get; set; } = 1;
public bool EnableGameContextMenu { get; set; } = true; public bool EnableGameContextMenu { get; set; } = true;
public bool HideWindowInCutscene { get; set; } = false; public bool HideWindowInCutscene { get; set; } = false;
public bool ShowAutomationSetEditing { get; set; } = true;
public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings; public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings;
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift); public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);

View file

@ -71,15 +71,20 @@ public class SetPanel
if (!child || !_selector.HasSelection) if (!child || !_selector.HasSelection)
return; return;
using (var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, var spacing = ImGui.GetStyle().ItemInnerSpacing with { Y = ImGui.GetStyle().ItemSpacing.Y };
ImGui.GetStyle().ItemInnerSpacing with { Y = ImGui.GetStyle().ItemSpacing.Y }))
using (var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
{ {
var enabled = Selection.Enabled; var enabled = Selection.Enabled;
if (ImGui.Checkbox("##Enabled", ref enabled)) if (ImGui.Checkbox("##Enabled", ref enabled))
_manager.SetState(_selector.SelectionIndex, enabled); _manager.SetState(_selector.SelectionIndex, enabled);
ImGuiUtil.LabeledHelpMarker("Enabled", ImGuiUtil.LabeledHelpMarker("Enabled",
"Whether the designs in this set should be applied at all. Only one set can be enabled for a character at the same time."); "Whether the designs in this set should be applied at all. Only one set can be enabled for a character at the same time.");
}
ImGui.SameLine();
using (var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
{
var useGame = _selector.Selection!.BaseState is AutoDesignSet.Base.Game; var useGame = _selector.Selection!.BaseState is AutoDesignSet.Base.Game;
if (ImGui.Checkbox("##gameState", ref useGame)) if (ImGui.Checkbox("##gameState", ref useGame))
_manager.ChangeBaseState(_selector.SelectionIndex, useGame ? AutoDesignSet.Base.Game : AutoDesignSet.Base.Current); _manager.ChangeBaseState(_selector.SelectionIndex, useGame ? AutoDesignSet.Base.Game : AutoDesignSet.Base.Current);
@ -88,22 +93,40 @@ public class SetPanel
+ "Otherwise, they will be applied on top of the characters actual current look using Glamourer."); + "Otherwise, they will be applied on top of the characters actual current look using Glamourer.");
} }
var name = _tempName ?? Selection.Name; ImGui.SameLine();
var flags = _selector.IncognitoMode ? ImGuiInputTextFlags.ReadOnly | ImGuiInputTextFlags.Password : ImGuiInputTextFlags.None; using (var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
ImGui.SetNextItemWidth(330 * ImGuiHelpers.GlobalScale);
if (ImGui.InputText("Rename Set##Name", ref name, 128, flags))
_tempName = name;
if (ImGui.IsItemDeactivated())
{ {
_manager.Rename(_selector.SelectionIndex, name); var editing = _config.ShowAutomationSetEditing;
_tempName = null; if (ImGui.Checkbox("##Show Editing", ref editing))
{
_config.ShowAutomationSetEditing = editing;
_config.Save();
}
ImGuiUtil.LabeledHelpMarker("Show Editing",
"Show options to change the name or the associated character or NPC of this design set.");
} }
ImGui.Dummy(Vector2.Zero); if (_showEditing)
ImGui.Separator(); {
ImGui.Dummy(Vector2.Zero); ImGui.Dummy(Vector2.Zero);
DrawIdentifierSelection(_selector.SelectionIndex); ImGui.Separator();
ImGui.Dummy(Vector2.Zero);
var name = _tempName ?? Selection.Name;
var flags = _selector.IncognitoMode ? ImGuiInputTextFlags.ReadOnly | ImGuiInputTextFlags.Password : ImGuiInputTextFlags.None;
ImGui.SetNextItemWidth(330 * ImGuiHelpers.GlobalScale);
if (ImGui.InputText("Rename Set##Name", ref name, 128, flags))
_tempName = name;
if (ImGui.IsItemDeactivated())
{
_manager.Rename(_selector.SelectionIndex, name);
_tempName = null;
}
DrawIdentifierSelection(_selector.SelectionIndex);
}
ImGui.Dummy(Vector2.Zero); ImGui.Dummy(Vector2.Zero);
ImGui.Separator(); ImGui.Separator();
@ -309,6 +332,7 @@ public class SetPanel
if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)AutoDesign.Type.All)) if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)AutoDesign.Type.All))
newType = (AutoDesign.Type)newTypeInt; newType = (AutoDesign.Type)newTypeInt;
} }
style.Pop(); style.Pop();
ImGuiUtil.HoverTooltip("Toggle all modes at once."); ImGuiUtil.HoverTooltip("Toggle all modes at once.");