diff --git a/Glamourer/Designs/DesignManager.cs b/Glamourer/Designs/DesignManager.cs index 7eaad9d..a31ba83 100644 --- a/Glamourer/Designs/DesignManager.cs +++ b/Glamourer/Designs/DesignManager.cs @@ -248,7 +248,8 @@ public sealed class DesignManager : DesignEditor design.LastEdit = DateTimeOffset.UtcNow; SaveService.QueueSave(design); Glamourer.Log.Debug($"Renamed tag {oldTag} at {tagIdx} to {newTag} in design {design.Identifier} and reordered tags."); - DesignChanged.Invoke(DesignChanged.Type.ChangedTag, design, new TagChangedTransaction(oldTag, newTag, tagIdx, design.Tags.IndexOf(newTag))); + DesignChanged.Invoke(DesignChanged.Type.ChangedTag, design, + new TagChangedTransaction(oldTag, newTag, tagIdx, design.Tags.IndexOf(newTag))); } /// Add an associated mod to a design. @@ -278,12 +279,20 @@ public sealed class DesignManager : DesignEditor /// Add or update an associated mod to a design. public void UpdateMod(Design design, Mod mod, ModSettings settings) { - var oldSettings = design.AssociatedMods[mod]; + var hasOldSettings = design.AssociatedMods.TryGetValue(mod, out var oldSettings); design.AssociatedMods[mod] = settings; design.LastEdit = DateTimeOffset.UtcNow; SaveService.QueueSave(design); - Glamourer.Log.Debug($"Updated (or added) associated mod {mod.DirectoryName} from design {design.Identifier}."); - DesignChanged.Invoke(DesignChanged.Type.UpdatedMod, design, new ModUpdatedTransaction(mod, oldSettings, settings)); + if (hasOldSettings) + { + Glamourer.Log.Debug($"Updated associated mod {mod.DirectoryName} from design {design.Identifier}."); + DesignChanged.Invoke(DesignChanged.Type.UpdatedMod, design, new ModUpdatedTransaction(mod, oldSettings, settings)); + } + else + { + Glamourer.Log.Debug($"Added associated mod {mod.DirectoryName} from design {design.Identifier}."); + DesignChanged.Invoke(DesignChanged.Type.AddedMod, design, new ModAddedTransaction(mod, settings)); + } } /// Set the write protection status of a design. diff --git a/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs b/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs index 3ebf78a..1f1e1ad 100644 --- a/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs +++ b/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs @@ -10,11 +10,10 @@ using OtterGui.Classes; using OtterGui.Raii; using OtterGui.Text; using OtterGui.Text.Widget; -using OtterGui.Widgets; namespace Glamourer.Gui.Tabs.DesignTab; -public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelector selector, DesignManager manager) +public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelector selector, DesignManager manager, Configuration config) { private readonly ModCombo _modCombo = new(penumbra, Glamourer.Log); private (Mod, ModSettings)[]? _copy; @@ -127,8 +126,17 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect removedMod = null; updatedMod = null; ImGui.TableNextColumn(); - if (ImUtf8.IconButton(FontAwesomeIcon.Trash, "Delete this mod from associations."u8)) - removedMod = mod; + var canDelete = config.DeleteDesignModifier.IsActive(); + if (canDelete) + { + if (ImUtf8.IconButton(FontAwesomeIcon.Trash, "Delete this mod from associations."u8)) + removedMod = mod; + } + else + { + ImUtf8.IconButton(FontAwesomeIcon.Trash, $"Delete this mod from associations.\nHold {config.DeleteDesignModifier} to delete.", + disabled: true); + } ImUtf8.SameLineInner(); if (ImUtf8.IconButton(FontAwesomeIcon.Clipboard, "Copy this mod setting to clipboard."u8)) diff --git a/Penumbra.GameData b/Penumbra.GameData index a62d62a..ad6973c 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit a62d62a8532de528f43515233ea44892cdb974b5 +Subproject commit ad6973c559b4c05aa3c3735ec7b53cc0f5d2f203