mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-28 19:39:22 +01:00
Add color display options.
This commit is contained in:
parent
4abae59974
commit
53c4dfeee5
3 changed files with 79 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ using Dalamud.Game.ClientState.Keys;
|
||||||
using Dalamud.Interface.Internal.Notifications;
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
using Glamourer.Designs;
|
using Glamourer.Designs;
|
||||||
using Glamourer.Gui;
|
using Glamourer.Gui;
|
||||||
|
using Glamourer.Gui.Customization;
|
||||||
using Glamourer.Services;
|
using Glamourer.Services;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
|
|
@ -37,6 +38,9 @@ public class Configuration : IPluginConfiguration, ISavable
|
||||||
public bool UseAdvancedParameters { get; set; } = true;
|
public bool UseAdvancedParameters { get; set; } = true;
|
||||||
public bool ShowRevertAdvancedParametersButton { get; set; } = true;
|
public bool ShowRevertAdvancedParametersButton { get; set; } = true;
|
||||||
public bool ShowPalettePlusImport { get; set; } = true;
|
public bool ShowPalettePlusImport { get; set; } = true;
|
||||||
|
public bool UseFloatForColors { get; set; } = true;
|
||||||
|
public bool UseRgbForColors { get; set; } = true;
|
||||||
|
public bool ShowColorConfig { get; set; } = true;
|
||||||
public ModifiableHotkey ToggleQuickDesignBar { get; set; } = new(VirtualKey.NO_KEY);
|
public ModifiableHotkey ToggleQuickDesignBar { get; set; } = new(VirtualKey.NO_KEY);
|
||||||
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
||||||
public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New;
|
public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New;
|
||||||
|
|
@ -45,7 +49,7 @@ public class Configuration : IPluginConfiguration, ISavable
|
||||||
[JsonProperty(Order = int.MaxValue)]
|
[JsonProperty(Order = int.MaxValue)]
|
||||||
public ISortMode<Design> SortMode { get; set; } = ISortMode<Design>.FoldersFirst;
|
public ISortMode<Design> SortMode { get; set; } = ISortMode<Design>.FoldersFirst;
|
||||||
|
|
||||||
public List<(string Code, bool Enabled)> Codes { get; set; } = [];
|
public List<(string Code, bool Enabled)> Codes { get; set; } = [];
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public bool DebugMode { get; set; } = true;
|
public bool DebugMode { get; set; } = true;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import
|
||||||
{
|
{
|
||||||
using var _ = EnsureSize();
|
using var _ = EnsureSize();
|
||||||
DrawPaletteImport(designManager, design);
|
DrawPaletteImport(designManager, design);
|
||||||
|
DrawConfig(true);
|
||||||
foreach (var flag in CustomizeParameterExtensions.RgbFlags)
|
foreach (var flag in CustomizeParameterExtensions.RgbFlags)
|
||||||
DrawColorInput3(CustomizeParameterDrawData.FromDesign(designManager, design, flag));
|
DrawColorInput3(CustomizeParameterDrawData.FromDesign(designManager, design, flag));
|
||||||
|
|
||||||
|
|
@ -99,6 +100,7 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import
|
||||||
public void Draw(StateManager stateManager, ActorState state)
|
public void Draw(StateManager stateManager, ActorState state)
|
||||||
{
|
{
|
||||||
using var _ = EnsureSize();
|
using var _ = EnsureSize();
|
||||||
|
DrawConfig(false);
|
||||||
foreach (var flag in CustomizeParameterExtensions.RgbFlags)
|
foreach (var flag in CustomizeParameterExtensions.RgbFlags)
|
||||||
DrawColorInput3(CustomizeParameterDrawData.FromState(stateManager, state, flag));
|
DrawColorInput3(CustomizeParameterDrawData.FromState(stateManager, state, flag));
|
||||||
|
|
||||||
|
|
@ -112,6 +114,68 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import
|
||||||
DrawValueInput(CustomizeParameterDrawData.FromState(stateManager, state, flag));
|
DrawValueInput(CustomizeParameterDrawData.FromState(stateManager, state, flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DrawConfig(bool withApply)
|
||||||
|
{
|
||||||
|
if (!config.ShowColorConfig)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DrawColorDisplayOptions();
|
||||||
|
DrawColorFormatOptions(withApply);
|
||||||
|
var value = config.ShowColorConfig;
|
||||||
|
ImGui.SameLine();
|
||||||
|
if (ImGui.Checkbox("Show Config", ref value))
|
||||||
|
{
|
||||||
|
config.ShowColorConfig = value;
|
||||||
|
config.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiUtil.HoverTooltip(
|
||||||
|
"Hide the color configuration options from the Advanced Customization panel. You can re-enable it in Glamourers interface settings.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawColorDisplayOptions()
|
||||||
|
{
|
||||||
|
using var group = ImRaii.Group();
|
||||||
|
if (ImGui.RadioButton("RGB", config.UseRgbForColors) && !config.UseRgbForColors)
|
||||||
|
{
|
||||||
|
config.UseRgbForColors = true;
|
||||||
|
config.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
if (ImGui.RadioButton("HSV", !config.UseRgbForColors) && config.UseRgbForColors)
|
||||||
|
{
|
||||||
|
config.UseRgbForColors = false;
|
||||||
|
config.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawColorFormatOptions(bool withApply)
|
||||||
|
{
|
||||||
|
var width = _width
|
||||||
|
- (ImGui.CalcTextSize("Float").X
|
||||||
|
+ ImGui.CalcTextSize("Integer").X
|
||||||
|
+ 2 * (ImGui.GetFrameHeight() + ImGui.GetStyle().ItemSpacing.X)
|
||||||
|
+ ImGui.GetStyle().ItemInnerSpacing.X
|
||||||
|
+ ImGui.GetItemRectSize().X);
|
||||||
|
if (!withApply)
|
||||||
|
width -= ImGui.GetFrameHeight() + ImGui.GetStyle().ItemInnerSpacing.X;
|
||||||
|
|
||||||
|
ImGui.SameLine(0, width);
|
||||||
|
if (ImGui.RadioButton("Float", config.UseFloatForColors) && !config.UseFloatForColors)
|
||||||
|
{
|
||||||
|
config.UseFloatForColors = true;
|
||||||
|
config.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
if (ImGui.RadioButton("Integer", !config.UseFloatForColors) && config.UseFloatForColors)
|
||||||
|
{
|
||||||
|
config.UseFloatForColors = false;
|
||||||
|
config.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawColorInput3(in CustomizeParameterDrawData data)
|
private void DrawColorInput3(in CustomizeParameterDrawData data)
|
||||||
{
|
{
|
||||||
using var id = ImRaii.PushId((int)data.Flag);
|
using var id = ImRaii.PushId((int)data.Flag);
|
||||||
|
|
@ -169,6 +233,7 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import
|
||||||
data.ValueSetter(new CustomizeParameterValue(value / 100f));
|
data.ValueSetter(new CustomizeParameterValue(value / 100f));
|
||||||
ImGuiUtil.HoverTooltip("You can control-click this to enter arbitrary values by hand instead of dragging.");
|
ImGuiUtil.HoverTooltip("You can control-click this to enter arbitrary values by hand instead of dragging.");
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRevert(data);
|
DrawRevert(data);
|
||||||
|
|
||||||
DrawApplyAndLabel(data);
|
DrawApplyAndLabel(data);
|
||||||
|
|
@ -204,11 +269,14 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import
|
||||||
ImGui.TextUnformatted(data.Flag.ToName());
|
ImGui.TextUnformatted(data.Flag.ToName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ImGuiColorEditFlags GetFlags()
|
private ImGuiColorEditFlags GetFlags()
|
||||||
=> ImGui.GetIO().KeyCtrl
|
=> Format | Display | ImGuiColorEditFlags.HDR | ImGuiColorEditFlags.NoOptions;
|
||||||
? ImGuiColorEditFlags.Float | ImGuiColorEditFlags.HDR | ImGuiColorEditFlags.NoOptions
|
|
||||||
: ImGuiColorEditFlags.Float | ImGuiColorEditFlags.HDR;
|
|
||||||
|
|
||||||
|
private ImGuiColorEditFlags Format
|
||||||
|
=> config.UseFloatForColors ? ImGuiColorEditFlags.Float : ImGuiColorEditFlags.Uint8;
|
||||||
|
|
||||||
|
private ImGuiColorEditFlags Display
|
||||||
|
=> config.UseRgbForColors ? ImGuiColorEditFlags.DisplayRGB : ImGuiColorEditFlags.DisplayHSV;
|
||||||
|
|
||||||
private ImRaii.IEndObject EnsureSize()
|
private ImRaii.IEndObject EnsureSize()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,8 @@ public class SettingsTab(
|
||||||
Checkbox("Show Revert Advanced Customizations Button in Quick Design Bar",
|
Checkbox("Show Revert Advanced Customizations Button in Quick Design Bar",
|
||||||
"Show a button to revert only advanced customizations on your character or a target in the quick design bar.",
|
"Show a button to revert only advanced customizations on your character or a target in the quick design bar.",
|
||||||
config.ShowRevertAdvancedParametersButton, v => config.ShowRevertAdvancedParametersButton = v);
|
config.ShowRevertAdvancedParametersButton, v => config.ShowRevertAdvancedParametersButton = v);
|
||||||
|
Checkbox("Show Color Display Config", "Show the Color Display configuration options in the Advanced Customization panels.",
|
||||||
|
config.ShowColorConfig, v => config.ShowColorConfig = v);
|
||||||
Checkbox("Show Palette+ Import Button",
|
Checkbox("Show Palette+ Import Button",
|
||||||
"Show the import button that allows you to import Palette+ palettes onto a design in the Advanced Customization options section for designs.",
|
"Show the import button that allows you to import Palette+ palettes onto a design in the Advanced Customization options section for designs.",
|
||||||
config.ShowPalettePlusImport, v => config.ShowPalettePlusImport = v);
|
config.ShowPalettePlusImport, v => config.ShowPalettePlusImport = v);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue