mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-25 14:11:47 +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 AllowDoubleClickToApply { get; set; } = false;
|
||||||
public bool RespectManualOnAutomationUpdate { get; set; } = false;
|
public bool RespectManualOnAutomationUpdate { get; set; } = false;
|
||||||
public bool PreventRandomRepeats { get; set; } = false;
|
public bool PreventRandomRepeats { get; set; } = false;
|
||||||
public bool? AlwaysEditAsRoughness { get; set; } = null;
|
|
||||||
public string PcpFolder { get; set; } = "PCP";
|
public string PcpFolder { get; set; } = "PCP";
|
||||||
public string PcpColor { get; set; } = "";
|
public string PcpColor { get; set; } = "";
|
||||||
|
|
||||||
|
public RoughnessSetting RoughnessSetting { get; set; } = RoughnessSetting.AsIs;
|
||||||
|
|
||||||
public DesignPanelFlag HideDesignPanel { get; set; } = 0;
|
public DesignPanelFlag HideDesignPanel { get; set; } = 0;
|
||||||
public DesignPanelFlag AutoExpandDesignPanel { 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
|
else
|
||||||
{
|
{
|
||||||
Im.Item.SetNextWidthScaled(100);
|
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
|
applied |= (_mode, editAsRoughness) switch
|
||||||
{
|
{
|
||||||
(ColorRow.Mode.Legacy, false) => DragGloss(ref value.Model.GlossStrength, false),
|
(ColorRow.Mode.Legacy, false) => DragGloss(ref value.Model.GlossStrength, false),
|
||||||
(ColorRow.Mode.Legacy, true) => DragGlossAsRoughness(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, false) => DragRoughnessAsGloss(ref value.Model.Roughness, false),
|
||||||
(ColorRow.Mode.Dawntrail, true) => DragRoughness(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);
|
Im.Tooltip.OnHover(editAsRoughness ? "Change the roughness for this row."u8 : "Change the gloss strength for this row."u8);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -553,30 +553,20 @@ private string _newIgnoredMod = string.Empty;
|
||||||
private void DrawRoughnessSettings()
|
private void DrawRoughnessSettings()
|
||||||
{
|
{
|
||||||
Im.Item.SetNextWidthScaled(300);
|
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)
|
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();
|
config.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LunaStyle.DrawAlignedHelpMarkerLabel("Gloss Strength and Roughness Display Type"u8,
|
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);
|
"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);
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
static ReadOnlySpan<byte> ToRoughnessSettingString(bool? alwaysEditAsRoughness)
|
|
||||||
=> alwaysEditAsRoughness switch
|
|
||||||
{
|
|
||||||
null => "As-Is"u8,
|
|
||||||
true => "Always Roughness"u8,
|
|
||||||
false => "Always Gloss Strength"u8,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue