mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Fix some issues with parameters.
This commit is contained in:
parent
ed27b1dff4
commit
630647b544
14 changed files with 52 additions and 30 deletions
|
|
@ -444,7 +444,7 @@ public class DesignBase
|
|||
if (!TryGetToken(flag, out var token))
|
||||
continue;
|
||||
|
||||
var value = Math.Clamp(token["Percentage"]?.ToObject<float>() ?? 0f, 0f, 1f);
|
||||
var value = token["Percentage"]?.ToObject<float>() ?? 0f;
|
||||
design.GetDesignDataRef().Parameters[flag] = new CustomizeParameterValue(value);
|
||||
}
|
||||
|
||||
|
|
@ -453,9 +453,9 @@ public class DesignBase
|
|||
if (!TryGetToken(flag, out var token))
|
||||
continue;
|
||||
|
||||
var r = Math.Clamp(token["Red"]?.ToObject<float>() ?? 0f, 0, 1);
|
||||
var g = Math.Clamp(token["Green"]?.ToObject<float>() ?? 0f, 0, 1);
|
||||
var b = Math.Clamp(token["Blue"]?.ToObject<float>() ?? 0f, 0, 1);
|
||||
var r = token["Red"]?.ToObject<float>() ?? 0f;
|
||||
var g = token["Green"]?.ToObject<float>() ?? 0f;
|
||||
var b = token["Blue"]?.ToObject<float>() ?? 0f;
|
||||
design.GetDesignDataRef().Parameters[flag] = new CustomizeParameterValue(r, g, b);
|
||||
}
|
||||
|
||||
|
|
@ -464,10 +464,10 @@ public class DesignBase
|
|||
if (!TryGetToken(flag, out var token))
|
||||
continue;
|
||||
|
||||
var r = Math.Clamp(token["Red"]?.ToObject<float>() ?? 0f, 0, 1);
|
||||
var g = Math.Clamp(token["Green"]?.ToObject<float>() ?? 0f, 0, 1);
|
||||
var b = Math.Clamp(token["Blue"]?.ToObject<float>() ?? 0f, 0, 1);
|
||||
var a = Math.Clamp(token["Alpha"]?.ToObject<float>() ?? 0f, 0, 1);
|
||||
var r = token["Red"]?.ToObject<float>() ?? 0f;
|
||||
var g = token["Green"]?.ToObject<float>() ?? 0f;
|
||||
var b = token["Blue"]?.ToObject<float>() ?? 0f;
|
||||
var a = token["Alpha"]?.ToObject<float>() ?? 0f;
|
||||
design.GetDesignDataRef().Parameters[flag] = new CustomizeParameterValue(r, g, b, a);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public sealed class DesignChanged()
|
|||
/// <summary> An existing design had a crest visibility changed. Data is the old crest visibility, the new crest visibility and the slot [(bool, bool, EquipSlot)]. </summary>
|
||||
Crest,
|
||||
|
||||
/// <summary> An existing design had a customize parameter changed. Data is the old value, the new value and the flag [(Vector3, Vector3, CustomizeParameterFlag)]. </summary>
|
||||
/// <summary> An existing design had a customize parameter changed. Data is the old value, the new value and the flag [(CustomizeParameterValue, CustomizeParameterValue, CustomizeParameterFlag)]. </summary>
|
||||
Parameter,
|
||||
|
||||
/// <summary> An existing design changed whether a specific customization is applied. Data is the type of customization [CustomizeIndex]. </summary>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public sealed class StateChanged()
|
|||
/// <summary> A characters saved state had a crest visibility changed. Data is the old crest visibility, the new crest visibility and the slot [(bool, bool, EquipSlot)]. </summary>
|
||||
Crest,
|
||||
|
||||
/// <summary> A characters saved state had its customize parameter changed. Data is the old value, the new value and the type [(Vector3, Vector3, CustomizeParameterFlag)]. </summary>
|
||||
/// <summary> A characters saved state had its customize parameter changed. Data is the old value, the new value and the type [(CustomizeParameterValue, CustomizeParameterValue, CustomizeParameterFlag)]. </summary>
|
||||
Parameter,
|
||||
|
||||
/// <summary> A characters saved state had a design applied. This means everything may have changed. Data is the applied design. [DesignBase] </summary>
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public struct CustomizeParameterData
|
|||
};
|
||||
|
||||
if (flags.HasFlag(CustomizeParameterFlag.SkinSpecular))
|
||||
parameters.SkinFresnelValue0 = new CustomizeParameterValue(SkinDiffuse).XivQuadruple;
|
||||
parameters.SkinFresnelValue0 = new CustomizeParameterValue(SkinSpecular).XivQuadruple;
|
||||
if (flags.HasFlag(CustomizeParameterFlag.HairDiffuse))
|
||||
parameters.MainColor = new CustomizeParameterValue(HairDiffuse).XivTriple;
|
||||
if (flags.HasFlag(CustomizeParameterFlag.HairSpecular))
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public readonly struct CustomizeParameterValue
|
|||
=> x < 0 ? -x * x : x * x;
|
||||
|
||||
private static float Root(float x)
|
||||
=> x < 0 ? -(float)Math.Sqrt(-x) : x;
|
||||
=> x < 0 ? -(float)Math.Sqrt(-x) : (float)Math.Sqrt(x);
|
||||
|
||||
public float this[int idx]
|
||||
=> _data[idx];
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class CustomizeParameterDrawer(Configuration config) : IService
|
|||
var value = data.CurrentValue.InternalTriple;
|
||||
using (_ = ImRaii.Disabled(data.Locked))
|
||||
{
|
||||
if (ImGui.ColorEdit3("##value", ref value, ImGuiColorEditFlags.Float | ImGuiColorEditFlags.HDR | ImGuiColorEditFlags.NoOptions))
|
||||
if (ImGui.ColorEdit3("##value", ref value, GetFlags()))
|
||||
data.ValueSetter(new CustomizeParameterValue(value));
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ public class CustomizeParameterDrawer(Configuration config) : IService
|
|||
var value = data.CurrentValue.InternalQuadruple;
|
||||
using (_ = ImRaii.Disabled(data.Locked))
|
||||
{
|
||||
if (ImGui.ColorEdit4("##value", ref value, ImGuiColorEditFlags.Float | ImGuiColorEditFlags.HDR | ImGuiColorEditFlags.NoOptions))
|
||||
if (ImGui.ColorEdit4("##value", ref value, GetFlags()))
|
||||
data.ValueSetter(new CustomizeParameterValue(value));
|
||||
}
|
||||
|
||||
|
|
@ -140,4 +140,9 @@ public class CustomizeParameterDrawer(Configuration config) : IService
|
|||
ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X);
|
||||
ImGui.TextUnformatted(data.Flag.ToName());
|
||||
}
|
||||
|
||||
private static ImGuiColorEditFlags GetFlags()
|
||||
=> ImGui.GetIO().KeyCtrl
|
||||
? ImGuiColorEditFlags.Float | ImGuiColorEditFlags.HDR | ImGuiColorEditFlags.NoOptions
|
||||
: ImGuiColorEditFlags.Float | ImGuiColorEditFlags.HDR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,8 @@ public class ActorPanel(
|
|||
var header = _state!.ModelData.ModelId == 0
|
||||
? "Customization"
|
||||
: $"Customization (Model Id #{_state.ModelData.ModelId})###Customization";
|
||||
if (!ImGui.CollapsingHeader(header))
|
||||
using var h = ImRaii.CollapsingHeader(header);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
if (_customizationDrawer.Draw(_state!.ModelData.Customize, _state.IsLocked, _lockedRedraw))
|
||||
|
|
@ -146,7 +147,8 @@ public class ActorPanel(
|
|||
|
||||
private void DrawEquipmentHeader()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Equipment"))
|
||||
using var h = ImRaii.CollapsingHeader("Equipment");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
_equipmentDrawer.Prepare();
|
||||
|
|
@ -171,7 +173,11 @@ public class ActorPanel(
|
|||
|
||||
private void DrawParameterHeader()
|
||||
{
|
||||
if (!_config.UseAdvancedParameters || !ImGui.CollapsingHeader("Advanced Customizations"))
|
||||
if (!_config.UseAdvancedParameters)
|
||||
return;
|
||||
|
||||
using var h = ImRaii.CollapsingHeader("Advanced Customizations");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
_parameterDrawer.Draw(_stateManager, _state!);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ public class DebugTabHeader(string label, params IGameDataDrawer[] subTrees)
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader(Label))
|
||||
using var h = ImRaii.CollapsingHeader(Label);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
foreach (var subTree in SubTrees)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ public class DesignDetailTab
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Design Details"))
|
||||
using var h = ImRaii.CollapsingHeader("Design Details");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
DrawDesignInfoTable();
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ public class DesignPanel(
|
|||
|
||||
private void DrawEquipment()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Equipment"))
|
||||
using var h = ImRaii.CollapsingHeader("Equipment");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
_equipmentDrawer.Prepare();
|
||||
|
|
@ -142,7 +143,8 @@ public class DesignPanel(
|
|||
var header = _selector.Selected!.DesignData.ModelId == 0
|
||||
? "Customization"
|
||||
: $"Customization (Model Id #{_selector.Selected!.DesignData.ModelId})###Customization";
|
||||
if (!ImGui.CollapsingHeader(header))
|
||||
using var h = ImRaii.CollapsingHeader(header);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
if (_customizationDrawer.Draw(_selector.Selected!.DesignData.Customize, _selector.Selected.ApplyCustomizeRaw,
|
||||
|
|
@ -162,7 +164,10 @@ public class DesignPanel(
|
|||
|
||||
private void DrawCustomizeParameters()
|
||||
{
|
||||
if (!_config.UseAdvancedParameters || !ImGui.CollapsingHeader("Advanced Customization"))
|
||||
if (!_config.UseAdvancedParameters)
|
||||
return;
|
||||
using var h = ImRaii.CollapsingHeader("Advanced Customizations");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
_parameterDrawer.Draw(_manager, _selector.Selected!);
|
||||
|
|
@ -214,7 +219,8 @@ public class DesignPanel(
|
|||
|
||||
private void DrawApplicationRules()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Application Rules"))
|
||||
using var h = ImRaii.CollapsingHeader("Application Rules");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
using (var _ = ImRaii.Group())
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ public class ModAssociationsTab
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
var headerOpen = ImGui.CollapsingHeader("Mod Associations");
|
||||
using var h = ImRaii.CollapsingHeader("Mod Associations");
|
||||
ImGuiUtil.HoverTooltip(
|
||||
"This tab can store information about specific mods associated with this design.\n\n"
|
||||
+ "It does NOT change any mod settings automatically, though there is functionality to apply desired mod settings manually.\n"
|
||||
+ "You can also use it to quickly open the associated mod page in Penumbra.\n\n"
|
||||
+ "It is not feasible to apply those changes automatically in general cases, since there would be no way to revert those changes, handle multiple designs applying at once, etc.");
|
||||
if (!headerOpen)
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
DrawApplyAllButton();
|
||||
|
|
|
|||
|
|
@ -141,7 +141,8 @@ public class NpcPanel(
|
|||
|
||||
private void DrawCustomization()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Customization"))
|
||||
using var h = ImRaii.CollapsingHeader("Customization");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
_customizeDrawer.Draw(_selector.Selection.Customize, true, true);
|
||||
|
|
@ -150,7 +151,8 @@ public class NpcPanel(
|
|||
|
||||
private void DrawEquipment()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Equipment"))
|
||||
using var h = ImRaii.CollapsingHeader("Equipment");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
_equipDrawer.Prepare();
|
||||
|
|
@ -223,7 +225,8 @@ public class NpcPanel(
|
|||
|
||||
private void DrawAppearanceInfo()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Appearance Details"))
|
||||
using var h = ImRaii.CollapsingHeader("Appearance Details");
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
using var table = ImRaii.Table("Details", 2);
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ public class StateManager(
|
|||
_applier.ChangeWeaponState(actors, state.ModelData.IsWeaponVisible());
|
||||
_applier.ChangeVisor(actors, state.ModelData.IsVisorToggled());
|
||||
_applier.ChangeCrests(actors, state.ModelData.CrestVisibility);
|
||||
_applier.ChangeParameters(actors, state.OnlyChangedParameters(), state.ModelData.Parameters);
|
||||
_applier.ChangeParameters(actors, state.OnlyChangedParameters(), state.ModelData.Parameters, state.IsLocked);
|
||||
}
|
||||
|
||||
return actors;
|
||||
|
|
|
|||
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
|||
Subproject commit f8f3e0b9bd39ed58f1233affc40df187b0c2b70e
|
||||
Subproject commit 9f9705f417114d006c7b1f043637083f0782bb6b
|
||||
Loading…
Add table
Add a link
Reference in a new issue