Fix some issues with parameters.

This commit is contained in:
Ottermandias 2024-01-10 15:44:19 +01:00
parent ed27b1dff4
commit 630647b544
14 changed files with 52 additions and 30 deletions

View file

@ -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;
}

View file

@ -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!);

View file

@ -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)

View file

@ -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();

View file

@ -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())

View file

@ -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();

View file

@ -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);