Display relevant settings in Penumbra

This commit is contained in:
Exter-N 2025-11-13 20:09:26 +01:00
parent bf4673a1d9
commit 04fb37d661
4 changed files with 56 additions and 11 deletions

View file

@ -102,6 +102,8 @@ public class MainWindow : Window, IDisposable
SelectTab = _config.Ephemeral.SelectedTab; SelectTab = _config.Ephemeral.SelectedTab;
_event.Subscribe(OnTabSelected, TabSelected.Priority.MainWindow); _event.Subscribe(OnTabSelected, TabSelected.Priority.MainWindow);
IsOpen = _config.OpenWindowAtStart; IsOpen = _config.OpenWindowAtStart;
_penumbra.DrawSettingsSection += Settings.DrawPenumbraIntegrationSettings;
} }
public void OpenSettings() public void OpenSettings()
@ -120,7 +122,10 @@ public class MainWindow : Window, IDisposable
} }
public void Dispose() public void Dispose()
=> _event.Unsubscribe(OnTabSelected); {
_event.Unsubscribe(OnTabSelected);
_penumbra.DrawSettingsSection -= Settings.DrawPenumbraIntegrationSettings;
}
public override void Draw() public override void Draw()
{ {

View file

@ -9,6 +9,7 @@ using Glamourer.Designs;
using Glamourer.Gui.Tabs.DesignTab; using Glamourer.Gui.Tabs.DesignTab;
using Glamourer.Interop; using Glamourer.Interop;
using Glamourer.Interop.PalettePlus; using Glamourer.Interop.PalettePlus;
using Glamourer.Interop.Penumbra;
using Glamourer.Services; using Glamourer.Services;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
@ -69,6 +70,12 @@ public class SettingsTab(
MainWindow.DrawSupportButtons(glamourer, changelog.Changelog); MainWindow.DrawSupportButtons(glamourer, changelog.Changelog);
} }
public void DrawPenumbraIntegrationSettings()
{
DrawPenumbraIntegrationSettings1();
DrawPenumbraIntegrationSettings2();
}
private void DrawBehaviorSettings() private void DrawBehaviorSettings()
{ {
if (!ImUtf8.CollapsingHeader("Glamourer Behavior"u8)) if (!ImUtf8.CollapsingHeader("Glamourer Behavior"u8))
@ -89,6 +96,20 @@ public class SettingsTab(
Checkbox("Enable Festival Easter-Eggs"u8, Checkbox("Enable Festival Easter-Eggs"u8,
"Glamourer may do some fun things on specific dates. Disable this if you do not want your experience disrupted by this."u8, "Glamourer may do some fun things on specific dates. Disable this if you do not want your experience disrupted by this."u8,
config.DisableFestivals == 0, v => config.DisableFestivals = v ? (byte)0 : (byte)2); config.DisableFestivals == 0, v => config.DisableFestivals = v ? (byte)0 : (byte)2);
DrawPenumbraIntegrationSettings1();
Checkbox("Revert Manual Changes on Zone Change"u8,
"Restores the old behaviour of reverting your character to its game or automation base whenever you change the zone."u8,
config.RevertManualChangesOnZoneChange, v => config.RevertManualChangesOnZoneChange = v);
PaletteImportButton();
DrawPenumbraIntegrationSettings2();
Checkbox("Prevent Random Design Repeats"u8,
"When using random designs, prevent the same design from being chosen twice in a row."u8,
config.PreventRandomRepeats, v => config.PreventRandomRepeats = v);
ImGui.NewLine();
}
private void DrawPenumbraIntegrationSettings1()
{
Checkbox("Auto-Reload Gear"u8, Checkbox("Auto-Reload Gear"u8,
"Automatically reload equipment pieces on your own character when changing any mod options in Penumbra in their associated collection."u8, "Automatically reload equipment pieces on your own character when changing any mod options in Penumbra in their associated collection."u8,
config.AutoRedrawEquipOnChanges, v => config.AutoRedrawEquipOnChanges = v); config.AutoRedrawEquipOnChanges, v => config.AutoRedrawEquipOnChanges = v);
@ -101,10 +122,10 @@ public class SettingsTab(
pcpService.CleanPcpDesigns(); pcpService.CleanPcpDesigns();
if (!active) if (!active)
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"\nHold {config.DeleteDesignModifier} while clicking."); ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"\nHold {config.DeleteDesignModifier} while clicking.");
Checkbox("Revert Manual Changes on Zone Change"u8, }
"Restores the old behaviour of reverting your character to its game or automation base whenever you change the zone."u8,
config.RevertManualChangesOnZoneChange, v => config.RevertManualChangesOnZoneChange = v); private void DrawPenumbraIntegrationSettings2()
PaletteImportButton(); {
Checkbox("Always Apply Associated Mods"u8, Checkbox("Always Apply Associated Mods"u8,
"Whenever a design is applied to a character (including via automation), Glamourer will try to apply its associated mod settings to the collection currently associated with that character, if it is available.\n\n"u8 "Whenever a design is applied to a character (including via automation), Glamourer will try to apply its associated mod settings to the collection currently associated with that character, if it is available.\n\n"u8
+ "Glamourer will NOT revert these applied settings automatically. This may mess up your collection and configuration.\n\n"u8 + "Glamourer will NOT revert these applied settings automatically. This may mess up your collection and configuration.\n\n"u8
@ -114,10 +135,6 @@ public class SettingsTab(
"Apply all settings as temporary settings so they will be reset when Glamourer or the game shut down."u8, "Apply all settings as temporary settings so they will be reset when Glamourer or the game shut down."u8,
config.UseTemporarySettings, config.UseTemporarySettings,
v => config.UseTemporarySettings = v); v => config.UseTemporarySettings = v);
Checkbox("Prevent Random Design Repeats"u8,
"When using random designs, prevent the same design from being chosen twice in a row."u8,
config.PreventRandomRepeats, v => config.PreventRandomRepeats = v);
ImGui.NewLine();
} }
private void DrawDesignDefaultSettings() private void DrawDesignDefaultSettings()

View file

@ -1,5 +1,6 @@
using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Ipc.Exceptions;
using Glamourer.Events; using Glamourer.Events;
using Glamourer.State; using Glamourer.State;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
@ -36,7 +37,7 @@ public readonly record struct ModSettings(Dictionary<string, List<string>> Setti
public class PenumbraService : IDisposable public class PenumbraService : IDisposable
{ {
public const int RequiredPenumbraBreakingVersion = 5; public const int RequiredPenumbraBreakingVersion = 5;
public const int RequiredPenumbraFeatureVersion = 8; public const int RequiredPenumbraFeatureVersion = 13;
private const int KeyFixed = -1610; private const int KeyFixed = -1610;
private const string NameFixed = "Glamourer (Automation)"; private const string NameFixed = "Glamourer (Automation)";
@ -77,6 +78,8 @@ public class PenumbraService : IDisposable
private global::Penumbra.Api.IpcSubscribers.QueryTemporaryModSettingsPlayer? _queryTemporaryModSettingsPlayer; private global::Penumbra.Api.IpcSubscribers.QueryTemporaryModSettingsPlayer? _queryTemporaryModSettingsPlayer;
private global::Penumbra.Api.IpcSubscribers.OpenMainWindow? _openModPage; private global::Penumbra.Api.IpcSubscribers.OpenMainWindow? _openModPage;
private global::Penumbra.Api.IpcSubscribers.GetChangedItems? _getChangedItems; private global::Penumbra.Api.IpcSubscribers.GetChangedItems? _getChangedItems;
private global::Penumbra.Api.IpcSubscribers.RegisterSettingsSection? _registerSettingsSection;
private global::Penumbra.Api.IpcSubscribers.UnregisterSettingsSection? _unregisterSettingsSection;
private IReadOnlyList<(string ModDirectory, IReadOnlyDictionary<string, object?> ChangedItems)>? _changedItems; private IReadOnlyList<(string ModDirectory, IReadOnlyDictionary<string, object?> ChangedItems)>? _changedItems;
private Func<string, (string ModDirectory, string ModName)[]>? _checkCurrentChangedItems; private Func<string, (string ModDirectory, string ModName)[]>? _checkCurrentChangedItems;
private Func<int, int>? _checkCutsceneParent; private Func<int, int>? _checkCutsceneParent;
@ -152,6 +155,11 @@ public class PenumbraService : IDisposable
remove => _pcpParsed.Event -= value; remove => _pcpParsed.Event -= value;
} }
public event Action? DrawSettingsSection;
private void InvokeDrawSettingsSection()
=> DrawSettingsSection?.Invoke();
public Dictionary<Guid, string> GetCollections() public Dictionary<Guid, string> GetCollections()
=> Available ? _collections!.Invoke() : []; => Available ? _collections!.Invoke() : [];
@ -565,6 +573,10 @@ public class PenumbraService : IDisposable
_changedItems = new global::Penumbra.Api.IpcSubscribers.GetChangedItemAdapterList(_pluginInterface).Invoke(); _changedItems = new global::Penumbra.Api.IpcSubscribers.GetChangedItemAdapterList(_pluginInterface).Invoke();
_checkCurrentChangedItems = _checkCurrentChangedItems =
new global::Penumbra.Api.IpcSubscribers.CheckCurrentChangedItemFunc(_pluginInterface).Invoke(); new global::Penumbra.Api.IpcSubscribers.CheckCurrentChangedItemFunc(_pluginInterface).Invoke();
_registerSettingsSection = new global::Penumbra.Api.IpcSubscribers.RegisterSettingsSection(_pluginInterface);
_unregisterSettingsSection = new global::Penumbra.Api.IpcSubscribers.UnregisterSettingsSection(_pluginInterface);
_registerSettingsSection.Invoke(InvokeDrawSettingsSection);
Available = true; Available = true;
_penumbraReloaded.Invoke(); _penumbraReloaded.Invoke();
@ -587,6 +599,15 @@ public class PenumbraService : IDisposable
_modSettingChanged.Disable(); _modSettingChanged.Disable();
_pcpCreated.Disable(); _pcpCreated.Disable();
_pcpParsed.Disable(); _pcpParsed.Disable();
try
{
_unregisterSettingsSection?.Invoke(InvokeDrawSettingsSection);
}
catch (IpcNotReadyError)
{
// Ignore.
}
if (Available) if (Available)
{ {
_collectionByIdentifier = null; _collectionByIdentifier = null;
@ -617,6 +638,8 @@ public class PenumbraService : IDisposable
_getChangedItems = null; _getChangedItems = null;
_changedItems = null; _changedItems = null;
_checkCurrentChangedItems = null; _checkCurrentChangedItems = null;
_registerSettingsSection = null;
_unregisterSettingsSection = null;
Available = false; Available = false;
Glamourer.Log.Debug("Glamourer detached from Penumbra."); Glamourer.Log.Debug("Glamourer detached from Penumbra.");
} }

@ -1 +1 @@
Subproject commit c23ee05c1e9fa103eaa52e6aa7e855ef568ee669 Subproject commit b97784bd7cd911bd0a323cd8e717714de1875469