mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Add default settings for design configuration.
This commit is contained in:
parent
533c53fd8d
commit
4215e0ad44
5 changed files with 67 additions and 21 deletions
|
|
@ -25,6 +25,13 @@ public enum HeightDisplayType
|
|||
OlympicPool,
|
||||
}
|
||||
|
||||
public class DefaultDesignSettings
|
||||
{
|
||||
public bool AlwaysForceRedrawing = false;
|
||||
public bool ResetAdvancedDyes = false;
|
||||
public bool ShowQuickDesignBar = true;
|
||||
}
|
||||
|
||||
public class Configuration : IPluginConfiguration, ISavable
|
||||
{
|
||||
[JsonIgnore]
|
||||
|
|
@ -59,6 +66,8 @@ public class Configuration : IPluginConfiguration, ISavable
|
|||
public bool AllowDoubleClickToApply { get; set; } = false;
|
||||
public bool RespectManualOnAutomationUpdate { get; set; } = false;
|
||||
|
||||
public DefaultDesignSettings DefaultDesignSettings { get; set; } = new();
|
||||
|
||||
public HeightDisplayType HeightDisplayType { get; set; } = HeightDisplayType.Centimetre;
|
||||
public RenameField ShowRename { get; set; } = RenameField.BothDataPrio;
|
||||
public ModifiableHotkey ToggleQuickDesignBar { get; set; } = new(VirtualKey.NO_KEY);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,14 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
internal Design(Design other)
|
||||
: base(other)
|
||||
{
|
||||
Tags = [.. other.Tags];
|
||||
Description = other.Description;
|
||||
QuickDesign = other.QuickDesign;
|
||||
AssociatedMods = new SortedList<Mod, ModSettings>(other.AssociatedMods);
|
||||
Tags = [.. other.Tags];
|
||||
Description = other.Description;
|
||||
QuickDesign = other.QuickDesign;
|
||||
ForcedRedraw = other.ForcedRedraw;
|
||||
ResetAdvancedDyes = other.ResetAdvancedDyes;
|
||||
Color = other.Color;
|
||||
AssociatedMods = new SortedList<Mod, ModSettings>(other.AssociatedMods);
|
||||
Links = Links.Clone();
|
||||
}
|
||||
|
||||
// Metadata
|
||||
|
|
|
|||
|
|
@ -99,11 +99,14 @@ public sealed class DesignManager : DesignEditor
|
|||
var (actualName, path) = ParseName(name, handlePath);
|
||||
var design = new Design(Customizations, Items)
|
||||
{
|
||||
CreationDate = DateTimeOffset.UtcNow,
|
||||
LastEdit = DateTimeOffset.UtcNow,
|
||||
Identifier = CreateNewGuid(),
|
||||
Name = actualName,
|
||||
Index = Designs.Count,
|
||||
CreationDate = DateTimeOffset.UtcNow,
|
||||
LastEdit = DateTimeOffset.UtcNow,
|
||||
Identifier = CreateNewGuid(),
|
||||
Name = actualName,
|
||||
Index = Designs.Count,
|
||||
ForcedRedraw = Config.DefaultDesignSettings.AlwaysForceRedrawing,
|
||||
ResetAdvancedDyes = Config.DefaultDesignSettings.ResetAdvancedDyes,
|
||||
QuickDesign = Config.DefaultDesignSettings.ShowQuickDesignBar,
|
||||
};
|
||||
Designs.Add(design);
|
||||
Glamourer.Log.Debug($"Added new design {design.Identifier}.");
|
||||
|
|
@ -118,11 +121,14 @@ public sealed class DesignManager : DesignEditor
|
|||
var (actualName, path) = ParseName(name, handlePath);
|
||||
var design = new Design(clone)
|
||||
{
|
||||
CreationDate = DateTimeOffset.UtcNow,
|
||||
LastEdit = DateTimeOffset.UtcNow,
|
||||
Identifier = CreateNewGuid(),
|
||||
Name = actualName,
|
||||
Index = Designs.Count,
|
||||
CreationDate = DateTimeOffset.UtcNow,
|
||||
LastEdit = DateTimeOffset.UtcNow,
|
||||
Identifier = CreateNewGuid(),
|
||||
Name = actualName,
|
||||
Index = Designs.Count,
|
||||
ForcedRedraw = Config.DefaultDesignSettings.AlwaysForceRedrawing,
|
||||
ResetAdvancedDyes = Config.DefaultDesignSettings.ResetAdvancedDyes,
|
||||
QuickDesign = Config.DefaultDesignSettings.ShowQuickDesignBar,
|
||||
};
|
||||
|
||||
Designs.Add(design);
|
||||
|
|
@ -138,11 +144,11 @@ public sealed class DesignManager : DesignEditor
|
|||
var (actualName, path) = ParseName(name, handlePath);
|
||||
var design = new Design(clone)
|
||||
{
|
||||
CreationDate = DateTimeOffset.UtcNow,
|
||||
LastEdit = DateTimeOffset.UtcNow,
|
||||
Identifier = CreateNewGuid(),
|
||||
Name = actualName,
|
||||
Index = Designs.Count,
|
||||
CreationDate = DateTimeOffset.UtcNow,
|
||||
LastEdit = DateTimeOffset.UtcNow,
|
||||
Identifier = CreateNewGuid(),
|
||||
Name = actualName,
|
||||
Index = Designs.Count,
|
||||
};
|
||||
Designs.Add(design);
|
||||
Glamourer.Log.Debug(
|
||||
|
|
|
|||
|
|
@ -14,6 +14,16 @@ public sealed class LinkContainer : List<DesignLink>
|
|||
public new int Count
|
||||
=> base.Count + After.Count;
|
||||
|
||||
public LinkContainer Clone()
|
||||
{
|
||||
var ret = new LinkContainer();
|
||||
ret.EnsureCapacity(base.Count);
|
||||
ret.After.EnsureCapacity(After.Count);
|
||||
ret.AddRange(this);
|
||||
ret.After.AddRange(After);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public bool Reorder(int fromIndex, LinkOrder fromOrder, int toIndex, LinkOrder toOrder)
|
||||
{
|
||||
var fromList = fromOrder switch
|
||||
|
|
@ -89,13 +99,15 @@ public sealed class LinkContainer : List<DesignLink>
|
|||
|
||||
if (GetAllLinks(parent).Any(l => l.Link.Link == child && l.Order != order))
|
||||
{
|
||||
error = $"Adding {child.Incognito} to {parent.Incognito}s links would create a circle, the parent already links to the child in the opposite direction.";
|
||||
error =
|
||||
$"Adding {child.Incognito} to {parent.Incognito}s links would create a circle, the parent already links to the child in the opposite direction.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetAllLinks(child).Any(l => l.Link.Link == parent && l.Order == order))
|
||||
{
|
||||
error = $"Adding {child.Incognito} to {parent.Incognito}s links would create a circle, the child already links to the parent in the opposite direction.";
|
||||
error =
|
||||
$"Adding {child.Incognito} to {parent.Incognito}s links would create a circle, the child already links to the parent in the opposite direction.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Glamourer.Interop.PalettePlus;
|
|||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using OtterGui.Widgets;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.SettingsTab;
|
||||
|
|
@ -51,6 +52,7 @@ public class SettingsTab(
|
|||
using (ImRaii.Child("SettingsChild"))
|
||||
{
|
||||
DrawBehaviorSettings();
|
||||
DrawDesignDefaultSettings();
|
||||
DrawInterfaceSettings();
|
||||
DrawColorSettings();
|
||||
overrides.Draw();
|
||||
|
|
@ -101,6 +103,19 @@ public class SettingsTab(
|
|||
ImGui.NewLine();
|
||||
}
|
||||
|
||||
private void DrawDesignDefaultSettings()
|
||||
{
|
||||
if (!ImUtf8.CollapsingHeader("Design Defaults"))
|
||||
return;
|
||||
|
||||
Checkbox("Show in Quick Design Bar", "Newly created designs will be shown in the quick design bar by default.",
|
||||
config.DefaultDesignSettings.ShowQuickDesignBar, v => config.DefaultDesignSettings.ShowQuickDesignBar = v);
|
||||
Checkbox("Reset Advanced Dyes", "Newly created designs will be configured to reset advanced dyes on application by default.",
|
||||
config.DefaultDesignSettings.ResetAdvancedDyes, v => config.DefaultDesignSettings.ResetAdvancedDyes = v);
|
||||
Checkbox("Always Force Redraw", "Newly created designs will be configured to force character redraws on application by default.",
|
||||
config.DefaultDesignSettings.AlwaysForceRedrawing, v => config.DefaultDesignSettings.AlwaysForceRedrawing = v);
|
||||
}
|
||||
|
||||
private void DrawInterfaceSettings()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Interface"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue