mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Fix PR.
This commit is contained in:
parent
ef96dadba5
commit
cca2bf645f
13 changed files with 65 additions and 64 deletions
|
|
@ -287,8 +287,7 @@ public sealed class AutoDesignApplier : IDisposable
|
|||
set.Designs.Where(d => d.IsActive(actor)).SelectMany(d => d.Design.AllLinks.Select(l => (l.Design, l.Flags & d.Type, d.Jobs.Flags))),
|
||||
state.ModelData.Customize, state.BaseData, true, _config.AlwaysApplyAssociatedMods);
|
||||
|
||||
var resetMaterials = mergedDesign.ResetMaterials;
|
||||
_state.ApplyDesign(state, mergedDesign, new ApplySettings(0, StateSource.Fixed, respectManual, fromJobChange, false, false, resetMaterials));
|
||||
_state.ApplyDesign(state, mergedDesign, new ApplySettings(0, StateSource.Fixed, respectManual, fromJobChange, false, false, false));
|
||||
forcedRedraw = mergedDesign.ForcedRedraw;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
public string[] Tags { get; internal set; } = [];
|
||||
public int Index { get; internal set; }
|
||||
public bool ForcedRedraw { get; internal set; }
|
||||
public bool ResetMaterials { get; internal set; }
|
||||
public bool ResetAdvancedDyes { get; internal set; }
|
||||
public bool QuickDesign { get; internal set; } = true;
|
||||
public string Color { get; internal set; } = string.Empty;
|
||||
public SortedList<Mod, ModSettings> AssociatedMods { get; private set; } = [];
|
||||
|
|
@ -103,7 +103,7 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
["Name"] = Name.Text,
|
||||
["Description"] = Description,
|
||||
["ForcedRedraw"] = ForcedRedraw,
|
||||
["ResetMaterials"] = ResetMaterials,
|
||||
["ResetAdvancedDyes"] = ResetAdvancedDyes,
|
||||
["Color"] = Color,
|
||||
["QuickDesign"] = QuickDesign,
|
||||
["Tags"] = JArray.FromObject(Tags),
|
||||
|
|
@ -146,7 +146,8 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
|
||||
#region Deserialization
|
||||
|
||||
public static Design LoadDesign(SaveService saveService, CustomizeService customizations, ItemManager items, DesignLinkLoader linkLoader, JObject json)
|
||||
public static Design LoadDesign(SaveService saveService, CustomizeService customizations, ItemManager items, DesignLinkLoader linkLoader,
|
||||
JObject json)
|
||||
{
|
||||
var version = json["FileVersion"]?.ToObject<int>() ?? 0;
|
||||
return version switch
|
||||
|
|
@ -158,7 +159,8 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
}
|
||||
|
||||
/// <summary> The values for gloss and specular strength were switched. Swap them for all appropriate designs. </summary>
|
||||
private static Design LoadDesignV1(SaveService saveService, CustomizeService customizations, ItemManager items, DesignLinkLoader linkLoader, JObject json)
|
||||
private static Design LoadDesignV1(SaveService saveService, CustomizeService customizations, ItemManager items, DesignLinkLoader linkLoader,
|
||||
JObject json)
|
||||
{
|
||||
var design = LoadDesignV2(customizations, items, linkLoader, json);
|
||||
var materialDesignData = design.GetMaterialDataRef();
|
||||
|
|
@ -216,7 +218,7 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
Glamourer.Messager.AddMessage(new Notification(
|
||||
$"Swapped Gloss and Specular Strength in {materialDesignData.Values.Count} Rows in design {design.Incognito} {reason}",
|
||||
NotificationType.Info));
|
||||
saveService.Save(SaveType.ImmediateSync,design);
|
||||
saveService.Save(SaveType.ImmediateSync, design);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +248,7 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn
|
|||
LoadLinks(linkLoader, json["Links"], design);
|
||||
design.Color = json["Color"]?.ToObject<string>() ?? string.Empty;
|
||||
design.ForcedRedraw = json["ForcedRedraw"]?.ToObject<bool>() ?? false;
|
||||
design.ResetMaterials = json["ResetMaterials"]?.ToObject<bool>() ?? false;
|
||||
design.ResetAdvancedDyes = json["ResetAdvancedDyes"]?.ToObject<bool>() ?? false;
|
||||
return design;
|
||||
|
||||
static string[] ParseTags(JObject json)
|
||||
|
|
|
|||
|
|
@ -304,8 +304,8 @@ public class DesignEditor(
|
|||
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void ApplyDesign(object data, MergedDesign other, ApplySettings _ = default)
|
||||
=> ApplyDesign(data, other.Design);
|
||||
public void ApplyDesign(object data, MergedDesign other, ApplySettings settings = default)
|
||||
=> ApplyDesign(data, other.Design, settings);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void ApplyDesign(object data, DesignBase other, ApplySettings _ = default)
|
||||
|
|
|
|||
|
|
@ -334,15 +334,15 @@ public sealed class DesignManager : DesignEditor
|
|||
DesignChanged.Invoke(DesignChanged.Type.ForceRedraw, design, null);
|
||||
}
|
||||
|
||||
public void ChangeResetMaterials(Design design, bool resetMaterials)
|
||||
public void ChangeResetAdvancedDyes(Design design, bool resetAdvancedDyes)
|
||||
{
|
||||
if (design.ResetMaterials == resetMaterials)
|
||||
if (design.ResetAdvancedDyes == resetAdvancedDyes)
|
||||
return;
|
||||
|
||||
design.ResetMaterials = resetMaterials;
|
||||
design.ResetAdvancedDyes = resetAdvancedDyes;
|
||||
SaveService.QueueSave(design);
|
||||
Glamourer.Log.Debug($"Set {design.Identifier} to {(resetMaterials ? "not" : string.Empty)} reset materials.");
|
||||
DesignChanged.Invoke(DesignChanged.Type.ResetMaterials, design, null);
|
||||
Glamourer.Log.Debug($"Set {design.Identifier} to {(resetAdvancedDyes ? "not" : string.Empty)} reset advanced dyes.");
|
||||
DesignChanged.Invoke(DesignChanged.Type.ResetAdvancedDyes, design, null);
|
||||
}
|
||||
|
||||
/// <summary> Change whether to apply a specific customize value. </summary>
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ public interface IDesignStandIn : IEquatable<IDesignStandIn>
|
|||
|
||||
public bool ForcedRedraw { get; }
|
||||
|
||||
public bool ResetMaterials { get; }
|
||||
public bool ResetAdvancedDyes { get; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ public class DesignMerger(
|
|||
ReduceMaterials(design, ret);
|
||||
if (design.ForcedRedraw)
|
||||
ret.ForcedRedraw = true;
|
||||
if (design.ResetMaterials)
|
||||
ret.ResetMaterials = true;
|
||||
if (design.ResetAdvancedDyes)
|
||||
ret.ResetAdvancedDyes = true;
|
||||
}
|
||||
|
||||
ApplyFixFlags(ret, fixFlags);
|
||||
|
|
|
|||
|
|
@ -100,5 +100,5 @@ public sealed class MergedDesign
|
|||
public readonly SortedList<Mod, ModSettings> AssociatedMods = [];
|
||||
public StateSources Sources = new();
|
||||
public bool ForcedRedraw;
|
||||
public bool ResetMaterials;
|
||||
public bool ResetAdvancedDyes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,6 @@ public class QuickSelectedDesign(QuickDesignCombo combo) : IDesignStandIn, IServ
|
|||
public bool ForcedRedraw
|
||||
=> combo.Design?.ForcedRedraw ?? false;
|
||||
|
||||
public bool ResetMaterials
|
||||
=> combo.Design?.ResetMaterials ?? false;
|
||||
public bool ResetAdvancedDyes
|
||||
=> combo.Design?.ResetAdvancedDyes ?? false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,6 @@ public class RandomDesign(RandomDesignGenerator rng) : IDesignStandIn
|
|||
public bool ForcedRedraw
|
||||
=> false;
|
||||
|
||||
public bool ResetMaterials
|
||||
public bool ResetAdvancedDyes
|
||||
=> false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,6 @@ public class RevertDesign : IDesignStandIn
|
|||
public bool ForcedRedraw
|
||||
=> false;
|
||||
|
||||
public bool ResetMaterials
|
||||
=> false;
|
||||
public bool ResetAdvancedDyes
|
||||
=> true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ public sealed class DesignChanged()
|
|||
/// <summary> An existing design had changed whether it always forces a redraw or not. </summary>
|
||||
ForceRedraw,
|
||||
|
||||
/// <summary> An existing design had changed whether it always reset materials or not. </summary>
|
||||
ResetMaterials,
|
||||
/// <summary> An existing design had changed whether it always resets advanced dyes or not. </summary>
|
||||
ResetAdvancedDyes,
|
||||
|
||||
/// <summary> An existing design changed whether a specific customization is applied. </summary>
|
||||
ApplyCustomize,
|
||||
|
|
|
|||
|
|
@ -143,12 +143,12 @@ public class DesignDetailTab
|
|||
_manager.ChangeForcedRedraw(_selector.Selected!, forceRedraw);
|
||||
ImGuiUtil.HoverTooltip("Set this design to always force a redraw when it is applied through any means.");
|
||||
|
||||
var resetMaterials = _selector.Selected!.ResetMaterials;
|
||||
ImGuiUtil.DrawFrameColumn("Reset Materials");
|
||||
var resetMaterials = _selector.Selected!.ResetAdvancedDyes;
|
||||
ImGuiUtil.DrawFrameColumn("Reset Advanced Dyes");
|
||||
ImGui.TableNextColumn();
|
||||
if (ImGui.Checkbox("##ResetMaterials", ref resetMaterials))
|
||||
_manager.ChangeResetMaterials(_selector.Selected!, resetMaterials);
|
||||
ImGuiUtil.HoverTooltip("Set this design to reset materials when it is applied through any means.");
|
||||
if (ImGui.Checkbox("##ResetAdvancedDyes", ref resetMaterials))
|
||||
_manager.ChangeResetAdvancedDyes(_selector.Selected!, resetMaterials);
|
||||
ImGuiUtil.HoverTooltip("Set this design to reset any previously applied advanced dyes when it is applied through any means.");
|
||||
|
||||
ImGuiUtil.DrawFrameColumn("Color");
|
||||
var colorName = _selector.Selected!.Color.Length == 0 ? DesignColors.AutomaticName : _selector.Selected!.Color;
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ public class StateEditor(
|
|||
Editor.ChangeMetaState(state, meta, mergedDesign.Design.DesignData.GetMeta(meta), Source(meta), out _, settings.Key);
|
||||
}
|
||||
|
||||
if (settings.ResetMaterials)
|
||||
if (settings.ResetMaterials || mergedDesign.ResetAdvancedDyes)
|
||||
state.Materials.Clear();
|
||||
|
||||
foreach (var (key, value) in mergedDesign.Design.Materials)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue