mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Make all panels configurable.
This commit is contained in:
parent
c96f009fb4
commit
6e685b96d1
11 changed files with 176 additions and 25 deletions
|
|
@ -66,6 +66,9 @@ public class Configuration : IPluginConfiguration, ISavable
|
|||
public bool AllowDoubleClickToApply { get; set; } = false;
|
||||
public bool RespectManualOnAutomationUpdate { get; set; } = false;
|
||||
|
||||
public DesignPanelFlag HideDesignPanel { get; set; } = 0;
|
||||
public DesignPanelFlag AutoExpandDesignPanel { get; set; } = 0;
|
||||
|
||||
public DefaultDesignSettings DefaultDesignSettings { get; set; } = new();
|
||||
|
||||
public HeightDisplayType HeightDisplayType { get; set; } = HeightDisplayType.Centimetre;
|
||||
|
|
|
|||
96
Glamourer/DesignPanelFlag.cs
Normal file
96
Glamourer/DesignPanelFlag.cs
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
using Glamourer.Designs;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Text;
|
||||
using OtterGui.Text.EndObjects;
|
||||
|
||||
namespace Glamourer;
|
||||
|
||||
[Flags]
|
||||
public enum DesignPanelFlag : uint
|
||||
{
|
||||
Customization = 0x0001,
|
||||
Equipment = 0x0002,
|
||||
AdvancedCustomizations = 0x0004,
|
||||
AdvancedDyes = 0x0008,
|
||||
AppearanceDetails = 0x0010,
|
||||
DesignDetails = 0x0020,
|
||||
ModAssociations = 0x0040,
|
||||
DesignLinks = 0x0080,
|
||||
ApplicationRules = 0x0100,
|
||||
DebugData = 0x0200,
|
||||
}
|
||||
|
||||
public static class DesignPanelFlagExtensions
|
||||
{
|
||||
public static ReadOnlySpan<byte> ToName(this DesignPanelFlag flag)
|
||||
=> flag switch
|
||||
{
|
||||
DesignPanelFlag.Customization => "Customization"u8,
|
||||
DesignPanelFlag.Equipment => "Equipment"u8,
|
||||
DesignPanelFlag.AdvancedCustomizations => "Advanced Customization"u8,
|
||||
DesignPanelFlag.AdvancedDyes => "Advanced Dyes"u8,
|
||||
DesignPanelFlag.DesignDetails => "Design Details"u8,
|
||||
DesignPanelFlag.ApplicationRules => "Application Rules"u8,
|
||||
DesignPanelFlag.ModAssociations => "Mod Associations"u8,
|
||||
DesignPanelFlag.DesignLinks => "Design Links"u8,
|
||||
DesignPanelFlag.DebugData => "Debug Data"u8,
|
||||
DesignPanelFlag.AppearanceDetails => "Appearance Details"u8,
|
||||
_ => ""u8,
|
||||
};
|
||||
|
||||
public static CollapsingHeader Header(this DesignPanelFlag flag, Configuration config)
|
||||
{
|
||||
if (config.HideDesignPanel.HasFlag(flag))
|
||||
return new CollapsingHeader()
|
||||
{
|
||||
Disposed = true,
|
||||
};
|
||||
|
||||
var expand = config.AutoExpandDesignPanel.HasFlag(flag);
|
||||
return ImUtf8.CollapsingHeaderId(flag.ToName(), expand ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None);
|
||||
}
|
||||
|
||||
public static void DrawTable(ReadOnlySpan<byte> label, DesignPanelFlag hidden, DesignPanelFlag expanded, Action<DesignPanelFlag> setterHide,
|
||||
Action<DesignPanelFlag> setterExpand)
|
||||
{
|
||||
var checkBoxWidth = Math.Max(ImGui.GetFrameHeight(), ImUtf8.CalcTextSize("Expand"u8).X);
|
||||
var textWidth = ImUtf8.CalcTextSize(DesignPanelFlag.AdvancedCustomizations.ToName()).X;
|
||||
var tableSize = 2 * (textWidth + 2 * checkBoxWidth) + 10 * ImGui.GetStyle().CellPadding.X + 2 * ImGui.GetStyle().WindowPadding.X + 2 * ImGui.GetStyle().FrameBorderSize;
|
||||
using var table = ImUtf8.Table(label, 6, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.Borders, new Vector2(tableSize, 6 * ImGui.GetFrameHeight()));
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
var headerColor = ImGui.GetColorU32(ImGuiCol.TableHeaderBg);
|
||||
var checkBoxOffset = (checkBoxWidth - ImGui.GetFrameHeight()) / 2;
|
||||
ImUtf8.TableSetupColumn("Panel##1"u8, ImGuiTableColumnFlags.WidthFixed, textWidth);
|
||||
ImUtf8.TableSetupColumn("Show##1"u8, ImGuiTableColumnFlags.WidthFixed, checkBoxWidth);
|
||||
ImUtf8.TableSetupColumn("Expand##1"u8, ImGuiTableColumnFlags.WidthFixed, checkBoxWidth);
|
||||
ImUtf8.TableSetupColumn("Panel##2"u8, ImGuiTableColumnFlags.WidthFixed, textWidth);
|
||||
ImUtf8.TableSetupColumn("Show##2"u8, ImGuiTableColumnFlags.WidthFixed, checkBoxWidth);
|
||||
ImUtf8.TableSetupColumn("Expand##2"u8, ImGuiTableColumnFlags.WidthFixed, checkBoxWidth);
|
||||
|
||||
ImGui.TableHeadersRow();
|
||||
foreach (var panel in Enum.GetValues<DesignPanelFlag>())
|
||||
{
|
||||
using var id = ImUtf8.PushId((int)panel);
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, headerColor);
|
||||
ImUtf8.TextFrameAligned(panel.ToName());
|
||||
var isShown = !hidden.HasFlag(panel);
|
||||
var isExpanded = expanded.HasFlag(panel);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + checkBoxOffset);
|
||||
if (ImUtf8.Checkbox("##show"u8, ref isShown))
|
||||
setterHide.Invoke(isShown ? hidden & ~panel : hidden | panel);
|
||||
ImUtf8.HoverTooltip(
|
||||
"Show this panel and associated functionality in all relevant tabs.\n\nToggling this off does NOT disable any functionality, just the display of it, so hide panels at your own risk."u8);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + checkBoxOffset);
|
||||
if (ImUtf8.Checkbox("##expand"u8, ref isExpanded))
|
||||
setterExpand.Invoke(isExpanded ? expanded | panel : expanded & ~panel);
|
||||
ImUtf8.HoverTooltip("Expand this panel by default in all relevant tabs."u8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -71,6 +71,7 @@ public class Glamourer : IDalamudPlugin
|
|||
sb.Append($"> **`Festival Easter-Eggs: `** {config.DisableFestivals}\n");
|
||||
sb.Append($"> **`Apply Entire Weapon: `** {config.ChangeEntireItem}\n");
|
||||
sb.Append($"> **`Apply Associated Mods:`** {config.AlwaysApplyAssociatedMods}\n");
|
||||
sb.Append($"> **`Hidden Panels: `** {config.HideDesignPanel}\n");
|
||||
sb.Append($"> **`Show QDB: `** {config.Ephemeral.ShowDesignQuickBar}\n");
|
||||
sb.Append($"> **`QDB Hotkey: `** {config.ToggleQuickDesignBar}\n");
|
||||
sb.Append($"> **`Smaller Equip Display:`** {config.SmallEquip}\n");
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ public sealed unsafe class AdvancedDyePopup(
|
|||
|
||||
private void DrawButton(MaterialValueIndex index, uint color)
|
||||
{
|
||||
if (config.HideDesignPanel.HasFlag(DesignPanelFlag.AdvancedDyes))
|
||||
return;
|
||||
|
||||
ImGui.SameLine();
|
||||
using var id = ImUtf8.PushId(index.SlotIndex | ((int)index.DrawObject << 8));
|
||||
var isOpen = index == _drawIndex;
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ public class ActorPanel
|
|||
using var table = ImUtf8.Table("##Panel", 1, ImGuiTableFlags.BordersOuter | ImGuiTableFlags.ScrollY, ImGui.GetContentRegionAvail());
|
||||
if (!table || !_selector.HasSelection || !_stateManager.GetOrCreate(_identifier, _actor, out _state))
|
||||
return;
|
||||
|
||||
ImGui.TableSetupScrollFreeze(0, 1);
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
|
|
@ -191,10 +192,14 @@ public class ActorPanel
|
|||
|
||||
private void DrawCustomizationsHeader()
|
||||
{
|
||||
if (_config.HideDesignPanel.HasFlag(DesignPanelFlag.Customization))
|
||||
return;
|
||||
|
||||
var header = _state!.ModelData.ModelId == 0
|
||||
? "Customization"
|
||||
: $"Customization (Model Id #{_state.ModelData.ModelId})###Customization";
|
||||
using var h = ImUtf8.CollapsingHeaderId(header);
|
||||
var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization);
|
||||
using var h = ImUtf8.CollapsingHeaderId(header, expand ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -207,7 +212,7 @@ public class ActorPanel
|
|||
|
||||
private void DrawEquipmentHeader()
|
||||
{
|
||||
using var h = ImUtf8.CollapsingHeaderId("Equipment"u8);
|
||||
using var h = DesignPanelFlag.Equipment.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -239,7 +244,7 @@ public class ActorPanel
|
|||
|
||||
private void DrawParameterHeader()
|
||||
{
|
||||
using var h = ImUtf8.CollapsingHeaderId("Advanced Customizations"u8);
|
||||
using var h = DesignPanelFlag.AdvancedCustomizations.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -251,7 +256,7 @@ public class ActorPanel
|
|||
if (!_config.DebugMode)
|
||||
return;
|
||||
|
||||
using var h = ImUtf8.CollapsingHeaderId("Debug Data"u8);
|
||||
using var h = DesignPanelFlag.DebugData.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace Glamourer.Gui.Tabs.DesignTab;
|
|||
public class DesignDetailTab
|
||||
{
|
||||
private readonly SaveService _saveService;
|
||||
private readonly Configuration _config;
|
||||
private readonly DesignFileSystemSelector _selector;
|
||||
private readonly DesignFileSystem _fileSystem;
|
||||
private readonly DesignManager _manager;
|
||||
|
|
@ -30,19 +31,20 @@ public class DesignDetailTab
|
|||
private DesignFileSystem.Leaf? _changeLeaf;
|
||||
|
||||
public DesignDetailTab(SaveService saveService, DesignFileSystemSelector selector, DesignManager manager, DesignFileSystem fileSystem,
|
||||
DesignColors colors)
|
||||
DesignColors colors, Configuration config)
|
||||
{
|
||||
_saveService = saveService;
|
||||
_selector = selector;
|
||||
_manager = manager;
|
||||
_fileSystem = fileSystem;
|
||||
_colors = colors;
|
||||
_config = config;
|
||||
_colorCombo = new DesignColorCombo(_colors, false);
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
using var h = ImUtf8.CollapsingHeaderId("Design Details"u8);
|
||||
using var h = DesignPanelFlag.DesignDetails.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -159,7 +161,8 @@ public class DesignDetailTab
|
|||
ImGui.TableNextColumn();
|
||||
if (ImUtf8.Checkbox("##ResetTemporarySettings"u8, ref resetTemporarySettings))
|
||||
_manager.ChangeResetTemporarySettings(_selector.Selected!, resetTemporarySettings);
|
||||
ImUtf8.HoverTooltip("Set this design to reset any temporary settings previously applied to the associated collection when it is applied through any means."u8);
|
||||
ImUtf8.HoverTooltip(
|
||||
"Set this design to reset any temporary settings previously applied to the associated collection when it is applied through any means."u8);
|
||||
|
||||
ImUtf8.DrawFrameColumn("Color"u8);
|
||||
var colorName = _selector.Selected!.Color.Length == 0 ? DesignColors.AutomaticName : _selector.Selected!.Color;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,12 @@ using OtterGui.Services;
|
|||
|
||||
namespace Glamourer.Gui.Tabs.DesignTab;
|
||||
|
||||
public class DesignLinkDrawer(DesignLinkManager _linkManager, DesignFileSystemSelector _selector, LinkDesignCombo _combo, DesignColors _colorManager) : IUiService
|
||||
public class DesignLinkDrawer(
|
||||
DesignLinkManager _linkManager,
|
||||
DesignFileSystemSelector _selector,
|
||||
LinkDesignCombo _combo,
|
||||
DesignColors _colorManager,
|
||||
Configuration config) : IUiService
|
||||
{
|
||||
private int _dragDropIndex = -1;
|
||||
private LinkOrder _dragDropOrder = LinkOrder.None;
|
||||
|
|
@ -19,12 +24,15 @@ public class DesignLinkDrawer(DesignLinkManager _linkManager, DesignFileSystemSe
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
using var header = ImRaii.CollapsingHeader("Design Links");
|
||||
using var h = DesignPanelFlag.DesignLinks.Header(config);
|
||||
if (h.Disposed)
|
||||
return;
|
||||
|
||||
ImGuiUtil.HoverTooltip(
|
||||
"Design links are links to other designs that will be applied to characters or during automation according to the rules set.\n"
|
||||
+ "They apply from top to bottom just like automated design sets, so anything set by an earlier design will not not be set again by later designs, and order is important.\n"
|
||||
+ "If a linked design links to other designs, they will also be applied, so circular links are prohibited. ");
|
||||
if (!header)
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
DrawList();
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class DesignPanel
|
|||
|
||||
private void DrawEquipment()
|
||||
{
|
||||
using var h = ImRaii.CollapsingHeader("Equipment");
|
||||
using var h = DesignPanelFlag.Equipment.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -156,10 +156,14 @@ public class DesignPanel
|
|||
|
||||
private void DrawCustomize()
|
||||
{
|
||||
if (_config.HideDesignPanel.HasFlag(DesignPanelFlag.Customization))
|
||||
return;
|
||||
|
||||
var header = _selector.Selected!.DesignData.ModelId == 0
|
||||
? "Customization"
|
||||
: $"Customization (Model Id #{_selector.Selected!.DesignData.ModelId})###Customization";
|
||||
using var h = ImRaii.CollapsingHeader(header);
|
||||
var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization);
|
||||
using var h = ImUtf8.CollapsingHeaderId(header, expand ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -180,7 +184,7 @@ public class DesignPanel
|
|||
|
||||
private void DrawCustomizeParameters()
|
||||
{
|
||||
using var h = ImUtf8.CollapsingHeaderId("Advanced Customizations"u8);
|
||||
using var h = DesignPanelFlag.AdvancedCustomizations.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -189,7 +193,7 @@ public class DesignPanel
|
|||
|
||||
private void DrawMaterialValues()
|
||||
{
|
||||
using var h = ImUtf8.CollapsingHeaderId("Advanced Dyes"u8);
|
||||
using var h = DesignPanelFlag.AdvancedDyes.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -244,7 +248,7 @@ public class DesignPanel
|
|||
|
||||
private void DrawApplicationRules()
|
||||
{
|
||||
using var h = ImUtf8.CollapsingHeaderId("Application Rules"u8);
|
||||
using var h = DesignPanelFlag.ApplicationRules.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
using var h = ImRaii.CollapsingHeader("Mod Associations");
|
||||
using var h = DesignPanelFlag.ModAssociations.Header(config);
|
||||
if (h.Disposed)
|
||||
return;
|
||||
|
||||
ImGuiUtil.HoverTooltip(
|
||||
"This tab can store information about specific mods associated with this design.\n\n"
|
||||
+ "It does NOT change any mod settings automatically, though there is functionality to apply desired mod settings manually.\n"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ namespace Glamourer.Gui.Tabs.NpcTab;
|
|||
|
||||
public class NpcPanel
|
||||
{
|
||||
private readonly Configuration _config;
|
||||
private readonly DesignColorCombo _colorCombo;
|
||||
private string _newName = string.Empty;
|
||||
private DesignBase? _newDesign;
|
||||
|
|
@ -42,7 +43,8 @@ public class NpcPanel
|
|||
DesignManager designManager,
|
||||
StateManager state,
|
||||
ObjectManager objects,
|
||||
DesignColors colors)
|
||||
DesignColors colors,
|
||||
Configuration config)
|
||||
{
|
||||
_selector = selector;
|
||||
_favorites = favorites;
|
||||
|
|
@ -53,6 +55,7 @@ public class NpcPanel
|
|||
_state = state;
|
||||
_objects = objects;
|
||||
_colors = colors;
|
||||
_config = config;
|
||||
_colorCombo = new DesignColorCombo(colors, true);
|
||||
_leftButtons =
|
||||
[
|
||||
|
|
@ -139,9 +142,14 @@ public class NpcPanel
|
|||
|
||||
private void DrawCustomization()
|
||||
{
|
||||
using var h = _selector.Selection.ModelId == 0
|
||||
? ImUtf8.CollapsingHeaderId("Customization"u8)
|
||||
: ImUtf8.CollapsingHeaderId($"Customization (Model Id #{_selector.Selection.ModelId})###Customization");
|
||||
if (_config.HideDesignPanel.HasFlag(DesignPanelFlag.Customization))
|
||||
return;
|
||||
|
||||
var header = _selector.Selection.ModelId == 0
|
||||
? "Customization"
|
||||
: $"Customization (Model Id #{_selector.Selection.ModelId})###Customization";
|
||||
var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization);
|
||||
using var h = ImUtf8.CollapsingHeaderId(header, expand ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -151,7 +159,7 @@ public class NpcPanel
|
|||
|
||||
private void DrawEquipment()
|
||||
{
|
||||
using var h = ImUtf8.CollapsingHeaderId("Equipment"u8);
|
||||
using var h = DesignPanelFlag.Equipment.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -190,7 +198,9 @@ public class NpcPanel
|
|||
private void DrawApplyToSelf()
|
||||
{
|
||||
var (id, data) = _objects.PlayerData;
|
||||
if (!ImUtf8.ButtonEx("Apply to Yourself"u8, "Apply the current NPC appearance to your character.\nHold Control to only apply gear.\nHold Shift to only apply customizations."u8, Vector2.Zero, !data.Valid))
|
||||
if (!ImUtf8.ButtonEx("Apply to Yourself"u8,
|
||||
"Apply the current NPC appearance to your character.\nHold Control to only apply gear.\nHold Shift to only apply customizations."u8,
|
||||
Vector2.Zero, !data.Valid))
|
||||
return;
|
||||
|
||||
if (_state.GetOrCreate(id, data.Objects[0], out var state))
|
||||
|
|
@ -221,7 +231,7 @@ public class NpcPanel
|
|||
|
||||
private void DrawAppearanceInfo()
|
||||
{
|
||||
using var h = ImUtf8.CollapsingHeaderId("Appearance Details"u8);
|
||||
using var h = DesignPanelFlag.AppearanceDetails.Header(_config);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ public class SettingsTab(
|
|||
100 * ImGuiHelpers.GlobalScale,
|
||||
config.ToggleQuickDesignBar, v => config.ToggleQuickDesignBar = v, _validKeys))
|
||||
config.Save();
|
||||
|
||||
Checkbox("Show Quick Design Bar in Main Window"u8,
|
||||
"Show the quick design bar in the tab selection part of the main window, too."u8,
|
||||
config.ShowQuickBarInTabs, v => config.ShowQuickBarInTabs = v);
|
||||
|
|
@ -193,6 +194,20 @@ public class SettingsTab(
|
|||
v => config.OpenFoldersByDefault = v);
|
||||
DrawFolderSortType();
|
||||
|
||||
ImGui.NewLine();
|
||||
ImUtf8.Text("Show the following panels in their respective tabs:"u8);
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
DesignPanelFlagExtensions.DrawTable("##panelTable"u8, config.HideDesignPanel, config.AutoExpandDesignPanel, v =>
|
||||
{
|
||||
config.HideDesignPanel = v;
|
||||
config.Save();
|
||||
}, v =>
|
||||
{
|
||||
config.AutoExpandDesignPanel = v;
|
||||
config.Save();
|
||||
});
|
||||
|
||||
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
ImGui.Separator();
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue