mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-24 05:31:50 +01:00
Add roughness enum.
This commit is contained in:
parent
93ac50cbdc
commit
4b2f44b63e
4 changed files with 40 additions and 22 deletions
|
|
@ -52,10 +52,11 @@ public sealed partial class Configuration : IPluginConfiguration, ISavable, ISer
|
|||
public bool AllowDoubleClickToApply { get; set; } = false;
|
||||
public bool RespectManualOnAutomationUpdate { get; set; } = false;
|
||||
public bool PreventRandomRepeats { get; set; } = false;
|
||||
public bool? AlwaysEditAsRoughness { get; set; } = null;
|
||||
public string PcpFolder { get; set; } = "PCP";
|
||||
public string PcpColor { get; set; } = "";
|
||||
|
||||
public RoughnessSetting RoughnessSetting { get; set; } = RoughnessSetting.AsIs;
|
||||
|
||||
public DesignPanelFlag HideDesignPanel { get; set; } = 0;
|
||||
public DesignPanelFlag AutoExpandDesignPanel { get; set; } = 0;
|
||||
|
||||
|
|
|
|||
27
Glamourer/Config/RoughnessSetting.cs
Normal file
27
Glamourer/Config/RoughnessSetting.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using Luna.Generators;
|
||||
|
||||
namespace Glamourer.Config;
|
||||
|
||||
[NamedEnum(Utf16: false)]
|
||||
public enum RoughnessSetting
|
||||
{
|
||||
[Name("As-Is")]
|
||||
AsIs,
|
||||
|
||||
[Name("Always Roughness")]
|
||||
AlwaysRoughness,
|
||||
|
||||
[Name("Always Gloss Strength")]
|
||||
AlwaysGloss,
|
||||
}
|
||||
|
||||
public static partial class RoughnessSettingExtensions
|
||||
{
|
||||
public static bool Get(this RoughnessSetting setting, bool roughness)
|
||||
=> setting switch
|
||||
{
|
||||
RoughnessSetting.AlwaysRoughness => true,
|
||||
RoughnessSetting.AlwaysGloss => false,
|
||||
_ => roughness,
|
||||
};
|
||||
}
|
||||
|
|
@ -453,14 +453,14 @@ public sealed unsafe class AdvancedDyePopup(
|
|||
else
|
||||
{
|
||||
Im.Item.SetNextWidthScaled(100);
|
||||
var editAsRoughness = config.AlwaysEditAsRoughness ?? _mode is ColorRow.Mode.Dawntrail;
|
||||
var editAsRoughness = config.RoughnessSetting.Get(_mode is ColorRow.Mode.Dawntrail);
|
||||
applied |= (_mode, editAsRoughness) switch
|
||||
{
|
||||
(ColorRow.Mode.Legacy, false) => DragGloss(ref value.Model.GlossStrength, false),
|
||||
(ColorRow.Mode.Legacy, true) => DragGlossAsRoughness(ref value.Model.GlossStrength, false),
|
||||
(ColorRow.Mode.Dawntrail, false) => DragRoughnessAsGloss(ref value.Model.Roughness, false),
|
||||
(ColorRow.Mode.Dawntrail, true) => DragRoughness(ref value.Model.Roughness, false),
|
||||
_ => throw new NotImplementedException(),
|
||||
_ => false,
|
||||
};
|
||||
Im.Tooltip.OnHover(editAsRoughness ? "Change the roughness for this row."u8 : "Change the gloss strength for this row."u8);
|
||||
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ public sealed class SettingsTab(
|
|||
"Select how to display the height of characters in real-world units, if at all."u8);
|
||||
}
|
||||
|
||||
private string _newIgnoredMod = string.Empty;
|
||||
private string _newIgnoredMod = string.Empty;
|
||||
|
||||
private void DrawIgnoredMods()
|
||||
{
|
||||
|
|
@ -530,15 +530,15 @@ private string _newIgnoredMod = string.Empty;
|
|||
delete = mod;
|
||||
|
||||
Im.Line.SameInner();
|
||||
ImEx.TextFramed(mod, Im.ContentRegion.Available with { Y = Im.Style.FrameHeight});
|
||||
ImEx.TextFramed(mod, Im.ContentRegion.Available with { Y = Im.Style.FrameHeight });
|
||||
}
|
||||
|
||||
if (delete.Length > 0)
|
||||
ignoredMods.Remove(delete);
|
||||
|
||||
var tt = _newIgnoredMod.Length is 0 ? "Please enter a new mod name or mod directory to ignore."u8 :
|
||||
var tt = _newIgnoredMod.Length is 0 ? "Please enter a new mod name or mod directory to ignore."u8 :
|
||||
ignoredMods.Contains(_newIgnoredMod) ? "This mod is already ignored."u8 :
|
||||
"Ignore all mods with this name or directory in the Unlocks tab."u8;
|
||||
"Ignore all mods with this name or directory in the Unlocks tab."u8;
|
||||
if (ImEx.Icon.Button(LunaStyle.AddObjectIcon, tt, tt[0] is not (byte)'I'))
|
||||
{
|
||||
ignoredMods.Add(_newIgnoredMod);
|
||||
|
|
@ -553,30 +553,20 @@ private string _newIgnoredMod = string.Empty;
|
|||
private void DrawRoughnessSettings()
|
||||
{
|
||||
Im.Item.SetNextWidthScaled(300);
|
||||
using (var combo = Im.Combo.Begin("##alwaysEditAsRoughness"u8, ToRoughnessSettingString(config.AlwaysEditAsRoughness)))
|
||||
using (var combo = Im.Combo.Begin("##alwaysEditAsRoughness"u8, config.RoughnessSetting.ToNameU8()))
|
||||
{
|
||||
if (combo)
|
||||
foreach (var type in (IEnumerable<bool?>)[null, true, false,])
|
||||
foreach (var type in RoughnessSetting.Values)
|
||||
{
|
||||
if (Im.Selectable(ToRoughnessSettingString(type), config.AlwaysEditAsRoughness == type))
|
||||
if (Im.Selectable(type.ToNameU8(), config.RoughnessSetting == type))
|
||||
{
|
||||
config.AlwaysEditAsRoughness = type;
|
||||
config.RoughnessSetting = type;
|
||||
config.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LunaStyle.DrawAlignedHelpMarkerLabel("Gloss Strength and Roughness Display Type"u8,
|
||||
"Select how to display and edit Gloss Strength and Roughness values.\nThe conversion formula used is an approximation and does not account for all the subtleties of legacy vs PBR shaders."u8);
|
||||
|
||||
return;
|
||||
|
||||
static ReadOnlySpan<byte> ToRoughnessSettingString(bool? alwaysEditAsRoughness)
|
||||
=> alwaysEditAsRoughness switch
|
||||
{
|
||||
null => "As-Is"u8,
|
||||
true => "Always Roughness"u8,
|
||||
false => "Always Gloss Strength"u8,
|
||||
};
|
||||
"Select how to display and edit Gloss Strength and Roughness values.\nThe conversion formula used is an approximation and does not account for all the subtleties of legacy versus PBR shaders."u8);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue