diff --git a/Config/Tree/BaseNode.cs b/Config/Tree/BaseNode.cs index 606cb4c..e793abd 100644 --- a/Config/Tree/BaseNode.cs +++ b/Config/Tree/BaseNode.cs @@ -226,7 +226,7 @@ namespace HSUI.Config.Tree } } - DrawExportResetContextMenu(selectionNode, selectionNode.Name); + DrawExportResetContextMenu(selectionNode, selectionNode.Name + "_section"); } // changelog button diff --git a/Config/Tree/Node.cs b/Config/Tree/Node.cs index f620ce4..c4ae40c 100644 --- a/Config/Tree/Node.cs +++ b/Config/Tree/Node.cs @@ -43,7 +43,7 @@ namespace HSUI.Config.Tree return; } - _nodeToReset = ImGuiHelper.DrawExportResetContextMenu(node, allowExport, allowReset); + _nodeToReset = ImGuiHelper.DrawExportResetContextMenu(node, allowExport, allowReset, name); _nodeToResetName = name; } diff --git a/Config/Tree/SectionNode.cs b/Config/Tree/SectionNode.cs index 0034f4b..4fed94f 100644 --- a/Config/Tree/SectionNode.cs +++ b/Config/Tree/SectionNode.cs @@ -70,7 +70,7 @@ namespace HSUI.Config.Tree } } - DrawExportResetContextMenu(subSectionNode, subSectionNode.Name); + DrawExportResetContextMenu(subSectionNode, Name + "_" + subSectionNode.Name + "_tab"); ImGui.BeginChild("subconfig value", new Vector2(0, 0), true); didReset |= subSectionNode.Draw(ref changed); diff --git a/Config/Tree/SubSectionNode.cs b/Config/Tree/SubSectionNode.cs index d3460e6..9fab6da 100644 --- a/Config/Tree/SubSectionNode.cs +++ b/Config/Tree/SubSectionNode.cs @@ -81,7 +81,7 @@ namespace HSUI.Config.Tree } } - DrawExportResetContextMenu(subSectionNode, subSectionNode.Name); + DrawExportResetContextMenu(subSectionNode, Name + "_" + subSectionNode.Name + "_nested"); ImGui.BeginChild("subconfig" + Depth + " value", new Vector2(0, ImGui.GetWindowHeight())); didReset |= subSectionNode.Draw(ref changed); diff --git a/HSUI.csproj b/HSUI.csproj index 24a8cbb..54214d3 100644 --- a/HSUI.csproj +++ b/HSUI.csproj @@ -9,9 +9,9 @@ HSUI - 1.0.1.0 - 1.0.1.0 - 1.0.1.0 + 1.0.2.0 + 1.0.2.0 + 1.0.2.0 diff --git a/HSUI.json b/HSUI.json index 37c8638..15b3e48 100644 --- a/HSUI.json +++ b/HSUI.json @@ -2,7 +2,7 @@ "Author": "Knack117", "Name": "HSUI", "InternalName": "HSUI", - "AssemblyVersion": "1.0.1.0", + "AssemblyVersion": "1.0.2.0", "Description": "HSUI provides a highly configurable HUD replacement for FFXIV, recreated from DelvUI using KamiToolKit, FFXIVClientStructs, and Dalamud. Features unit frames, castbars, job gauges, nameplates, party frames, status effects, enemy list, configurable hotbars with drag-and-drop, and profiles.", "ApplicableVersion": "any", "RepoUrl": "https://github.com/Knack117/HSUI", diff --git a/Helpers/ImGuiHelper.cs b/Helpers/ImGuiHelper.cs index cdc8ab5..93ddf70 100644 --- a/Helpers/ImGuiHelper.cs +++ b/Helpers/ImGuiHelper.cs @@ -47,11 +47,12 @@ namespace HSUI.Helpers ImGui.SameLine(); } - public static Node? DrawExportResetContextMenu(Node node, bool canExport, bool canReset) + public static Node? DrawExportResetContextMenu(Node node, bool canExport, bool canReset, string? uniqueId = null) { Node? nodeToReset = null; + string popupId = string.IsNullOrEmpty(uniqueId) ? "ResetContextMenu" : "ResetContextMenu_" + uniqueId; - if (ImGui.BeginPopupContextItem("ResetContextMenu")) + if (ImGui.BeginPopupContextItem(popupId)) { if (canExport && ImGui.Selectable("Export")) { diff --git a/Interface/GeneralElements/HotbarsConfig.cs b/Interface/GeneralElements/HotbarsConfig.cs index 6ab3f3b..eb76a3f 100644 --- a/Interface/GeneralElements/HotbarsConfig.cs +++ b/Interface/GeneralElements/HotbarsConfig.cs @@ -1,6 +1,7 @@ using HSUI.Config; using HSUI.Config.Attributes; using HSUI.Enums; +using HSUI.Helpers; using HSUI.Interface; using System.Numerics; using Dalamud.Bindings.ImGui; @@ -83,7 +84,7 @@ namespace HSUI.Interface.GeneralElements return config; } - protected static void ApplyDefaults(HotbarBarConfig config, int hotbarIndex) + public static void ApplyDefaults(HotbarBarConfig config, int hotbarIndex) { var viewport = ImGui.GetMainViewport().Size; float yOffset = 60 + (hotbarIndex - 1) * 50; @@ -106,7 +107,62 @@ namespace HSUI.Interface.GeneralElements [NestedConfig("Drag & Drop Options", 5, separator = true, collapseWith = null)] public HotbarsGeneralOptionsConfig GeneralOptions = new(); + [ManualDraw] + public bool DrawRestoreHotbarsButton(ref bool changed) + { + ImGuiHelper.DrawSeparator(2, 1); + if (ImGui.Button("Restore Hotbar Layout", new Vector2(200, 24))) + { + RestoreAllHotbarsToDefaults(); + changed = true; + return true; + } + if (ImGui.IsItemHovered()) + ImGui.SetTooltip("Reset positions and re-enable all hotbars. Use if your hotbars disappeared after an update."); + return false; + } + public new static HotbarsConfig DefaultConfig() => new HotbarsConfig(); + + private static void RestoreAllHotbarsToDefaults() + { + var cfg = ConfigurationManager.Instance; + if (cfg == null) return; + var bars = new (HotbarBarConfig config, int index)[] + { + (cfg.GetConfigObject(), 1), + (cfg.GetConfigObject(), 2), + (cfg.GetConfigObject(), 3), + (cfg.GetConfigObject(), 4), + (cfg.GetConfigObject(), 5), + (cfg.GetConfigObject(), 6), + (cfg.GetConfigObject(), 7), + (cfg.GetConfigObject(), 8), + (cfg.GetConfigObject(), 9), + (cfg.GetConfigObject(), 10) + }; + foreach (var (bar, idx) in bars) + { + if (bar == null) continue; + bar.Enabled = true; + HotbarBarConfig.ApplyDefaults(bar, idx); + } + var vis = cfg.GetConfigObject(); + if (vis != null) + { + var defaults = new VisibilityConfig(); + vis.HotbarConfig1.CopyFrom(defaults); + vis.HotbarConfig2.CopyFrom(defaults); + vis.HotbarConfig3.CopyFrom(defaults); + vis.HotbarConfig4.CopyFrom(defaults); + vis.HotbarConfig5.CopyFrom(defaults); + vis.HotbarConfig6.CopyFrom(defaults); + vis.HotbarConfig7.CopyFrom(defaults); + vis.HotbarConfig8.CopyFrom(defaults); + vis.HotbarConfig9.CopyFrom(defaults); + vis.HotbarConfig10.CopyFrom(defaults); + } + } } public enum ComboHighlightLineStyle diff --git a/Interface/HudHelper.cs b/Interface/HudHelper.cs index 5e8c3aa..5151472 100644 --- a/Interface/HudHelper.cs +++ b/Interface/HudHelper.cs @@ -263,6 +263,30 @@ namespace HSUI.Interface SetGameHudElementsHidden(hashesToHide.ToArray(), false); } + private static bool AnyHotbarEnabled() + { + var cfg = ConfigurationManager.Instance; + if (cfg == null) return true; + var bars = new HotbarBarConfig?[] + { + cfg.GetConfigObject(), + cfg.GetConfigObject(), + cfg.GetConfigObject(), + cfg.GetConfigObject(), + cfg.GetConfigObject(), + cfg.GetConfigObject(), + cfg.GetConfigObject(), + cfg.GetConfigObject(), + cfg.GetConfigObject(), + cfg.GetConfigObject() + }; + foreach (var bar in bars) + { + if (bar?.Enabled == true) return true; + } + return false; + } + /// Visibility (ByteValue2) of game HUD elements before we hid them. Restored on disable/unload. private readonly Dictionary _gameHudVisibilityBeforeHide = new(); diff --git a/changelog.md b/changelog.md index 609c5c2..4cefc8e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +# 1.0.2.0 +- **Hotbars**: Restore Hotbar Layout button (Hotbars → General) to recover hotbars after updates. Game hotbars shown as fallback when all HSUI hotbars disabled. +- **Config**: Fixed right-click Export/Reset context menu so it works on all sections and tabs (not just Unit Frames). + # 1.0.1.0 - **Combo highlight**: Configurable color, glow, line style (solid/dashed/dotted), and border thickness. - **Tooltips**: Font selection, scaling slider, improved text wrap and cramping. diff --git a/pluginmaster.json b/pluginmaster.json index d4a4c12..523902a 100644 --- a/pluginmaster.json +++ b/pluginmaster.json @@ -4,9 +4,9 @@ "Name": "HSUI", "Punchline": "A modern HUD replacement built for customization.", "Description": "HSUI provides a highly configurable HUD replacement for FFXIV, recreated from DelvUI using KamiToolKit, FFXIVClientStructs, and Dalamud. Features unit frames, castbars, job gauges, nameplates, party frames, status effects, enemy list, configurable hotbars with drag-and-drop, and profiles.", - "Changelog": "Combo highlight config (color, glow, line style). Tooltip font/scale. Nameplate quest icons, jitter fix. Hotbar keybind/empty slot fix.", + "Changelog": "Restore Hotbar Layout button. Fixed config right-click Export/Reset for all sections. Hotbar fallback when all disabled.", "InternalName": "HSUI", - "AssemblyVersion": "1.0.1.0", + "AssemblyVersion": "1.0.2.0", "RepoUrl": "https://github.com/Knack117/HSUI", "ApplicableVersion": "any", "Tags": ["UI", "HUD", "Unit Frames", "Nameplates", "Party Frames", "Hotbars"], @@ -14,10 +14,10 @@ "DalamudApiLevel": 14, "IconUrl": "https://raw.githubusercontent.com/Knack117/HSUI/main/Media/Images/icon.png", "ImageUrls": [], - "DownloadLinkInstall": "https://github.com/Knack117/HSUI/releases/download/v1.0.1.0/latest.zip", + "DownloadLinkInstall": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.0/latest.zip", "IsHide": false, "IsTestingExclusive": false, - "DownloadLinkTesting": "https://github.com/Knack117/HSUI/releases/download/v1.0.1.0/latest.zip", - "DownloadLinkUpdate": "https://github.com/Knack117/HSUI/releases/download/v1.0.1.0/latest.zip" + "DownloadLinkTesting": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.0/latest.zip", + "DownloadLinkUpdate": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.0/latest.zip" } ]