diff --git a/Glamourer/Api/StateApi.cs b/Glamourer/Api/StateApi.cs index b2fdc9b..c27abb7 100644 --- a/Glamourer/Api/StateApi.cs +++ b/Glamourer/Api/StateApi.cs @@ -314,7 +314,7 @@ public sealed class StateApi : IGlamourerApiState, IApiService, IDisposable if (!state.CanUnlock(key)) return (GlamourerApiEc.InvalidKey, null); - return (GlamourerApiEc.Success, _converter.ShareJObject(state, ApplicationRules.AllWithConfig(_config))); + return (GlamourerApiEc.Success, _converter.ShareJObject(state, ApplicationRules.All)); } private (GlamourerApiEc, string?) ConvertBase64(ActorState? state, uint key) diff --git a/Glamourer/Configuration.cs b/Glamourer/Configuration.cs index 4b59191..019bb2b 100644 --- a/Glamourer/Configuration.cs +++ b/Glamourer/Configuration.cs @@ -55,8 +55,6 @@ public class Configuration : IPluginConfiguration, ISavable public bool ShowQuickBarInTabs { get; set; } = true; public bool OpenWindowAtStart { get; set; } = false; public bool ShowWindowWhenUiHidden { get; set; } = false; - public bool UseAdvancedParameters { get; set; } = true; - public bool UseAdvancedDyes { get; set; } = true; public bool KeepAdvancedDyesAttached { get; set; } = true; public bool ShowPalettePlusImport { get; set; } = true; public bool UseFloatForColors { get; set; } = true; diff --git a/Glamourer/Designs/ApplicationRules.cs b/Glamourer/Designs/ApplicationRules.cs index 703a3ae..0df4feb 100644 --- a/Glamourer/Designs/ApplicationRules.cs +++ b/Glamourer/Designs/ApplicationRules.cs @@ -19,9 +19,6 @@ public readonly struct ApplicationRules(ApplicationCollection application, bool public static ApplicationRules AllButParameters(ActorState state) => new(ApplicationCollection.All with { Parameters = ComputeParameters(state.ModelData, state.BaseData, All.Parameters) }, true); - public static ApplicationRules AllWithConfig(Configuration config) - => new(ApplicationCollection.All with { Parameters = config.UseAdvancedParameters ? All.Parameters : 0 }, config.UseAdvancedDyes); - public static ApplicationRules NpcFromModifiers(bool ctrl, bool shift) { var equip = ctrl || !shift ? EquipFlagExtensions.All : 0; diff --git a/Glamourer/Glamourer.cs b/Glamourer/Glamourer.cs index cf0b278..5d38e3a 100644 --- a/Glamourer/Glamourer.cs +++ b/Glamourer/Glamourer.cs @@ -69,8 +69,6 @@ public class Glamourer : IDalamudPlugin sb.Append($"> **`Auto-Reload Gear: `** {config.AutoRedrawEquipOnChanges}\n"); sb.Append($"> **`Revert on Zone Change:`** {config.RevertManualChangesOnZoneChange}\n"); sb.Append($"> **`Festival Easter-Eggs: `** {config.DisableFestivals}\n"); - sb.Append($"> **`Advanced Customize: `** {config.UseAdvancedParameters}\n"); - sb.Append($"> **`Advanced Dye: `** {config.UseAdvancedDyes}\n"); sb.Append($"> **`Apply Entire Weapon: `** {config.ChangeEntireItem}\n"); sb.Append($"> **`Apply Associated Mods:`** {config.AlwaysApplyAssociatedMods}\n"); sb.Append($"> **`Show QDB: `** {config.Ephemeral.ShowDesignQuickBar}\n"); diff --git a/Glamourer/Gui/DesignQuickBar.cs b/Glamourer/Gui/DesignQuickBar.cs index b125b37..cabd888 100644 --- a/Glamourer/Gui/DesignQuickBar.cs +++ b/Glamourer/Gui/DesignQuickBar.cs @@ -11,7 +11,6 @@ using Glamourer.Interop.Penumbra; using Glamourer.Interop.Structs; using Glamourer.State; using ImGuiNET; -using OtterGui; using OtterGui.Classes; using OtterGui.Text; using Penumbra.GameData.Actors; @@ -304,9 +303,6 @@ public sealed class DesignQuickBar : Window, IDisposable private void DrawRevertAdvancedCustomization(Vector2 buttonSize) { - if (!_config.UseAdvancedParameters) - return; - if (!_config.QdbButtons.HasFlag(QdbButtons.RevertAdvanced)) return; @@ -475,7 +471,7 @@ public sealed class DesignQuickBar : Window, IDisposable ++_numButtons; } - if ((_config.UseAdvancedParameters || _config.UseAdvancedDyes) && _config.QdbButtons.HasFlag(QdbButtons.RevertAdvanced)) + if (_config.QdbButtons.HasFlag(QdbButtons.RevertAdvanced)) ++_numButtons; if (_config.QdbButtons.HasFlag(QdbButtons.RevertCustomize)) ++_numButtons; diff --git a/Glamourer/Gui/Materials/AdvancedDyePopup.cs b/Glamourer/Gui/Materials/AdvancedDyePopup.cs index d6d7420..6d0bb70 100644 --- a/Glamourer/Gui/Materials/AdvancedDyePopup.cs +++ b/Glamourer/Gui/Materials/AdvancedDyePopup.cs @@ -38,9 +38,6 @@ public sealed unsafe class AdvancedDyePopup( private bool ShouldBeDrawn() { - if (!config.UseAdvancedDyes) - return false; - if (_drawIndex is not { Valid: true }) return false; @@ -58,9 +55,6 @@ public sealed unsafe class AdvancedDyePopup( private void DrawButton(MaterialValueIndex index, uint color) { - if (!config.UseAdvancedDyes) - return; - ImGui.SameLine(); using var id = ImUtf8.PushId(index.SlotIndex | ((int)index.DrawObject << 8)); var isOpen = index == _drawIndex; diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs index 9c8f3cf..e56266d 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs @@ -239,9 +239,6 @@ public class ActorPanel private void DrawParameterHeader() { - if (!_config.UseAdvancedParameters) - return; - using var h = ImUtf8.CollapsingHeaderId("Advanced Customizations"u8); if (!h) return; diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs b/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs index 748afea..554e671 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs @@ -180,10 +180,7 @@ public class DesignPanel private void DrawCustomizeParameters() { - if (!_config.UseAdvancedParameters) - return; - - using var h = ImRaii.CollapsingHeader("Advanced Customizations"); + using var h = ImUtf8.CollapsingHeaderId("Advanced Customizations"u8); if (!h) return; @@ -192,10 +189,7 @@ public class DesignPanel private void DrawMaterialValues() { - if (!_config.UseAdvancedDyes) - return; - - using var h = ImRaii.CollapsingHeader("Advanced Dyes"); + using var h = ImUtf8.CollapsingHeaderId("Advanced Dyes"u8); if (!h) return; @@ -204,7 +198,7 @@ public class DesignPanel private void DrawCustomizeApplication() { - using var id = ImRaii.PushId("Customizations"); + using var id = ImUtf8.PushId("Customizations"u8); var set = _selector.Selected!.CustomizeSet; var available = set.SettingAvailable | CustomizeFlag.Clan | CustomizeFlag.Gender | CustomizeFlag.BodyType; var flags = _selector.Selected!.ApplyCustomizeExcludingBodyType == 0 ? 0 : @@ -219,55 +213,52 @@ public class DesignPanel } var applyClan = _selector.Selected!.DoApplyCustomize(CustomizeIndex.Clan); - if (ImGui.Checkbox($"Apply {CustomizeIndex.Clan.ToDefaultName()}", ref applyClan)) + if (ImUtf8.Checkbox($"Apply {CustomizeIndex.Clan.ToDefaultName()}", ref applyClan)) _manager.ChangeApplyCustomize(_selector.Selected!, CustomizeIndex.Clan, applyClan); var applyGender = _selector.Selected!.DoApplyCustomize(CustomizeIndex.Gender); - if (ImGui.Checkbox($"Apply {CustomizeIndex.Gender.ToDefaultName()}", ref applyGender)) + if (ImUtf8.Checkbox($"Apply {CustomizeIndex.Gender.ToDefaultName()}", ref applyGender)) _manager.ChangeApplyCustomize(_selector.Selected!, CustomizeIndex.Gender, applyGender); foreach (var index in CustomizationExtensions.All.Where(set.IsAvailable)) { var apply = _selector.Selected!.DoApplyCustomize(index); - if (ImGui.Checkbox($"Apply {set.Option(index)}", ref apply)) + if (ImUtf8.Checkbox($"Apply {set.Option(index)}", ref apply)) _manager.ChangeApplyCustomize(_selector.Selected!, index, apply); } } private void DrawCrestApplication() { - using var id = ImRaii.PushId("Crests"); + using var id = ImUtf8.PushId("Crests"u8); var flags = (uint)_selector.Selected!.Application.Crest; var bigChange = ImGui.CheckboxFlags("Apply All Crests", ref flags, (uint)CrestExtensions.AllRelevant); foreach (var flag in CrestExtensions.AllRelevantSet) { var apply = bigChange ? ((CrestFlag)flags & flag) == flag : _selector.Selected!.DoApplyCrest(flag); - if (ImGui.Checkbox($"Apply {flag.ToLabel()} Crest", ref apply) || bigChange) + if (ImUtf8.Checkbox($"Apply {flag.ToLabel()} Crest", ref apply) || bigChange) _manager.ChangeApplyCrest(_selector.Selected!, flag, apply); } } private void DrawApplicationRules() { - using var h = ImRaii.CollapsingHeader("Application Rules"); + using var h = ImUtf8.CollapsingHeaderId("Application Rules"u8); if (!h) return; using var disabled = ImRaii.Disabled(_selector.Selected!.WriteProtected()); - using (var _ = ImRaii.Group()) + using (var _ = ImUtf8.Group()) { DrawCustomizeApplication(); ImUtf8.IconDummy(); DrawCrestApplication(); ImUtf8.IconDummy(); - if (_config.UseAdvancedParameters) - { - DrawMetaApplication(); - ImUtf8.IconDummy(); - DrawBonusSlotApplication(); - } + DrawMetaApplication(); + ImUtf8.IconDummy(); + DrawBonusSlotApplication(); } ImGui.SameLine(ImGui.GetContentRegionAvail().X / 2); @@ -276,20 +267,20 @@ public class DesignPanel void ApplyEquip(string label, EquipFlag allFlags, bool stain, IEnumerable slots) { var flags = (uint)(allFlags & _selector.Selected!.Application.Equip); - using var id = ImRaii.PushId(label); + using var id = ImUtf8.PushId(label); var bigChange = ImGui.CheckboxFlags($"Apply All {label}", ref flags, (uint)allFlags); if (stain) foreach (var slot in slots) { var apply = bigChange ? ((EquipFlag)flags).HasFlag(slot.ToStainFlag()) : _selector.Selected!.DoApplyStain(slot); - if (ImGui.Checkbox($"Apply {slot.ToName()} Dye", ref apply) || bigChange) + if (ImUtf8.Checkbox($"Apply {slot.ToName()} Dye", ref apply) || bigChange) _manager.ChangeApplyStains(_selector.Selected!, slot, apply); } else foreach (var slot in slots) { var apply = bigChange ? ((EquipFlag)flags).HasFlag(slot.ToFlag()) : _selector.Selected!.DoApplyEquip(slot); - if (ImGui.Checkbox($"Apply {slot.ToName()}", ref apply) || bigChange) + if (ImUtf8.Checkbox($"Apply {slot.ToName()}", ref apply) || bigChange) _manager.ChangeApplyItem(_selector.Selected!, slot, apply); } } @@ -311,16 +302,7 @@ public class DesignPanel EquipSlotExtensions.FullSlots); ImUtf8.IconDummy(); - if (_config.UseAdvancedParameters) - { - DrawParameterApplication(); - } - else - { - DrawMetaApplication(); - ImUtf8.IconDummy(); - DrawBonusSlotApplication(); - } + DrawParameterApplication(); } } @@ -334,7 +316,7 @@ public class DesignPanel private void DrawMetaApplication() { - using var id = ImRaii.PushId("Meta"); + using var id = ImUtf8.PushId("Meta"); const uint all = (uint)MetaExtensions.All; var flags = (uint)_selector.Selected!.Application.Meta; var bigChange = ImGui.CheckboxFlags("Apply All Meta Changes", ref flags, all); @@ -342,7 +324,7 @@ public class DesignPanel foreach (var (index, label) in MetaExtensions.AllRelevant.Zip(MetaLabels)) { var apply = bigChange ? ((MetaFlag)flags).HasFlag(index.ToFlag()) : _selector.Selected!.DoApplyMeta(index); - if (ImGui.Checkbox(label, ref apply) || bigChange) + if (ImUtf8.Checkbox(label, ref apply) || bigChange) _manager.ChangeApplyMeta(_selector.Selected!, index, apply); } } @@ -368,20 +350,20 @@ public class DesignPanel private void DrawParameterApplication() { - using var id = ImRaii.PushId("Parameter"); + using var id = ImUtf8.PushId("Parameter"); var flags = (uint)_selector.Selected!.Application.Parameters; var bigChange = ImGui.CheckboxFlags("Apply All Customize Parameters", ref flags, (uint)CustomizeParameterExtensions.All); foreach (var flag in CustomizeParameterExtensions.AllFlags) { var apply = bigChange ? ((CustomizeParameterFlag)flags).HasFlag(flag) : _selector.Selected!.DoApplyParameter(flag); - if (ImGui.Checkbox($"Apply {flag.ToName()}", ref apply) || bigChange) + if (ImUtf8.Checkbox($"Apply {flag.ToName()}", ref apply) || bigChange) _manager.ChangeApplyParameter(_selector.Selected!, flag, apply); } } public void Draw() { - using var group = ImRaii.Group(); + using var group = ImUtf8.Group(); if (_selector.SelectedPaths.Count > 1) { _multiDesignPanel.Draw(); @@ -419,10 +401,12 @@ public class DesignPanel using var table = ImUtf8.Table("##Panel", 1, ImGuiTableFlags.BordersOuter | ImGuiTableFlags.ScrollY, ImGui.GetContentRegionAvail()); if (!table || _selector.Selected == null) return; + ImGui.TableSetupScrollFreeze(0, 1); ImGui.TableNextColumn(); if (_selector.Selected == null) return; + ImGui.Dummy(Vector2.Zero); DrawButtonRow(); ImGui.TableNextColumn(); diff --git a/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs b/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs index 4ee261b..fd4f3f5 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs @@ -24,7 +24,6 @@ public class SettingsTab( IKeyState keys, DesignColorUi designColorUi, PaletteImport paletteImport, - PalettePlusChecker paletteChecker, CollectionOverrideDrawer overrides, CodeDrawer codeDrawer, Glamourer glamourer, @@ -93,20 +92,15 @@ public class SettingsTab( 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); - Checkbox("Enable Advanced Customization Options"u8, - "Enable the display and editing of advanced customization options like arbitrary colors."u8, - config.UseAdvancedParameters, paletteChecker.SetAdvancedParameters); PaletteImportButton(); - Checkbox("Enable Advanced Dye Options"u8, - "Enable the display and editing of advanced dyes (color sets) for all equipment"u8, - config.UseAdvancedDyes, v => config.UseAdvancedDyes = v); 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 + "Glamourer will NOT revert these applied settings automatically. This may mess up your collection and configuration.\n\n"u8 + "If you enable this setting, you are aware that any resulting misconfiguration is your own fault."u8, config.AlwaysApplyAssociatedMods, v => config.AlwaysApplyAssociatedMods = v); Checkbox("Use Temporary Mod Settings"u8, - "Apply all settings as temporary settings so they will be reset when Glamourer or the game shut down."u8, config.UseTemporarySettings, + "Apply all settings as temporary settings so they will be reset when Glamourer or the game shut down."u8, + config.UseTemporarySettings, v => config.UseTemporarySettings = v); ImGui.NewLine(); } @@ -152,7 +146,7 @@ public class SettingsTab( ImGui.Dummy(Vector2.Zero); Checkbox("Enable Game Context Menus"u8, "Whether to show a Try On via Glamourer button on context menus for equippable items."u8, - config.EnableGameContextMenu, v => + config.EnableGameContextMenu, v => { config.EnableGameContextMenu = v; if (v) @@ -161,12 +155,13 @@ public class SettingsTab( contextMenuService.Disable(); }); Checkbox("Show Window when UI is Hidden"u8, "Whether to show Glamourer windows even when the games UI is hidden."u8, - config.ShowWindowWhenUiHidden, v => + config.ShowWindowWhenUiHidden, v => { config.ShowWindowWhenUiHidden = v; uiBuilder.DisableUserUiHide = v; }); - Checkbox("Hide Window in Cutscenes"u8, "Whether the main Glamourer window should automatically be hidden when entering cutscenes or not."u8, + Checkbox("Hide Window in Cutscenes"u8, + "Whether the main Glamourer window should automatically be hidden when entering cutscenes or not."u8, config.HideWindowInCutscene, v => { @@ -177,13 +172,13 @@ public class SettingsTab( config.Ephemeral.LockMainWindow, v => config.Ephemeral.LockMainWindow = v); Checkbox("Open Main Window at Game Start"u8, "Whether the main Glamourer window should be open or closed after launching the game."u8, - config.OpenWindowAtStart, v => config.OpenWindowAtStart = v); + config.OpenWindowAtStart, v => config.OpenWindowAtStart = v); ImGui.Dummy(Vector2.Zero); ImGui.Separator(); ImGui.Dummy(Vector2.Zero); Checkbox("Smaller Equip Display"u8, "Use single-line display without icons and small dye buttons instead of double-line display."u8, - config.SmallEquip, v => config.SmallEquip = v); + config.SmallEquip, v => config.SmallEquip = v); DrawHeightUnitSettings(); Checkbox("Show Application Checkboxes"u8, "Show the application checkboxes in the Customization and Equipment panels of the design tab, instead of only showing them under Application Rules."u8, @@ -211,23 +206,22 @@ public class SettingsTab( Checkbox("Show Unobtained Item Warnings"u8, "Show information whether you have unlocked all items and customizations in your automated design or not."u8, config.ShowUnlockedItemWarnings, v => config.ShowUnlockedItemWarnings = v); - if (config.UseAdvancedParameters) + Checkbox("Show Color Display Config"u8, "Show the Color Display configuration options in the Advanced Customization panels."u8, + config.ShowColorConfig, v => config.ShowColorConfig = v); + Checkbox("Show Palette+ Import Button"u8, + "Show the import button that allows you to import Palette+ palettes onto a design in the Advanced Customization options section for designs."u8, + config.ShowPalettePlusImport, v => config.ShowPalettePlusImport = v); + using (ImRaii.PushId(1)) { - Checkbox("Show Color Display Config"u8, "Show the Color Display configuration options in the Advanced Customization panels."u8, - config.ShowColorConfig, v => config.ShowColorConfig = v); - Checkbox("Show Palette+ Import Button"u8, - "Show the import button that allows you to import Palette+ palettes onto a design in the Advanced Customization options section for designs."u8, - config.ShowPalettePlusImport, v => config.ShowPalettePlusImport = v); - using var id = ImRaii.PushId(1); PaletteImportButton(); } - if (config.UseAdvancedDyes) - Checkbox("Keep Advanced Dye Window Attached"u8, - "Keeps the advanced dye window expansion attached to the main window, or makes it freely movable."u8, - config.KeepAdvancedDyesAttached, v => config.KeepAdvancedDyesAttached = v); + Checkbox("Keep Advanced Dye Window Attached"u8, + "Keeps the advanced dye window expansion attached to the main window, or makes it freely movable."u8, + config.KeepAdvancedDyesAttached, v => config.KeepAdvancedDyesAttached = v); - Checkbox("Debug Mode"u8, "Show the debug tab. Only useful for debugging or advanced use. Not recommended in general."u8, config.DebugMode, + Checkbox("Debug Mode"u8, "Show the debug tab. Only useful for debugging or advanced use. Not recommended in general."u8, + config.DebugMode, v => config.DebugMode = v); ImGui.NewLine(); } @@ -235,8 +229,7 @@ public class SettingsTab( private void DrawQuickDesignBoxes() { var showAuto = config.EnableAutoDesigns; - var showAdvanced = config.UseAdvancedParameters || config.UseAdvancedDyes; - var numColumns = 8 - (showAuto ? 0 : 2) - (showAdvanced ? 0 : 1) - (config.UseTemporarySettings ? 0 : 1); + var numColumns = 8 - (showAuto ? 0 : 2) - (config.UseTemporarySettings ? 0 : 1); ImGui.NewLine(); ImUtf8.Text("Show the Following Buttons in the Quick Design Bar:"u8); ImGui.Dummy(Vector2.Zero); @@ -253,11 +246,11 @@ public class SettingsTab( ("Reapply Auto", showAuto, QdbButtons.ReapplyAutomation), ("Revert Equip", true, QdbButtons.RevertEquip), ("Revert Customize", true, QdbButtons.RevertCustomize), - ("Revert Advanced", showAdvanced, QdbButtons.RevertAdvanced), + ("Revert Advanced", true, QdbButtons.RevertAdvanced), ("Reset Settings", config.UseTemporarySettings, QdbButtons.ResetSettings), ]; - for(var i = 0; i < columns.Length; ++i) + for (var i = 0; i < columns.Length; ++i) { if (!columns[i].Item2) continue; @@ -291,7 +284,7 @@ public class SettingsTab( private void PaletteImportButton() { - if (!config.UseAdvancedParameters || !config.ShowPalettePlusImport) + if (!config.ShowPalettePlusImport) return; ImGui.SameLine(); diff --git a/Glamourer/Interop/Material/MaterialManager.cs b/Glamourer/Interop/Material/MaterialManager.cs index f3c1875..81373c5 100644 --- a/Glamourer/Interop/Material/MaterialManager.cs +++ b/Glamourer/Interop/Material/MaterialManager.cs @@ -41,9 +41,6 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable private void OnPrepareColorSet(CharacterBase* characterBase, MaterialResourceHandle* material, ref StainIds stain, ref nint ret) { - if (!_config.UseAdvancedDyes) - return; - var actor = _penumbra.GameObjectFromDrawObject(characterBase); var validType = FindType(characterBase, actor, out var type); var (slotId, materialId) = FindMaterial(characterBase, material); diff --git a/Glamourer/Interop/PalettePlus/PalettePlusChecker.cs b/Glamourer/Interop/PalettePlus/PalettePlusChecker.cs deleted file mode 100644 index a5a5ed9..0000000 --- a/Glamourer/Interop/PalettePlus/PalettePlusChecker.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Dalamud.Interface.ImGuiNotification; -using Dalamud.Plugin; -using OtterGui.Services; -using Notification = OtterGui.Classes.Notification; - -namespace Glamourer.Interop.PalettePlus; - -public sealed class PalettePlusChecker : IRequiredService, IDisposable -{ - private readonly Timer _paletteTimer; - private readonly Configuration _config; - private readonly IDalamudPluginInterface _pluginInterface; - - public PalettePlusChecker(Configuration config, IDalamudPluginInterface pluginInterface) - { - _config = config; - _pluginInterface = pluginInterface; - _paletteTimer = new Timer(_ => PalettePlusCheck(), null, TimeSpan.FromSeconds(30), Timeout.InfiniteTimeSpan); - } - - public void Dispose() - => _paletteTimer.Dispose(); - - public void SetAdvancedParameters(bool value) - { - _config.UseAdvancedParameters = value; - PalettePlusCheck(); - } - - private void PalettePlusCheck() - { - if (!_config.UseAdvancedParameters) - return; - - try - { - var subscriber = _pluginInterface.GetIpcSubscriber("PalettePlus.ApiVersion"); - subscriber.InvokeFunc(); - Glamourer.Messager.AddMessage(new Notification( - "You currently have Palette+ installed. This conflicts with Glamourers advanced options and will cause invalid state.\n\n" - + "Please uninstall Palette+ and restart your game. Palette+ is deprecated and no longer supported by Mare Synchronos.", - NotificationType.Warning, 10000)); - } - catch - { - // ignored - } - } -} diff --git a/Glamourer/State/StateApplier.cs b/Glamourer/State/StateApplier.cs index 2e086d6..be85580 100644 --- a/Glamourer/State/StateApplier.cs +++ b/Glamourer/State/StateApplier.cs @@ -25,7 +25,6 @@ public class StateApplier( MetaService _metaService, ObjectManager _objects, CrestService _crests, - Configuration _config, DirectXService _directX) { /// Simply force a redraw regardless of conditions. @@ -291,30 +290,26 @@ public class StateApplier( } /// Change the customize parameters on models. Can change multiple at once. - public void ChangeParameters(ActorData data, CustomizeParameterFlag flags, in CustomizeParameterData values, bool force) + public void ChangeParameters(ActorData data, CustomizeParameterFlag flags, in CustomizeParameterData values) { - if (!force && !_config.UseAdvancedParameters || flags == 0) + if (flags == 0) return; foreach (var actor in data.Objects.Where(a => a is { IsCharacter: true, Model.IsHuman: true })) actor.Model.ApplyParameterData(flags, values); } - /// + /// public ActorData ChangeParameters(ActorState state, CustomizeParameterFlag flags, bool apply) { var data = GetData(state); if (apply) - ChangeParameters(data, flags, state.ModelData.Parameters, state.IsLocked); + ChangeParameters(data, flags, state.ModelData.Parameters); return data; } - public unsafe void ChangeMaterialValue(ActorState state, ActorData data, MaterialValueIndex changedIndex, ColorRow? changedValue, - bool force) + public unsafe void ChangeMaterialValue(ActorState state, ActorData data, MaterialValueIndex changedIndex, ColorRow? changedValue) { - if (!force && !_config.UseAdvancedDyes) - return; - foreach (var actor in data.Objects.Where(a => a is { IsCharacter: true, Model.IsHuman: true })) { if (!changedIndex.TryGetTexture(actor, out var texture)) @@ -341,16 +336,13 @@ public class StateApplier( { var data = GetData(state); if (apply) - ChangeMaterialValue(state, data, index, state.Materials.TryGetValue(index, out var v) ? v.Model : null, state.IsLocked); + ChangeMaterialValue(state, data, index, state.Materials.TryGetValue(index, out var v) ? v.Model : null); return data; } - public unsafe void ChangeMaterialValues(ActorData data, in StateMaterialManager materials, bool force) + public unsafe void ChangeMaterialValues(ActorData data, in StateMaterialManager materials) { - if (!force && !_config.UseAdvancedDyes) - return; - var groupedMaterialValues = materials.Values.Select(p => (MaterialValueIndex.FromKey(p.Key), p.Value)) .GroupBy(p => (p.Item1.DrawObject, p.Item1.SlotIndex, p.Item1.MaterialIndex)); @@ -410,8 +402,8 @@ public class StateApplier( ChangeMetaState(actors, MetaIndex.WeaponState, state.ModelData.IsWeaponVisible()); ChangeMetaState(actors, MetaIndex.VisorState, state.ModelData.IsVisorToggled()); ChangeCrests(actors, state.ModelData.CrestVisibility); - ChangeParameters(actors, state.OnlyChangedParameters(), state.ModelData.Parameters, state.IsLocked); - ChangeMaterialValues(actors, state.Materials, state.IsLocked); + ChangeParameters(actors, state.OnlyChangedParameters(), state.ModelData.Parameters); + ChangeMaterialValues(actors, state.Materials); } } diff --git a/Glamourer/State/StateListener.cs b/Glamourer/State/StateListener.cs index 3a6d6ef..88ec0b5 100644 --- a/Glamourer/State/StateListener.cs +++ b/Glamourer/State/StateListener.cs @@ -41,7 +41,7 @@ public class StateListener : IDisposable private readonly HeadGearVisibilityChanged _headGearVisibility; private readonly VisorStateChanged _visorState; private readonly WeaponVisibilityChanged _weaponVisibility; - private readonly StateFinalized _stateFinalized; + private readonly StateFinalized _stateFinalized; private readonly AutoDesignApplier _autoDesignApplier; private readonly FunModule _funModule; private readonly HumanModelList _humans; @@ -88,7 +88,7 @@ public class StateListener : IDisposable _condition = condition; _crestService = crestService; _bonusSlotUpdating = bonusSlotUpdating; - _stateFinalized = stateFinalized; + _stateFinalized = stateFinalized; Subscribe(); } @@ -225,7 +225,7 @@ public class StateListener : IDisposable // then we do not want to use our restricted gear protection // since we assume the player has that gear modded to availability. var locked = false; - if (actor.Identifier(_actors, out var identifier) + if (actor.Identifier(_actors, out var identifier) && _manager.TryGetValue(identifier, out var state)) { HandleEquipSlot(actor, state, slot, ref armor); @@ -889,7 +889,7 @@ public class StateListener : IDisposable case StateSource.Manual: if (state.BaseData.Parameters.Set(flag, newValue)) _manager.ChangeCustomizeParameter(state, flag, newValue, ApplySettings.Game); - else if (_config.UseAdvancedParameters) + else model.ApplySingleParameterData(flag, state.ModelData.Parameters); break; case StateSource.IpcManual: @@ -900,8 +900,7 @@ public class StateListener : IDisposable break; case StateSource.Fixed: state.BaseData.Parameters.Set(flag, newValue); - if (_config.UseAdvancedParameters) - model.ApplySingleParameterData(flag, state.ModelData.Parameters); + model.ApplySingleParameterData(flag, state.ModelData.Parameters); break; case StateSource.IpcFixed: state.BaseData.Parameters.Set(flag, newValue); @@ -910,14 +909,12 @@ public class StateListener : IDisposable case StateSource.Pending: state.BaseData.Parameters.Set(flag, newValue); state.Sources[flag] = StateSource.Manual; - if (_config.UseAdvancedParameters) - model.ApplySingleParameterData(flag, state.ModelData.Parameters); + model.ApplySingleParameterData(flag, state.ModelData.Parameters); break; case StateSource.IpcPending: state.BaseData.Parameters.Set(flag, newValue); state.Sources[flag] = StateSource.IpcManual; - if (_config.UseAdvancedParameters) - model.ApplySingleParameterData(flag, state.ModelData.Parameters); + model.ApplySingleParameterData(flag, state.ModelData.Parameters); break; } } diff --git a/Glamourer/State/StateManager.cs b/Glamourer/State/StateManager.cs index 9b71586..2dda310 100644 --- a/Glamourer/State/StateManager.cs +++ b/Glamourer/State/StateManager.cs @@ -297,7 +297,7 @@ public sealed class StateManager( { actors = Applier.ChangeParameters(state, CustomizeParameterExtensions.All, true); foreach (var (idx, mat) in state.Materials.Values) - Applier.ChangeMaterialValue(state, actors, MaterialValueIndex.FromKey(idx), mat.Game, true); + Applier.ChangeMaterialValue(state, actors, MaterialValueIndex.FromKey(idx), mat.Game); } state.Materials.Clear();