Current state.

This commit is contained in:
Ottermandias 2026-02-01 14:53:22 +01:00
parent 4b005c1ca2
commit 2850067f43
74 changed files with 1400 additions and 1427 deletions

View file

@ -5,6 +5,7 @@ using Glamourer.Designs;
using Glamourer.Gui; using Glamourer.Gui;
using Glamourer.Gui.Tabs.DesignTab; using Glamourer.Gui.Tabs.DesignTab;
using Glamourer.Services; using Glamourer.Services;
using ImSharp;
using Newtonsoft.Json; using Newtonsoft.Json;
using OtterGui.Filesystem; using OtterGui.Filesystem;
using Luna; using Luna;
@ -99,7 +100,7 @@ public class Configuration : IPluginConfiguration, ISavable
public int Version { get; set; } = Constants.CurrentVersion; public int Version { get; set; } = Constants.CurrentVersion;
public Dictionary<ColorId, uint> Colors { get; private set; } public Dictionary<ColorId, uint> Colors { get; private set; }
= Enum.GetValues<ColorId>().ToDictionary(c => c, c => c.Data().DefaultColor); = ColorId.Values.ToDictionary(c => c, c => c.Data().DefaultColor);
[JsonIgnore] [JsonIgnore]
private readonly SaveService _saveService; private readonly SaveService _saveService;

View file

@ -2,6 +2,7 @@
using Glamourer.GameData; using Glamourer.GameData;
using Glamourer.Interop.Material; using Glamourer.Interop.Material;
using Glamourer.Services; using Glamourer.Services;
using ImSharp;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -303,7 +304,7 @@ public class DesignBase
var customize = _designData.Customize; var customize = _designData.Customize;
if (_designData.IsHuman) if (_designData.IsHuman)
foreach (var idx in Enum.GetValues<CustomizeIndex>()) foreach (var idx in CustomizeIndex.Values)
{ {
ret[idx.ToString()] = new JObject() ret[idx.ToString()] = new JObject()
{ {

View file

@ -254,10 +254,10 @@ public class DesignColors : ISavable, IReadOnlyDictionary<string, Rgba32>
return false; return false;
} }
public static uint AutoColor(DesignBase design) public static Rgba32 AutoColor(DesignBase design)
{ {
var customize = design.ApplyCustomizeExcludingBodyType == 0; var customize = design.ApplyCustomizeExcludingBodyType is 0;
var equip = design.Application.Equip == 0; var equip = design.Application.Equip is 0;
return (customize, equip) switch return (customize, equip) switch
{ {
(true, true) => ColorId.StateDesign.Value(), (true, true) => ColorId.StateDesign.Value(),

View file

@ -4,6 +4,8 @@ using Glamourer.Events;
using Glamourer.GameData; using Glamourer.GameData;
using Glamourer.Interop.Material; using Glamourer.Interop.Material;
using Glamourer.Services; using Glamourer.Services;
using ImSharp;
using Luna;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -71,7 +73,7 @@ public class DesignEditor(
} }
design.LastEdit = DateTimeOffset.UtcNow; design.LastEdit = DateTimeOffset.UtcNow;
Glamourer.Log.Debug($"Changed customize {idx.ToDefaultName()} in design {design.Identifier} from {oldValue.Value} to {value.Value}."); Glamourer.Log.Debug($"Changed customize {idx.ToName()} in design {design.Identifier} from {oldValue.Value} to {value.Value}.");
SaveService.QueueSave(design); SaveService.QueueSave(design);
DesignChanged.Invoke(DesignChanged.Type.Customize, design, new CustomizeTransaction(idx, oldValue, value)); DesignChanged.Invoke(DesignChanged.Type.Customize, design, new CustomizeTransaction(idx, oldValue, value));
} }
@ -336,7 +338,7 @@ public class DesignEditor(
ChangeBonusItem(design, slot, other.DesignData.BonusItem(slot)); ChangeBonusItem(design, slot, other.DesignData.BonusItem(slot));
} }
foreach (var slot in Enum.GetValues<CrestFlag>().Where(other.DoApplyCrest)) foreach (var slot in CrestFlag.Values.Where(other.DoApplyCrest))
ChangeCrest(design, slot, other.DesignData.Crest(slot)); ChangeCrest(design, slot, other.DesignData.Crest(slot));
foreach (var parameter in CustomizeParameterExtensions.AllFlags.Where(other.DoApplyParameter)) foreach (var parameter in CustomizeParameterExtensions.AllFlags.Where(other.DoApplyParameter))

View file

@ -377,7 +377,7 @@ public sealed class DesignManager : DesignEditor
design.LastEdit = DateTimeOffset.UtcNow; design.LastEdit = DateTimeOffset.UtcNow;
SaveService.QueueSave(design); SaveService.QueueSave(design);
Glamourer.Log.Debug($"Set applying of customization {idx.ToDefaultName()} to {value}."); Glamourer.Log.Debug($"Set applying of customization {idx.ToName()} to {value}.");
DesignChanged.Invoke(DesignChanged.Type.ApplyCustomize, design, new ApplicationTransaction(idx, !value, value)); DesignChanged.Invoke(DesignChanged.Type.ApplyCustomize, design, new ApplicationTransaction(idx, !value, value));
} }

View file

@ -5,6 +5,7 @@ using Glamourer.Interop.Material;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using ImSharp;
using Luna; using Luna;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -284,7 +285,7 @@ public class DesignMerger(
var set = customizeService.Manager.GetSet(customize.Clan, customize.Gender); var set = customizeService.Manager.GetSet(customize.Clan, customize.Gender);
var face = customize.Face; var face = customize.Face;
foreach (var index in Enum.GetValues<CustomizeIndex>()) foreach (var index in CustomizeIndex.Values)
{ {
var flag = index.ToFlag(); var flag = index.ToFlag();
if (!customizeFlags.HasFlag(flag)) if (!customizeFlags.HasFlag(flag))
@ -314,7 +315,7 @@ public class DesignMerger(
var source = ret.Design.DoApplyCustomize(CustomizeIndex.Clan) var source = ret.Design.DoApplyCustomize(CustomizeIndex.Clan)
? ret.Sources[CustomizeIndex.Clan] ? ret.Sources[CustomizeIndex.Clan]
: ret.Sources[CustomizeIndex.Gender]; : ret.Sources[CustomizeIndex.Gender];
foreach (var index in Enum.GetValues<CustomizeIndex>()) foreach (var index in CustomizeIndex.Values)
{ {
var flag = index.ToFlag(); var flag = index.ToFlag();
if (!fixFlags.HasFlag(flag)) if (!fixFlags.HasFlag(flag))

View file

@ -1,7 +1,6 @@
using Dalamud.Interface.Textures; using Dalamud.Interface.Textures;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Luna; using Luna;
using OtterGui.Classes;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Race = Penumbra.GameData.Enums.Race; using Race = Penumbra.GameData.Enums.Race;
@ -33,7 +32,7 @@ public class CustomizeManager : IAsyncDataContainer
/// <summary> Get specific icons. </summary> /// <summary> Get specific icons. </summary>
public ISharedImmediateTexture GetIcon(uint id) public ISharedImmediateTexture GetIcon(uint id)
=> _icons.TextureProvider.GetFromGameIcon(id); => _textures.GetFromGameIcon(id);
/// <summary> Iterate over all supported genders and clans. </summary> /// <summary> Iterate over all supported genders and clans. </summary>
public static IEnumerable<(SubRace Clan, Gender Gender)> AllSets() public static IEnumerable<(SubRace Clan, Gender Gender)> AllSets()
@ -47,12 +46,12 @@ public class CustomizeManager : IAsyncDataContainer
public CustomizeManager(ITextureProvider textures, IDataManager gameData, IPluginLog log, NpcCustomizeSet npcCustomizeSet) public CustomizeManager(ITextureProvider textures, IDataManager gameData, IPluginLog log, NpcCustomizeSet npcCustomizeSet)
{ {
_icons = new TextureCache(gameData, textures); _textures = textures;
var stopwatch = new Stopwatch(); var stopwatch = new Stopwatch();
var tmpTask = Task.Run(() => var tmpTask = Task.Run(() =>
{ {
stopwatch.Start(); stopwatch.Start();
return new CustomizeSetFactory(gameData, log, _icons, npcCustomizeSet); return new CustomizeSetFactory(gameData, textures, log, npcCustomizeSet);
}); });
var setTasks = AllSets().Select(p var setTasks = AllSets().Select(p
=> tmpTask.ContinueWith(t => _customizationSets[ToIndex(p.Clan, p.Gender)] = t.Result.CreateSet(p.Clan, p.Gender))); => tmpTask.ContinueWith(t => _customizationSets[ToIndex(p.Clan, p.Gender)] = t.Result.CreateSet(p.Clan, p.Gender)));
@ -72,9 +71,9 @@ public class CustomizeManager : IAsyncDataContainer
public bool Finished public bool Finished
=> Awaiter.IsCompletedSuccessfully; => Awaiter.IsCompletedSuccessfully;
private readonly TextureCache _icons; private readonly ITextureProvider _textures;
private static readonly int ListSize = Clans.Count * Genders.Count; private static readonly int ListSize = Clans.Count * Genders.Count;
private readonly CustomizeSet[] _customizationSets = new CustomizeSet[ListSize]; private readonly CustomizeSet[] _customizationSets = new CustomizeSet[ListSize];
/// <summary> Get the index for the given pair of tribe and gender. </summary> /// <summary> Get the index for the given pair of tribe and gender. </summary>
private static int ToIndex(SubRace race, Gender gender) private static int ToIndex(SubRace race, Gender gender)

View file

@ -1,4 +1,5 @@
using Luna.Generators; using ImSharp;
using Luna.Generators;
namespace Glamourer.GameData; namespace Glamourer.GameData;
@ -69,7 +70,7 @@ public static partial class CustomizeParameterExtensions
public const CustomizeParameterFlag Values = CustomizeParameterFlag.FacePaintUvOffset | CustomizeParameterFlag.FacePaintUvMultiplier; public const CustomizeParameterFlag Values = CustomizeParameterFlag.FacePaintUvOffset | CustomizeParameterFlag.FacePaintUvMultiplier;
public static readonly IReadOnlyList<CustomizeParameterFlag> AllFlags = public static readonly IReadOnlyList<CustomizeParameterFlag> AllFlags =
[.. Enum.GetValues<CustomizeParameterFlag>().Where(f => All.HasFlag(f))]; [.. CustomizeParameterFlag.Values.Where(f => All.HasFlag(f))];
public static readonly IReadOnlyList<CustomizeParameterFlag> RgbaFlags = AllFlags.Where(f => RgbaQuadruples.HasFlag(f)).ToArray(); public static readonly IReadOnlyList<CustomizeParameterFlag> RgbaFlags = AllFlags.Where(f => RgbaQuadruples.HasFlag(f)).ToArray();
public static readonly IReadOnlyList<CustomizeParameterFlag> RgbFlags = AllFlags.Where(f => RgbTriples.HasFlag(f)).ToArray(); public static readonly IReadOnlyList<CustomizeParameterFlag> RgbFlags = AllFlags.Where(f => RgbTriples.HasFlag(f)).ToArray();

View file

@ -1,8 +1,10 @@
using Dalamud.Game; using Dalamud.Game;
using Dalamud.Interface.Textures;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using ImSharp;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using OtterGui.Classes; using Luna;
using Penumbra.GameData; using Penumbra.GameData;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -11,24 +13,24 @@ using Race = Penumbra.GameData.Enums.Race;
namespace Glamourer.GameData; namespace Glamourer.GameData;
internal class CustomizeSetFactory( internal class CustomizeSetFactory(
IDataManager _gameData, IDataManager gameData,
IPluginLog _log, ITextureProvider textures,
TextureCache _icons, IPluginLog log,
NpcCustomizeSet _npcCustomizeSet, NpcCustomizeSet npcCustomizeSet,
ColorParameters _colors) ColorParameters colors)
{ {
public CustomizeSetFactory(IDataManager gameData, IPluginLog log, TextureCache icons, NpcCustomizeSet npcCustomizeSet) public CustomizeSetFactory(IDataManager gameData, ITextureProvider textures, IPluginLog log, NpcCustomizeSet npcCustomizeSet)
: this(gameData, log, icons, npcCustomizeSet, new ColorParameters(gameData, log)) : this(gameData, textures, log, npcCustomizeSet, new ColorParameters(gameData, log))
{ } { }
/// <summary> Create the set of all available customization options for a given clan and gender. </summary> /// <summary> Create the set of all available customization options for a given clan and gender. </summary>
public CustomizeSet CreateSet(SubRace race, Gender gender) public CustomizeSet CreateSet(SubRace race, Gender gender)
{ {
var (skin, hair) = GetSkinHairColors(race, gender); var (skin, hair) = GetSkinHairColors(race, gender);
var row = _charaMakeSheet.GetRow(((uint)race - 1) * 2 - 1 + (uint)gender)!; var row = _charaMakeSheet.GetRow(((uint)race - 1) * 2 - 1 + (uint)gender);
var hrothgar = race.ToRace() == Race.Hrothgar; var hrothgar = race.ToRace() == Race.Hrothgar;
// Create the initial set with all the easily accessible parameters available for anyone. // Create the initial set with all the easily accessible parameters available for anyone.
var set = new CustomizeSet(_npcCustomizeSet, race, gender) var set = new CustomizeSet(npcCustomizeSet, race, gender)
{ {
Name = GetName(race, gender), Name = GetName(race, gender),
Voices = row.VoiceStruct, Voices = row.VoiceStruct,
@ -79,12 +81,12 @@ internal class CustomizeSetFactory(
CustomizeIndex.TailShape, CustomizeIndex.TailShape,
}; };
var npcCustomizations = new HashSet<(CustomizeIndex, CustomizeValue)>() var npcCustomizations = new HashSet<(CustomizeIndex, CustomizeValue)>
{ {
(CustomizeIndex.Height, CustomizeValue.Max), (CustomizeIndex.Height, CustomizeValue.Max),
}; };
_npcCustomizeSet.Awaiter.Wait(); npcCustomizeSet.Awaiter.Wait();
foreach (var customize in _npcCustomizeSet.Select(s => s.Customize) foreach (var customize in npcCustomizeSet.Select(s => s.Customize)
.Where(c => c.Clan == race && c.Gender == gender && c.BodyType.Value == 1)) .Where(c => c.Clan == race && c.Gender == gender && c.BodyType.Value == 1))
{ {
foreach (var customizeIndex in customizeIndices) foreach (var customizeIndex in customizeIndices)
@ -103,22 +105,22 @@ internal class CustomizeSetFactory(
set.NpcOptions = npcCustomizations.OrderBy(p => p.Item1).ThenBy(p => p.Item2.Value).ToArray(); set.NpcOptions = npcCustomizations.OrderBy(p => p.Item1).ThenBy(p => p.Item2.Value).ToArray();
} }
private readonly ColorParameters _colorParameters = new(_gameData, _log); private readonly ColorParameters _colorParameters = new(gameData, log);
private readonly ExcelSheet<CharaMakeCustomize> _customizeSheet = _gameData.GetExcelSheet<CharaMakeCustomize>(ClientLanguage.English); private readonly ExcelSheet<CharaMakeCustomize> _customizeSheet = gameData.GetExcelSheet<CharaMakeCustomize>(ClientLanguage.English);
private readonly ExcelSheet<Lobby> _lobbySheet = _gameData.GetExcelSheet<Lobby>(ClientLanguage.English); private readonly ExcelSheet<Lobby> _lobbySheet = gameData.GetExcelSheet<Lobby>(ClientLanguage.English);
private readonly ExcelSheet<RawRow> _hairSheet = _gameData.GetExcelSheet<RawRow>(ClientLanguage.English, "HairMakeType"); private readonly ExcelSheet<RawRow> _hairSheet = gameData.GetExcelSheet<RawRow>(ClientLanguage.English, "HairMakeType");
private readonly ExcelSheet<Tribe> _tribeSheet = _gameData.GetExcelSheet<Tribe>(ClientLanguage.English); private readonly ExcelSheet<Tribe> _tribeSheet = gameData.GetExcelSheet<Tribe>(ClientLanguage.English);
// Those color pickers are shared between all races. // Those color pickers are shared between all races.
private readonly CustomizeData[] _highlightPicker = CreateColors(_colors, CustomizeIndex.HighlightsColor, 256, 192); private readonly CustomizeData[] _highlightPicker = CreateColors(colors, CustomizeIndex.HighlightsColor, 256, 192);
private readonly CustomizeData[] _lipColorPickerDark = CreateColors(_colors, CustomizeIndex.LipColor, 512, 96); private readonly CustomizeData[] _lipColorPickerDark = CreateColors(colors, CustomizeIndex.LipColor, 512, 96);
private readonly CustomizeData[] _lipColorPickerLight = CreateColors(_colors, CustomizeIndex.LipColor, 1024, 96, true); private readonly CustomizeData[] _lipColorPickerLight = CreateColors(colors, CustomizeIndex.LipColor, 1024, 96, true);
private readonly CustomizeData[] _eyeColorPicker = CreateColors(_colors, CustomizeIndex.EyeColorLeft, 0, 192); private readonly CustomizeData[] _eyeColorPicker = CreateColors(colors, CustomizeIndex.EyeColorLeft, 0, 192);
private readonly CustomizeData[] _facePaintColorPickerDark = CreateColors(_colors, CustomizeIndex.FacePaintColor, 640, 96); private readonly CustomizeData[] _facePaintColorPickerDark = CreateColors(colors, CustomizeIndex.FacePaintColor, 640, 96);
private readonly CustomizeData[] _facePaintColorPickerLight = CreateColors(_colors, CustomizeIndex.FacePaintColor, 1152, 96, true); private readonly CustomizeData[] _facePaintColorPickerLight = CreateColors(colors, CustomizeIndex.FacePaintColor, 1152, 96, true);
private readonly CustomizeData[] _tattooColorPicker = CreateColors(_colors, CustomizeIndex.TattooColor, 0, 192); private readonly CustomizeData[] _tattooColorPicker = CreateColors(colors, CustomizeIndex.TattooColor, 0, 192);
private readonly ExcelSheet<CharaMakeType> _charaMakeSheet = _gameData.Excel.GetSheet<CharaMakeType>(); private readonly ExcelSheet<CharaMakeType> _charaMakeSheet = gameData.Excel.GetSheet<CharaMakeType>();
/// <summary> Obtain available skin and hair colors for the given clan and gender. </summary> /// <summary> Obtain available skin and hair colors for the given clan and gender. </summary>
private (CustomizeData[] Skin, CustomizeData[] Hair) GetSkinHairColors(SubRace race, Gender gender) private (CustomizeData[] Skin, CustomizeData[] Hair) GetSkinHairColors(SubRace race, Gender gender)
@ -134,12 +136,12 @@ internal class CustomizeSetFactory(
} }
/// <summary> Obtain the gender-specific clan name. </summary> /// <summary> Obtain the gender-specific clan name. </summary>
private string GetName(SubRace race, Gender gender) private StringU8 GetName(SubRace race, Gender gender)
=> gender switch => gender switch
{ {
Gender.Male => _tribeSheet.TryGetRow((uint)race, out var row) ? row.Masculine.ExtractText() : race.ToName(), Gender.Male => _tribeSheet.TryGetRow((uint)race, out var row) ? new StringU8(row.Masculine.ExtractText()) : race.ToNameU8(),
Gender.Female => _tribeSheet.TryGetRow((uint)race, out var row) ? row.Feminine.ExtractText() : race.ToName(), Gender.Female => _tribeSheet.TryGetRow((uint)race, out var row) ? new StringU8(row.Feminine.ExtractText()) : race.ToNameU8(),
_ => "Unknown", _ => new StringU8("Unknown"u8),
}; };
/// <summary> Obtain available hairstyles via reflection from the Hair sheet for the given subrace and gender. </summary> /// <summary> Obtain available hairstyles via reflection from the Hair sheet for the given subrace and gender. </summary>
@ -160,7 +162,7 @@ internal class CustomizeSetFactory(
// Hair Row from CustomizeSheet might not be set in case of unlockable hair. // Hair Row from CustomizeSheet might not be set in case of unlockable hair.
if (!_customizeSheet.TryGetRow(customizeIdx, out var hairRow)) if (!_customizeSheet.TryGetRow(customizeIdx, out var hairRow))
hairList.Add(new CustomizeData(CustomizeIndex.Hairstyle, (CustomizeValue)i, customizeIdx)); hairList.Add(new CustomizeData(CustomizeIndex.Hairstyle, (CustomizeValue)i, customizeIdx));
else if (_icons.IconExists(hairRow.Icon)) else if (IconExists(hairRow.Icon))
hairList.Add(new CustomizeData(CustomizeIndex.Hairstyle, (CustomizeValue)hairRow.FeatureID, hairRow.Icon, hairList.Add(new CustomizeData(CustomizeIndex.Hairstyle, (CustomizeValue)hairRow.FeatureID, hairRow.Icon,
(ushort)hairRow.RowId)); (ushort)hairRow.RowId));
} }
@ -168,6 +170,7 @@ internal class CustomizeSetFactory(
return [.. hairList.OrderBy(h => h.Value.Value)]; return [.. hairList.OrderBy(h => h.Value.Value)];
} }
/// <summary> Specific icons for tails or ears. </summary> /// <summary> Specific icons for tails or ears. </summary>
private CustomizeData[] GetTailEarShapes(CharaMakeType row) private CustomizeData[] GetTailEarShapes(CharaMakeType row)
=> ExtractValues(row, CustomizeIndex.TailShape); => ExtractValues(row, CustomizeIndex.TailShape);
@ -189,9 +192,9 @@ internal class CustomizeSetFactory(
/// <summary> Get face paints from the hair sheet via reflection since there are also unlockable face paints. </summary> /// <summary> Get face paints from the hair sheet via reflection since there are also unlockable face paints. </summary>
private CustomizeData[] GetFacePaints(SubRace race, Gender gender) private CustomizeData[] GetFacePaints(SubRace race, Gender gender)
{ {
var row = _hairSheet.GetRow(((uint)race - 1) * 2 - 1 + (uint)gender); var row = _hairSheet.GetRow(((uint)race - 1) * 2 - 1 + (uint)gender);
// Number of available face paints is at Unknown37. // Number of available face paints is at Unknown37.
var numPaints = row.ReadUInt8Column(37); var numPaints = row.ReadUInt8Column(37);
var paintList = new List<CustomizeData>(numPaints); var paintList = new List<CustomizeData>(numPaints);
for (var i = 0; i < numPaints; ++i) for (var i = 0; i < numPaints; ++i)
@ -242,43 +245,43 @@ internal class CustomizeSetFactory(
} }
/// <summary> Set the specific option names for the given set of parameters. </summary> /// <summary> Set the specific option names for the given set of parameters. </summary>
private string[] GetOptionNames(CharaMakeType row) private StringU8[] GetOptionNames(CharaMakeType row)
{ {
var nameArray = Enum.GetValues<CustomizeIndex>().Select(c => var nameArray = CustomizeIndex.Values.Select(c =>
{ {
// Find the first menu that corresponds to the Id. // Find the first menu that corresponds to the Id.
var byteId = c.ToByteAndMask().ByteIdx; var byteId = c.ToByteAndMask().ByteIdx;
var menu = row.CharaMakeStruct.FirstOrNull(m => m.Customize == byteId); var menu = row.CharaMakeStruct.FirstOrNull(m => m.Customize == byteId);
if (menu == null) if (menu is null)
{ {
// If none exists and the id corresponds to highlights, set the Highlights name. // If none exists and the id corresponds to highlights, set the Highlights name.
if (c == CustomizeIndex.Highlights) if (c == CustomizeIndex.Highlights)
return string.Intern(_lobbySheet.TryGetRow(237, out var text) ? text.Text.ExtractText() : "Highlights"); return _lobbySheet.TryGetRow(237, out var text) ? new StringU8(text.Text.ExtractText()) : new StringU8("Highlights"u8);
// Otherwise there is an error and we use the default name. // Otherwise there is an error and we use the default name.
return c.ToDefaultName(); return c.ToNameU8();
} }
// Otherwise all is normal, get the menu name or if it does not work the default name. // Otherwise all is normal, get the menu name or if it does not work the default name.
return string.Intern(_lobbySheet.TryGetRow(menu.Value.Menu.RowId, out var textRow) return _lobbySheet.TryGetRow(menu.Value.Menu.RowId, out var textRow)
? textRow.Text.ExtractText() ? new StringU8(textRow.Text.ExtractText())
: c.ToDefaultName()); : c.ToNameU8();
}).ToArray(); }).ToArray();
// Add names for both eye colors. // Add names for both eye colors.
nameArray[(int)CustomizeIndex.EyeColorLeft] = CustomizeIndex.EyeColorLeft.ToDefaultName(); nameArray[(int)CustomizeIndex.EyeColorLeft] = CustomizeIndex.EyeColorLeft.ToNameU8();
nameArray[(int)CustomizeIndex.EyeColorRight] = CustomizeIndex.EyeColorRight.ToDefaultName(); nameArray[(int)CustomizeIndex.EyeColorRight] = CustomizeIndex.EyeColorRight.ToNameU8();
nameArray[(int)CustomizeIndex.FacialFeature1] = CustomizeIndex.FacialFeature1.ToDefaultName(); nameArray[(int)CustomizeIndex.FacialFeature1] = CustomizeIndex.FacialFeature1.ToNameU8();
nameArray[(int)CustomizeIndex.FacialFeature2] = CustomizeIndex.FacialFeature2.ToDefaultName(); nameArray[(int)CustomizeIndex.FacialFeature2] = CustomizeIndex.FacialFeature2.ToNameU8();
nameArray[(int)CustomizeIndex.FacialFeature3] = CustomizeIndex.FacialFeature3.ToDefaultName(); nameArray[(int)CustomizeIndex.FacialFeature3] = CustomizeIndex.FacialFeature3.ToNameU8();
nameArray[(int)CustomizeIndex.FacialFeature4] = CustomizeIndex.FacialFeature4.ToDefaultName(); nameArray[(int)CustomizeIndex.FacialFeature4] = CustomizeIndex.FacialFeature4.ToNameU8();
nameArray[(int)CustomizeIndex.FacialFeature5] = CustomizeIndex.FacialFeature5.ToDefaultName(); nameArray[(int)CustomizeIndex.FacialFeature5] = CustomizeIndex.FacialFeature5.ToNameU8();
nameArray[(int)CustomizeIndex.FacialFeature6] = CustomizeIndex.FacialFeature6.ToDefaultName(); nameArray[(int)CustomizeIndex.FacialFeature6] = CustomizeIndex.FacialFeature6.ToNameU8();
nameArray[(int)CustomizeIndex.FacialFeature7] = CustomizeIndex.FacialFeature7.ToDefaultName(); nameArray[(int)CustomizeIndex.FacialFeature7] = CustomizeIndex.FacialFeature7.ToNameU8();
nameArray[(int)CustomizeIndex.LegacyTattoo] = CustomizeIndex.LegacyTattoo.ToDefaultName(); nameArray[(int)CustomizeIndex.LegacyTattoo] = CustomizeIndex.LegacyTattoo.ToNameU8();
nameArray[(int)CustomizeIndex.SmallIris] = CustomizeIndex.SmallIris.ToDefaultName(); nameArray[(int)CustomizeIndex.SmallIris] = CustomizeIndex.SmallIris.ToNameU8();
nameArray[(int)CustomizeIndex.Lipstick] = CustomizeIndex.Lipstick.ToDefaultName(); nameArray[(int)CustomizeIndex.Lipstick] = CustomizeIndex.Lipstick.ToNameU8();
nameArray[(int)CustomizeIndex.FacePaintReversed] = CustomizeIndex.FacePaintReversed.ToDefaultName(); nameArray[(int)CustomizeIndex.FacePaintReversed] = CustomizeIndex.FacePaintReversed.ToNameU8();
return nameArray; return nameArray;
} }
@ -286,7 +289,7 @@ internal class CustomizeSetFactory(
private static MenuType[] GetMenuTypes(CharaMakeType row) private static MenuType[] GetMenuTypes(CharaMakeType row)
{ {
// Set up the menu types for all customizations. // Set up the menu types for all customizations.
return Enum.GetValues<CustomizeIndex>().Select(c => return CustomizeIndex.Values.Select(c =>
{ {
// Those types are not correctly given in the menu, so special case them to color pickers. // Those types are not correctly given in the menu, so special case them to color pickers.
switch (c) switch (c)
@ -370,13 +373,13 @@ internal class CustomizeSetFactory(
internal static void SetOrder(CustomizeSet set) internal static void SetOrder(CustomizeSet set)
{ {
var ret = Enum.GetValues<CustomizeIndex>().ToArray(); var ret = CustomizeIndex.Values.ToArray();
ret[(int)CustomizeIndex.TattooColor] = CustomizeIndex.EyeColorLeft; ret[(int)CustomizeIndex.TattooColor] = CustomizeIndex.EyeColorLeft;
ret[(int)CustomizeIndex.EyeColorLeft] = CustomizeIndex.EyeColorRight; ret[(int)CustomizeIndex.EyeColorLeft] = CustomizeIndex.EyeColorRight;
ret[(int)CustomizeIndex.EyeColorRight] = CustomizeIndex.TattooColor; ret[(int)CustomizeIndex.EyeColorRight] = CustomizeIndex.TattooColor;
var dict = ret.Skip(2).Where(set.IsAvailable).GroupBy(set.Type).ToDictionary(k => k.Key, k => k.ToArray()); var dict = ret.Skip(2).Where(set.IsAvailable).GroupBy(set.Type).ToDictionary(k => k.Key, k => k.ToArray());
foreach (var type in Enum.GetValues<MenuType>()) foreach (var type in MenuType.Values)
dict.TryAdd(type, []); dict.TryAdd(type, []);
set.Order = dict; set.Order = dict;
} }
@ -443,4 +446,9 @@ internal class CustomizeSetFactory(
static (CustomizeData, CustomizeData) Create(CustomizeIndex i, uint data) static (CustomizeData, CustomizeData) Create(CustomizeIndex i, uint data)
=> (new CustomizeData(i, CustomizeValue.Zero, data), new CustomizeData(i, CustomizeValue.Max, data, 1)); => (new CustomizeData(i, CustomizeValue.Zero, data), new CustomizeData(i, CustomizeValue.Max, data, 1));
} }
/// <summary> Check whether an icon exists. </summary>
private bool IconExists(uint iconId)
=> textures.TryGetIconPath(new GameIconLookup(iconId), out _)
|| textures.TryGetIconPath(new GameIconLookup(iconId, false, false), out _);
} }

View file

@ -6,6 +6,7 @@ using Glamourer.Gui;
using Glamourer.Interop; using Glamourer.Interop;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using ImSharp;
using Luna; using Luna;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Logger = OtterGui.Log.Logger; using Logger = OtterGui.Log.Logger;
@ -109,7 +110,7 @@ public class Glamourer : IDalamudPlugin
sb.AppendLine("**State**"); sb.AppendLine("**State**");
foreach (var (ident, state) in states) foreach (var (ident, state) in states)
{ {
var sources = Enum.GetValues<StateSource>().Select(s => (0, s)).ToArray(); var sources = StateSource.Values.Select(s => (0, s)).ToArray();
foreach (var source in StateIndex.All.Select(s => state.Sources[s])) foreach (var source in StateIndex.All.Select(s => state.Sources[s]))
++sources[(int)source].Item1; ++sources[(int)source].Item1;
foreach (var material in state.Materials.Values) foreach (var material in state.Materials.Values)

View file

@ -21,11 +21,11 @@ public partial class CustomizationDrawer
if (_withApply) if (_withApply)
{ {
using var disabled = Im.Disabled(_locked); using var disabled = Im.Disabled(_locked);
if (UiHelpers.DrawCheckbox("##applyGender", "Apply gender of this design.", ChangeApply.HasFlag(CustomizeFlag.Gender), if (UiHelpers.DrawCheckbox("##applyGender"u8, "Apply gender of this design."u8, ChangeApply.HasFlag(CustomizeFlag.Gender),
out var applyGender, _locked)) out var applyGender, _locked))
ChangeApply = applyGender ? ChangeApply | CustomizeFlag.Gender : ChangeApply & ~CustomizeFlag.Gender; ChangeApply = applyGender ? ChangeApply | CustomizeFlag.Gender : ChangeApply & ~CustomizeFlag.Gender;
Im.Line.Same(); Im.Line.Same();
if (UiHelpers.DrawCheckbox("##applyClan", "Apply clan of this design.", ChangeApply.HasFlag(CustomizeFlag.Clan), out var applyClan, if (UiHelpers.DrawCheckbox("##applyClan"u8, "Apply clan of this design."u8, ChangeApply.HasFlag(CustomizeFlag.Clan), out var applyClan,
_locked)) _locked))
ChangeApply = applyClan ? ChangeApply | CustomizeFlag.Clan : ChangeApply & ~CustomizeFlag.Clan; ChangeApply = applyClan ? ChangeApply | CustomizeFlag.Clan : ChangeApply & ~CustomizeFlag.Clan;
Im.Line.Same(); Im.Line.Same();

View file

@ -252,7 +252,7 @@ public partial class CustomizationDrawer
var tmp = _currentByte != CustomizeValue.Zero; var tmp = _currentByte != CustomizeValue.Zero;
if (_withApply) if (_withApply)
{ {
switch (UiHelpers.DrawMetaToggle(_currentIndex.ToDefaultName(), tmp, _currentApply, out var newValue, out var newApply, _locked)) switch (UiHelpers.DrawMetaToggle(_currentIndex.ToNameU8(), tmp, _currentApply, out var newValue, out var newApply, _locked))
{ {
case (true, false): case (true, false):
_customize.Set(idx, newValue ? CustomizeValue.Max : CustomizeValue.Zero); _customize.Set(idx, newValue ? CustomizeValue.Max : CustomizeValue.Zero);
@ -278,20 +278,20 @@ public partial class CustomizationDrawer
} }
Im.Line.Same(); Im.Line.Same();
Im.Text(_currentIndex.ToDefaultName()); Im.Text(_currentIndex.ToNameU8());
} }
} }
private void ApplyCheckbox() private void ApplyCheckbox()
{ {
if (UiHelpers.DrawCheckbox("##apply", $"Apply the {_currentOption} customization in this design.", _currentApply, out _, _locked)) if (UiHelpers.DrawCheckbox("##apply"u8, $"Apply the {_currentOption} customization in this design.", _currentApply, out _, _locked))
ToggleApply(); ToggleApply();
} }
private void ApplyCheckbox(CustomizeIndex index) private void ApplyCheckbox(CustomizeIndex index)
{ {
using var id = SetId(index); using var id = SetId(index);
if (UiHelpers.DrawCheckbox("##apply", $"Apply the {_currentOption} customization in this design.", _currentApply, out _, _locked)) if (UiHelpers.DrawCheckbox("##apply"u8, $"Apply the {_currentOption} customization in this design.", _currentApply, out _, _locked))
ToggleApply(); ToggleApply();
} }

View file

@ -262,7 +262,7 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import
private static void DrawApply(in CustomizeParameterDrawData data) private static void DrawApply(in CustomizeParameterDrawData data)
{ {
if (UiHelpers.DrawCheckbox("##apply", "Apply this custom parameter when applying the Design.", data.CurrentApply, out var enabled, if (UiHelpers.DrawCheckbox("##apply"u8, "Apply this custom parameter when applying the Design."u8, data.CurrentApply, out var enabled,
data.Locked)) data.Locked))
data.ChangeApplyParameter(enabled); data.ChangeApplyParameter(enabled);
} }

View file

@ -60,7 +60,7 @@ public abstract class DesignComboBase : FilterComboCache<Tuple<IDesignStandIn, s
} }
case QuickSelectedDesign quickDesign: case QuickSelectedDesign quickDesign:
{ {
using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.NormalDesign.Value()); using var color = ImGuiColor.Text.Push(ColorId.NormalDesign.Value());
ret = base.DrawSelectable(globalIdx, selected); ret = base.DrawSelectable(globalIdx, selected);
DrawResolvedDesign(quickDesign); DrawResolvedDesign(quickDesign);
return ret; return ret;
@ -74,7 +74,7 @@ public abstract class DesignComboBase : FilterComboCache<Tuple<IDesignStandIn, s
if (path.Length <= 0 || realDesign.Name == path) if (path.Length <= 0 || realDesign.Name == path)
return; return;
DrawRightAligned(realDesign.Name, path, ImGui.GetColorU32(ImGuiCol.TextDisabled)); DrawRightAligned(realDesign.Name, path, ImGuiColor.TextDisabled.Get().Color);
} }
private void DrawResolvedDesign(QuickSelectedDesign quickDesign) private void DrawResolvedDesign(QuickSelectedDesign quickDesign)
@ -95,12 +95,12 @@ public abstract class DesignComboBase : FilterComboCache<Tuple<IDesignStandIn, s
bool ret; bool ret;
using (currentDesign is not null ? ImGuiColor.Text.Push(DesignColors.GetColor(currentDesign as Design)) : null) using (currentDesign is not null ? ImGuiColor.Text.Push(DesignColors.GetColor(currentDesign as Design)) : null)
{ {
ret = Draw("##design", name, string.Empty, width, ImGui.GetTextLineHeightWithSpacing()) && CurrentSelection is not null; ret = Draw("##design", name, string.Empty, width, Im.Style.TextHeightWithSpacing) && CurrentSelection is not null;
} }
if (currentDesign is Design design) if (currentDesign is Design design)
{ {
if (ImGui.IsItemClicked(ImGuiMouseButton.Right) && ImGui.GetIO().KeyCtrl) if (Im.Item.RightClicked() && Im.Io.KeyControl)
TabSelected.Invoke(MainTabType.Designs, design); TabSelected.Invoke(MainTabType.Designs, design);
ImGuiUtil.HoverTooltip("Control + Right-Click to move to design."); ImGuiUtil.HoverTooltip("Control + Right-Click to move to design.");
} }
@ -363,7 +363,7 @@ public sealed class SpecialDesignCombo(
{ {
public void Draw(AutoDesignSet set, AutoDesign? design, int autoDesignIndex) public void Draw(AutoDesignSet set, AutoDesign? design, int autoDesignIndex)
{ {
if (!Draw(design?.Design, design?.Design.ResolveName(Incognito), ImGui.GetContentRegionAvail().X)) if (!Draw(design?.Design, design?.Design.ResolveName(Incognito), Im.ContentRegion.Available.X))
return; return;
if (autoDesignIndex >= 0) if (autoDesignIndex >= 0)

View file

@ -57,7 +57,7 @@ public sealed class BonusItemCombo : FilterComboCache<EquipItem>
_innerWidth = innerWidth; _innerWidth = innerWidth;
_currentItem = previewIdx; _currentItem = previewIdx;
CustomVariant = 0; CustomVariant = 0;
return Draw($"##{Label}", previewName, string.Empty, width, ImGui.GetTextLineHeightWithSpacing()); return Draw($"##{Label}", previewName, string.Empty, width, Im.Style.TextHeightWithSpacing);
} }
protected override float GetFilterWidth() protected override float GetFilterWidth()
@ -77,7 +77,7 @@ public sealed class BonusItemCombo : FilterComboCache<EquipItem>
Im.Line.Same(); Im.Line.Same();
var ret = ImGui.Selectable(name, selected); var ret = ImGui.Selectable(name, selected);
Im.Line.Same(); Im.Line.Same();
using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080); using var color = ImGuiColor.Text.Push(0xFF808080);
ImGuiUtil.RightAlign($"({obj.PrimaryId.Id}-{obj.Variant.Id})"); ImGuiUtil.RightAlign($"({obj.PrimaryId.Id}-{obj.Variant.Id})");
return ret; return ret;
} }
@ -110,7 +110,7 @@ public sealed class BonusItemCombo : FilterComboCache<EquipItem>
protected override void OnClosePopup() protected override void OnClosePopup()
{ {
// If holding control while the popup closes, try to parse the input as a full pair of set id and variant, and set a custom item for that. // If holding control while the popup closes, try to parse the input as a full pair of set id and variant, and set a custom item for that.
if (!ImGui.GetIO().KeyCtrl) if (!Im.Io.KeyControl)
return; return;
var split = Filter.Text.Split('-', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var split = Filter.Text.Split('-', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);

View file

@ -1,16 +1,15 @@
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Utility;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Glamourer.Events; using Glamourer.Events;
using Glamourer.Gui.Materials; using Glamourer.Gui.Materials;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using ImSharp; using ImSharp;
using Luna;
using Penumbra.GameData.Data; using Penumbra.GameData.Data;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
using MouseWheelType = OtterGui.Widgets.MouseWheelType;
namespace Glamourer.Gui.Equipment; namespace Glamourer.Gui.Equipment;
@ -51,7 +50,7 @@ public class EquipmentDrawer
_itemCombo = EquipSlotExtensions.EqdpSlots.Select(e => new ItemCombo(gameData, items, e, Glamourer.Log, favorites)).ToArray(); _itemCombo = EquipSlotExtensions.EqdpSlots.Select(e => new ItemCombo(gameData, items, e, Glamourer.Log, favorites)).ToArray();
_bonusItemCombo = BonusExtensions.AllFlags.Select(f => new BonusItemCombo(gameData, items, f, Glamourer.Log, favorites)).ToArray(); _bonusItemCombo = BonusExtensions.AllFlags.Select(f => new BonusItemCombo(gameData, items, f, Glamourer.Log, favorites)).ToArray();
_weaponCombo = new Dictionary<FullEquipType, WeaponCombo>(FullEquipTypeExtensions.WeaponTypes.Count * 2); _weaponCombo = new Dictionary<FullEquipType, WeaponCombo>(FullEquipTypeExtensions.WeaponTypes.Count * 2);
foreach (var type in Enum.GetValues<FullEquipType>()) foreach (var type in FullEquipType.Values)
{ {
if (type.ToSlot() is EquipSlot.MainHand) if (type.ToSlot() is EquipSlot.MainHand)
_weaponCombo.TryAdd(type, new WeaponCombo(items, type, Glamourer.Log, favorites)); _weaponCombo.TryAdd(type, new WeaponCombo(items, type, Glamourer.Log, favorites));
@ -142,7 +141,7 @@ public class EquipmentDrawer
{ {
if (data.DisplayApplication) if (data.DisplayApplication)
{ {
var (valueChanged, applyChanged) = UiHelpers.DrawMetaToggle(data.Label.ToString(), data.CurrentValue, data.CurrentApply, var (valueChanged, applyChanged) = UiHelpers.DrawMetaToggle(data.Label, data.CurrentValue, data.CurrentApply,
out var newValue, out var newValue,
out var newApply, data.Locked); out var newApply, data.Locked);
if (valueChanged) if (valueChanged)
@ -152,7 +151,7 @@ public class EquipmentDrawer
} }
else else
{ {
if (UiHelpers.DrawCheckbox(data.Label.ToString(), data.Tooltip.ToString(), data.CurrentValue, out var newValue, data.Locked)) if (UiHelpers.DrawCheckbox(data.Label, data.Tooltip, data.CurrentValue, out var newValue, data.Locked))
data.SetValue(newValue); data.SetValue(newValue);
} }
} }
@ -160,7 +159,7 @@ public class EquipmentDrawer
public bool DrawAllStain(out StainIds ret, bool locked) public bool DrawAllStain(out StainIds ret, bool locked)
{ {
using var disabled = Im.Disabled(locked); using var disabled = Im.Disabled(locked);
var change = _stainCombo.Draw("Dye All Slots", Stain.None.RgbaColor, string.Empty, false, false, MouseWheelType.None); var change = _stainCombo.Draw("Dye All Slots", Stain.None.RgbaColor, string.Empty, false, false, OtterGui.Widgets.MouseWheelType.None);
ret = StainIds.None; ret = StainIds.None;
if (change) if (change)
if (_stainData.TryGetValue(_stainCombo.CurrentSelection.Key, out var stain)) if (_stainData.TryGetValue(_stainCombo.CurrentSelection.Key, out var stain))
@ -210,7 +209,8 @@ public class EquipmentDrawer
private void DrawBonusItemSmall(in BonusDrawData bonusDrawData) private void DrawBonusItemSmall(in BonusDrawData bonusDrawData)
{ {
ImGui.Dummy(new Vector2(StainId.NumStains * ImUtf8.FrameHeight + (StainId.NumStains - 1) * ImUtf8.ItemSpacing.X, ImUtf8.FrameHeight)); Im.Dummy(new Vector2(StainId.NumStains * Im.Style.FrameHeight + (StainId.NumStains - 1) * Im.Style.ItemSpacing.X,
Im.Style.FrameHeight));
Im.Line.Same(); Im.Line.Same();
DrawBonusItem(bonusDrawData, out var label, true, false, false); DrawBonusItem(bonusDrawData, out var label, true, false, false);
if (bonusDrawData.DisplayApplication) if (bonusDrawData.DisplayApplication)
@ -275,10 +275,10 @@ public class EquipmentDrawer
private void DrawEquipNormal(in EquipDrawData equipDrawData) private void DrawEquipNormal(in EquipDrawData equipDrawData)
{ {
equipDrawData.CurrentItem.DrawIcon(_textures, _iconSize, equipDrawData.Slot); equipDrawData.CurrentItem.DrawIcon(_textures, _iconSize, equipDrawData.Slot);
var right = ImGui.IsItemClicked(ImGuiMouseButton.Right); var right = Im.Item.RightClicked();
var left = ImGui.IsItemClicked(ImGuiMouseButton.Left); var left = Im.Item.Clicked();
Im.Line.Same(); Im.Line.Same();
using var group = ImRaii.Group(); using var group = Im.Group();
DrawItem(equipDrawData, out var label, false, right, left); DrawItem(equipDrawData, out var label, false, right, left);
if (equipDrawData.DisplayApplication) if (equipDrawData.DisplayApplication)
{ {
@ -302,15 +302,15 @@ public class EquipmentDrawer
if (VerifyRestrictedGear(equipDrawData)) if (VerifyRestrictedGear(equipDrawData))
{ {
Im.Line.Same(); Im.Line.Same();
ImUtf8.Text("(Restricted)"u8); Im.Text("(Restricted)"u8);
} }
} }
private void DrawBonusItemNormal(in BonusDrawData bonusDrawData) private void DrawBonusItemNormal(in BonusDrawData bonusDrawData)
{ {
bonusDrawData.CurrentItem.DrawIcon(_textures, _iconSize, bonusDrawData.Slot); bonusDrawData.CurrentItem.DrawIcon(_textures, _iconSize, bonusDrawData.Slot);
var right = ImGui.IsItemClicked(ImGuiMouseButton.Right); var right = Im.Item.RightClicked();
var left = ImGui.IsItemClicked(ImGuiMouseButton.Left); var left = Im.Item.Clicked();
Im.Line.Same(); Im.Line.Same();
DrawBonusItem(bonusDrawData, out var label, false, right, left); DrawBonusItem(bonusDrawData, out var label, false, right, left);
if (bonusDrawData.DisplayApplication) if (bonusDrawData.DisplayApplication)
@ -328,13 +328,12 @@ public class EquipmentDrawer
private void DrawWeaponsNormal(EquipDrawData mainhand, EquipDrawData offhand, bool allWeapons) private void DrawWeaponsNormal(EquipDrawData mainhand, EquipDrawData offhand, bool allWeapons)
{ {
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, using var style = ImStyleDouble.ItemSpacing.PushX(Im.Style.ItemInnerSpacing.X);
Im.Style.ItemInnerSpacing with { Y = Im.Style.ItemSpacing.Y });
mainhand.CurrentItem.DrawIcon(_textures, _iconSize, EquipSlot.MainHand); mainhand.CurrentItem.DrawIcon(_textures, _iconSize, EquipSlot.MainHand);
var left = ImGui.IsItemClicked(ImGuiMouseButton.Left); var left = Im.Item.Clicked();
Im.Line.Same(); Im.Line.Same();
using (ImUtf8.Group()) using (Im.Group())
{ {
DrawMainhand(ref mainhand, ref offhand, out var mainhandLabel, allWeapons, false, left); DrawMainhand(ref mainhand, ref offhand, out var mainhandLabel, allWeapons, false, left);
if (mainhand.DisplayApplication) if (mainhand.DisplayApplication)
@ -362,10 +361,10 @@ public class EquipmentDrawer
return; return;
offhand.CurrentItem.DrawIcon(_textures, _iconSize, EquipSlot.OffHand); offhand.CurrentItem.DrawIcon(_textures, _iconSize, EquipSlot.OffHand);
var right = ImGui.IsItemClicked(ImGuiMouseButton.Right); var right = Im.Item.RightClicked();
left = ImGui.IsItemClicked(ImGuiMouseButton.Left); left = Im.Item.Clicked();
Im.Line.Same(); Im.Line.Same();
using (ImUtf8.Group()) using (Im.Group())
{ {
DrawOffhand(mainhand, offhand, out var offhandLabel, false, right, left); DrawOffhand(mainhand, offhand, out var offhandLabel, false, right, left);
if (offhand.DisplayApplication) if (offhand.DisplayApplication)
@ -391,11 +390,11 @@ public class EquipmentDrawer
private void DrawStain(in EquipDrawData data, bool small) private void DrawStain(in EquipDrawData data, bool small)
{ {
using var disabled = ImRaii.Disabled(data.Locked); using var disabled = Im.Disabled(data.Locked);
var width = (_comboLength - ImUtf8.ItemInnerSpacing.X * (data.CurrentStains.Count - 1)) / data.CurrentStains.Count; var width = (_comboLength - Im.Style.ItemInnerSpacing.X * (data.CurrentStains.Count - 1)) / data.CurrentStains.Count;
foreach (var (stainId, index) in data.CurrentStains.WithIndex()) foreach (var (index, stainId) in data.CurrentStains.Index())
{ {
using var id = ImUtf8.PushId(index); using var id = Im.Id.Push(index);
var found = _stainData.TryGetValue(stainId, out var stain); var found = _stainData.TryGetValue(stainId, out var stain);
var change = small var change = small
? _stainCombo.Draw($"##stain{data.Slot}", stain.RgbaColor, stain.Name, found, stain.Gloss) ? _stainCombo.Draw($"##stain{data.Slot}", stain.RgbaColor, stain.Name, found, stain.Gloss)
@ -406,7 +405,7 @@ public class EquipmentDrawer
DrawStainDragDrop(data, index, stain, found); DrawStainDragDrop(data, index, stain, found);
if (index < data.CurrentStains.Count - 1) if (index < data.CurrentStains.Count - 1)
ImUtf8.SameLineInner(); Im.Line.SameInner();
if (change) if (change)
if (_stainData.TryGetValue(_stainCombo.CurrentSelection.Key, out stain)) if (_stainData.TryGetValue(_stainCombo.CurrentSelection.Key, out stain))
@ -423,16 +422,16 @@ public class EquipmentDrawer
{ {
if (found) if (found)
{ {
using var dragSource = ImUtf8.DragDropSource(); using var dragSource = Im.DragDrop.Source();
if (dragSource.Success) if (dragSource.Success)
{ {
DragDropSource.SetPayload("stainDragDrop"u8); dragSource.SetPayload("stainDragDrop"u8);
_draggedStain = stain; _draggedStain = stain;
ImUtf8.Text($"Dragging {stain.Name}..."); Im.Text($"Dragging {stain.Name}...");
} }
} }
using var dragTarget = ImUtf8.DragDropTarget(); using var dragTarget = Im.DragDrop.Target();
if (dragTarget.IsDropping("stainDragDrop"u8) && _draggedStain.HasValue) if (dragTarget.IsDropping("stainDragDrop"u8) && _draggedStain.HasValue)
{ {
data.SetStains(data.CurrentStains.With(index, _draggedStain.Value.RowIndex)); data.SetStains(data.CurrentStains.With(index, _draggedStain.Value.RowIndex));
@ -449,7 +448,7 @@ public class EquipmentDrawer
if (!data.Locked && open) if (!data.Locked && open)
UiHelpers.OpenCombo($"##{combo.Label}"); UiHelpers.OpenCombo($"##{combo.Label}");
using var disabled = ImRaii.Disabled(data.Locked); using var disabled = Im.Disabled(data.Locked);
var change = combo.Draw(data.CurrentItem.Name, data.CurrentItem.ItemId, small ? _comboLength - Im.Style.FrameHeight : _comboLength, var change = combo.Draw(data.CurrentItem.Name, data.CurrentItem.ItemId, small ? _comboLength - Im.Style.FrameHeight : _comboLength,
_requiredComboWidth); _requiredComboWidth);
DrawGearDragDrop(data); DrawGearDragDrop(data);
@ -471,15 +470,15 @@ public class EquipmentDrawer
if (!data.Locked && open) if (!data.Locked && open)
UiHelpers.OpenCombo($"##{combo.Label}"); UiHelpers.OpenCombo($"##{combo.Label}");
using var disabled = ImRaii.Disabled(data.Locked); using var disabled = Im.Disabled(data.Locked);
var change = combo.Draw(data.CurrentItem.Name, data.CurrentItem.Id.BonusItem, var change = combo.Draw(data.CurrentItem.Name, data.CurrentItem.Id.BonusItem,
small ? _comboLength - Im.Style.FrameHeight : _comboLength, small ? _comboLength - Im.Style.FrameHeight : _comboLength,
_requiredComboWidth); _requiredComboWidth);
if (ImGui.IsItemHovered() && ImGui.GetIO().KeyCtrl) if (Im.Item.Hovered() && Im.Io.KeyControl)
{ {
if (ImGui.IsKeyPressed(ImGuiKey.C)) if (Im.Keyboard.IsPressed(Key.C))
_itemCopy.Copy(combo.CurrentSelection); _itemCopy.Copy(combo.CurrentSelection);
else if (ImGui.IsKeyPressed(ImGuiKey.V)) else if (Im.Keyboard.IsPressed(Key.V))
_itemCopy.Paste(data.Slot.ToEquipType(), data.SetItem); _itemCopy.Paste(data.Slot.ToEquipType(), data.SetItem);
} }
@ -497,15 +496,15 @@ public class EquipmentDrawer
{ {
if (data.CurrentItem.Valid) if (data.CurrentItem.Valid)
{ {
using var dragSource = ImUtf8.DragDropSource(); using var dragSource = Im.DragDrop.Source();
if (dragSource.Success) if (dragSource.Success)
{ {
DragDropSource.SetPayload("equipDragDrop"u8); dragSource.SetPayload("equipDragDrop"u8);
_draggedItem.Update(_items, data.CurrentItem, data.Slot); _draggedItem.Update(_items, data.CurrentItem, data.Slot);
} }
} }
using var dragTarget = ImUtf8.DragDropTarget(); using var dragTarget = Im.DragDrop.Target();
if (!dragTarget) if (!dragTarget)
return; return;
@ -521,21 +520,20 @@ public class EquipmentDrawer
_draggedItem.Clear(); _draggedItem.Clear();
} }
public unsafe void DrawDragDropTooltip() public void DrawDragDropTooltip()
{ {
var payload = ImGui.GetDragDropPayload().Handle; var payload = Im.DragDrop.PeekPayload();
if (payload is null) if (!payload.Valid)
return; return;
if (!MemoryMarshal.CreateReadOnlySpanFromNullTerminated((byte*)Unsafe.AsPointer(ref payload->DataType_0)) if (!payload.CheckType("equipDragDrop"u8))
.SequenceEqual("equipDragDrop"u8))
return; return;
using var tt = ImUtf8.Tooltip(); using var tt = Im.Tooltip.Begin();
if (_dragTarget is EquipSlot.Unknown) if (_dragTarget is EquipSlot.Unknown)
ImUtf8.Text($"Dragging {_draggedItem.Dragged.Name}..."); Im.Text($"Dragging {_draggedItem.Dragged.Name}...");
else else
ImUtf8.Text($"Converting to {_draggedItem[_dragTarget].Name}..."); Im.Text($"Converting to {_draggedItem[_dragTarget].Name}...");
} }
private static bool ResetOrClear<T>(bool locked, bool clicked, bool allowRevert, bool allowClear, private static bool ResetOrClear<T>(bool locked, bool clicked, bool allowRevert, bool allowClear,
@ -547,21 +545,25 @@ public class EquipmentDrawer
return false; return false;
} }
clicked = clicked || ImGui.IsItemClicked(ImGuiMouseButton.Right); clicked = clicked || Im.Item.RightClicked();
(var tt, item, var valid) = (allowRevert && !revertItem.Equals(currentItem), allowClear && !clearItem.Equals(currentItem), (var tt, item, var valid) = (allowRevert && !revertItem.Equals(currentItem), allowClear && !clearItem.Equals(currentItem),
ImGui.GetIO().KeyCtrl) switch Im.Io.KeyControl) switch
{ {
(true, true, true) => ("Right-click to clear. Control and Right-Click to revert to game.\nControl and mouse wheel to scroll.", (true, true, true) => RefTuple.Create(
"Right-click to clear. Control and Right-Click to revert to game.\nControl and mouse wheel to scroll."u8,
revertItem, true), revertItem, true),
(true, true, false) => ("Right-click to clear. Control and Right-Click to revert to game.\nControl and mouse wheel to scroll.", (true, true, false) => RefTuple.Create(
"Right-click to clear. Control and Right-Click to revert to game.\nControl and mouse wheel to scroll."u8,
clearItem, true), clearItem, true),
(true, false, true) => ("Control and Right-Click to revert to game.\nControl and mouse wheel to scroll.", revertItem, true), (true, false, true) => RefTuple.Create("Control and Right-Click to revert to game.\nControl and mouse wheel to scroll."u8,
(true, false, false) => ("Control and Right-Click to revert to game.\nControl and mouse wheel to scroll.", default, false), revertItem, true),
(false, true, _) => ("Right-click to clear.\nControl and mouse wheel to scroll.", clearItem, true), (true, false, false) => RefTuple.Create("Control and Right-Click to revert to game.\nControl and mouse wheel to scroll."u8,
(false, false, _) => ("Control and mouse wheel to scroll.", default, false), (T?)default!, false),
(false, true, _) => RefTuple.Create("Right-click to clear.\nControl and mouse wheel to scroll."u8, clearItem, true),
(false, false, _) => RefTuple.Create("Control and mouse wheel to scroll."u8, (T?)default!, false),
}; };
ImUtf8.HoverTooltip(tt); Im.Tooltip.OnHover(tt);
return clicked && valid; return clicked && valid;
} }
@ -577,9 +579,9 @@ public class EquipmentDrawer
label = combo.Label; label = combo.Label;
var unknown = !_gPose.InGPose && mainhand.CurrentItem.Type is FullEquipType.Unknown; var unknown = !_gPose.InGPose && mainhand.CurrentItem.Type is FullEquipType.Unknown;
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Im.Style.ItemInnerSpacing); using var style = ImStyleDouble.ItemSpacing.Push(Im.Style.ItemInnerSpacing);
EquipItem? changedItem = null; EquipItem? changedItem = null;
using (var _ = ImRaii.Disabled(mainhand.Locked | unknown)) using (Im.Disabled(mainhand.Locked | unknown))
{ {
if (!mainhand.Locked && open) if (!mainhand.Locked && open)
UiHelpers.OpenCombo($"##{label}"); UiHelpers.OpenCombo($"##{label}");
@ -609,7 +611,7 @@ public class EquipmentDrawer
} }
if (unknown) if (unknown)
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled,
"The weapon type could not be identified, thus changing it to other weapons of that type is not possible."u8); "The weapon type could not be identified, thus changing it to other weapons of that type is not possible."u8);
} }
@ -624,7 +626,7 @@ public class EquipmentDrawer
label = combo.Label; label = combo.Label;
var locked = offhand.Locked var locked = offhand.Locked
|| !_gPose.InGPose && (offhand.CurrentItem.Type.IsUnknown() || mainhand.CurrentItem.Type.IsUnknown()); || !_gPose.InGPose && (offhand.CurrentItem.Type.IsUnknown() || mainhand.CurrentItem.Type.IsUnknown());
using var disabled = ImRaii.Disabled(locked); using var disabled = Im.Disabled(locked);
if (!locked && open) if (!locked && open)
UiHelpers.OpenCombo($"##{combo.Label}"); UiHelpers.OpenCombo($"##{combo.Label}");
if (combo.Draw(offhand.CurrentItem.Name, offhand.CurrentItem.ItemId, small ? _comboLength - Im.Style.FrameHeight : _comboLength, if (combo.Draw(offhand.CurrentItem.Name, offhand.CurrentItem.ItemId, small ? _comboLength - Im.Style.FrameHeight : _comboLength,
@ -642,21 +644,24 @@ public class EquipmentDrawer
private static void DrawApply(in EquipDrawData data) private static void DrawApply(in EquipDrawData data)
{ {
if (UiHelpers.DrawCheckbox($"##apply{data.Slot}", "Apply this item when applying the Design.", data.CurrentApply, out var enabled, using var id = Im.Id.Push((int)data.Slot);
if (UiHelpers.DrawCheckbox("##apply"u8, "Apply this item when applying the Design."u8, data.CurrentApply, out var enabled,
data.Locked)) data.Locked))
data.SetApplyItem(enabled); data.SetApplyItem(enabled);
} }
private static void DrawApply(in BonusDrawData data) private static void DrawApply(in BonusDrawData data)
{ {
if (UiHelpers.DrawCheckbox($"##apply{data.Slot}", "Apply this bonus item when applying the Design.", data.CurrentApply, out var enabled, using var id = Im.Id.Push((int)data.Slot);
if (UiHelpers.DrawCheckbox("##apply"u8, "Apply this bonus item when applying the Design."u8, data.CurrentApply, out var enabled,
data.Locked)) data.Locked))
data.SetApplyItem(enabled); data.SetApplyItem(enabled);
} }
private static void DrawApplyStain(in EquipDrawData data) private static void DrawApplyStain(in EquipDrawData data)
{ {
if (UiHelpers.DrawCheckbox($"##applyStain{data.Slot}", "Apply this dye to the item when applying the Design.", data.CurrentApplyStain, using var id = Im.Id.Push((int)data.Slot);
if (UiHelpers.DrawCheckbox("##applyStain"u8, "Apply this dye to the item when applying the Design."u8, data.CurrentApplyStain,
out var enabled, out var enabled,
data.Locked)) data.Locked))
data.SetApplyStain(enabled); data.SetApplyStain(enabled);
@ -666,30 +671,29 @@ public class EquipmentDrawer
private void WeaponHelpMarker(bool hasAdvancedDyes, string label, string? type = null) private void WeaponHelpMarker(bool hasAdvancedDyes, string label, string? type = null)
{ {
Im.Line.Same(); LunaStyle.DrawAlignedHelpMarker(
ImGuiComponents.HelpMarker( "Changing weapons to weapons of different types can cause crashes, freezes, soft- and hard locks and cheating, "u8
"Changing weapons to weapons of different types can cause crashes, freezes, soft- and hard locks and cheating, " + "thus it is only allowed to change weapons to other weapons of the same type."u8);
+ "thus it is only allowed to change weapons to other weapons of the same type.");
DrawEquipLabel(hasAdvancedDyes, label); DrawEquipLabel(hasAdvancedDyes, label);
if (type == null) if (type is null)
return; return;
var pos = ImGui.GetItemRectMin(); var pos = Im.Item.UpperLeftCorner;
pos.Y += Im.Style.FrameHeightWithSpacing; pos.Y += Im.Style.FrameHeightWithSpacing;
ImGui.GetWindowDrawList().AddText(pos, ImGui.GetColorU32(ImGuiCol.Text), $"({type})"); Im.Window.DrawList.Text(pos, ImGuiColor.Text.Get(), $"({type})");
} }
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
private void DrawEquipLabel(bool hasAdvancedDyes, string label) private void DrawEquipLabel(bool hasAdvancedDyes, string label)
{ {
Im.Line.Same(); Im.Line.Same();
using (ImRaii.PushColor(ImGuiCol.Text, _advancedMaterialColor, hasAdvancedDyes)) using (ImGuiColor.Text.Push(_advancedMaterialColor, hasAdvancedDyes))
{ {
ImUtf8.Text(label); Im.Text(label);
} }
if (hasAdvancedDyes) if (hasAdvancedDyes)
ImUtf8.HoverTooltip("This design has advanced dyes setup for this slot."u8); Im.Tooltip.OnHover("This design has advanced dyes setup for this slot."u8);
} }
} }

View file

@ -21,7 +21,7 @@ public sealed class GlamourerColorCombo(float _comboWidth, DictStain _stains, Fa
if (globalIdx == 0) if (globalIdx == 0)
{ {
using var font = ImRaii.PushFont(UiBuilder.IconFont); using var font = ImRaii.PushFont(UiBuilder.IconFont);
ImGui.Dummy(ImGui.CalcTextSize(FontAwesomeIcon.Star.ToIconString())); Im.Dummy(ImGui.CalcTextSize(FontAwesomeIcon.Star.ToIconString()));
} }
else else
{ {
@ -31,7 +31,7 @@ public sealed class GlamourerColorCombo(float _comboWidth, DictStain _stains, Fa
Im.Line.Same(); Im.Line.Same();
} }
var buttonWidth = ImGui.GetContentRegionAvail().X; var buttonWidth = Im.ContentRegion.Available.X;
var totalWidth = ImGui.GetContentRegionMax().X; var totalWidth = ImGui.GetContentRegionMax().X;
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(buttonWidth / 2 / totalWidth, 0.5f)); using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(buttonWidth / 2 / totalWidth, 0.5f));

View file

@ -57,7 +57,7 @@ public sealed class ItemCombo : FilterComboCache<EquipItem>
_innerWidth = innerWidth; _innerWidth = innerWidth;
_currentItem = previewIdx; _currentItem = previewIdx;
CustomVariant = 0; CustomVariant = 0;
return Draw($"##{Label}", previewName, string.Empty, width, ImGui.GetTextLineHeightWithSpacing()); return Draw($"##{Label}", previewName, string.Empty, width, Im.Style.TextHeightWithSpacing);
} }
protected override float GetFilterWidth() protected override float GetFilterWidth()
@ -77,7 +77,7 @@ public sealed class ItemCombo : FilterComboCache<EquipItem>
Im.Line.Same(); Im.Line.Same();
var ret = ImGui.Selectable(name, selected); var ret = ImGui.Selectable(name, selected);
Im.Line.Same(); Im.Line.Same();
using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080); using var color = ImGuiColor.Text.Push(0xFF808080);
ImUtf8.TextRightAligned($"({obj.PrimaryId.Id}-{obj.Variant.Id})"); ImUtf8.TextRightAligned($"({obj.PrimaryId.Id}-{obj.Variant.Id})");
return ret; return ret;
} }
@ -123,7 +123,7 @@ public sealed class ItemCombo : FilterComboCache<EquipItem>
protected override void OnClosePopup() protected override void OnClosePopup()
{ {
// If holding control while the popup closes, try to parse the input as a full pair of set id and variant, and set a custom item for that. // If holding control while the popup closes, try to parse the input as a full pair of set id and variant, and set a custom item for that.
if (!ImGui.GetIO().KeyCtrl) if (!Im.Io.KeyControl)
return; return;
var split = Filter.Text.Split('-', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var split = Filter.Text.Split('-', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);

View file

@ -11,6 +11,7 @@ using OtterGui.Widgets;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
using MouseWheelType = OtterGui.Widgets.MouseWheelType; using MouseWheelType = OtterGui.Widgets.MouseWheelType;
using Luna;
namespace Glamourer.Gui.Equipment; namespace Glamourer.Gui.Equipment;
@ -25,7 +26,7 @@ public sealed class WeaponCombo : FilterComboCache<EquipItem>
public SecondaryId CustomWeaponId { get; private set; } public SecondaryId CustomWeaponId { get; private set; }
public Variant CustomVariant { get; private set; } public Variant CustomVariant { get; private set; }
public WeaponCombo(ItemManager items, FullEquipType type, Logger log, FavoriteManager favorites) public WeaponCombo(ItemManager items, FullEquipType type, OtterGui.Log.Logger log, FavoriteManager favorites)
: base(() => GetWeapons(favorites, items, type), MouseWheelType.Control, log) : base(() => GetWeapons(favorites, items, type), MouseWheelType.Control, log)
{ {
_favorites = favorites; _favorites = favorites;
@ -55,7 +56,7 @@ public sealed class WeaponCombo : FilterComboCache<EquipItem>
_innerWidth = innerWidth; _innerWidth = innerWidth;
_currentItem = previewIdx; _currentItem = previewIdx;
CustomVariant = 0; CustomVariant = 0;
return Draw($"##{Label}", previewName, string.Empty, width, ImGui.GetTextLineHeightWithSpacing()); return Draw($"##{Label}", previewName, string.Empty, width, Im.Style.TextHeightWithSpacing);
} }
protected override float GetFilterWidth() protected override float GetFilterWidth()
@ -76,7 +77,7 @@ public sealed class WeaponCombo : FilterComboCache<EquipItem>
Im.Line.Same(); Im.Line.Same();
var ret = ImGui.Selectable(name, selected); var ret = ImGui.Selectable(name, selected);
Im.Line.Same(); Im.Line.Same();
using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080); using var color = ImGuiColor.Text.Push(0xFF808080);
ImUtf8.TextRightAligned($"({obj.PrimaryId.Id}-{obj.SecondaryId.Id}-{obj.Variant.Id})"); ImUtf8.TextRightAligned($"({obj.PrimaryId.Id}-{obj.SecondaryId.Id}-{obj.Variant.Id})");
return ret; return ret;
} }
@ -84,7 +85,7 @@ public sealed class WeaponCombo : FilterComboCache<EquipItem>
protected override void OnClosePopup() protected override void OnClosePopup()
{ {
// If holding control while the popup closes, try to parse the input as a full tuple of set id, weapon id and variant, and set a custom item for that. // If holding control while the popup closes, try to parse the input as a full tuple of set id, weapon id and variant, and set a custom item for that.
if (!ImGui.GetIO().KeyCtrl) if (!Im.Io.KeyControl)
return; return;
var split = Filter.Text.Split('-', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var split = Filter.Text.Split('-', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
@ -113,7 +114,7 @@ public sealed class WeaponCombo : FilterComboCache<EquipItem>
if (type is FullEquipType.Unknown) if (type is FullEquipType.Unknown)
{ {
var enumerable = Array.Empty<EquipItem>().AsEnumerable(); var enumerable = Array.Empty<EquipItem>().AsEnumerable();
foreach (var t in Enum.GetValues<FullEquipType>().Where(e => e.ToSlot() is EquipSlot.MainHand)) foreach (var t in FullEquipType.Values.Where(e => e.ToSlot() is EquipSlot.MainHand))
{ {
if (items.ItemData.ByType.TryGetValue(t, out var l)) if (items.ItemData.ByType.TryGetValue(t, out var l))
enumerable = enumerable.Concat(l); enumerable = enumerable.Concat(l);

View file

@ -1,6 +1,4 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.Utility;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Client.Graphics.Render; using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
@ -302,7 +300,7 @@ public sealed unsafe class AdvancedDyePopup(
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Messager.AddMessage(new Notification(ex, "Could not paste color table from clipboard.", Glamourer.Messager.AddMessage(new Notification(ex, "Could not paste color table from clipboard.",
"Could not paste color table from clipboard.", NotificationType.Error)); "Could not paste color table from clipboard."));
} }
table = default; table = default;
@ -311,7 +309,7 @@ public sealed unsafe class AdvancedDyePopup(
private void DrawAllRow(MaterialValueIndex materialIndex, in ColorTable.Table table) private void DrawAllRow(MaterialValueIndex materialIndex, in ColorTable.Table table)
{ {
using var id = Im.Id.Push(100); using var id = Im.Id.Push(100);
ImEx.Icon.Button(LunaStyle.OnHoverIcon, "Highlight all affected colors on the character."u8); ImEx.Icon.Button(LunaStyle.OnHoverIcon, "Highlight all affected colors on the character."u8);
if (Im.Item.Hovered()) if (Im.Item.Hovered())
preview.OnHover(materialIndex with { RowIndex = byte.MaxValue }, _actor.Index, table); preview.OnHover(materialIndex with { RowIndex = byte.MaxValue }, _actor.Index, table);
@ -387,56 +385,55 @@ public sealed unsafe class AdvancedDyePopup(
} }
Im.Line.Same(0, Im.Style.ItemSpacing.X * 2); Im.Line.Same(0, Im.Style.ItemSpacing.X * 2);
var applied = ImEx.ColorPicker("##diffuse"u8, "Change the diffuse value for this row."u8, value.Model.Diffuse, out var newColor, "D"u8); var applied = ImEx.ColorPickerButton("##diffuse"u8, "Change the diffuse value for this row."u8, value.Model.Diffuse,
if (applied) out value.Model.Diffuse, 'D');
value.Model.Diffuse = newColor;
var spacing = Im.Style.ItemInnerSpacing; var spacing = Im.Style.ItemInnerSpacing;
ImGui.SameLine(0, spacing.X); Im.Line.Same(0, spacing.X);
applied |= ImUtf8.ColorPicker("##specular"u8, "Change the specular value for this row."u8, value.Model.Specular, applied |= ImEx.ColorPickerButton("##specular"u8, "Change the specular value for this row."u8, value.Model.Specular,
v => value.Model.Specular = v, "S"u8); out value.Model.Specular, 'S');
ImGui.SameLine(0, spacing.X); Im.Line.Same(0, spacing.X);
applied |= ImUtf8.ColorPicker("##emissive"u8, "Change the emissive value for this row."u8, value.Model.Emissive, applied |= ImEx.ColorPickerButton("##emissive"u8, "Change the emissive value for this row."u8, value.Model.Emissive,
v => value.Model.Emissive = v, "E"u8); out value.Model.Emissive, 'E');
ImGui.SameLine(0, spacing.X); Im.Line.Same(0, spacing.X);
if (_mode is not ColorRow.Mode.Dawntrail) if (_mode is not ColorRow.Mode.Dawntrail)
{ {
ImGui.SetNextItemWidth(100 * Im.Style.GlobalScale); Im.Item.SetNextWidthScaled(100);
applied |= DragGloss(ref value.Model.GlossStrength); applied |= DragGloss(ref value.Model.GlossStrength);
ImUtf8.HoverTooltip("Change the gloss strength for this row."u8); Im.Tooltip.OnHover("Change the gloss strength for this row."u8);
} }
else else
{ {
ImGui.Dummy(new Vector2(100 * Im.Style.GlobalScale, 0)); Im.Dummy(new Vector2(100 * Im.Style.GlobalScale, 0));
} }
ImGui.SameLine(0, spacing.X); Im.Line.Same(0, spacing.X);
if (_mode is not ColorRow.Mode.Dawntrail) if (_mode is not ColorRow.Mode.Dawntrail)
{ {
ImGui.SetNextItemWidth(100 * Im.Style.GlobalScale); Im.Item.SetNextWidthScaled(100);
applied |= DragSpecularStrength(ref value.Model.SpecularStrength); applied |= DragSpecularStrength(ref value.Model.SpecularStrength);
ImUtf8.HoverTooltip("Change the specular strength for this row."u8); Im.Tooltip.OnHover("Change the specular strength for this row."u8);
} }
else else
{ {
ImGui.Dummy(new Vector2(100 * Im.Style.GlobalScale, 0)); Im.Dummy(new Vector2(100 * Im.Style.GlobalScale, 0));
} }
ImGui.SameLine(0, spacing.X); Im.Line.Same(0, spacing.X);
if (ImUtf8.IconButton(FontAwesomeIcon.Clipboard, "Export this row to your clipboard."u8, buttonSize)) if (ImEx.Icon.Button(LunaStyle.ToClipboardIcon, "Export this row to your clipboard."u8))
ColorRowClipboard.Row = value.Model; ColorRowClipboard.Row = value.Model;
ImGui.SameLine(0, spacing.X); Im.Line.Same(0, spacing.X);
if (ImUtf8.IconButton(FontAwesomeIcon.Paste, "Import an exported row from your clipboard onto this row."u8, buttonSize, if (ImEx.Icon.Button(LunaStyle.FromClipboardIcon, "Import an exported row from your clipboard onto this row."u8,
!ColorRowClipboard.IsSet)) !ColorRowClipboard.IsSet))
{ {
value.Model = ColorRowClipboard.Row; value.Model = ColorRowClipboard.Row;
applied = true; applied = true;
} }
ImGui.SameLine(0, spacing.X); Im.Line.Same(0, spacing.X);
if (ImUtf8.IconButton(FontAwesomeIcon.UndoAlt, "Reset this row to game state."u8, buttonSize, !changed)) if (ImEx.Icon.Button(LunaStyle.UndoIcon, "Reset this row to game state."u8, !changed))
stateManager.ResetMaterialValue(_state, index, ApplySettings.Game); stateManager.ResetMaterialValue(_state, index, ApplySettings.Game);
if (applied) if (applied)
@ -446,9 +443,8 @@ public sealed unsafe class AdvancedDyePopup(
public static bool DragGloss(ref float value) public static bool DragGloss(ref float value)
{ {
var tmp = value; var tmp = value;
var minValue = ImGui.GetIO().KeyCtrl ? 0f : (float)Half.Epsilon; var minValue = Im.Io.KeyControl ? 0f : (float)Half.Epsilon;
if (!ImUtf8.DragScalar("##Gloss"u8, ref tmp, "%.1f G"u8, 0.001f, minValue, Math.Max(0.01f, 0.005f * value), if (!Im.Drag("##Gloss"u8, ref tmp, "%.1f G"u8, 0.001f, minValue, Math.Max(0.01f, 0.005f * value), SliderFlags.AlwaysClamp))
ImGuiSliderFlags.AlwaysClamp))
return false; return false;
var tmp2 = Math.Clamp(tmp, minValue, (float)Half.MaxValue); var tmp2 = Math.Clamp(tmp, minValue, (float)Half.MaxValue);
@ -462,8 +458,7 @@ public sealed unsafe class AdvancedDyePopup(
public static bool DragSpecularStrength(ref float value) public static bool DragSpecularStrength(ref float value)
{ {
var tmp = value * 100f; var tmp = value * 100f;
if (!ImUtf8.DragScalar("##SpecularStrength"u8, ref tmp, "%.0f%% SS"u8, 0f, (float)Half.MaxValue * 100f, 0.05f, if (!Im.Drag("##SpecularStrength"u8, ref tmp, "%.0f%% SS"u8, 0f, (float)Half.MaxValue * 100f, 0.05f, SliderFlags.AlwaysClamp))
ImGuiSliderFlags.AlwaysClamp))
return false; return false;
var tmp2 = Math.Clamp(tmp, 0f, (float)Half.MaxValue * 100f) / 100f; var tmp2 = Math.Clamp(tmp, 0f, (float)Half.MaxValue * 100f) / 100f;

View file

@ -134,7 +134,7 @@ public class MaterialDrawer(DesignManager designManager, Configuration config) :
{ {
var deleteEnabled = config.DeleteDesignModifier.IsActive(); var deleteEnabled = config.DeleteDesignModifier.IsActive();
if (!ImEx.Icon.Button(LunaStyle.DeleteIcon, if (!ImEx.Icon.Button(LunaStyle.DeleteIcon,
$"Delete this color row.{(deleteEnabled ? string.Empty : $"\nHold {config.DeleteDesignModifier} to delete.")}", disabled: $"Delete this color row.{(deleteEnabled ? string.Empty : $"\nHold {config.DeleteDesignModifier} to delete.")}",
!deleteEnabled || design.WriteProtected())) !deleteEnabled || design.WriteProtected()))
return; return;
@ -151,7 +151,7 @@ public class MaterialDrawer(DesignManager designManager, Configuration config) :
private void PasteButton(Design design, MaterialValueIndex index) private void PasteButton(Design design, MaterialValueIndex index)
{ {
if (ImEx.Icon.Button(LunaStyle.FromClipboardIcon, "Import an exported row from your clipboard onto this row."u8, if (ImEx.Icon.Button(LunaStyle.FromClipboardIcon, "Import an exported row from your clipboard onto this row."u8,
disabled: !ColorRowClipboard.IsSet || design.WriteProtected())) !ColorRowClipboard.IsSet || design.WriteProtected()))
designManager.ChangeMaterialValue(design, index, ColorRowClipboard.Row); designManager.ChangeMaterialValue(design, index, ColorRowClipboard.Row);
} }
@ -222,7 +222,8 @@ public class MaterialDrawer(DesignManager designManager, Configuration config) :
private void DrawMaterialIdxDrag() private void DrawMaterialIdxDrag()
{ {
Im.Item.SetNextWidth(Im.Font.CalculateSize("Material AA"u8).X); Im.Item.SetNextWidth(Im.Font.CalculateSize("Material AA"u8).X);
if (Im.Drag("##Material"u8, ref _newMaterialIdx, $"Material {(char)('A' + _newMaterialIdx)}", 0, MaterialService.MaterialsPerModel - 1, 0.01f, SliderFlags.NoInput)) if (Im.Drag("##Material"u8, ref _newMaterialIdx, $"Material {(char)('A' + _newMaterialIdx)}", 0, MaterialService.MaterialsPerModel - 1,
0.01f, SliderFlags.NoInput))
{ {
_newMaterialIdx = Math.Clamp(_newMaterialIdx, 0, MaterialService.MaterialsPerModel - 1); _newMaterialIdx = Math.Clamp(_newMaterialIdx, 0, MaterialService.MaterialsPerModel - 1);
_newKey = _newKey with { MaterialIndex = (byte)_newMaterialIdx }; _newKey = _newKey with { MaterialIndex = (byte)_newMaterialIdx };
@ -234,7 +235,8 @@ public class MaterialDrawer(DesignManager designManager, Configuration config) :
private void DrawRowIdxDrag() private void DrawRowIdxDrag()
{ {
Im.Item.SetNextWidth(Im.Font.CalculateSize("Row 0000"u8).X); Im.Item.SetNextWidth(Im.Font.CalculateSize("Row 0000"u8).X);
if (Im.Drag("##Row"u8, ref _newRowIdx, $"Row {_newRowIdx / 2 + 1}{(char)(_newRowIdx % 2 + 'A')}", 0, ColorTable.NumRows - 1, 0.01f, SliderFlags.NoInput)) if (Im.Drag("##Row"u8, ref _newRowIdx, $"Row {_newRowIdx / 2 + 1}{(char)(_newRowIdx % 2 + 'A')}", 0, ColorTable.NumRows - 1, 0.01f,
SliderFlags.NoInput))
{ {
_newRowIdx = Math.Clamp(_newRowIdx, 0, ColorTable.NumRows - 1); _newRowIdx = Math.Clamp(_newRowIdx, 0, ColorTable.NumRows - 1);
_newKey = _newKey with { RowIndex = (byte)_newRowIdx }; _newKey = _newKey with { RowIndex = (byte)_newRowIdx };
@ -247,11 +249,11 @@ public class MaterialDrawer(DesignManager designManager, Configuration config) :
{ {
var tmp = row; var tmp = row;
using var _ = Im.Disabled(disabled); using var _ = Im.Disabled(disabled);
var applied = ImGuiUtil.ColorPicker("##diffuse", "Change the diffuse value for this row.", row.Diffuse, v => tmp.Diffuse = v, "D"); var applied = ImEx.ColorPickerButton("##diffuse"u8, "Change the diffuse value for this row."u8, row.Diffuse, out tmp.Diffuse, 'D');
Im.Line.SameInner(); Im.Line.SameInner();
applied |= ImGuiUtil.ColorPicker("##specular", "Change the specular value for this row.", row.Specular, v => tmp.Specular = v, "S"); applied |= ImEx.ColorPickerButton("##specular"u8, "Change the specular value for this row."u8, row.Specular, out tmp.Specular, 'S');
Im.Line.SameInner(); Im.Line.SameInner();
applied |= ImGuiUtil.ColorPicker("##emissive", "Change the emissive value for this row.", row.Emissive, v => tmp.Emissive = v, "E"); applied |= ImEx.ColorPickerButton("##emissive"u8, "Change the emissive value for this row."u8, row.Emissive, out tmp.Emissive, 'E');
Im.Line.SameInner(); Im.Line.SameInner();
Im.Item.SetNextWidth(GlossWidth * Im.Style.GlobalScale); Im.Item.SetNextWidth(GlossWidth * Im.Style.GlobalScale);
applied |= AdvancedDyePopup.DragGloss(ref tmp.GlossStrength); applied |= AdvancedDyePopup.DragGloss(ref tmp.GlossStrength);

View file

@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.Conditions; using Dalamud.Bindings.ImGui;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
@ -11,7 +12,6 @@ using Glamourer.Gui.Equipment;
using Glamourer.Gui.Materials; using Glamourer.Gui.Materials;
using Glamourer.Interop; using Glamourer.Interop;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using Luna; using Luna;
using OtterGui; using OtterGui;
@ -133,9 +133,9 @@ public class ActorPanel
private void DrawHeader() private void DrawHeader()
{ {
var textColor = !_identifier.IsValid ? ImGui.GetColorU32(ImGuiCol.Text) : var textColor = !_identifier.IsValid ? ImGuiColor.Text.Get() :
_data.Valid ? ColorId.ActorAvailable.Value() : ColorId.ActorUnavailable.Value(); _data.Valid ? ColorId.ActorAvailable.Value() : ColorId.ActorUnavailable.Value();
HeaderDrawer.Draw(_actorName, textColor, ImGui.GetColorU32(ImGuiCol.FrameBg), _leftButtons, _rightButtons); HeaderDrawer.Draw(_actorName, textColor.Color, ImGuiColor.FrameBackground.Get().Color, _leftButtons, _rightButtons);
SaveDesignDrawPopup(); SaveDesignDrawPopup();
} }
@ -153,15 +153,15 @@ public class ActorPanel
private unsafe void DrawPanel() private unsafe void DrawPanel()
{ {
using var table = ImUtf8.Table("##Panel", 1, ImGuiTableFlags.BordersOuter | ImGuiTableFlags.ScrollY, ImGui.GetContentRegionAvail()); using var table = Im.Table.Begin("##Panel"u8, 1, TableFlags.BordersOuter | TableFlags.ScrollY, Im.ContentRegion.Available);
if (!table || !_selector.HasSelection || !_stateManager.GetOrCreate(_identifier, _actor, out _state)) if (!table || !_selector.HasSelection || !_stateManager.GetOrCreate(_identifier, _actor, out _state))
return; return;
ImGui.TableSetupScrollFreeze(0, 1); table.SetupScrollFreeze(0, 1);
ImGui.TableNextColumn(); table.NextColumn();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
var transformationId = _actor.IsCharacter ? _actor.AsCharacter->CharacterData.TransformationId : 0; var transformationId = _actor.IsCharacter ? _actor.AsCharacter->CharacterData.TransformationId : 0;
if (transformationId != 0) if (transformationId is not 0)
ImGuiUtil.DrawTextButton($"Currently transformed to Transformation {transformationId}.", ImGuiUtil.DrawTextButton($"Currently transformed to Transformation {transformationId}.",
-Vector2.UnitX, Colors.SelectedRed); -Vector2.UnitX, Colors.SelectedRed);
@ -170,9 +170,9 @@ public class ActorPanel
DrawApplyToTarget(); DrawApplyToTarget();
RevertButtons(); RevertButtons();
ImGui.TableNextColumn(); table.NextColumn();
using var disabled = ImRaii.Disabled(transformationId != 0); using var disabled = Im.Disabled(transformationId is not 0);
if (_state.ModelData.IsHuman) if (_state.ModelData.IsHuman)
DrawHumanPanel(); DrawHumanPanel();
else else
@ -198,7 +198,7 @@ public class ActorPanel
? "Customization" ? "Customization"
: $"Customization (Model Id #{_state.ModelData.ModelId})###Customization"; : $"Customization (Model Id #{_state.ModelData.ModelId})###Customization";
var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization); var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization);
using var h = ImUtf8.CollapsingHeaderId(header, expand ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None); using var h = Im.Tree.HeaderId(header, expand ? TreeNodeFlags.DefaultOpen : TreeNodeFlags.None);
if (!h) if (!h)
return; return;
@ -206,7 +206,7 @@ public class ActorPanel
_stateManager.ChangeEntireCustomize(_state, _customizationDrawer.Customize, _customizationDrawer.Changed, ApplySettings.Manual); _stateManager.ChangeEntireCustomize(_state, _customizationDrawer.Customize, _customizationDrawer.Changed, ApplySettings.Manual);
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(MetaIndex.Wetness, _stateManager, _state)); EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(MetaIndex.Wetness, _stateManager, _state));
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
} }
private void DrawEquipmentHeader() private void DrawEquipmentHeader()
@ -236,9 +236,9 @@ public class ActorPanel
_equipmentDrawer.DrawBonusItem(data); _equipmentDrawer.DrawBonusItem(data);
} }
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
DrawEquipmentMetaToggles(); DrawEquipmentMetaToggles();
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
_equipmentDrawer.DrawDragDropTooltip(); _equipmentDrawer.DrawDragDropTooltip();
} }
@ -260,7 +260,7 @@ public class ActorPanel
if (!h) if (!h)
return; return;
using var t = ImUtf8.Table("table"u8, 2, ImGuiTableFlags.SizingFixedFit); using var t = Im.Table.Begin("table"u8, 2, TableFlags.SizingFixedFit);
if (!t) if (!t)
return; return;
@ -280,7 +280,7 @@ public class ActorPanel
static void DrawCopyColumn(ref OtterGui.Text.HelperObjects.Utf8StringHandler<TextStringHandlerBuffer> text) static void DrawCopyColumn(ref OtterGui.Text.HelperObjects.Utf8StringHandler<TextStringHandlerBuffer> text)
{ {
ImUtf8.DrawTableColumn(ref text); ImUtf8.DrawTableColumn(ref text);
if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) if (Im.Item.RightClicked())
ImUtf8.SetClipboardText(TextStringHandlerBuffer.Span); ImUtf8.SetClipboardText(TextStringHandlerBuffer.Span);
} }
} }
@ -317,58 +317,57 @@ public class ActorPanel
private void DrawMonsterPanel() private void DrawMonsterPanel()
{ {
var names = _modelChara[_state!.ModelData.ModelId]; var names = _modelChara[_state!.ModelData.ModelId];
var turnHuman = ImGui.Button("Turn Human"); var turnHuman = Im.Button("Turn Human"u8);
ImGui.Separator(); Im.Separator();
using (_ = ImRaii.ListBox("##MonsterList", using (Im.ListBox.Begin("##MonsterList"u8, Im.ContentRegion.Available with { Y = 10 * Im.Style.TextHeightWithSpacing }))
new Vector2(ImGui.GetContentRegionAvail().X, 10 * ImGui.GetTextLineHeightWithSpacing())))
{ {
if (names.Count == 0) if (names.Count is 0)
ImGui.TextUnformatted("Unknown Monster"); Im.Text("Unknown Monster"u8);
else else
ImGuiClip.ClippedDraw(names, p => ImGui.TextUnformatted($"{p.Name} ({p.Kind.ToName()} #{p.Id})"), ImGuiClip.ClippedDraw(names, p => Im.Text($"{p.Name} ({p.Kind.ToName()} #{p.Id})"),
ImGui.GetTextLineHeightWithSpacing()); Im.Style.TextHeightWithSpacing);
} }
ImGui.Separator(); Im.Separator();
ImGui.TextUnformatted("Customization Data"); Im.Text("Customization Data"u8);
using (_ = ImRaii.PushFont(UiBuilder.MonoFont)) using (Im.Font.PushMono())
{ {
foreach (var b in _state.ModelData.Customize) foreach (var b in _state.ModelData.Customize)
{ {
using (_ = ImRaii.Group()) using (Im.Group())
{ {
ImGui.TextUnformatted($" {b.Value:X2}"); Im.Text($" {b.Value:X2}");
ImGui.TextUnformatted($"{b.Value,3}"); Im.Text($"{b.Value,3}");
} }
Im.Line.Same(); Im.Line.Same();
if (ImGui.GetContentRegionAvail().X < Im.Style.ItemSpacing.X + ImGui.CalcTextSize("XXX").X) if (Im.ContentRegion.Available.X < Im.Style.ItemSpacing.X + Im.Font.CalculateSize("XXX"u8).X)
ImGui.NewLine(); Im.Line.New();
} }
if (ImGui.GetCursorPosX() != 0) if (Im.Cursor.X is not 0)
ImGui.NewLine(); Im.Line.New();
} }
ImGui.Separator(); Im.Separator();
ImGui.TextUnformatted("Equipment Data"); Im.Text("Equipment Data"u8);
using (_ = ImRaii.PushFont(UiBuilder.MonoFont)) using (Im.Font.PushMono())
{ {
foreach (var b in _state.ModelData.GetEquipmentBytes()) foreach (var b in _state.ModelData.GetEquipmentBytes())
{ {
using (_ = ImRaii.Group()) using (Im.Group())
{ {
ImGui.TextUnformatted($" {b:X2}"); Im.Text($" {b:X2}");
ImGui.TextUnformatted($"{b,3}"); Im.Text($"{b,3}");
} }
Im.Line.Same(); Im.Line.Same();
if (ImGui.GetContentRegionAvail().X < Im.Style.ItemSpacing.X + ImGui.CalcTextSize("XXX").X) if (Im.ContentRegion.Available.X < Im.Style.ItemSpacing.X + Im.Font.CalculateSize("XXX"u8).X)
ImGui.NewLine(); Im.Line.New();
} }
if (ImGui.GetCursorPosX() != 0) if (Im.Cursor.X is not 0)
ImGui.NewLine(); Im.Line.New();
} }
if (turnHuman) if (turnHuman)
@ -562,10 +561,10 @@ public class ActorPanel
protected override bool Disabled protected override bool Disabled
=> true; => true;
protected override uint BorderColor protected override Rgba32 BorderColor
=> ColorId.ActorUnavailable.Value(); => ColorId.ActorUnavailable.Value();
protected override uint TextColor protected override Rgba32 TextColor
=> ColorId.ActorUnavailable.Value(); => ColorId.ActorUnavailable.Value();
protected override void OnClick() protected override void OnClick()

View file

@ -40,7 +40,7 @@ public class ActorSelector(ActorObjectManager objects, ActorManager actors, Ephe
public void Draw(float width) public void Draw(float width)
{ {
_width = width; _width = width;
using var group = ImUtf8.Group(); using var group = Im.Group();
_defaultItemSpacing = Im.Style.ItemSpacing; _defaultItemSpacing = Im.Style.ItemSpacing;
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero) using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
.Push(ImGuiStyleVar.FrameRounding, 0); .Push(ImGuiStyleVar.FrameRounding, 0);
@ -50,30 +50,30 @@ public class ActorSelector(ActorObjectManager objects, ActorManager actors, Ephe
{ {
using var tt = ImUtf8.Tooltip(); using var tt = ImUtf8.Tooltip();
ImUtf8.Text("Filter for names containing the input."u8); ImUtf8.Text("Filter for names containing the input."u8);
ImGui.Dummy(new Vector2(0, ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(0, Im.Style.TextHeight / 2));
ImUtf8.Text("Special filters are:"u8); ImUtf8.Text("Special filters are:"u8);
var color = ColorId.HeaderButtons.Value(); var color = ColorId.HeaderButtons.Value();
ImUtf8.Text("<p>"u8, color); Im.Text("<p>"u8, color);
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImUtf8.Text(": show only player characters."u8); ImUtf8.Text(": show only player characters."u8);
ImUtf8.Text("<o>"u8, color); Im.Text("<o>"u8, color);
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImUtf8.Text(": show only owned game objects."u8); ImUtf8.Text(": show only owned game objects."u8);
ImUtf8.Text("<n>"u8, color); Im.Text("<n>"u8, color);
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImUtf8.Text(": show only NPCs."u8); ImUtf8.Text(": show only NPCs."u8);
ImUtf8.Text("<r>"u8, color); Im.Text("<r>"u8, color);
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImUtf8.Text(": show only retainers."u8); ImUtf8.Text(": show only retainers."u8);
ImUtf8.Text("<s>"u8, color); Im.Text("<s>"u8, color);
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImUtf8.Text(": show only special screen characters."u8); ImUtf8.Text(": show only special screen characters."u8);
ImUtf8.Text("<w>"u8, color); Im.Text("<w>"u8, color);
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImUtf8.Text(": show only players from your world."u8); ImUtf8.Text(": show only players from your world."u8);
} }
@ -90,10 +90,10 @@ public class ActorSelector(ActorObjectManager objects, ActorManager actors, Ephe
_world = new WorldId(objects.Player.Valid ? objects.Player.HomeWorld : (ushort)0); _world = new WorldId(objects.Player.Valid ? objects.Player.HomeWorld : (ushort)0);
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing);
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeight()); var skips = ImGuiClip.GetNecessarySkips(Im.Style.TextHeight);
var remainder = ImGuiClip.FilteredClippedDraw(objects.Where(p => p.Value.Objects.Any(a => a.Model)), skips, CheckFilter, var remainder = ImGuiClip.FilteredClippedDraw(objects.Where(p => p.Value.Objects.Any(a => a.Model)), skips, CheckFilter,
DrawSelectable); DrawSelectable);
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); ImGuiClip.DrawEndDummy(remainder, Im.Style.TextHeight);
} }
private bool CheckFilter(KeyValuePair<ActorIdentifier, ActorData> pair) private bool CheckFilter(KeyValuePair<ActorIdentifier, ActorData> pair)

View file

@ -1,12 +1,14 @@
using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Utility; using Dalamud.Utility;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui; using OtterGui;
using OtterGui.Extensions; using OtterGui.Extensions;
using OtterGui.Log; using OtterGui.Log;
using OtterGui.Widgets; using OtterGui.Widgets;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using OtterGui.Custom; using OtterGui.Custom;
using MouseWheelType = OtterGui.Widgets.MouseWheelType;
namespace Glamourer.Gui.Tabs.AutomationTab; namespace Glamourer.Gui.Tabs.AutomationTab;
@ -36,7 +38,7 @@ public sealed class HumanNpcCombo(
public bool Draw(float width) public bool Draw(float width)
=> Draw(label, CurrentSelection.Name.IsNullOrEmpty() ? "Human Non-Player-Characters..." : CurrentSelection.Name, string.Empty, width, => Draw(label, CurrentSelection.Name.IsNullOrEmpty() ? "Human Non-Player-Characters..." : CurrentSelection.Name, string.Empty, width,
ImGui.GetTextLineHeightWithSpacing()); Im.Style.TextHeightWithSpacing);
/// <summary> Compare strings in a way that letters and numbers are sorted before any special symbols. </summary> /// <summary> Compare strings in a way that letters and numbers are sorted before any special symbols. </summary>

View file

@ -1,15 +1,10 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Glamourer.Automation; using Glamourer.Automation;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.Designs.Special; using Glamourer.Designs.Special;
using Glamourer.Events; using Glamourer.Events;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using Luna; using Luna;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Text;
namespace Glamourer.Gui.Tabs.AutomationTab; namespace Glamourer.Gui.Tabs.AutomationTab;
@ -28,7 +23,7 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
private string _newText = string.Empty; private string _newText = string.Empty;
private string? _newDefinition; private string? _newDefinition;
private Design? _newDesign = null; private Design? _newDesign;
public RandomRestrictionDrawer(AutomationChanged automationChanged, Configuration config, AutoDesignManager autoDesignManager, public RandomRestrictionDrawer(AutomationChanged automationChanged, Configuration config, AutoDesignManager autoDesignManager,
RandomDesignCombo randomDesignCombo, SetSelector selector, DesignFileSystem designFileSystem, DesignStorage designs) RandomDesignCombo randomDesignCombo, SetSelector selector, DesignFileSystem designFileSystem, DesignStorage designs)
@ -51,13 +46,12 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
public void DrawButton(AutoDesignSet set, int designIndex) public void DrawButton(AutoDesignSet set, int designIndex)
{ {
var isOpen = set == _set && designIndex == _designIndex; var isOpen = set == _set && designIndex == _designIndex;
using (var color = ImRaii.PushColor(ImGuiCol.Button, ImGui.GetColorU32(ImGuiCol.ButtonActive), isOpen) using (ImGuiColor.Button.Push(Im.Style[ImGuiColor.ButtonActive], isOpen)
.Push(ImGuiCol.Text, ColorId.HeaderButtons.Value(), isOpen) .Push(ImGuiColor.Text, ColorId.HeaderButtons.Value(), isOpen)
.Push(ImGuiCol.Border, ColorId.HeaderButtons.Value(), isOpen)) .Push(ImGuiColor.Border, ColorId.HeaderButtons.Value(), isOpen))
{ {
using var frame = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 2 * Im.Style.GlobalScale, isOpen); using var frame = ImStyleSingle.FrameBorderThickness.Push(2 * Im.Style.GlobalScale, isOpen);
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Edit.ToIconString(), new Vector2(Im.Style.FrameHeight), if (ImEx.Icon.Button(LunaStyle.EditIcon))
string.Empty, false, true))
{ {
if (isOpen) if (isOpen)
Close(); Close();
@ -66,7 +60,7 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
} }
} }
ImGuiUtil.HoverTooltip("Edit restrictions for this random design."); Im.Tooltip.OnHover("Edit restrictions for this random design."u8);
} }
private void Open(AutoDesignSet set, int designIndex) private void Open(AutoDesignSet set, int designIndex)
@ -90,7 +84,7 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
public void Draw() public void Draw()
{ {
if (_set == null || _designIndex < 0 || _designIndex >= _set.Designs.Count) if (_set is null || _designIndex < 0 || _designIndex >= _set.Designs.Count)
return; return;
if (_set != _selector.Selection) if (_set != _selector.Selection)
@ -108,28 +102,28 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
private void DrawWindow(RandomDesign random) private void DrawWindow(RandomDesign random)
{ {
var flags = ImGuiWindowFlags.NoFocusOnAppearing var flags = WindowFlags.NoFocusOnAppearing
| ImGuiWindowFlags.NoCollapse | WindowFlags.NoCollapse
| ImGuiWindowFlags.NoResize; | WindowFlags.NoResize;
// Set position to the right of the main window when attached // Set position to the right of the main window when attached
// The downwards offset is implicit through child position. // The downwards offset is implicit through child position.
if (_config.KeepAdvancedDyesAttached) if (_config.KeepAdvancedDyesAttached)
{ {
var position = ImGui.GetWindowPos(); var position = Im.Window.Position;
position.X += ImGui.GetWindowSize().X + Im.Style.WindowPadding.X; position.X += Im.Window.Size.X + Im.Style.WindowPadding.X;
ImGui.SetNextWindowPos(position); Im.Window.SetNextPosition(position);
flags |= ImGuiWindowFlags.NoMove; flags |= WindowFlags.NoMove;
} }
using var color = ImRaii.PushColor(ImGuiCol.TitleBgActive, ImGui.GetColorU32(ImGuiCol.TitleBg)); using var color = ImGuiColor.TitleBackgroundActive.Push(Im.Style[ImGuiColor.TitleBackground]);
var size = new Vector2(7 * Im.Style.FrameHeight + 3 * Im.Style.ItemInnerSpacing.X + 300 * Im.Style.GlobalScale, var size = new Vector2(7 * Im.Style.FrameHeight + 3 * Im.Style.ItemInnerSpacing.X + 300 * Im.Style.GlobalScale,
18 * Im.Style.FrameHeightWithSpacing + Im.Style.WindowPadding.Y + Im.Style.ItemSpacing.Y); 18 * Im.Style.FrameHeightWithSpacing + Im.Style.WindowPadding.Y + Im.Style.ItemSpacing.Y);
ImGui.SetNextWindowSize(size); Im.Window.SetNextSize(size);
var open = true; var open = true;
var window = ImGui.Begin($"{_set!.Name} #{_designIndex + 1:D2}###Glamourer Random Design", ref open, flags); var window = Im.Window.Begin($"{_set!.Name} #{_designIndex + 1:D2}###Glamourer Random Design", ref open, flags);
try try
{ {
if (window) if (window)
@ -137,7 +131,7 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
} }
finally finally
{ {
ImGui.End(); window.Dispose();
} }
if (!open) if (!open)
@ -146,41 +140,39 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
private void DrawTable(RandomDesign random, List<IDesignPredicate> list) private void DrawTable(RandomDesign random, List<IDesignPredicate> list)
{ {
using var table = ImRaii.Table("##table", 3); using var table = Im.Table.Begin("##table"u8, 3);
if (!table) if (!table)
return; return;
using var spacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Im.Style.ItemInnerSpacing); using var spacing = ImStyleDouble.ItemSpacing.Push(Im.Style.ItemInnerSpacing);
var buttonSize = new Vector2(Im.Style.FrameHeight); var buttonSize = new Vector2(Im.Style.FrameHeight);
var descWidth = ImGui.CalcTextSize("or that are set to the color").X; var descWidth = Im.Font.CalculateSize("or that are set to the color"u8).X;
ImGui.TableSetupColumn("desc", ImGuiTableColumnFlags.WidthFixed, descWidth); table.SetupColumn("desc"u8, TableColumnFlags.WidthFixed, descWidth);
ImGui.TableSetupColumn("input", ImGuiTableColumnFlags.WidthStretch); table.SetupColumn("input"u8, TableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("del", ImGuiTableColumnFlags.WidthFixed, buttonSize.X * 2 + Im.Style.ItemInnerSpacing.X); table.SetupColumn("del"u8, TableColumnFlags.WidthFixed, buttonSize.X * 2 + Im.Style.ItemInnerSpacing.X);
var orSize = ImGui.CalcTextSize("or "); var orSize = Im.Font.CalculateSize("or "u8);
for (var i = 0; i < random.Predicates.Count; ++i) for (var i = 0; i < random.Predicates.Count; ++i)
{ {
using var id = ImRaii.PushId(i); using var id = Im.Id.Push(i);
var predicate = random.Predicates[i]; var predicate = random.Predicates[i];
ImGui.TableNextColumn(); table.NextColumn();
ImGui.AlignTextToFramePadding(); if (i is not 0)
if (i != 0) ImEx.TextFrameAligned("or "u8);
ImGui.TextUnformatted("or ");
else else
ImGui.Dummy(orSize); Im.Dummy(orSize);
ImGui.SameLine(0, 0); Im.Line.NoSpacing();
ImGui.AlignTextToFramePadding();
switch (predicate) switch (predicate)
{ {
case RandomPredicate.Contains contains: case RandomPredicate.Contains contains:
{ {
ImGui.TextUnformatted("that contain"); ImEx.TextFrameAligned("that contain"u8);
ImGui.TableNextColumn(); table.NextColumn();
var data = contains.Value.Text; var data = contains.Value.Text;
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); Im.Item.SetNextWidthFull();
if (ImGui.InputTextWithHint("##match", "Name, Path, or Identifier Contains...", ref data, 128)) if (Im.Input.Text("##match"u8, ref data, "Name, Path, or Identifier Contains..."u8))
{ {
if (data.Length == 0) if (data.Length is 0)
list.RemoveAt(i); list.RemoveAt(i);
else else
list[i] = new RandomPredicate.Contains(data); list[i] = new RandomPredicate.Contains(data);
@ -191,13 +183,13 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
} }
case RandomPredicate.StartsWith startsWith: case RandomPredicate.StartsWith startsWith:
{ {
ImGui.TextUnformatted("whose path starts with"); ImEx.TextFrameAligned("whose path starts with"u8);
ImGui.TableNextColumn(); table.NextColumn();
var data = startsWith.Value.Text; var data = startsWith.Value.Text;
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); Im.Item.SetNextWidthFull();
if (ImGui.InputTextWithHint("##startsWith", "Path Starts With...", ref data, 128)) if (Im.Input.Text("##startsWith"u8, ref data, "Path Starts With..."u8))
{ {
if (data.Length == 0) if (data.Length is 0)
list.RemoveAt(i); list.RemoveAt(i);
else else
list[i] = new RandomPredicate.StartsWith(data); list[i] = new RandomPredicate.StartsWith(data);
@ -208,13 +200,13 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
} }
case RandomPredicate.Exact { Which: RandomPredicate.Exact.Type.Tag } exact: case RandomPredicate.Exact { Which: RandomPredicate.Exact.Type.Tag } exact:
{ {
ImGui.TextUnformatted("that contain the tag"); ImEx.TextFrameAligned("that contain the tag"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); Im.Item.SetNextWidthFull();
var data = exact.Value.Text; var data = exact.Value.Text;
if (ImGui.InputTextWithHint("##color", "Contained tag...", ref data, 128)) if (Im.Input.Text("##color"u8, ref data, "Contained tag..."u8))
{ {
if (data.Length == 0) if (data.Length is 0)
list.RemoveAt(i); list.RemoveAt(i);
else else
list[i] = new RandomPredicate.Exact(RandomPredicate.Exact.Type.Tag, data); list[i] = new RandomPredicate.Exact(RandomPredicate.Exact.Type.Tag, data);
@ -225,13 +217,13 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
} }
case RandomPredicate.Exact { Which: RandomPredicate.Exact.Type.Color } exact: case RandomPredicate.Exact { Which: RandomPredicate.Exact.Type.Color } exact:
{ {
ImGui.TextUnformatted("that are set to the color"); ImEx.TextFrameAligned("that are set to the color"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); Im.Item.SetNextWidthFull();
var data = exact.Value.Text; var data = exact.Value.Text;
if (ImGui.InputTextWithHint("##color", "Assigned Color is...", ref data, 128)) if (Im.Input.Text("##color"u8, ref data, "Assigned Color is..."u8))
{ {
if (data.Length == 0) if (data.Length is 0)
list.RemoveAt(i); list.RemoveAt(i);
else else
list[i] = new RandomPredicate.Exact(RandomPredicate.Exact.Type.Color, data); list[i] = new RandomPredicate.Exact(RandomPredicate.Exact.Type.Color, data);
@ -242,9 +234,9 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
} }
case RandomPredicate.Exact exact: case RandomPredicate.Exact exact:
{ {
ImGui.TextUnformatted("that are exactly"); ImEx.TextFrameAligned("that are exactly"u8);
ImGui.TableNextColumn(); table.NextColumn();
if (_randomDesignCombo.Draw(exact, ImGui.GetContentRegionAvail().X) && _randomDesignCombo.Design is Design d) if (_randomDesignCombo.Draw(exact, Im.ContentRegion.Available.X) && _randomDesignCombo.Design is Design d)
{ {
list[i] = new RandomPredicate.Exact(RandomPredicate.Exact.Type.Identifier, d.Identifier.ToString()); list[i] = new RandomPredicate.Exact(RandomPredicate.Exact.Type.Identifier, d.Identifier.ToString());
_autoDesignManager.ChangeData(_set!, _designIndex, list); _autoDesignManager.ChangeData(_set!, _designIndex, list);
@ -254,22 +246,22 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
} }
} }
ImGui.TableNextColumn(); table.NextColumn();
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), buttonSize, "Delete this restriction.", false, true)) if (ImEx.Icon.Button(LunaStyle.DeleteIcon, "Delete this restriction."u8))
{ {
list.RemoveAt(i); list.RemoveAt(i);
_autoDesignManager.ChangeData(_set!, _designIndex, list); _autoDesignManager.ChangeData(_set!, _designIndex, list);
} }
Im.Line.Same(); Im.Line.Same();
DrawLookup(predicate, buttonSize); DrawLookup(predicate);
} }
} }
private void DrawLookup(IDesignPredicate predicate, Vector2 buttonSize) private void DrawLookup(IDesignPredicate predicate)
{ {
ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.MagnifyingGlassChart.ToIconString(), buttonSize, string.Empty, false, true); ImEx.Icon.Button(FontAwesomeIcon.MagnifyingGlassChart.Icon(), StringU8.Empty);
if (!ImGui.IsItemHovered()) if (!Im.Item.Hovered())
return; return;
var designs = predicate.Get(_designs, _designFileSystem); var designs = predicate.Get(_designs, _designFileSystem);
@ -278,46 +270,54 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
private void LookupTooltip(IEnumerable<Design> designs) private void LookupTooltip(IEnumerable<Design> designs)
{ {
using var _ = ImRaii.Tooltip(); using var _ = Im.Tooltip.Begin();
var tt = string.Join('\n', designs.Select(d => _designFileSystem.TryGetValue(d, out var l) ? l.FullName() : d.Name.Text).OrderBy(t => t)); using var enumerator = designs.GetEnumerator();
ImGui.TextUnformatted(tt.Length == 0 while (enumerator.MoveNext())
? "Matches no currently existing designs." {
: "Matches the following designs:"); Im.Text("Matches the following designs:"u8);
ImGui.Separator(); var name = _designFileSystem.TryGetValue(enumerator.Current, out var l) ? l.FullName() : enumerator.Current.Name.Text;
ImGui.TextUnformatted(tt); Im.Separator();
Im.BulletText(name);
while (enumerator.MoveNext())
{
name = _designFileSystem.TryGetValue(enumerator.Current, out l) ? l.FullName() : enumerator.Current.Name.Text;
Im.BulletText(name);
}
return;
}
Im.Text("Matches no currently existing designs."u8);
} }
private void DrawNewButtons(List<IDesignPredicate> list) private void DrawNewButtons(List<IDesignPredicate> list)
{ {
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); Im.Item.SetNextWidthFull();
ImGui.InputTextWithHint("##newText", "Add New Restriction...", ref _newText, 128); Im.Input.Text("##newText"u8, ref _newText, "Add New Restriction..."u8);
var spacing = Im.Style.ItemInnerSpacing.X; var invalid = _newText.Length is 0;
var invalid = _newText.Length == 0;
var buttonSize = new Vector2((ImGui.GetContentRegionAvail().X - 3 * spacing) / 4, 0); var buttonSize = new Vector2((Im.ContentRegion.Available.X - 3 * Im.Style.ItemInnerSpacing.X) / 4, 0);
var changed = ImGuiUtil.DrawDisabledButton("Starts With", buttonSize, var changed = ImEx.Button("Starts With"u8, buttonSize,
"Add a new condition that design paths must start with the given text.", invalid) "Add a new condition that design paths must start with the given text."u8, invalid)
&& Add(new RandomPredicate.StartsWith(_newText)); && Add(new RandomPredicate.StartsWith(_newText));
ImGui.SameLine(0, spacing); Im.Line.SameInner();
changed |= ImGuiUtil.DrawDisabledButton("Contains", buttonSize, changed |= ImEx.Button("Contains"u8, buttonSize,
"Add a new condition that design paths, names or identifiers must contain the given text.", invalid) "Add a new condition that design paths, names or identifiers must contain the given text."u8, invalid)
&& Add(new RandomPredicate.Contains(_newText)); && Add(new RandomPredicate.Contains(_newText));
ImGui.SameLine(0, spacing); Im.Line.SameInner();
changed |= ImGuiUtil.DrawDisabledButton("Has Tag", buttonSize, changed |= ImEx.Button("Has Tag"u8, buttonSize,
"Add a new condition that the design must contain the given tag.", invalid) "Add a new condition that the design must contain the given tag."u8, invalid)
&& Add(new RandomPredicate.Exact(RandomPredicate.Exact.Type.Tag, _newText)); && Add(new RandomPredicate.Exact(RandomPredicate.Exact.Type.Tag, _newText));
ImGui.SameLine(0, spacing); Im.Line.SameInner();
changed |= ImGuiUtil.DrawDisabledButton("Assigned Color", buttonSize, changed |= ImEx.Button("Assigned Color"u8, buttonSize,
"Add a new condition that the design must be assigned to the given color.", invalid) "Add a new condition that the design must be assigned to the given color."u8, invalid)
&& Add(new RandomPredicate.Exact(RandomPredicate.Exact.Type.Color, _newText)); && Add(new RandomPredicate.Exact(RandomPredicate.Exact.Type.Color, _newText));
if (_randomDesignCombo.Draw(_newDesign, ImGui.GetContentRegionAvail().X - spacing - buttonSize.X)) if (_randomDesignCombo.Draw(_newDesign, Im.ContentRegion.Available.X - Im.Style.ItemInnerSpacing.X - buttonSize.X))
_newDesign = _randomDesignCombo.CurrentSelection?.Item1 as Design; _newDesign = _randomDesignCombo.CurrentSelection?.Item1 as Design;
ImGui.SameLine(0, spacing); Im.Line.SameInner();
if (ImGuiUtil.DrawDisabledButton("Exact Design", buttonSize, "Add a single, specific design.", _newDesign == null)) if (ImEx.Button("Exact Design"u8, buttonSize, "Add a single, specific design."u8, _newDesign is null))
{ {
Add(new RandomPredicate.Exact(RandomPredicate.Exact.Type.Identifier, _newDesign!.Identifier.ToString())); Add(new RandomPredicate.Exact(RandomPredicate.Exact.Type.Identifier, _newDesign!.Identifier.ToString()));
changed = true; changed = true;
@ -338,30 +338,29 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
private void DrawManualInput(IReadOnlyList<IDesignPredicate> list) private void DrawManualInput(IReadOnlyList<IDesignPredicate> list)
{ {
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
DrawTotalPreview(list); DrawTotalPreview(list);
var currentDefinition = RandomPredicate.GeneratePredicateString(list); var currentDefinition = RandomPredicate.GeneratePredicateString(list);
var definition = _newDefinition ?? currentDefinition; var definition = _newDefinition ?? currentDefinition;
definition = definition.Replace(";", ";\n\t").Replace("{", "{\n\t").Replace("}", "\n}"); definition = definition.Replace(";", ";\n\t").Replace("{", "{\n\t").Replace("}", "\n}");
var lines = definition.Count(c => c is '\n'); var lines = definition.Count(c => c is '\n');
if (ImGui.InputTextMultiline("##definition", ref definition, 2000, if (Im.Input.MultiLine("##definition"u8, ref definition, Im.ContentRegion.Available with { Y = (lines + 1) * Im.Style.TextHeight + Im.Style.FrameHeight },
new Vector2(ImGui.GetContentRegionAvail().X, (lines + 1) * ImGui.GetTextLineHeight() + Im.Style.FrameHeight), InputTextFlags.CtrlEnterForNewLine))
ImGuiInputTextFlags.CtrlEnterForNewLine))
_newDefinition = definition; _newDefinition = definition;
if (ImGui.IsItemDeactivatedAfterEdit() && _newDefinition != null && _newDefinition != currentDefinition) if (Im.Item.DeactivatedAfterEdit && _newDefinition is not null && _newDefinition != currentDefinition)
{ {
var predicates = RandomPredicate.GeneratePredicates(_newDefinition.Replace("\n", string.Empty).Replace("\t", string.Empty)); var predicates = RandomPredicate.GeneratePredicates(_newDefinition.Replace("\n", string.Empty).Replace("\t", string.Empty));
_autoDesignManager.ChangeData(_set!, _designIndex, predicates); _autoDesignManager.ChangeData(_set!, _designIndex, predicates);
_newDefinition = null; _newDefinition = null;
} }
if (ImGui.Button("Copy to Clipboard Without Line Breaks", new Vector2(ImGui.GetContentRegionAvail().X, 0))) if (Im.Button("Copy to Clipboard Without Line Breaks"u8, Im.ContentRegion.Available with { Y = 0 }))
{ {
try try
{ {
ImGui.SetClipboardText(currentDefinition); Im.Clipboard.Set(currentDefinition);
} }
catch catch
{ {
@ -373,40 +372,38 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
private void DrawTotalPreview(IReadOnlyList<IDesignPredicate> list) private void DrawTotalPreview(IReadOnlyList<IDesignPredicate> list)
{ {
var designs = IDesignPredicate.Get(list, _designs, _designFileSystem).ToList(); var designs = IDesignPredicate.Get(list, _designs, _designFileSystem).ToList();
var button = designs.Count > 0 Im.Button(designs.Count > 0
? $"All Restrictions Combined Match {designs.Count} Designs" ? $"All Restrictions Combined Match {designs.Count} Designs"
: "None of the Restrictions Matches Any Designs"; : "None of the Restrictions Matches Any Designs"u8, Im.ContentRegion.Available with { Y = 0 });
ImGuiUtil.DrawDisabledButton(button, new Vector2(ImGui.GetContentRegionAvail().X, 0), if (Im.Item.Hovered())
string.Empty, false, false);
if (ImGui.IsItemHovered())
LookupTooltip(designs); LookupTooltip(designs);
} }
private void DrawContent(RandomDesign random) private void DrawContent(RandomDesign random)
{ {
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - Im.Style.WindowPadding.Y + Im.Style.GlobalScale); Im.Cursor.Y += Im.Style.GlobalScale - Im.Style.WindowPadding.Y;
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
var reset = random.ResetOnRedraw; var reset = random.ResetOnRedraw;
if (ImUtf8.Checkbox("Reset Chosen Design On Every Redraw"u8, ref reset)) if (Im.Checkbox("Reset Chosen Design On Every Redraw"u8, ref reset))
_autoDesignManager.ChangeData(_set!, _designIndex, reset); _autoDesignManager.ChangeData(_set!, _designIndex, reset);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
var list = random.Predicates.ToList(); var list = random.Predicates.ToList();
if (list.Count == 0) if (list.Count is 0)
{ {
ImGui.TextUnformatted("No Restrictions Set. Selects among all existing Designs."); Im.Text("No Restrictions Set. Selects among all existing Designs."u8);
} }
else else
{ {
ImGui.TextUnformatted("Select among designs..."); Im.Text("Select among designs..."u8);
DrawTable(random, list); DrawTable(random, list);
} }
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
DrawNewButtons(list); DrawNewButtons(list);
DrawManualInput(list); DrawManualInput(list);
@ -414,7 +411,7 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable
private void OnAutomationChange(AutomationChanged.Type type, AutoDesignSet? set, object? data) private void OnAutomationChange(AutomationChanged.Type type, AutoDesignSet? set, object? data)
{ {
if (set != _set || _set == null) if (set != _set || _set is null)
return; return;
switch (type) switch (type)

View file

@ -51,7 +51,7 @@ public class SetPanel(
} }
private void DrawHeader() private void DrawHeader()
=> HeaderDrawer.Draw(selector.SelectionName, 0, ImGui.GetColorU32(ImGuiCol.FrameBg), [], _rightButtons); => HeaderDrawer.Draw(selector.SelectionName, 0, ImGuiColor.FrameBackground.Get().Color, [], _rightButtons);
private void DrawPanel() private void DrawPanel()
{ {
@ -112,14 +112,14 @@ public class SetPanel(
if (config.ShowAutomationSetEditing) if (config.ShowAutomationSetEditing)
{ {
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
var name = _tempName ?? Selection.Name; var name = _tempName ?? Selection.Name;
var flags = selector.IncognitoMode ? ImGuiInputTextFlags.ReadOnly | ImGuiInputTextFlags.Password : ImGuiInputTextFlags.None; var flags = selector.IncognitoMode ? InputTextFlags.ReadOnly | InputTextFlags.Password : InputTextFlags.None;
ImGui.SetNextItemWidth(330 * Im.Style.GlobalScale); ImGui.SetNextItemWidth(330 * Im.Style.GlobalScale);
if (ImGui.InputText("Rename Set##Name", ref name, 128, flags)) if (Im.Input.Text("Rename Set##Name"u8, ref name, StringU8.Empty, flags))
_tempName = name; _tempName = name;
if (ImGui.IsItemDeactivated()) if (ImGui.IsItemDeactivated())
@ -131,9 +131,9 @@ public class SetPanel(
DrawIdentifierSelection(selector.SelectionIndex); DrawIdentifierSelection(selector.SelectionIndex);
} }
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
DrawDesignTable(); DrawDesignTable();
randomDrawer.Draw(); randomDrawer.Draw();
} }
@ -154,7 +154,7 @@ public class SetPanel(
+ 5 * Im.Style.CellPadding.X + 5 * Im.Style.CellPadding.X
+ 150 * Im.Style.GlobalScale; + 150 * Im.Style.GlobalScale;
var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine || numSpacing == 0; var singleRow = Im.ContentRegion.Available.X >= requiredSizeOneLine || numSpacing == 0;
var numRows = (singleRow, config.ShowUnlockedItemWarnings) switch var numRows = (singleRow, config.ShowUnlockedItemWarnings) switch
{ {
(true, true) => 6, (true, true) => 6,
@ -163,40 +163,40 @@ public class SetPanel(
(false, false) => 4, (false, false) => 4,
}; };
using var table = ImUtf8.Table("SetTable"u8, numRows, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY); using var table = Im.Table.Begin("SetTable"u8, numRows, TableFlags.RowBackground | TableFlags.ScrollX | TableFlags.ScrollY);
if (!table) if (!table)
return; return;
ImUtf8.TableSetupColumn("##del"u8, ImGuiTableColumnFlags.WidthFixed, Im.Style.FrameHeight); table.SetupColumn("##del"u8, TableColumnFlags.WidthFixed, Im.Style.FrameHeight);
ImUtf8.TableSetupColumn("##Index"u8, ImGuiTableColumnFlags.WidthFixed, 30 * Im.Style.GlobalScale); table.SetupColumn("##Index"u8, TableColumnFlags.WidthFixed, 30 * Im.Style.GlobalScale);
if (singleRow) if (singleRow)
{ {
ImUtf8.TableSetupColumn("Design"u8, ImGuiTableColumnFlags.WidthFixed, 220 * Im.Style.GlobalScale); table.SetupColumn("Design"u8, TableColumnFlags.WidthFixed, 220 * Im.Style.GlobalScale);
if (config.ShowAllAutomatedApplicationRules) if (config.ShowAllAutomatedApplicationRules)
ImUtf8.TableSetupColumn("Application"u8, ImGuiTableColumnFlags.WidthFixed, table.SetupColumn("Application"u8, TableColumnFlags.WidthFixed,
6 * Im.Style.FrameHeight + 10 * Im.Style.GlobalScale); 6 * Im.Style.FrameHeight + 10 * Im.Style.GlobalScale);
else else
ImUtf8.TableSetupColumn("Use"u8, ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X); table.SetupColumn("Use"u8, TableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X);
} }
else else
{ {
ImUtf8.TableSetupColumn("Design / Job Restrictions"u8, ImGuiTableColumnFlags.WidthFixed, table.SetupColumn("Design / Job Restrictions"u8, TableColumnFlags.WidthFixed,
250 * Im.Style.GlobalScale - (ImGui.GetScrollMaxY() > 0 ? Im.Style.ScrollbarSize : 0)); 250 * Im.Style.GlobalScale - (ImGui.GetScrollMaxY() > 0 ? Im.Style.ScrollbarSize : 0));
if (config.ShowAllAutomatedApplicationRules) if (config.ShowAllAutomatedApplicationRules)
ImUtf8.TableSetupColumn("Application"u8, ImGuiTableColumnFlags.WidthFixed, table.SetupColumn("Application"u8, TableColumnFlags.WidthFixed,
3 * Im.Style.FrameHeight + 4 * Im.Style.GlobalScale); 3 * Im.Style.FrameHeight + 4 * Im.Style.GlobalScale);
else else
ImUtf8.TableSetupColumn("Use"u8, ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X); table.SetupColumn("Use"u8, TableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X);
} }
if (singleRow) if (singleRow)
ImUtf8.TableSetupColumn("Job Restrictions"u8, ImGuiTableColumnFlags.WidthStretch); table.SetupColumn("Job Restrictions"u8, TableColumnFlags.WidthStretch);
if (config.ShowUnlockedItemWarnings) if (config.ShowUnlockedItemWarnings)
ImUtf8.TableSetupColumn(""u8, ImGuiTableColumnFlags.WidthFixed, 2 * Im.Style.FrameHeight + 4 * Im.Style.GlobalScale); table.SetupColumn(""u8, TableColumnFlags.WidthFixed, 2 * Im.Style.FrameHeight + 4 * Im.Style.GlobalScale);
ImGui.TableHeadersRow(); table.HeaderRow();
foreach (var (design, idx) in Selection.Designs.WithIndex()) foreach (var (design, idx) in Selection.Designs.WithIndex())
{ {
using var id = ImUtf8.PushId(idx); using var id = ImUtf8.PushId(idx);
@ -249,8 +249,8 @@ public class SetPanel(
private void DrawSelectable(int idx, IDesignStandIn design) private void DrawSelectable(int idx, IDesignStandIn design)
{ {
var highlight = 0u; var highlight = Rgba32.Transparent;
var sb = new StringBuilder(); var sb = new StringBuilder();
if (design is Design d) if (design is Design d)
{ {
var count = design.AllLinks(true).Count(); var count = design.AllLinks(true).Count();
@ -275,7 +275,7 @@ public class SetPanel(
} }
} }
using (ImRaii.PushColor(ImGuiCol.Text, highlight, highlight != 0)) using (ImGuiColor.Text.Push(highlight, highlight.IsTransparent))
{ {
ImUtf8.Selectable($"#{idx + 1:D2}"); ImUtf8.Selectable($"#{idx + 1:D2}");
} }
@ -303,7 +303,7 @@ public class SetPanel(
if (usingGearset) if (usingGearset)
{ {
var set = 1 + (_tmpGearset == int.MaxValue || _whichIndex != idx ? design.GearsetIndex : _tmpGearset); var set = 1 + (_tmpGearset == int.MaxValue || _whichIndex != idx ? design.GearsetIndex : _tmpGearset);
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
if (ImUtf8.InputScalar("##whichGearset"u8, ref set)) if (ImUtf8.InputScalar("##whichGearset"u8, ref set))
{ {
_whichIndex = idx; _whichIndex = idx;
@ -375,12 +375,12 @@ public class SetPanel(
continue; continue;
if (flag.RequiresRedraw()) if (flag.RequiresRedraw())
sb.AppendLine($"{type.ToDefaultName()} Customization should not be changed automatically."); sb.AppendLine($"{type.ToName()} Customization should not be changed automatically.");
else if (type is CustomizeIndex.Hairstyle or CustomizeIndex.FacePaint else if (type is CustomizeIndex.Hairstyle or CustomizeIndex.FacePaint
&& set.DataByValue(type, customize[type], out var data, customize.Face) >= 0 && set.DataByValue(type, customize[type], out var data, customize.Face) >= 0
&& !customizeUnlocks.IsUnlocked(data!.Value, out _)) && !customizeUnlocks.IsUnlocked(data!.Value, out _))
sb2.AppendLine( sb2.AppendLine(
$"{type.ToDefaultName()} Customization {customizeUnlocks.Unlockable[data.Value].Name} is not unlocked but should be applied."); $"{type.ToName()} Customization {customizeUnlocks.Unlockable[data.Value].Name} is not unlocked but should be applied.");
} }
Im.Line.Same(); Im.Line.Same();
@ -448,8 +448,7 @@ public class SetPanel(
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * Im.Style.GlobalScale)); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * Im.Style.GlobalScale));
var newType = design.Type; var newType = design.Type;
var newTypeInt = (uint)newType; var newTypeInt = (uint)newType;
style.Push(ImGuiStyleVar.FrameBorderSize, Im.Style.GlobalScale); using (ImStyleBorder.Frame.Push(ColorId.FolderLine.Value()))
using (_ = ImRaii.PushColor(ImGuiCol.Border, ColorId.FolderLine.Value()))
{ {
if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)ApplicationType.All)) if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)ApplicationType.All))
newType = (ApplicationType)newTypeInt; newType = (ApplicationType)newTypeInt;
@ -518,10 +517,10 @@ public class SetPanel(
CurrentSelectionIdx = jobs.JobGroups.Values.IndexOf(j => j.Id == design.Jobs.Id); CurrentSelectionIdx = jobs.JobGroups.Values.IndexOf(j => j.Id == design.Jobs.Id);
if (Draw("##JobGroups", design.Jobs.Name.ToString(), if (Draw("##JobGroups", design.Jobs.Name.ToString(),
"Select for which job groups this design should be applied.\nControl + Right-Click to set to all classes.", "Select for which job groups this design should be applied.\nControl + Right-Click to set to all classes.",
ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeightWithSpacing()) Im.ContentRegion.Available.X, Im.Style.TextHeightWithSpacing)
&& CurrentSelectionIdx >= 0) && CurrentSelectionIdx >= 0)
manager.ChangeJobCondition(set, autoDesignIndex, CurrentSelection); manager.ChangeJobCondition(set, autoDesignIndex, CurrentSelection);
else if (ImGui.GetIO().KeyCtrl && ImGui.IsItemClicked(ImGuiMouseButton.Right)) else if (Im.Io.KeyControl && Im.Item.RightClicked())
manager.ChangeJobCondition(set, autoDesignIndex, jobs.JobGroups[1]); manager.ChangeJobCondition(set, autoDesignIndex, jobs.JobGroups[1]);
} }

View file

@ -158,7 +158,7 @@ public class SetSelector : IDisposable
var pos = ImGui.GetItemRectMin(); var pos = ImGui.GetItemRectMin();
pos.X -= Im.Style.GlobalScale; pos.X -= Im.Style.GlobalScale;
ImGui.GetWindowDrawList().AddLine(pos, pos with { Y = ImGui.GetItemRectMax().Y }, ImGui.GetColorU32(ImGuiCol.Border), ImGui.GetWindowDrawList().AddLine(pos, pos with { Y = ImGui.GetItemRectMax().Y }, ImGuiColor.Border.Get().Color,
Im.Style.GlobalScale); Im.Style.GlobalScale);
ImGuiUtil.HoverTooltip("Filter to show only enabled or disabled sets."); ImGuiUtil.HoverTooltip("Filter to show only enabled or disabled sets.");
@ -175,7 +175,7 @@ public class SetSelector : IDisposable
UpdateList(); UpdateList();
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing);
_selectableSize = new Vector2(0, 2 * ImGui.GetTextLineHeight() + Im.Style.ItemSpacing.Y); _selectableSize = new Vector2(0, 2 * Im.Style.TextHeight + Im.Style.ItemSpacing.Y);
ImGuiClip.ClippedDraw(_list, DrawSetSelectable, _selectableSize.Y + 2 * Im.Style.ItemSpacing.Y); ImGuiClip.ClippedDraw(_list, DrawSetSelectable, _selectableSize.Y + 2 * Im.Style.ItemSpacing.Y);
_endAction?.Invoke(); _endAction?.Invoke();
_endAction = null; _endAction = null;
@ -183,8 +183,8 @@ public class SetSelector : IDisposable
private void DrawSetSelectable((AutoDesignSet Set, int Index) pair) private void DrawSetSelectable((AutoDesignSet Set, int Index) pair)
{ {
using var id = ImRaii.PushId(pair.Index); using var id = Im.Id.Push(pair.Index);
using (ImRaii.PushColor(ImGuiCol.Text, pair.Set.Enabled ? ColorId.EnabledAutoSet.Value() : ColorId.DisabledAutoSet.Value())) using (ImGuiColor.Text.Push(pair.Set.Enabled ? ColorId.EnabledAutoSet.Value() : ColorId.DisabledAutoSet.Value()))
{ {
if (ImGui.Selectable(GetSetName(pair.Set, pair.Index), pair.Set == Selection, ImGuiSelectableFlags.None, _selectableSize)) if (ImGui.Selectable(GetSetName(pair.Set, pair.Index), pair.Set == Selection, ImGuiSelectableFlags.None, _selectableSize))
{ {
@ -195,7 +195,7 @@ public class SetSelector : IDisposable
var lineEnd = ImGui.GetItemRectMax(); var lineEnd = ImGui.GetItemRectMax();
var lineStart = new Vector2(ImGui.GetItemRectMin().X, lineEnd.Y); var lineStart = new Vector2(ImGui.GetItemRectMin().X, lineEnd.Y);
ImGui.GetWindowDrawList().AddLine(lineStart, lineEnd, ImGui.GetColorU32(ImGuiCol.Border), Im.Style.GlobalScale); ImGui.GetWindowDrawList().AddLine(lineStart, lineEnd, ImGuiColor.Border.Get().Color, Im.Style.GlobalScale);
DrawDragDrop(pair.Set, pair.Index); DrawDragDrop(pair.Set, pair.Index);
@ -204,8 +204,8 @@ public class SetSelector : IDisposable
text = pair.Set.Identifiers[0].Incognito(text); text = pair.Set.Identifiers[0].Incognito(text);
var textSize = ImGui.CalcTextSize(text); var textSize = ImGui.CalcTextSize(text);
var textColor = pair.Set.Identifiers.Any(_objects.ContainsKey) ? ColorId.AutomationActorAvailable : ColorId.AutomationActorUnavailable; var textColor = pair.Set.Identifiers.Any(_objects.ContainsKey) ? ColorId.AutomationActorAvailable : ColorId.AutomationActorUnavailable;
ImGui.SetCursorPos(new Vector2(ImGui.GetContentRegionAvail().X - textSize.X, ImGui.SetCursorPos(new Vector2(Im.ContentRegion.Available.X - textSize.X,
ImGui.GetCursorPosY() - ImGui.GetTextLineHeightWithSpacing())); ImGui.GetCursorPosY() - Im.Style.TextHeightWithSpacing));
Im.Text(text, textColor.Value()); Im.Text(text, textColor.Value());
} }
@ -229,13 +229,13 @@ public class SetSelector : IDisposable
ImGui.OpenPopup("Automation Help"); ImGui.OpenPopup("Automation Help");
static void HalfLine() static void HalfLine()
=> ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); => Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
const string longestLine = const string longestLine =
"A single set can contain multiple automated designs that apply under different conditions and different parts of their design."; "A single set can contain multiple automated designs that apply under different conditions and different parts of their design.";
ImGuiUtil.HelpPopup("Automation Help", ImGuiUtil.HelpPopup("Automation Help",
new Vector2(ImGui.CalcTextSize(longestLine).X + 50 * Im.Style.GlobalScale, 33 * ImGui.GetTextLineHeightWithSpacing()), () => new Vector2(ImGui.CalcTextSize(longestLine).X + 50 * Im.Style.GlobalScale, 33 * Im.Style.TextHeightWithSpacing), () =>
{ {
HalfLine(); HalfLine();
ImGui.TextUnformatted("What is Automation?"); ImGui.TextUnformatted("What is Automation?");

View file

@ -1,11 +1,8 @@
using Dalamud.Interface; using Glamourer.GameData;
using Glamourer.GameData;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using OtterGui; using Luna;
using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
@ -24,116 +21,119 @@ public sealed class ActiveStatePanel(StateManager stateManager, ActorObjectManag
{ {
foreach (var (identifier, actors) in objectManager) foreach (var (identifier, actors) in objectManager)
{ {
if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Trash.ToIconString()}##{actors.Label}", new Vector2(Im.Style.FrameHeight), using var id = Im.Id.Push(actors.Label);
string.Empty, !stateManager.ContainsKey(identifier), true)) if (ImEx.Icon.Button(LunaStyle.DeleteIcon, StringU8.Empty, !stateManager.ContainsKey(identifier)))
stateManager.DeleteState(identifier); stateManager.DeleteState(identifier);
Im.Line.Same(); Im.Line.Same();
using var t = ImRaii.TreeNode(actors.Label); using var t = Im.Tree.Node(actors.Label);
if (!t) if (!t)
continue; continue;
if (stateManager.GetOrCreate(identifier, actors.Objects[0], out var state)) if (stateManager.GetOrCreate(identifier, actors.Objects[0], out var state))
DrawState(stateManager, actors, state); DrawState(stateManager, actors, state);
else else
ImGui.TextUnformatted("Invalid actor."); Im.Text("Invalid actor."u8);
} }
} }
public static void DrawState(StateManager stateManager, ActorData data, ActorState state) public static void DrawState(StateManager stateManager, ActorData data, ActorState state)
{ {
using var table = ImRaii.Table("##state", 7, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit); using var table = Im.Table.Begin("##state"u8, 7, TableFlags.RowBackground | TableFlags.SizingFixedFit);
if (!table) if (!table)
return; return;
ImGuiUtil.DrawTableColumn("Name"); table.DrawDataPair("Name"u8, state.Identifier);
ImGuiUtil.DrawTableColumn(state.Identifier.ToString()); table.NextColumn();
ImGui.TableNextColumn(); if (Im.Button("Reset"u8))
if (ImGui.Button("Reset"))
stateManager.ResetState(state, StateSource.Manual); stateManager.ResetState(state, StateSource.Manual);
ImGui.TableNextRow(); table.NextRow();
static void PrintRow<T>(string label, T actor, T model, StateSource source) where T : notnull PrintRow("Model ID"u8, state.BaseData.ModelId, state.ModelData.ModelId, state.Sources[MetaIndex.ModelId]);
{ table.NextRow();
ImGuiUtil.DrawTableColumn(label); PrintRow("Wetness"u8, state.BaseData.IsWet(), state.ModelData.IsWet(), state.Sources[MetaIndex.Wetness]);
ImGuiUtil.DrawTableColumn(actor.ToString()!); table.NextRow();
ImGuiUtil.DrawTableColumn(model.ToString()!);
ImGuiUtil.DrawTableColumn(source.ToString());
}
static string ItemString(in DesignData data, EquipSlot slot)
{
var item = data.Item(slot);
return
$"{item.Name} ({item.Id.ToDiscriminatingString()} {item.PrimaryId.Id}{(item.SecondaryId != 0 ? $"-{item.SecondaryId.Id}" : string.Empty)}-{item.Variant})";
}
static string BonusItemString(in DesignData data, BonusItemFlag slot)
{
var item = data.BonusItem(slot);
return
$"{item.Name} ({item.Id.ToDiscriminatingString()} {item.PrimaryId.Id}{(item.SecondaryId != 0 ? $"-{item.SecondaryId.Id}" : string.Empty)}-{item.Variant})";
}
PrintRow("Model ID", state.BaseData.ModelId, state.ModelData.ModelId, state.Sources[MetaIndex.ModelId]);
ImGui.TableNextRow();
PrintRow("Wetness", state.BaseData.IsWet(), state.ModelData.IsWet(), state.Sources[MetaIndex.Wetness]);
ImGui.TableNextRow();
if (state.BaseData.IsHuman && state.ModelData.IsHuman) if (state.BaseData.IsHuman && state.ModelData.IsHuman)
{ {
PrintRow("Hat Visible", state.BaseData.IsHatVisible(), state.ModelData.IsHatVisible(), state.Sources[MetaIndex.HatState]); PrintRow("Hat Visible"u8, state.BaseData.IsHatVisible(), state.ModelData.IsHatVisible(), state.Sources[MetaIndex.HatState]);
ImGui.TableNextRow(); table.NextRow();
PrintRow("Visor Toggled", state.BaseData.IsVisorToggled(), state.ModelData.IsVisorToggled(), PrintRow("Visor Toggled"u8, state.BaseData.IsVisorToggled(), state.ModelData.IsVisorToggled(),
state.Sources[MetaIndex.VisorState]); state.Sources[MetaIndex.VisorState]);
ImGui.TableNextRow(); table.NextRow();
PrintRow("Viera Ears Visible", state.BaseData.AreEarsVisible(), state.ModelData.AreEarsVisible(), PrintRow("Viera Ears Visible"u8, state.BaseData.AreEarsVisible(), state.ModelData.AreEarsVisible(),
state.Sources[MetaIndex.EarState]); state.Sources[MetaIndex.EarState]);
ImGui.TableNextRow(); table.NextRow();
PrintRow("Weapon Visible", state.BaseData.IsWeaponVisible(), state.ModelData.IsWeaponVisible(), PrintRow("Weapon Visible"u8, state.BaseData.IsWeaponVisible(), state.ModelData.IsWeaponVisible(),
state.Sources[MetaIndex.WeaponState]); state.Sources[MetaIndex.WeaponState]);
ImGui.TableNextRow(); table.NextRow();
foreach (var slot in EquipSlotExtensions.EqdpSlots.Prepend(EquipSlot.OffHand).Prepend(EquipSlot.MainHand)) foreach (var slot in EquipSlotExtensions.EqdpSlots.Prepend(EquipSlot.OffHand).Prepend(EquipSlot.MainHand))
{ {
PrintRow(slot.ToName(), ItemString(state.BaseData, slot), ItemString(state.ModelData, slot), state.Sources[slot, false]); PrintRow(slot.ToNameU8(), ItemString(state.BaseData, slot), ItemString(state.ModelData, slot), state.Sources[slot, false]);
ImGuiUtil.DrawTableColumn(state.BaseData.Stain(slot).ToString()); table.DrawColumn($"{state.BaseData.Stain(slot)}");
ImGuiUtil.DrawTableColumn(state.ModelData.Stain(slot).ToString()); table.DrawColumn($"{state.ModelData.Stain(slot)}");
ImGuiUtil.DrawTableColumn(state.Sources[slot, true].ToString()); table.DrawColumn($"{state.Sources[slot, true]}");
} }
foreach (var slot in BonusExtensions.AllFlags) foreach (var slot in BonusExtensions.AllFlags)
{ {
PrintRow(slot.ToName(), BonusItemString(state.BaseData, slot), BonusItemString(state.ModelData, slot), state.Sources[slot]); PrintRow(slot.ToNameU8(), BonusItemString(state.BaseData, slot), BonusItemString(state.ModelData, slot), state.Sources[slot]);
ImGui.TableNextRow(); table.NextRow();
} }
foreach (var type in Enum.GetValues<CustomizeIndex>()) foreach (var type in CustomizeIndex.Values)
{ {
PrintRow(type.ToDefaultName(), state.BaseData.Customize[type].Value, state.ModelData.Customize[type].Value, PrintRow(type.ToNameU8(), state.BaseData.Customize[type].Value, state.ModelData.Customize[type].Value,
state.Sources[type]); state.Sources[type]);
ImGui.TableNextRow(); table.NextRow();
} }
foreach (var crest in CrestExtensions.AllRelevantSet) foreach (var crest in CrestExtensions.AllRelevantSet)
{ {
PrintRow(crest.ToLabel(), state.BaseData.Crest(crest), state.ModelData.Crest(crest), state.Sources[crest]); PrintRow(crest.ToLabelU8(), state.BaseData.Crest(crest), state.ModelData.Crest(crest), state.Sources[crest]);
ImGui.TableNextRow(); table.NextRow();
} }
foreach (var flag in CustomizeParameterExtensions.AllFlags) foreach (var flag in CustomizeParameterExtensions.AllFlags)
{ {
PrintRow(flag.ToString(), state.BaseData.Parameters[flag], state.ModelData.Parameters[flag], state.Sources[flag]); PrintRow(flag.ToNameU8(), state.BaseData.Parameters[flag], state.ModelData.Parameters[flag], state.Sources[flag]);
ImGui.TableNextRow(); table.NextRow();
} }
} }
else else
{ {
ImGuiUtil.DrawTableColumn(string.Join(" ", state.BaseData.GetCustomizeBytes().Select(b => b.ToString("X2")))); table.DrawColumn(StringU8.Join((byte)' ', state.BaseData.GetCustomizeBytes().Select(b => b.ToString("X2"))));
ImGuiUtil.DrawTableColumn(string.Join(" ", state.ModelData.GetCustomizeBytes().Select(b => b.ToString("X2")))); table.DrawColumn(StringU8.Join((byte)' ', state.ModelData.GetCustomizeBytes().Select(b => b.ToString("X2"))));
ImGui.TableNextRow(); table.NextRow();
ImGuiUtil.DrawTableColumn(string.Join(" ", state.BaseData.GetEquipmentBytes().Select(b => b.ToString("X2")))); table.DrawColumn(StringU8.Join((byte)' ', state.BaseData.GetEquipmentBytes().Select(b => b.ToString("X2"))));
ImGuiUtil.DrawTableColumn(string.Join(" ", state.ModelData.GetEquipmentBytes().Select(b => b.ToString("X2")))); table.DrawColumn(StringU8.Join((byte)' ', state.ModelData.GetEquipmentBytes().Select(b => b.ToString("X2"))));
}
return;
static StringU8 ItemString(in DesignData data, EquipSlot slot)
{
var item = data.Item(slot);
return
new StringU8(
$"{item.Name} ({item.Id.ToDiscriminatingString()} {item.PrimaryId.Id}{(item.SecondaryId != 0 ? $"-{item.SecondaryId.Id}" : string.Empty)}-{item.Variant})");
}
static StringU8 BonusItemString(in DesignData data, BonusItemFlag slot)
{
var item = data.BonusItem(slot);
return
new StringU8(
$"{item.Name} ({item.Id.ToDiscriminatingString()} {item.PrimaryId.Id}{(item.SecondaryId != 0 ? $"-{item.SecondaryId.Id}" : string.Empty)}-{item.Variant})");
}
static void PrintRow<T>(ReadOnlySpan<byte> label, T actor, T model, StateSource source) where T : notnull
{
Im.Table.DrawColumn(label);
Im.Table.DrawColumn($"{actor}");
Im.Table.DrawColumn($"{model}");
Im.Table.DrawColumn(source.ToNameU8());
} }
} }
} }

View file

@ -1,7 +1,5 @@
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using Dalamud.Bindings.ImGui; using ImSharp;
using OtterGui.Raii;
using OtterGui.Text;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
@ -17,17 +15,17 @@ public sealed unsafe class AdvancedCustomizationDrawer(ActorObjectManager object
public void Draw() public void Draw()
{ {
var (player, data) = objects.PlayerData; var (_, data) = objects.PlayerData;
if (!data.Valid) if (!data.Valid)
{ {
ImUtf8.Text("Invalid player."u8); Im.Text("Invalid player."u8);
return; return;
} }
var model = data.Objects[0].Model; var model = data.Objects[0].Model;
if (!model.IsHuman) if (!model.IsHuman)
{ {
ImUtf8.Text("Invalid model."u8); Im.Text("Invalid model."u8);
return; return;
} }
@ -40,36 +38,36 @@ public sealed unsafe class AdvancedCustomizationDrawer(ActorObjectManager object
private static void DrawCBuffer(ReadOnlySpan<byte> label, ConstantBuffer* cBuffer, int type) private static void DrawCBuffer(ReadOnlySpan<byte> label, ConstantBuffer* cBuffer, int type)
{ {
using var tree = ImUtf8.TreeNode(label); using var tree = Im.Tree.Node(label);
if (!tree) if (!tree)
return; return;
if (cBuffer == null) if (cBuffer is null)
{ {
ImUtf8.Text("Invalid CBuffer."u8); Im.Text("Invalid CBuffer."u8);
return; return;
} }
ImUtf8.Text($"{cBuffer->ByteSize / 4}"); Im.Text($"{cBuffer->ByteSize / 4}");
ImUtf8.Text($"{cBuffer->Flags}"); Im.Text($"{cBuffer->Flags}");
ImUtf8.Text($"0x{(ulong)cBuffer:X}"); Glamourer.Dynamis.DrawPointer(cBuffer);
var parameters = (float*)cBuffer->UnsafeSourcePointer; var parameters = (float*)cBuffer->UnsafeSourcePointer;
if (parameters == null) if (parameters is null)
{ {
ImUtf8.Text("No Parameters."u8); Im.Text("No Parameters."u8);
return; return;
} }
var start = parameters; var start = parameters;
using (ImUtf8.Group()) using (Im.Group())
{ {
for (var end = start + cBuffer->ByteSize / 4; parameters < end; parameters += 2) for (var end = start + cBuffer->ByteSize / 4; parameters < end; parameters += 2)
DrawParameters(parameters, type, (int)(parameters - start)); DrawParameters(parameters, type, (int)(parameters - start));
} }
ImGui.SameLine(0, 50 * ImUtf8.GlobalScale); Im.Line.Same(0, 50 * Im.Style.GlobalScale);
parameters = start + 1; parameters = start + 1;
using (ImUtf8.Group()) using (Im.Group())
{ {
for (var end = start + cBuffer->ByteSize / 4; parameters < end; parameters += 2) for (var end = start + cBuffer->ByteSize / 4; parameters < end; parameters += 2)
DrawParameters(parameters, type, (int)(parameters - start)); DrawParameters(parameters, type, (int)(parameters - start));
@ -78,24 +76,24 @@ public sealed unsafe class AdvancedCustomizationDrawer(ActorObjectManager object
private static void DrawParameters(float* param, int type, int idx) private static void DrawParameters(float* param, int type, int idx)
{ {
using var id = ImUtf8.PushId((nint)param); using var id = Im.Id.Push((nint)param);
ImUtf8.TextFrameAligned($"{idx:D2}: "); ImEx.TextFrameAligned($"{idx:D2}: ");
ImUtf8.SameLineInner(); Im.Line.SameInner();
ImGui.SetNextItemWidth(200 * ImUtf8.GlobalScale); Im.Item.SetNextWidthScaled(200);
if (TryGetKnown(type, idx, out var known)) if (TryGetKnown(type, idx, out var known))
{ {
ImUtf8.DragScalar(known, ref *param, float.MinValue, float.MaxValue, 0.01f); Im.Drag(known, ref *param, float.MinValue, float.MaxValue, 0.01f);
} }
else else
{ {
using var color = ImRaii.PushColor(ImGuiCol.Text, ImGui.GetColorU32(ImGuiCol.TextDisabled)); using var color = ImGuiColor.Text.Push(Im.Style[ImGuiColor.TextDisabled]);
ImUtf8.DragScalar($"+0x{idx * 4:X2}", ref *param, float.MinValue, float.MaxValue, 0.01f); Im.Drag($"+0x{idx * 4:X2}", ref *param, float.MinValue, float.MaxValue, 0.01f);
} }
} }
private static bool TryGetKnown(int type, int idx, out ReadOnlySpan<byte> text) private static bool TryGetKnown(int type, int idx, out ReadOnlySpan<byte> text)
{ {
if (type == 0) if (type is 0)
text = idx switch text = idx switch
{ {
0 => "Diffuse.R"u8, 0 => "Diffuse.R"u8,

View file

@ -1,8 +1,5 @@
using Glamourer.Automation; using Glamourer.Automation;
using Dalamud.Bindings.ImGui; using ImSharp;
using OtterGui;
using OtterGui.Extensions;
using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
@ -17,33 +14,26 @@ public sealed class AutoDesignPanel(AutoDesignManager autoDesignManager) : IGame
public void Draw() public void Draw()
{ {
foreach (var (set, idx) in autoDesignManager.WithIndex()) foreach (var (idx, set) in autoDesignManager.Index())
{ {
using var id = ImRaii.PushId(idx); using var id = Im.Id.Push(idx);
using var tree = ImRaii.TreeNode(set.Name); using var tree = Im.Tree.Node(set.Name);
if (!tree) if (!tree)
continue; continue;
using var table = ImRaii.Table("##autoDesign", 2, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var table = Im.Table.Begin("##autoDesign"u8, 2, TableFlags.SizingFixedFit | TableFlags.RowBackground);
if (!table) if (!table)
continue; continue;
ImGuiUtil.DrawTableColumn("Name"); table.DrawDataPair("Name"u8, set.Name);
ImGuiUtil.DrawTableColumn(set.Name); table.DrawDataPair("Index"u8, idx);
table.DrawDataPair("Enabled"u8, set.Enabled);
table.DrawDataPair("Actor"u8, set.Identifiers[0]);
ImGuiUtil.DrawTableColumn("Index"); foreach (var (designIdx, design) in set.Designs.Index())
ImGuiUtil.DrawTableColumn(idx.ToString());
ImGuiUtil.DrawTableColumn("Enabled");
ImGuiUtil.DrawTableColumn(set.Enabled.ToString());
ImGuiUtil.DrawTableColumn("Actor");
ImGuiUtil.DrawTableColumn(set.Identifiers[0].ToString());
foreach (var (design, designIdx) in set.Designs.WithIndex())
{ {
ImGuiUtil.DrawTableColumn($"{design.Design.ResolveName(false)} ({designIdx})"); table.DrawColumn($"{design.Design.ResolveName(false)} ({designIdx})");
ImGuiUtil.DrawTableColumn($"{design.Type} {design.Jobs.Name}"); table.DrawColumn($"{design.Type} {design.Jobs.Name}");
} }
} }
} }

View file

@ -1,12 +1,7 @@
using Dalamud.Interface; using Glamourer.GameData;
using Glamourer.GameData;
using Glamourer.Services; using Glamourer.Services;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using Luna; using Luna;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Text;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -34,70 +29,65 @@ public sealed class CustomizationServicePanel(CustomizeService customize) : IGam
DrawColorInfo(); DrawColorInfo();
} }
private void DrawFacepaintInfo() private void DrawFacepaintInfo()
{ {
using var tree = ImUtf8.TreeNode("NPC Facepaints"u8); using var tree = Im.Tree.Node("NPC Facepaints"u8);
if (!tree) if (!tree)
return; return;
using var table = ImUtf8.Table("data"u8, 2, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var table = Im.Table.Begin("data"u8, 2, TableFlags.SizingFixedFit | TableFlags.RowBackground);
if (!table) if (!table)
return; return;
ImGui.TableNextColumn(); table.NextColumn();
ImUtf8.TableHeader("Id"u8); table.Header("Id"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImUtf8.TableHeader("Facepaint"u8); table.Header("Facepaint"u8);
for (var i = 0; i < 128; ++i) for (var i = 0; i < 128; ++i)
{ {
var index = new CustomizeValue((byte)i); var index = new CustomizeValue((byte)i);
ImUtf8.DrawTableColumn($"{i:D3}"); table.DrawColumn($"{i:D3}");
using var font = ImRaii.PushFont(UiBuilder.IconFont); table.NextColumn();
ImUtf8.DrawTableColumn(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.FacePaint, index) ImEx.Icon.Draw(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.FacePaint, index) ? LunaStyle.TrueIcon : LunaStyle.FalseIcon);
? FontAwesomeIcon.Check.ToIconString()
: FontAwesomeIcon.Times.ToIconString());
} }
} }
private void DrawColorInfo() private void DrawColorInfo()
{ {
using var tree = ImUtf8.TreeNode("NPC Colors"u8); using var tree = Im.Tree.Node("NPC Colors"u8);
if (!tree) if (!tree)
return; return;
using var table = ImUtf8.Table("data"u8, 5, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var table = Im.Table.Begin("data"u8, 5, TableFlags.SizingFixedFit | TableFlags.RowBackground);
if (!table) if (!table)
return; return;
ImGui.TableNextColumn(); table.NextColumn();
ImUtf8.TableHeader("Id"u8); table.Header("Id"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImUtf8.TableHeader("Hair"u8); table.Header("Hair"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImUtf8.TableHeader("Eyes"u8); table.Header("Eyes"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImUtf8.TableHeader("Facepaint"u8); table.Header("Facepaint"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImUtf8.TableHeader("Tattoos"u8); table.Header("Tattoos"u8);
for (var i = 192; i < 256; ++i) for (var i = 192; i < 256; ++i)
{ {
var index = new CustomizeValue((byte)i); var index = new CustomizeValue((byte)i);
ImUtf8.DrawTableColumn($"{i:D3}"); table.DrawColumn($"{i:D3}");
using var font = ImRaii.PushFont(UiBuilder.IconFont); table.NextColumn();
ImUtf8.DrawTableColumn(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.HairColor, index) ImEx.Icon.Draw(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.HairColor, index) ? LunaStyle.TrueIcon : LunaStyle.FalseIcon);
? FontAwesomeIcon.Check.ToIconString() table.NextColumn();
: FontAwesomeIcon.Times.ToIconString()); ImEx.Icon.Draw(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.EyeColorLeft, index) ? LunaStyle.TrueIcon : LunaStyle.FalseIcon);
ImUtf8.DrawTableColumn(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.EyeColorLeft, index) table.NextColumn();
? FontAwesomeIcon.Check.ToIconString() ImEx.Icon.Draw(
: FontAwesomeIcon.Times.ToIconString()); customize.NpcCustomizeSet.CheckValue(CustomizeIndex.FacePaintColor, index) ? LunaStyle.TrueIcon : LunaStyle.FalseIcon);
ImUtf8.DrawTableColumn(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.FacePaintColor, index) table.NextColumn();
? FontAwesomeIcon.Check.ToIconString() ImEx.Icon.Draw(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.TattooColor, index) ? LunaStyle.TrueIcon : LunaStyle.FalseIcon);
: FontAwesomeIcon.Times.ToIconString());
ImUtf8.DrawTableColumn(customize.NpcCustomizeSet.CheckValue(CustomizeIndex.TattooColor, index)
? FontAwesomeIcon.Check.ToIconString()
: FontAwesomeIcon.Times.ToIconString());
} }
} }
@ -113,7 +103,7 @@ public sealed class CustomizationServicePanel(CustomizeService customize) : IGam
foreach (var index in CustomizeIndex.Values) foreach (var index in CustomizeIndex.Values)
{ {
table.DrawColumn(index.ToDefaultName()); table.DrawColumn(index.ToNameU8());
table.DrawColumn(set.Option(index)); table.DrawColumn(set.Option(index));
table.DrawColumn(set.IsAvailable(index) ? "Available"u8 : "Unavailable"u8); table.DrawColumn(set.IsAvailable(index) ? "Available"u8 : "Unavailable"u8);
table.DrawColumn(set.Type(index).ToNameU8()); table.DrawColumn(set.Type(index).ToNameU8());
@ -123,18 +113,18 @@ public sealed class CustomizationServicePanel(CustomizeService customize) : IGam
private void DrawNpcCustomizationInfo(CustomizeSet set) private void DrawNpcCustomizationInfo(CustomizeSet set)
{ {
using var tree = ImRaii.TreeNode($"{customize.ClanName(set.Clan, set.Gender)} {set.Gender} (NPC Options)"); using var tree = Im.Tree.Node($"{customize.ClanName(set.Clan, set.Gender)} {set.Gender} (NPC Options)");
if (!tree) if (!tree)
return; return;
using var table = ImRaii.Table("npc", 2, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var table = Im.Table.Begin("npc"u8, 2, TableFlags.SizingFixedFit | TableFlags.RowBackground);
if (!table) if (!table)
return; return;
foreach (var (index, value) in set.NpcOptions) foreach (var (index, value) in set.NpcOptions)
{ {
ImGuiUtil.DrawTableColumn(index.ToString()); table.DrawColumn($"{index}");
ImGuiUtil.DrawTableColumn(value.Value.ToString()); table.DrawColumn($"{value.Value}");
} }
} }
} }

View file

@ -1,7 +1,5 @@
using Glamourer.Unlocks; using Glamourer.Unlocks;
using Dalamud.Bindings.ImGui; using ImSharp;
using OtterGui;
using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
@ -17,28 +15,25 @@ public sealed class CustomizationUnlockPanel(CustomizeUnlockManager customizeUnl
public void Draw() public void Draw()
{ {
using var table = ImRaii.Table("customizationUnlocks", 6, using var table = Im.Table.Begin("customizationUnlocks"u8, 6,
ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.BordersOuter, TableFlags.SizingFixedFit | TableFlags.RowBackground | TableFlags.ScrollY | TableFlags.BordersOuter,
new Vector2(ImGui.GetContentRegionAvail().X, 12 * ImGui.GetTextLineHeight())); Im.ContentRegion.Available with { Y = 12 * Im.Style.TextHeight });
if (!table) if (!table)
return; return;
ImGui.TableNextColumn(); using var clipper = new Im.ListClipper(customizeUnlocks.Unlockable.Count, Im.Style.TextHeightWithSpacing);
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); foreach (var (key, value) in clipper.Iterate(customizeUnlocks.Unlockable))
ImGui.TableNextRow();
var remainder = ImGuiClip.ClippedDraw(customizeUnlocks.Unlockable, skips, t =>
{ {
ImGuiUtil.DrawTableColumn(t.Key.Index.ToDefaultName()); table.DrawColumn(key.Index.ToNameU8());
ImGuiUtil.DrawTableColumn(t.Key.CustomizeId.ToString()); table.DrawColumn($"{key.CustomizeId}");
ImGuiUtil.DrawTableColumn(t.Key.Value.Value.ToString()); table.DrawColumn($"{key.Value.Value}");
ImGuiUtil.DrawTableColumn(t.Value.Data.ToString()); table.DrawColumn($"{value.Data}");
ImGuiUtil.DrawTableColumn(t.Value.Name); table.DrawColumn(value.Name);
ImGuiUtil.DrawTableColumn(customizeUnlocks.IsUnlocked(t.Key, out var time) table.DrawColumn(customizeUnlocks.IsUnlocked(key, out var time)
? time == DateTimeOffset.MinValue ? time == DateTimeOffset.MinValue
? "Always" ? "Always"u8
: time.LocalDateTime.ToString("g") : $"{time.LocalDateTime:g}"
: "Never"); : "Never"u8);
}, customizeUnlocks.Unlockable.Count); }
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight());
} }
} }

View file

@ -1,12 +1,12 @@
using Glamourer.Interop; using Glamourer.Interop;
using Dalamud.Bindings.ImGui;
using OtterGui;
using Penumbra.GameData.Files; using Penumbra.GameData.Files;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
using ImSharp;
using Luna;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public sealed class DatFilePanel(ImportService importService) : IGameDataDrawer public sealed class DatFilePanel : IGameDataDrawer
{ {
public ReadOnlySpan<byte> Label public ReadOnlySpan<byte> Label
=> "Character Dat File"u8; => "Character Dat File"u8;
@ -14,27 +14,41 @@ public sealed class DatFilePanel(ImportService importService) : IGameDataDrawer
public bool Disabled public bool Disabled
=> false; => false;
private string _datFilePath = string.Empty; public sealed class Cache(ImportService importService) : BasicCache(TimeSpan.FromMinutes(10)), IService
private DatCharacterFile? _datFile; {
private string _datFilePath = string.Empty;
private DatCharacterFile? _datFile;
public void Draw()
{
using var id = Im.Id.Push("dat"u8);
Im.Input.Text("##datFilePath"u8, ref _datFilePath, "Dat File Path..."u8);
var exists = _datFilePath.Length > 0 && File.Exists(_datFilePath);
if (ImEx.Button("Load"u8, Vector2.Zero, StringU8.Empty, !exists))
_datFile = importService.LoadDat(_datFilePath, out var tmp) ? tmp : null;
if (ImEx.Button("Save"u8, Vector2.Zero, StringU8.Empty, _datFilePath.Length is 0 || _datFile is null))
importService.SaveDesignAsDat(_datFilePath, _datFile!.Value.Customize, _datFile!.Value.Description);
if (_datFile is null)
return;
Im.Text($"{_datFile.Value.Magic}");
Im.Text($"{_datFile.Value.Version}");
Im.Text($"{_datFile.Value.Time.LocalDateTime:g}");
Im.Text($"{_datFile.Value.Voice}");
Im.Text($"{_datFile.Value.Customize}");
Im.Text(_datFile.Value.Description);
}
public override void Update()
=> Dirty = IManagedCache.DirtyFlags.Clean;
}
public void Draw() public void Draw()
{ {
ImGui.InputTextWithHint("##datFilePath", "Dat File Path...", ref _datFilePath, 256); var cache = CacheManager.Instance.GetOrCreateCache<Cache>(Im.Id.Current);
var exists = _datFilePath.Length > 0 && File.Exists(_datFilePath); cache.Draw();
if (ImGuiUtil.DrawDisabledButton("Load##Dat", Vector2.Zero, string.Empty, !exists))
_datFile = importService.LoadDat(_datFilePath, out var tmp) ? tmp : null;
if (ImGuiUtil.DrawDisabledButton("Save##Dat", Vector2.Zero, string.Empty, _datFilePath.Length == 0 || _datFile == null))
importService.SaveDesignAsDat(_datFilePath, _datFile!.Value.Customize, _datFile!.Value.Description);
if (_datFile != null)
{
ImGui.TextUnformatted(_datFile.Value.Magic.ToString());
ImGui.TextUnformatted(_datFile.Value.Version.ToString());
ImGui.TextUnformatted(_datFile.Value.Time.LocalDateTime.ToString("g"));
ImGui.TextUnformatted(_datFile.Value.Voice.ToString());
ImGui.TextUnformatted(_datFile.Value.Customize.ToString());
ImGui.TextUnformatted(_datFile.Value.Description);
}
} }
} }

View file

@ -1,15 +1,13 @@
using Dalamud.Interface; using Glamourer.Designs;
using Glamourer.Designs;
using Glamourer.Utility; using Glamourer.Utility;
using Dalamud.Bindings.ImGui; using ImSharp;
using Luna;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui;
using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public sealed class DesignConverterPanel(DesignConverter designConverter) : IGameDataDrawer public sealed class DesignConverterPanel : IGameDataDrawer
{ {
public ReadOnlySpan<byte> Label public ReadOnlySpan<byte> Label
=> "Design Converter"u8; => "Design Converter"u8;
@ -17,81 +15,88 @@ public sealed class DesignConverterPanel(DesignConverter designConverter) : IGam
public bool Disabled public bool Disabled
=> false; => false;
private string _clipboardText = string.Empty; public sealed class Cache(DesignConverter designConverter) : BasicCache(TimeSpan.FromMinutes(10), IManagedCache.DirtyFlags.Clean), IService
private byte[] _clipboardData = []; {
private byte[] _dataUncompressed = []; private StringU8 _clipboardText = StringU8.Empty;
private byte _version = 0; private StringU8 _clipboardData = StringU8.Empty;
private string _textUncompressed = string.Empty; private StringU8 _dataUncompressed = StringU8.Empty;
private JObject? _json = null; private byte _version;
private DesignBase? _tmpDesign = null; private StringU8 _textUncompressed = StringU8.Empty;
private Exception? _clipboardProblem = null; private JObject? _json;
private DesignBase? _tmpDesign;
private StringU8 _clipboardProblem = StringU8.Empty;
public override void Update()
=> Dirty = IManagedCache.DirtyFlags.Clean;
public void Draw()
{
if (Im.Button("Import Clipboard"u8))
{
_clipboardData = StringU8.Empty;
_dataUncompressed = StringU8.Empty;
_textUncompressed = StringU8.Empty;
_json = null;
_tmpDesign = null;
_clipboardProblem = StringU8.Empty;
try
{
_clipboardText = Im.Clipboard.GetCopy();
var textU16 = _clipboardText.ToString();
var clipboardData = Convert.FromBase64String(textU16);
_version = clipboardData[0];
if (_version is 5)
clipboardData = clipboardData[DesignBase64Migration.Base64SizeV4..];
_clipboardData = StringU8.Join((byte)' ', clipboardData.Select(b => b.ToString("X2")));
_version = clipboardData.Decompress(out var dataUncompressed);
_dataUncompressed = StringU8.Join((byte)' ', dataUncompressed.Select(b => b.ToString("X2")));
_textUncompressed = new StringU8(dataUncompressed);
var textUncompressed = _textUncompressed.ToString();
_json = JObject.Parse(textUncompressed);
_tmpDesign = designConverter.FromBase64(textU16, true, true, out _);
}
catch (Exception ex)
{
_clipboardProblem = new StringU8($"{ex}");
}
}
using var mono = Im.Font.PushMono();
if (_clipboardText.Length > 0)
Im.TextWrapped(_clipboardText);
if (_clipboardData.Length > 0)
Im.TextWrapped(_clipboardData);
if (_dataUncompressed.Length > 0)
Im.TextWrapped(_dataUncompressed);
if (_textUncompressed.Length > 0)
{
Im.TextWrapped(_textUncompressed);
if (Im.Item.Clicked())
Im.Clipboard.Set(_textUncompressed);
}
mono.Pop();
if (_json is not null)
Im.Text("JSON Parsing Successful!"u8);
if (_tmpDesign is not null)
DesignManagerPanel.DrawDesign(_tmpDesign, null);
if (_clipboardProblem.Length > 0)
{
mono.Push(Im.Font.Mono);
Im.Text(_clipboardProblem);
}
}
}
public void Draw() public void Draw()
{ {
if (ImGui.Button("Import Clipboard")) var cache = CacheManager.Instance.GetOrCreateCache<Cache>(Im.Id.Current);
{ cache.Draw();
_clipboardText = string.Empty;
_clipboardData = [];
_dataUncompressed = [];
_textUncompressed = string.Empty;
_json = null;
_tmpDesign = null;
_clipboardProblem = null;
try
{
_clipboardText = ImGui.GetClipboardText();
_clipboardData = Convert.FromBase64String(_clipboardText);
_version = _clipboardData[0];
if (_version == 5)
_clipboardData = _clipboardData[DesignBase64Migration.Base64SizeV4..];
_version = _clipboardData.Decompress(out _dataUncompressed);
_textUncompressed = Encoding.UTF8.GetString(_dataUncompressed);
_json = JObject.Parse(_textUncompressed);
_tmpDesign = designConverter.FromBase64(_clipboardText, true, true, out _);
}
catch (Exception ex)
{
_clipboardProblem = ex;
}
}
if (_clipboardText.Length > 0)
{
using var f = ImRaii.PushFont(UiBuilder.MonoFont);
ImGuiUtil.TextWrapped(_clipboardText);
}
if (_clipboardData.Length > 0)
{
using var f = ImRaii.PushFont(UiBuilder.MonoFont);
ImGuiUtil.TextWrapped(string.Join(" ", _clipboardData.Select(b => b.ToString("X2"))));
}
if (_dataUncompressed.Length > 0)
{
using var f = ImRaii.PushFont(UiBuilder.MonoFont);
ImGuiUtil.TextWrapped(string.Join(" ", _dataUncompressed.Select(b => b.ToString("X2"))));
}
if (_textUncompressed.Length > 0)
{
using var f = ImRaii.PushFont(UiBuilder.MonoFont);
ImGuiUtil.TextWrapped(_textUncompressed);
if (ImGui.IsItemClicked())
ImGui.SetClipboardText(_textUncompressed);
}
if (_json != null)
ImGui.TextUnformatted("JSON Parsing Successful!");
if (_tmpDesign != null)
DesignManagerPanel.DrawDesign(_tmpDesign, null);
if (_clipboardProblem != null)
{
using var f = ImRaii.PushFont(UiBuilder.MonoFont);
ImGuiUtil.TextWrapped(_clipboardProblem.ToString());
}
} }
} }

View file

@ -1,11 +1,6 @@
using Dalamud.Interface; using Glamourer.Designs;
using Glamourer.Designs;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using OtterGui; using Luna;
using OtterGui.Extensions;
using OtterGui.Raii;
using OtterGui.Text;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
@ -22,9 +17,10 @@ public sealed class DesignManagerPanel(DesignManager designManager, DesignFileSy
public void Draw() public void Draw()
{ {
DrawButtons(); DrawButtons();
foreach (var (design, idx) in designManager.Designs.WithIndex()) foreach (var (idx, design) in designManager.Designs.Index())
{ {
using var t = ImRaii.TreeNode($"{design.Name}##{idx}"); using var id = Im.Id.Push(idx);
using var t = Im.Tree.Node(design.Name.Text);
if (!t) if (!t)
continue; continue;
@ -32,24 +28,24 @@ public sealed class DesignManagerPanel(DesignManager designManager, DesignFileSy
var base64 = DesignBase64Migration.CreateOldBase64(design.DesignData, design.Application.Equip, design.Application.Customize, var base64 = DesignBase64Migration.CreateOldBase64(design.DesignData, design.Application.Equip, design.Application.Customize,
design.Application.Meta, design.Application.Meta,
design.WriteProtected()); design.WriteProtected());
using var font = ImRaii.PushFont(UiBuilder.MonoFont); using var font = Im.Font.PushMono();
ImGuiUtil.TextWrapped(base64); Im.TextWrapped(base64);
if (ImGui.IsItemClicked()) if (Im.Item.Clicked())
ImGui.SetClipboardText(base64); Im.Clipboard.Set(base64);
} }
} }
private void DrawButtons() private void DrawButtons()
{ {
if (ImUtf8.Button("Generate 500 Test Designs"u8)) if (Im.Button("Generate 500 Test Designs"u8))
for (var i = 0; i < 500; ++i) for (var i = 0; i < 500; ++i)
{ {
var design = designManager.CreateEmpty($"Test Designs/Test Design {i}", true); var design = designManager.CreateEmpty($"Test Designs/Test Design {i}", true);
designManager.AddTag(design, "_DebugTest"); designManager.AddTag(design, "_DebugTest");
} }
ImUtf8.SameLineInner(); Im.Line.SameInner();
if (ImUtf8.Button("Remove All Test Designs"u8)) if (Im.Button("Remove All Test Designs"u8))
{ {
var designs = designManager.Designs.Where(d => d.Tags.Contains("_DebugTest")).ToArray(); var designs = designManager.Designs.Where(d => d.Tags.Contains("_DebugTest")).ToArray();
foreach (var design in designs) foreach (var design in designs)
@ -61,34 +57,29 @@ public sealed class DesignManagerPanel(DesignManager designManager, DesignFileSy
public static void DrawDesign(DesignBase design, DesignFileSystem? fileSystem) public static void DrawDesign(DesignBase design, DesignFileSystem? fileSystem)
{ {
using var table = ImRaii.Table("##equip", 8, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit); using var table = Im.Table.Begin("##equip"u8, 8, TableFlags.RowBackground | TableFlags.SizingFixedFit);
if (design is Design d) if (design is Design d)
{ {
ImGuiUtil.DrawTableColumn("Name"); table.DrawColumn("Name"u8);
ImGuiUtil.DrawTableColumn(d.Name); table.DrawColumn(d.Name.Text);
ImGuiUtil.DrawTableColumn($"({d.Index})"); table.DrawColumn($"({d.Index})");
ImGui.TableNextColumn(); table.DrawColumn("Description (Hover)"u8);
ImGui.TextUnformatted("Description (Hover)"); Im.Tooltip.OnHover(d.Description);
ImGuiUtil.HoverTooltip(d.Description); table.NextRow();
ImGui.TableNextRow();
ImGuiUtil.DrawTableColumn("Identifier"); table.DrawDataPair("Identifier"u8, d.Identifier);
ImGuiUtil.DrawTableColumn(d.Identifier.ToString()); table.NextRow();
ImGui.TableNextRow(); table.DrawColumn("Design File System Path"u8);
ImGuiUtil.DrawTableColumn("Design File System Path"); if (fileSystem is not null)
if (fileSystem != null) table.DrawColumn(fileSystem.TryGetValue(d, out var leaf) ? leaf.FullName() : "No Path Known"u8);
ImGuiUtil.DrawTableColumn(fileSystem.TryGetValue(d, out var leaf) ? leaf.FullName() : "No Path Known"); table.NextRow();
ImGui.TableNextRow();
ImGuiUtil.DrawTableColumn("Creation"); table.DrawDataPair("Creation"u8, d.CreationDate);
ImGuiUtil.DrawTableColumn(d.CreationDate.ToString()); table.NextRow();
ImGui.TableNextRow(); table.DrawDataPair("Update"u8, d.LastEdit);
ImGuiUtil.DrawTableColumn("Update"); table.NextRow();
ImGuiUtil.DrawTableColumn(d.LastEdit.ToString()); table.DrawDataPair("Tags"u8, StringU8.Join(", "u8, d.Tags));
ImGui.TableNextRow(); table.NextRow();
ImGuiUtil.DrawTableColumn("Tags");
ImGuiUtil.DrawTableColumn(string.Join(", ", d.Tags));
ImGui.TableNextRow();
} }
foreach (var slot in EquipSlotExtensions.EqdpSlots.Prepend(EquipSlot.OffHand).Prepend(EquipSlot.MainHand)) foreach (var slot in EquipSlotExtensions.EqdpSlots.Prepend(EquipSlot.OffHand).Prepend(EquipSlot.MainHand))
@ -99,36 +90,35 @@ public sealed class DesignManagerPanel(DesignManager designManager, DesignFileSy
var applyStain = design.DoApplyStain(slot); var applyStain = design.DoApplyStain(slot);
var crest = design.DesignData.Crest(slot.ToCrestFlag()); var crest = design.DesignData.Crest(slot.ToCrestFlag());
var applyCrest = design.DoApplyCrest(slot.ToCrestFlag()); var applyCrest = design.DoApplyCrest(slot.ToCrestFlag());
ImGuiUtil.DrawTableColumn(slot.ToName()); table.DrawColumn(slot.ToNameU8());
ImGuiUtil.DrawTableColumn(item.Name); table.DrawColumn(item.Name);
ImGuiUtil.DrawTableColumn(item.ItemId.ToString()); table.DrawColumn($"{item.ItemId}");
ImGuiUtil.DrawTableColumn(apply ? "Apply" : "Keep"); table.DrawColumn(apply ? "Apply"u8 : "Keep"u8);
ImGuiUtil.DrawTableColumn(stain.ToString()); table.DrawColumn($"{stain}");
ImGuiUtil.DrawTableColumn(applyStain ? "Apply" : "Keep"); table.DrawColumn(applyStain ? "Apply"u8 : "Keep"u8);
ImGuiUtil.DrawTableColumn(crest.ToString()); table.DrawColumn($"{crest}");
ImGuiUtil.DrawTableColumn(applyCrest ? "Apply" : "Keep"); table.DrawColumn(applyCrest ? "Apply"u8 : "Keep"u8);
} }
foreach (var index in MetaExtensions.AllRelevant) foreach (var index in MetaExtensions.AllRelevant)
{ {
ImGuiUtil.DrawTableColumn(index.ToName()); table.DrawColumn(index.ToNameU8());
ImGuiUtil.DrawTableColumn(design.DesignData.GetMeta(index).ToString()); table.DrawColumn($"{design.DesignData.GetMeta(index)}");
ImGuiUtil.DrawTableColumn(design.DoApplyMeta(index) ? "Apply" : "Keep"); table.DrawColumn(design.DoApplyMeta(index) ? "Apply"u8 : "Keep"u8);
ImGui.TableNextRow(); table.NextRow();
} }
ImGuiUtil.DrawTableColumn("Model ID"); table.DrawDataPair("Model ID"u8, design.DesignData.ModelId);
ImGuiUtil.DrawTableColumn(design.DesignData.ModelId.ToString()); table.NextRow();
ImGui.TableNextRow();
foreach (var index in Enum.GetValues<CustomizeIndex>()) foreach (var index in CustomizeIndex.Values)
{ {
var value = design.DesignData.Customize[index]; var value = design.DesignData.Customize[index];
var apply = design.DoApplyCustomize(index); var apply = design.DoApplyCustomize(index);
ImGuiUtil.DrawTableColumn(index.ToDefaultName()); table.DrawColumn(index.ToNameU8());
ImGuiUtil.DrawTableColumn(value.Value.ToString()); table.DrawColumn($"{value.Value}");
ImGuiUtil.DrawTableColumn(apply ? "Apply" : "Keep"); table.DrawColumn(apply ? "Apply"u8 : "Keep"u8);
ImGui.TableNextRow(); table.NextRow();
} }
} }
} }

View file

@ -1,14 +1,10 @@
using Dalamud.Interface; using Glamourer.Designs;
using Glamourer.Designs;
using Glamourer.Services; using Glamourer.Services;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using OtterGui;
using OtterGui.Extensions;
using OtterGui.Raii;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
using Luna;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
@ -36,9 +32,9 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans)
private void DrawBase64Input() private void DrawBase64Input()
{ {
ImGui.SetNextItemWidth(-1); Im.Item.SetNextWidthFull();
ImGui.InputTextWithHint("##base64", "Base 64 input...", ref _base64, 2047); Im.Input.Text("##base64"u8, ref _base64, "Base 64 input..."u8);
if (!ImGui.IsItemDeactivatedAfterEdit()) if (!Im.Item.DeactivatedAfterEdit)
return; return;
try try
@ -48,16 +44,16 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans)
} }
catch (Exception ex) catch (Exception ex)
{ {
_base64Bytes = Array.Empty<byte>(); _base64Bytes = [];
_parse64Failure = ex; _parse64Failure = ex;
} }
if (_parse64Failure != null) if (_parse64Failure is not null)
return; return;
try try
{ {
_parse64 = DesignBase64Migration.MigrateBase64(items, humans, _base64, out var ef, out var cf, out var wp, out var meta); _parse64 = DesignBase64Migration.MigrateBase64(items, humans, _base64, out var ef, out var cf, out var wp, out var meta);
_restore = DesignBase64Migration.CreateOldBase64(in _parse64, ef, cf, meta, wp); _restore = DesignBase64Migration.CreateOldBase64(in _parse64, ef, cf, meta, wp);
_restoreBytes = Convert.FromBase64String(_restore); _restoreBytes = Convert.FromBase64String(_restore);
} }
@ -70,9 +66,9 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans)
private void DrawDesignData() private void DrawDesignData()
{ {
if (_parse64Failure != null) if (_parse64Failure is not null)
{ {
ImGuiUtil.TextWrapped(_parse64Failure.ToString()); Im.TextWrapped($"{_parse64Failure}");
return; return;
} }
@ -80,54 +76,51 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans)
return; return;
DrawDesignData(_parse64); DrawDesignData(_parse64);
using var font = ImRaii.PushFont(UiBuilder.MonoFont); using var font = Im.Font.PushMono();
ImGui.TextUnformatted(_base64); Im.Text(_base64);
using (_ = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Im.Style.ItemSpacing with { X = 0 })) foreach (var (c1, c2) in _restore.Zip(_base64))
{ {
foreach (var (c1, c2) in _restore.Zip(_base64)) using var color = ImGuiColor.Text.Push(0xFF4040D0, c1 != c2);
{ Im.Text($"{c1}");
using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF4040D0, c1 != c2); Im.Line.NoSpacing();
ImGui.TextUnformatted(c1.ToString());
Im.Line.Same();
}
} }
ImGui.NewLine(); Im.Line.New();
foreach (var ((b1, b2), idx) in _base64Bytes.Zip(_restoreBytes).WithIndex()) foreach (var (idx, (b1, b2)) in _base64Bytes.Zip(_restoreBytes).Index())
{ {
using (_ = ImRaii.Group()) using (Im.Group())
{ {
ImGui.TextUnformatted(idx.ToString("D2")); Im.Text($"{idx:D2}");
ImGui.TextUnformatted(b1.ToString("X2")); Im.Text($"{b1:X2}");
using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF4040D0, b1 != b2); using var color = ImGuiColor.Text.Push(0xFF4040D0, b1 != b2);
ImGui.TextUnformatted(b2.ToString("X2")); Im.Text($"{b2:X2}");
} }
Im.Line.Same(); Im.Line.NoSpacing();
} }
ImGui.NewLine(); Im.Line.New();
} }
private void DrawBytes() private void DrawBytes()
{ {
if (_parse64Failure == null || _base64Bytes.Length <= 0) if (_parse64Failure is null || _base64Bytes.Length <= 0)
return; return;
using var font = ImRaii.PushFont(UiBuilder.MonoFont); using var font = Im.Font.PushMono();
foreach (var (b, idx) in _base64Bytes.WithIndex()) foreach (var (idx, b) in _base64Bytes.Index())
{ {
using (_ = ImRaii.Group()) using (Im.Group())
{ {
ImGui.TextUnformatted(idx.ToString("D2")); Im.Text($"{idx:D2}");
ImGui.TextUnformatted(b.ToString("X2")); Im.Text($"{b:X2}");
} }
Im.Line.Same(); Im.Line.Same();
} }
ImGui.NewLine(); Im.Line.New();
} }
public static void DrawDesignData(in DesignData data) public static void DrawDesignData(in DesignData data)
@ -140,7 +133,7 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans)
private static void DrawHumanData(in DesignData data) private static void DrawHumanData(in DesignData data)
{ {
using var table = ImRaii.Table("##equip", 5, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit); using var table = Im.Table.Begin("##equip"u8, 5, TableFlags.RowBackground | TableFlags.SizingFixedFit);
if (!table) if (!table)
return; return;
@ -149,51 +142,45 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans)
var item = data.Item(slot); var item = data.Item(slot);
var stain = data.Stain(slot); var stain = data.Stain(slot);
var crest = data.Crest(slot.ToCrestFlag()); var crest = data.Crest(slot.ToCrestFlag());
ImGuiUtil.DrawTableColumn(slot.ToName()); table.DrawColumn(slot.ToNameU8());
ImGuiUtil.DrawTableColumn(item.Name); table.DrawColumn(item.Name);
ImGuiUtil.DrawTableColumn(item.ItemId.ToString()); table.DrawColumn($"{item.ItemId}");
ImGuiUtil.DrawTableColumn(stain.ToString()); table.DrawColumn($"{stain}");
ImGuiUtil.DrawTableColumn(crest.ToString()); table.DrawColumn($"{crest}");
} }
ImGuiUtil.DrawTableColumn("Hat Visible"); table.DrawDataPair("Hat Visible"u8, data.IsHatVisible());
ImGuiUtil.DrawTableColumn(data.IsHatVisible().ToString()); table.NextRow();
ImGui.TableNextRow(); table.DrawDataPair("Visor Toggled"u8, data.IsVisorToggled());
ImGuiUtil.DrawTableColumn("Visor Toggled"); table.NextRow();
ImGuiUtil.DrawTableColumn(data.IsVisorToggled().ToString()); table.DrawDataPair("Weapon Visible"u8, data.IsWeaponVisible());
ImGui.TableNextRow(); table.NextRow();
ImGuiUtil.DrawTableColumn("Weapon Visible");
ImGuiUtil.DrawTableColumn(data.IsWeaponVisible().ToString());
ImGui.TableNextRow();
ImGuiUtil.DrawTableColumn("Model ID"); table.DrawDataPair("Model ID"u8,data.ModelId);
ImGuiUtil.DrawTableColumn(data.ModelId.ToString()); table.NextRow();
ImGui.TableNextRow();
foreach (var index in Enum.GetValues<CustomizeIndex>()) foreach (var index in CustomizeIndex.Values)
{ {
var value = data.Customize[index]; var value = data.Customize[index];
ImGuiUtil.DrawTableColumn(index.ToDefaultName()); table.DrawDataPair(index.ToNameU8(), value.Value);
ImGuiUtil.DrawTableColumn(value.Value.ToString()); table.NextRow();
ImGui.TableNextRow();
} }
ImGuiUtil.DrawTableColumn("Is Wet"); table.DrawDataPair("Is Wet"u8, data.IsWet());
ImGuiUtil.DrawTableColumn(data.IsWet().ToString()); table.NextRow();
ImGui.TableNextRow();
} }
private static void DrawMonsterData(in DesignData data) private static void DrawMonsterData(in DesignData data)
{ {
ImGui.TextUnformatted($"Model ID {data.ModelId}"); Im.Text($"Model ID {data.ModelId}");
ImGui.Separator(); Im.Separator();
using var font = ImRaii.PushFont(UiBuilder.MonoFont); using var font = Im.Font.PushMono();
ImGui.TextUnformatted("Customize Array"); Im.Text("Customize Array"u8);
ImGui.Separator(); Im.Separator();
ImGuiUtil.TextWrapped(string.Join(" ", data.GetCustomizeBytes().Select(b => b.ToString("X2")))); Im.TextWrapped(StringU8.Join((byte)' ', data.GetCustomizeBytes().Select(b => b.ToString("X2"))));
ImGui.TextUnformatted("Equipment Array"); Im.Text("Equipment Array"u8);
ImGui.Separator(); Im.Separator();
ImGuiUtil.TextWrapped(string.Join(" ", data.GetEquipmentBytes().Select(b => b.ToString("X2")))); Im.TextWrapped(StringU8.Join((byte)' ', data.GetEquipmentBytes().Select(b => b.ToString("X2"))));
} }
} }

View file

@ -59,7 +59,7 @@ public sealed unsafe class GlamourPlatePanel : IGameDataDrawer
ImUtf8.Text(manager == null ? "-" : manager->GlamourPlates.Length.ToString()); ImUtf8.Text(manager == null ? "-" : manager->GlamourPlates.Length.ToString());
ImUtf8.Text(manager == null ? "-" : manager->GlamourPlatesRequested.ToString()); ImUtf8.Text(manager == null ? "-" : manager->GlamourPlatesRequested.ToString());
Im.Line.Same(); Im.Line.Same();
if (ImUtf8.SmallButton("Request Update"u8)) if (Im.SmallButton("Request Update"u8))
RequestGlamour(); RequestGlamour();
ImUtf8.Text(manager == null ? "-" : manager->GlamourPlatesLoaded.ToString()); ImUtf8.Text(manager == null ? "-" : manager->GlamourPlatesLoaded.ToString());
ImUtf8.Text(manager == null ? "-" : manager->IsApplyingGlamourPlate.ToString()); ImUtf8.Text(manager == null ? "-" : manager->IsApplyingGlamourPlate.ToString());

View file

@ -1,5 +1,6 @@
using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
@ -28,7 +29,7 @@ public sealed unsafe class InventoryPanel : IGameDataDrawer
ImGuiUtil.CopyOnClickSelectable($"0x{(ulong)equip:X}"); ImGuiUtil.CopyOnClickSelectable($"0x{(ulong)equip:X}");
using var table = ImRaii.Table("items", 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit); using var table = Im.Table.Begin("items"u8, 4, TableFlags.RowBackground | TableFlags.SizingFixedFit);
if (!table) if (!table)
return; return;

View file

@ -4,6 +4,7 @@ using Dalamud.Plugin;
using Glamourer.Api.Enums; using Glamourer.Api.Enums;
using Glamourer.Api.IpcSubscribers; using Glamourer.Api.IpcSubscribers;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using Luna; using Luna;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
@ -34,10 +35,10 @@ public class DesignIpcTester(IDalamudPluginInterface pluginInterface) : IUiServi
IpcTesterHelpers.NameInput(ref _gameObjectName); IpcTesterHelpers.NameInput(ref _gameObjectName);
ImUtf8.InputText("##designName"u8, ref _designName, "Design Name..."u8); ImUtf8.InputText("##designName"u8, ref _designName, "Design Name..."u8);
ImGuiUtil.GuidInput("##identifier", "Design Identifier...", string.Empty, ref _design, ref _designText, ImGuiUtil.GuidInput("##identifier", "Design Identifier...", string.Empty, ref _design, ref _designText,
ImGui.GetContentRegionAvail().X); Im.ContentRegion.Available.X);
IpcTesterHelpers.DrawFlagInput(ref _flags); IpcTesterHelpers.DrawFlagInput(ref _flags);
using var table = ImRaii.Table("##table", 2, ImGuiTableFlags.SizingFixedFit); using var table = Im.Table.Begin("##table"u8, 2, TableFlags.SizingFixedFit);
IpcTesterHelpers.DrawIntro("Last Error"); IpcTesterHelpers.DrawIntro("Last Error");
ImGui.TextUnformatted(_lastError.ToString()); ImGui.TextUnformatted(_lastError.ToString());
@ -108,11 +109,11 @@ public class DesignIpcTester(IDalamudPluginInterface pluginInterface) : IUiServi
if (!p) if (!p)
return; return;
using var table = ImRaii.Table("Designs", 2, ImGuiTableFlags.SizingFixedFit); using var table = Im.Table.Begin("Designs"u8, 2, TableFlags.SizingFixedFit);
foreach (var (guid, name) in _designs) foreach (var (guid, name) in _designs)
{ {
ImGuiUtil.DrawTableColumn(name); ImGuiUtil.DrawTableColumn(name);
using var f = ImRaii.PushFont(UiBuilder.MonoFont); using var f = Im.Font.PushMono();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGuiUtil.CopyOnClickSelectable(guid.ToString()); ImGuiUtil.CopyOnClickSelectable(guid.ToString());
} }

View file

@ -30,13 +30,13 @@ public static class IpcTesterHelpers
public static void IndexInput(ref int index) public static void IndexInput(ref int index)
{ {
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X / 2); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X / 2);
ImGui.InputInt("Game Object Index", ref index, 0, 0); ImGui.InputInt("Game Object Index", ref index, 0, 0);
} }
public static void KeyInput(ref uint key) public static void KeyInput(ref uint key)
{ {
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X / 2); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X / 2);
var keyI = (int)key; var keyI = (int)key;
if (ImGui.InputInt("Key", ref keyI, 0, 0)) if (ImGui.InputInt("Key", ref keyI, 0, 0))
key = (uint)keyI; key = (uint)keyI;
@ -44,7 +44,7 @@ public static class IpcTesterHelpers
public static void NameInput(ref string name) public static void NameInput(ref string name)
{ {
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
ImGui.InputTextWithHint("##gameObject", "Character Name...", ref name, 64); ImGui.InputTextWithHint("##gameObject", "Character Name...", ref name, 64);
} }

View file

@ -35,7 +35,7 @@ public class ItemsIpcTester(IDalamudPluginInterface pluginInterface) : IUiServic
DrawItemInput(); DrawItemInput();
IpcTesterHelpers.NameInput(ref _gameObjectName); IpcTesterHelpers.NameInput(ref _gameObjectName);
IpcTesterHelpers.DrawFlagInput(ref _flags); IpcTesterHelpers.DrawFlagInput(ref _flags);
using var table = ImRaii.Table("##table", 2, ImGuiTableFlags.SizingFixedFit); using var table = Im.Table.Begin("##table"u8, 2, TableFlags.SizingFixedFit);
IpcTesterHelpers.DrawIntro("Last Error"); IpcTesterHelpers.DrawIntro("Last Error");
ImGui.TextUnformatted(_lastError.ToString()); ImGui.TextUnformatted(_lastError.ToString());
@ -64,7 +64,7 @@ public class ItemsIpcTester(IDalamudPluginInterface pluginInterface) : IUiServic
private void DrawItemInput() private void DrawItemInput()
{ {
var tmp = _customItemId.Id; var tmp = _customItemId.Id;
var width = ImGui.GetContentRegionAvail().X / 2; var width = Im.ContentRegion.Available.X / 2;
ImGui.SetNextItemWidth(width); ImGui.SetNextItemWidth(width);
if (ImGuiUtil.InputUlong("Custom Item ID", ref tmp)) if (ImGuiUtil.InputUlong("Custom Item ID", ref tmp))
_customItemId = tmp; _customItemId = tmp;

View file

@ -85,9 +85,9 @@ public class StateIpcTester : IUiService, IDisposable
IpcTesterHelpers.KeyInput(ref _key); IpcTesterHelpers.KeyInput(ref _key);
IpcTesterHelpers.NameInput(ref _gameObjectName); IpcTesterHelpers.NameInput(ref _gameObjectName);
IpcTesterHelpers.DrawFlagInput(ref _flags); IpcTesterHelpers.DrawFlagInput(ref _flags);
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
ImGui.InputTextWithHint("##base64", "Base 64 State...", ref _base64State, 2000); ImGui.InputTextWithHint("##base64", "Base 64 State...", ref _base64State, 2000);
using var table = ImRaii.Table("##table", 2, ImGuiTableFlags.SizingFixedFit); using var table = Im.Table.Begin("##table"u8, 2, TableFlags.SizingFixedFit);
IpcTesterHelpers.DrawIntro("Last Error"); IpcTesterHelpers.DrawIntro("Last Error");
ImGui.TextUnformatted(_lastError.ToString()); ImGui.TextUnformatted(_lastError.ToString());
@ -206,7 +206,7 @@ public class StateIpcTester : IUiService, IDisposable
ImUtf8.SetClipboardText(DesignConverter.ToBase64(_state)); ImUtf8.SetClipboardText(DesignConverter.ToBase64(_state));
} }
using var font = ImRaii.PushFont(UiBuilder.MonoFont); using var font = Im.Font.PushMono();
ImUtf8.TextWrapped(_stateString ?? string.Empty); ImUtf8.TextWrapped(_stateString ?? string.Empty);
if (ImUtf8.Button("Close"u8, -Vector2.UnitX) || !ImGui.IsWindowFocused()) if (ImUtf8.Button("Close"u8, -Vector2.UnitX) || !ImGui.IsWindowFocused())
@ -219,7 +219,7 @@ public class StateIpcTester : IUiService, IDisposable
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImUtf8.Text($" ({_lastStateChangeType})"); ImUtf8.Text($" ({_lastStateChangeType})");
Im.Line.Same(); Im.Line.Same();
using (ImRaii.PushFont(UiBuilder.MonoFont)) using (Im.Font.PushMono())
{ {
ImUtf8.CopyOnClickSelectable($"0x{_lastStateChangeActor:X}"); ImUtf8.CopyOnClickSelectable($"0x{_lastStateChangeActor:X}");
} }
@ -234,7 +234,7 @@ public class StateIpcTester : IUiService, IDisposable
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImUtf8.Text($" ({_lastStateFinalizeType})"); ImUtf8.Text($" ({_lastStateFinalizeType})");
Im.Line.Same(); Im.Line.Same();
using (ImRaii.PushFont(UiBuilder.MonoFont)) using (Im.Font.PushMono())
{ {
ImUtf8.CopyOnClickSelectable($"0x{_lastStateFinalizeActor:X}"); ImUtf8.CopyOnClickSelectable($"0x{_lastStateFinalizeActor:X}");
} }

View file

@ -2,8 +2,8 @@
using Glamourer.Services; using Glamourer.Services;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui; using OtterGui;
using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
using ImGuiClip = OtterGui.ImGuiClip; using ImGuiClip = OtterGui.ImGuiClip;
@ -20,20 +20,20 @@ public sealed class ItemUnlockPanel(ItemUnlockManager itemUnlocks, ItemManager i
public void Draw() public void Draw()
{ {
using var table = ImRaii.Table("itemUnlocks", 5, using var table = Im.Table.Begin("itemUnlocks"u8, 5,
ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.BordersOuter, TableFlags.SizingFixedFit | TableFlags.RowBackground | TableFlags.ScrollY | TableFlags.BordersOuter,
new Vector2(ImGui.GetContentRegionAvail().X, 12 * ImGui.GetTextLineHeight())); Im.ContentRegion.Available with { Y = 12 * Im.Style.TextHeight });
if (!table) if (!table)
return; return;
ImGui.TableSetupColumn("ItemId", ImGuiTableColumnFlags.WidthFixed, 30 * Im.Style.GlobalScale); table.SetupColumn("ItemId"u8, TableColumnFlags.WidthFixed, 30 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthFixed, 400 * Im.Style.GlobalScale); table.SetupColumn("Name"u8, TableColumnFlags.WidthFixed, 400 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Slot", ImGuiTableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale); table.SetupColumn("Slot"u8, TableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Model", ImGuiTableColumnFlags.WidthFixed, 80 * Im.Style.GlobalScale); table.SetupColumn("Model"u8, TableColumnFlags.WidthFixed, 80 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Unlock", ImGuiTableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale); table.SetupColumn("Unlock"u8, TableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); var skips = ImGuiClip.GetNecessarySkips(Im.Style.TextHeightWithSpacing);
ImGui.TableNextRow(); ImGui.TableNextRow();
var remainder = ImGuiClip.ClippedDraw(itemUnlocks, skips, t => var remainder = ImGuiClip.ClippedDraw(itemUnlocks, skips, t =>
{ {
@ -57,6 +57,6 @@ public sealed class ItemUnlockPanel(ItemUnlockManager itemUnlocks, ItemManager i
: time.LocalDateTime.ToString("g") : time.LocalDateTime.ToString("g")
: "Never"); : "Never");
}, itemUnlocks.Count); }, itemUnlocks.Count);
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); ImGuiClip.DrawEndDummy(remainder, Im.Style.TextHeight);
} }
} }

View file

@ -2,11 +2,7 @@
using Glamourer.GameData; using Glamourer.GameData;
using Glamourer.Interop; using Glamourer.Interop;
using Glamourer.Interop.Structs; using Glamourer.Interop.Structs;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Text;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
@ -34,76 +30,72 @@ public sealed unsafe class ModelEvaluationPanel(
public void Draw() public void Draw()
{ {
ImGui.InputInt("Game Object Index", ref _gameObjectIndex, 0, 0); Im.Input.Scalar("Game Object Index"u8, ref _gameObjectIndex);
var actor = objectManager.Objects[_gameObjectIndex]; var actor = objectManager.Objects[_gameObjectIndex];
var model = actor.Model; var model = actor.Model;
using var table = ImRaii.Table("##evaluationTable", 4, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var table = Im.Table.Begin("##evaluationTable"u8, 4, TableFlags.SizingFixedFit | TableFlags.RowBackground);
ImGui.TableNextColumn(); table.NextColumn();
ImGui.TableNextColumn(); table.NextColumn();
ImGui.TableHeader("Actor"); table.Header("Actor"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImGui.TableHeader("Model"); table.Header("Model"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImGuiUtil.DrawTableColumn("Address"); table.DrawColumn("Address"u8);
ImGui.TableNextColumn(); table.NextColumn();
Glamourer.Dynamis.DrawPointer(actor); Glamourer.Dynamis.DrawPointer(actor);
ImGui.TableNextColumn(); table.NextColumn();
Glamourer.Dynamis.DrawPointer(model); Glamourer.Dynamis.DrawPointer(model);
ImGui.TableNextColumn(); table.NextColumn();
if (actor.IsCharacter) if (actor.IsCharacter)
{ {
ImGui.TextUnformatted(actor.AsCharacter->ModelContainer.ModelCharaId.ToString()); Im.Text($"{actor.AsCharacter->ModelContainer.ModelCharaId}");
if (actor.AsCharacter->CharacterData.TransformationId != 0) if (actor.AsCharacter->CharacterData.TransformationId is not 0)
ImGui.TextUnformatted($"Transformation Id: {actor.AsCharacter->CharacterData.TransformationId}"); Im.Text($"Transformation Id: {actor.AsCharacter->CharacterData.TransformationId}");
if (actor.AsCharacter->ModelContainer.ModelCharaId_2 != -1) if (actor.AsCharacter->ModelContainer.ModelCharaId_2 is not -1)
ImGui.TextUnformatted($"ModelChara2 {actor.AsCharacter->ModelContainer.ModelCharaId_2}"); Im.Text($"ModelChara2 {actor.AsCharacter->ModelContainer.ModelCharaId_2}");
ImGuiUtil.DrawTableColumn("Character Mode"); table.DrawDataPair("Character Mode"u8, actor.AsCharacter->Mode);
ImGuiUtil.DrawTableColumn($"{actor.AsCharacter->Mode}"); table.NextColumn();
ImGui.TableNextColumn(); table.NextColumn();
ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("Animation"); table.DrawDataPair("Animation"u8, ((ushort*)&actor.AsCharacter->Timeline)[0x78]);
ImGuiUtil.DrawTableColumn($"{((ushort*)&actor.AsCharacter->Timeline)[0x78]}"); table.NextColumn();
ImGui.TableNextColumn(); table.NextColumn();
ImGui.TableNextColumn();
} }
ImGuiUtil.DrawTableColumn("Mainhand");
ImGuiUtil.DrawTableColumn(actor.IsCharacter ? actor.GetMainhand().ToString() : "No Character"); table.DrawColumn("Mainhand"u8);
table.DrawColumn(actor.IsCharacter ? $"{actor.GetMainhand()}" : "No Character"u8);
var (mainhand, offhand, mainModel, offModel) = model.GetWeapons(actor); var (mainhand, offhand, mainModel, offModel) = model.GetWeapons(actor);
ImGuiUtil.DrawTableColumn(mainModel.ToString()); table.DrawColumn($"{mainModel}");
ImGui.TableNextColumn(); table.NextColumn();
ImGuiUtil.CopyOnClickSelectable(mainhand.ToString()); Glamourer.Dynamis.DrawPointer(mainhand);
ImGuiUtil.DrawTableColumn("Offhand"); table.DrawColumn("Offhand"u8);
ImGuiUtil.DrawTableColumn(actor.IsCharacter ? actor.GetOffhand().ToString() : "No Character"); table.DrawColumn(actor.IsCharacter ? $"{actor.GetOffhand()}" : "No Character"u8);
ImGuiUtil.DrawTableColumn(offModel.ToString()); table.DrawColumn($"{offModel}");
ImGui.TableNextColumn(); table.NextColumn();
ImGuiUtil.CopyOnClickSelectable(offhand.ToString()); Glamourer.Dynamis.DrawPointer(offhand);
DrawVisor(actor, model); DrawVisor(table, actor, model);
DrawVieraEars(actor, model); DrawVieraEars(table, actor, model);
DrawHatState(actor, model); DrawHatState(table, actor, model);
DrawWeaponState(actor, model); DrawWeaponState(table, actor, model);
DrawWetness(actor, model); DrawWetness(table, actor, model);
DrawEquip(actor, model); DrawEquip(table, actor, model);
DrawCustomize(actor, model); DrawCustomize(table, actor, model);
DrawCrests(actor, model); DrawCrests(table, actor, model);
DrawParameters(actor, model); DrawParameters(table, actor, model);
ImGuiUtil.DrawTableColumn("Scale"); table.DrawColumn("Scale"u8);
ImGuiUtil.DrawTableColumn(actor.Valid ? actor.AsObject->Scale.ToString(CultureInfo.InvariantCulture) : "No Character"); table.DrawColumn(actor.Valid ? actor.AsObject->Scale.ToString(CultureInfo.InvariantCulture) : "No Character"u8);
ImGuiUtil.DrawTableColumn(model.Valid ? model.AsDrawObject->Object.Scale.ToString() : "No Model"); table.DrawColumn(model.Valid ? $"{model.AsDrawObject->Object.Scale}" : "No Model"u8);
ImGuiUtil.DrawTableColumn(model.IsCharacterBase
? $"{*(float*)(model.Address + 0x270)} {*(float*)(model.Address + 0x274)}"
: "No CharacterBase");
} }
private static void DrawParameters(Actor actor, Model model) private static void DrawParameters(in Im.TableDisposable table, Actor actor, Model model)
{ {
if (!model.IsHuman) if (!model.IsHuman)
return; return;
@ -111,201 +103,211 @@ public sealed unsafe class ModelEvaluationPanel(
var convert = model.GetParameterData(); var convert = model.GetParameterData();
foreach (var flag in CustomizeParameterExtensions.AllFlags) foreach (var flag in CustomizeParameterExtensions.AllFlags)
{ {
ImGuiUtil.DrawTableColumn(flag.ToString()); using var id = Im.Id.Push((int)flag);
ImGuiUtil.DrawTableColumn(string.Empty); table.DrawColumn(flag.ToNameU8());
ImGuiUtil.DrawTableColumn(convert[flag].InternalQuadruple.ToString()); table.DrawColumn(StringU8.Empty);
ImGui.TableNextColumn(); var value = convert[flag].InternalQuadruple;
table.DrawColumn($"{value.X:F2} | {value.Y:F2} | {value.Z:F2} | {value.W:F2}");
table.NextColumn();
} }
} }
private void DrawVisor(Actor actor, Model model) private void DrawVisor(in Im.TableDisposable table, Actor actor, Model model)
{ {
using var id = ImRaii.PushId("Visor"); using var id = Im.Id.Push("Visor"u8);
ImGuiUtil.DrawTableColumn("Visor State"); table.DrawColumn("Visor State"u8);
ImGuiUtil.DrawTableColumn(actor.IsCharacter ? actor.AsCharacter->DrawData.IsVisorToggled.ToString() : "No Character"); table.DrawColumn(actor.IsCharacter ? $"{actor.AsCharacter->DrawData.IsVisorToggled}" : "No Character"u8);
ImGuiUtil.DrawTableColumn(model.IsHuman ? VisorService.GetVisorState(model).ToString() : "No Human"); table.DrawColumn(model.IsHuman ? $"{VisorService.GetVisorState(model)}" : "No Human"u8);
ImGui.TableNextColumn(); table.NextColumn();
if (!model.IsHuman) if (!model.IsHuman)
return; return;
if (ImGui.SmallButton("Set True")) if (Im.SmallButton("Set True"u8))
visorService.SetVisorState(model, true); visorService.SetVisorState(model, true);
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Set False")) if (Im.SmallButton("Set False"u8))
visorService.SetVisorState(model, false); visorService.SetVisorState(model, false);
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Toggle")) if (Im.SmallButton("Toggle"u8))
visorService.SetVisorState(model, !VisorService.GetVisorState(model)); visorService.SetVisorState(model, !VisorService.GetVisorState(model));
} }
private void DrawVieraEars(Actor actor, Model model) private void DrawVieraEars(in Im.TableDisposable table, Actor actor, Model model)
{ {
using var id = ImRaii.PushId("Viera Ears"); using var id = Im.Id.Push("Viera Ears"u8);
ImGuiUtil.DrawTableColumn("Viera Ears"); table.DrawColumn("Viera Ears"u8);
ImGuiUtil.DrawTableColumn(actor.IsCharacter ? actor.ShowVieraEars.ToString() : "No Character"); table.DrawColumn(actor.IsCharacter ? $"{actor.ShowVieraEars}" : "No Character"u8);
ImGuiUtil.DrawTableColumn(model.IsHuman ? model.VieraEarsVisible.ToString() : "No Human"); table.DrawColumn(model.IsHuman ? $"{model.VieraEarsVisible}" : "No Human"u8);
ImGui.TableNextColumn(); table.NextColumn();
if (!model.IsHuman) if (!model.IsHuman)
return; return;
if (ImGui.SmallButton("Set True")) if (Im.SmallButton("Set True"u8))
vieraEarService.SetVieraEarState(model, true); vieraEarService.SetVieraEarState(model, true);
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Set False")) if (Im.SmallButton("Set False"u8))
vieraEarService.SetVieraEarState(model, false); vieraEarService.SetVieraEarState(model, false);
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Toggle")) if (Im.SmallButton("Toggle"u8))
vieraEarService.SetVieraEarState(model, !model.VieraEarsVisible); vieraEarService.SetVieraEarState(model, !model.VieraEarsVisible);
} }
private void DrawHatState(Actor actor, Model model) private void DrawHatState(in Im.TableDisposable table, Actor actor, Model model)
{ {
using var id = ImRaii.PushId("HatState"); using var id = Im.Id.Push("HatState"u8);
ImGuiUtil.DrawTableColumn("Hat State"); table.DrawColumn("Hat State"u8);
ImGuiUtil.DrawTableColumn(actor.IsCharacter table.DrawColumn(actor.IsCharacter
? actor.AsCharacter->DrawData.IsHatHidden ? "Hidden" : actor.GetArmor(EquipSlot.Head).ToString() ? actor.AsCharacter->DrawData.IsHatHidden ? "Hidden"u8 : $"{actor.GetArmor(EquipSlot.Head)}"
: "No Character"); : "No Character"u8);
ImGuiUtil.DrawTableColumn(model.IsHuman table.DrawColumn(model.IsHuman
? model.AsHuman->Head.Value == 0 ? "No Hat" : model.GetArmor(EquipSlot.Head).ToString() ? model.AsHuman->Head.Value is 0 ? "No Hat"u8 : $"{model.GetArmor(EquipSlot.Head)}"
: "No Human"); : "No Human"u8);
ImGui.TableNextColumn(); table.NextColumn();
if (!model.IsHuman) if (!model.IsHuman)
return; return;
if (ImGui.SmallButton("Hide")) if (Im.SmallButton("Hide"u8))
updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, CharacterArmor.Empty); updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, CharacterArmor.Empty);
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Show")) if (Im.SmallButton("Show"u8))
updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, actor.GetArmor(EquipSlot.Head)); updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, actor.GetArmor(EquipSlot.Head));
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Toggle")) if (Im.SmallButton("Toggle"u8))
updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, updateSlotService.UpdateEquipSlot(model, EquipSlot.Head,
model.AsHuman->Head.Value == 0 ? actor.GetArmor(EquipSlot.Head) : CharacterArmor.Empty); model.AsHuman->Head.Value == 0 ? actor.GetArmor(EquipSlot.Head) : CharacterArmor.Empty);
} }
private static void DrawWeaponState(Actor actor, Model model) private static void DrawWeaponState(in Im.TableDisposable table, Actor actor, Model model)
{ {
using var id = ImRaii.PushId("WeaponState"); using var id = Im.Id.Push("WeaponState"u8);
ImGuiUtil.DrawTableColumn("Weapon State"); table.DrawColumn("Weapon State"u8);
ImGuiUtil.DrawTableColumn(actor.IsCharacter table.DrawColumn(actor.IsCharacter
? actor.AsCharacter->DrawData.IsWeaponHidden ? "Hidden" : "Visible" ? actor.AsCharacter->DrawData.IsWeaponHidden ? "Hidden"u8 : "Visible"u8
: "No Character"); : "No Character"u8);
string text; ReadOnlySpan<byte> text;
if (!model.IsHuman) if (!model.IsHuman)
{ {
text = "No Model"; text = "No Model"u8;
} }
else if (model.AsDrawObject->Object.ChildObject == null) else if (model.AsDrawObject->Object.ChildObject is null)
{ {
text = "No Weapon"; text = "No Weapon"u8;
} }
else else
{ {
var weapon = (DrawObject*)model.AsDrawObject->Object.ChildObject; var weapon = (DrawObject*)model.AsDrawObject->Object.ChildObject;
text = (weapon->Flags & 0x09) == 0x09 ? "Visible" : "Hidden"; text = (weapon->Flags & 0x09) is 0x09 ? "Visible"u8 : "Hidden"u8;
} }
ImGuiUtil.DrawTableColumn(text); table.DrawColumn(text);
ImGui.TableNextColumn(); table.NextColumn();
} }
private static void DrawWetness(Actor actor, Model model) private static void DrawWetness(in Im.TableDisposable table, Actor actor, Model model)
{ {
using var id = ImRaii.PushId("Wetness"); using var id = Im.Id.Push("Wetness"u8);
ImGuiUtil.DrawTableColumn("Wetness"); table.DrawColumn("Wetness"u8);
ImGuiUtil.DrawTableColumn(actor.IsCharacter ? actor.IsGPoseWet ? "GPose" : "None" : "No Character"); table.DrawColumn(actor.IsCharacter ? actor.IsGPoseWet ? "GPose"u8 : "None"u8 : "No Character"u8);
var modelString = model.IsCharacterBase table.DrawColumn(model.IsCharacterBase
? $"{model.AsCharacterBase->SwimmingWetness:F4} Swimming\n" ? $"{model.AsCharacterBase->SwimmingWetness:F4} Swimming\n"
+ $"{model.AsCharacterBase->WeatherWetness:F4} Weather\n" + $"{model.AsCharacterBase->WeatherWetness:F4} Weather\n"
+ $"{model.AsCharacterBase->ForcedWetness:F4} Forced\n" + $"{model.AsCharacterBase->ForcedWetness:F4} Forced\n"
+ $"{model.AsCharacterBase->WetnessDepth:F4} Depth\n" + $"{model.AsCharacterBase->WetnessDepth:F4} Depth\n"
: "No CharacterBase"; : "No CharacterBase"u8);
ImGuiUtil.DrawTableColumn(modelString); table.NextColumn();
ImGui.TableNextColumn();
if (!actor.IsCharacter) if (!actor.IsCharacter)
return; return;
if (ImGui.SmallButton("GPose On")) if (Im.SmallButton("GPose On"u8))
actor.IsGPoseWet = true; actor.IsGPoseWet = true;
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("GPose Off")) if (Im.SmallButton("GPose Off"u8))
actor.IsGPoseWet = false; actor.IsGPoseWet = false;
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("GPose Toggle")) if (Im.SmallButton("GPose Toggle"u8))
actor.IsGPoseWet = !actor.IsGPoseWet; actor.IsGPoseWet = !actor.IsGPoseWet;
} }
private void DrawEquip(Actor actor, Model model) private void DrawEquip(in Im.TableDisposable table, Actor actor, Model model)
{ {
using var id = ImRaii.PushId("Equipment"); using var id = Im.Id.Push("Equipment"u8);
foreach (var slot in EquipSlotExtensions.EqdpSlots) foreach (var slot in EquipSlotExtensions.EqdpSlots)
{ {
using var id2 = ImRaii.PushId((int)slot); id.Push((int)slot);
ImGuiUtil.DrawTableColumn(slot.ToName()); table.DrawColumn(slot.ToNameU8());
ImGuiUtil.DrawTableColumn(actor.IsCharacter ? actor.GetArmor(slot).ToString() : "No Character"); table.DrawColumn(actor.IsCharacter ? $"{actor.GetArmor(slot)}" : "No Character"u8);
ImGuiUtil.DrawTableColumn(model.IsHuman ? model.GetArmor(slot).ToString() : "No Human"); table.DrawColumn(model.IsHuman ? $"{model.GetArmor(slot)}" : "No Human"u8);
ImGui.TableNextColumn(); table.NextColumn();
if (!model.IsHuman) if (!model.IsHuman)
continue; continue;
if (ImGui.SmallButton("Change Piece")) if (Im.SmallButton("Change Piece"u8))
updateSlotService.UpdateArmor(model, slot, updateSlotService.UpdateArmor(model, slot,
new CharacterArmor((PrimaryId)(slot == EquipSlot.Hands ? 6064 : slot == EquipSlot.Head ? 6072 : 1), 1, StainIds.None)); new CharacterArmor(slot switch
{
EquipSlot.Hands => 6064,
EquipSlot.Head => 6072,
_ => 1,
}, 1, StainIds.None));
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Change Stain")) if (Im.SmallButton("Change Stain"u8))
updateSlotService.UpdateStain(model, slot, new StainIds(5, 7)); updateSlotService.UpdateStain(model, slot, new StainIds(5, 7));
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Reset")) if (Im.SmallButton("Reset"u8))
updateSlotService.UpdateEquipSlot(model, slot, actor.GetArmor(slot)); updateSlotService.UpdateEquipSlot(model, slot, actor.GetArmor(slot));
id.Pop();
} }
foreach (var slot in BonusExtensions.AllFlags) foreach (var slot in BonusExtensions.AllFlags)
{ {
using var id2 = ImRaii.PushId((int)slot.ToModelIndex()); id.Push((int)slot.ToModelIndex());
ImGuiUtil.DrawTableColumn(slot.ToName()); table.DrawColumn(slot.ToNameU8());
if (!actor.IsCharacter) if (!actor.IsCharacter)
{ {
ImGuiUtil.DrawTableColumn("No Character"); table.DrawColumn("No Character"u8);
} }
else else
{ {
var glassesId = actor.GetBonusItem(slot); var glassesId = actor.GetBonusItem(slot);
if (bonusItems.TryGetValue(glassesId, out var glasses)) if (bonusItems.TryGetValue(glassesId, out var glasses))
ImGuiUtil.DrawTableColumn($"{glasses.PrimaryId.Id},{glasses.Variant.Id} ({glassesId})"); table.DrawColumn($"{glasses.PrimaryId.Id},{glasses.Variant.Id} ({glassesId})");
else else
ImGuiUtil.DrawTableColumn($"{glassesId}"); table.DrawColumn($"{glassesId}");
} }
ImGuiUtil.DrawTableColumn(model.IsHuman ? model.GetBonus(slot).ToString() : "No Human"); table.DrawColumn(model.IsHuman ? $"{model.GetBonus(slot)}" : "No Human"u8);
ImGui.TableNextColumn(); table.NextColumn();
if (ImUtf8.SmallButton("Change Piece"u8)) if (Im.SmallButton("Change Piece"u8))
{ {
var data = model.GetBonus(slot); var data = model.GetBonus(slot);
updateSlotService.UpdateBonusSlot(model, slot, data with { Variant = (Variant)((data.Variant.Id + 1) % 12) }); updateSlotService.UpdateBonusSlot(model, slot, data with { Variant = (Variant)((data.Variant.Id + 1) % 12) });
} }
id.Pop();
} }
} }
private void DrawCustomize(Actor actor, Model model) private void DrawCustomize(in Im.TableDisposable table, Actor actor, Model model)
{ {
using var id = ImRaii.PushId("Customize"); using var id = Im.Id.Push("Customize"u8);
var actorCustomize = actor.IsCharacter var actorCustomize = actor.IsCharacter
? *(CustomizeArray*)&actor.AsCharacter->DrawData.CustomizeData ? *(CustomizeArray*)&actor.AsCharacter->DrawData.CustomizeData
: new CustomizeArray(); : new CustomizeArray();
var modelCustomize = model.IsHuman var modelCustomize = model.IsHuman
? *(CustomizeArray*)&model.AsHuman->Customize ? *(CustomizeArray*)&model.AsHuman->Customize
: new CustomizeArray(); : new CustomizeArray();
foreach (var type in Enum.GetValues<CustomizeIndex>()) foreach (var type in CustomizeIndex.Values)
{ {
using var id2 = ImRaii.PushId((int)type); id.Push((int)type);
ImGuiUtil.DrawTableColumn(type.ToDefaultName());
ImGuiUtil.DrawTableColumn(actor.IsCharacter ? actorCustomize[type].Value.ToString("X2") : "No Character"); table.DrawColumn(type.ToNameU8());
ImGuiUtil.DrawTableColumn(model.IsHuman ? modelCustomize[type].Value.ToString("X2") : "No Human"); table.DrawColumn(actor.IsCharacter ? $"{actorCustomize[type].Value:X2}" : "No Character"u8);
ImGui.TableNextColumn(); table.DrawColumn(model.IsHuman ? $"{modelCustomize[type].Value}" : "No Human"u8);
table.NextColumn();
if (!model.IsHuman || type.ToFlag().RequiresRedraw()) if (!model.IsHuman || type.ToFlag().RequiresRedraw())
continue; continue;
if (ImGui.SmallButton("++")) if (Im.SmallButton("++"u8))
{ {
var value = modelCustomize[type].Value; var value = modelCustomize[type].Value;
var (_, mask) = type.ToByteAndMask(); var (_, mask) = type.ToByteAndMask();
@ -316,7 +318,7 @@ public sealed unsafe class ModelEvaluationPanel(
} }
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("--")) if (Im.SmallButton("--"u8))
{ {
var value = modelCustomize[type].Value; var value = modelCustomize[type].Value;
var (_, mask) = type.ToByteAndMask(); var (_, mask) = type.ToByteAndMask();
@ -327,17 +329,19 @@ public sealed unsafe class ModelEvaluationPanel(
} }
Im.Line.Same(); Im.Line.Same();
if (ImGui.SmallButton("Reset")) if (Im.SmallButton("Reset"u8))
{ {
modelCustomize.Set(type, actorCustomize[type]); modelCustomize.Set(type, actorCustomize[type]);
changeCustomizeService.UpdateCustomize(model, modelCustomize); changeCustomizeService.UpdateCustomize(model, modelCustomize);
} }
id.Pop();
} }
} }
private void DrawCrests(Actor actor, Model model) private void DrawCrests(in Im.TableDisposable table, Actor actor, Model model)
{ {
using var id = ImRaii.PushId("Crests"); using var id = Im.Id.Push("Crests"u8);
CrestFlag whichToggle = 0; CrestFlag whichToggle = 0;
CrestFlag totalModelFlags = 0; CrestFlag totalModelFlags = 0;
foreach (var crestFlag in CrestExtensions.AllRelevantSet) foreach (var crestFlag in CrestExtensions.AllRelevantSet)
@ -346,18 +350,18 @@ public sealed unsafe class ModelEvaluationPanel(
var modelCrest = CrestService.GetModelCrest(actor, crestFlag); var modelCrest = CrestService.GetModelCrest(actor, crestFlag);
if (modelCrest) if (modelCrest)
totalModelFlags |= crestFlag; totalModelFlags |= crestFlag;
ImGuiUtil.DrawTableColumn($"{crestFlag.ToLabel()} Crest"); table.DrawColumn($"{crestFlag.ToLabel()} Crest");
ImGuiUtil.DrawTableColumn(actor.IsCharacter ? actor.GetCrest(crestFlag).ToString() : "No Character"); table.DrawColumn(actor.IsCharacter ? $"{actor.GetCrest(crestFlag)}" : "No Character"u8);
ImGuiUtil.DrawTableColumn(modelCrest.ToString()); table.DrawColumn($"{modelCrest}");
ImGui.TableNextColumn(); table.NextColumn();
if (model.IsHuman && ImGui.SmallButton("Toggle")) if (model.IsHuman && Im.SmallButton("Toggle"u8))
whichToggle = crestFlag; whichToggle = crestFlag;
id.Pop(); id.Pop();
} }
if (whichToggle != 0) if (whichToggle is not 0)
crestService.UpdateCrests(actor, totalModelFlags ^ whichToggle); crestService.UpdateCrests(actor, totalModelFlags ^ whichToggle);
} }
} }

View file

@ -5,6 +5,7 @@ using Glamourer.Designs;
using Glamourer.GameData; using Glamourer.GameData;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Text; using OtterGui.Text;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -29,10 +30,10 @@ public sealed class NpcAppearancePanel(NpcCombo npcCombo, StateManager stateMana
public void Draw() public void Draw()
{ {
ImUtf8.Checkbox("Compare Customize (or Gear)"u8, ref _customizeOrGear); ImUtf8.Checkbox("Compare Customize (or Gear)"u8, ref _customizeOrGear);
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
var resetScroll = ImUtf8.InputText("##npcFilter"u8, ref _npcFilter, "Filter..."u8); var resetScroll = ImUtf8.InputText("##npcFilter"u8, ref _npcFilter, "Filter..."u8);
using var table = ImRaii.Table("npcs", 7, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.SizingFixedFit, using var table = Im.Table.Begin("npcs"u8, 7, TableFlags.RowBackground | TableFlags.ScrollY | TableFlags.SizingFixedFit,
new Vector2(-1, 400 * Im.Style.GlobalScale)); new Vector2(-1, 400 * Im.Style.GlobalScale));
if (!table) if (!table)
return; return;
@ -40,13 +41,13 @@ public sealed class NpcAppearancePanel(NpcCombo npcCombo, StateManager stateMana
if (resetScroll) if (resetScroll)
ImGui.SetScrollY(0); ImGui.SetScrollY(0);
ImUtf8.TableSetupColumn("Button"u8, ImGuiTableColumnFlags.WidthFixed); table.SetupColumn("Button"u8, TableColumnFlags.WidthFixed);
ImUtf8.TableSetupColumn("Name"u8, ImGuiTableColumnFlags.WidthFixed, Im.Style.GlobalScale * 300); table.SetupColumn("Name"u8, TableColumnFlags.WidthFixed, Im.Style.GlobalScale * 300);
ImUtf8.TableSetupColumn("Kind"u8, ImGuiTableColumnFlags.WidthFixed); table.SetupColumn("Kind"u8, TableColumnFlags.WidthFixed);
ImUtf8.TableSetupColumn("Id"u8, ImGuiTableColumnFlags.WidthFixed); table.SetupColumn("Id"u8, TableColumnFlags.WidthFixed);
ImUtf8.TableSetupColumn("Model"u8, ImGuiTableColumnFlags.WidthFixed); table.SetupColumn("Model"u8, TableColumnFlags.WidthFixed);
ImUtf8.TableSetupColumn("Visor"u8, ImGuiTableColumnFlags.WidthFixed); table.SetupColumn("Visor"u8, TableColumnFlags.WidthFixed);
ImUtf8.TableSetupColumn("Compare"u8, ImGuiTableColumnFlags.WidthStretch); table.SetupColumn("Compare"u8, TableColumnFlags.WidthStretch);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(Im.Style.FrameHeightWithSpacing); var skips = ImGuiClip.GetNecessarySkips(Im.Style.FrameHeightWithSpacing);
@ -60,7 +61,7 @@ public sealed class NpcAppearancePanel(NpcCombo npcCombo, StateManager stateMana
void DrawData(NpcData data) void DrawData(NpcData data)
{ {
using var id = ImRaii.PushId(idx++); using var id = Im.Id.Push(idx++);
var disabled = !stateManager.GetOrCreate(objectManager.Player, out var state); var disabled = !stateManager.GetOrCreate(objectManager.Player, out var state);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImUtf8.ButtonEx("Apply"u8, ""u8, Vector2.Zero, disabled)) if (ImUtf8.ButtonEx("Apply"u8, ""u8, Vector2.Zero, disabled))
@ -84,7 +85,7 @@ public sealed class NpcAppearancePanel(NpcCombo npcCombo, StateManager stateMana
ImUtf8.DrawFrameColumn(data.VisorToggled ? FontAwesomeIcon.Check.ToIconString() : FontAwesomeIcon.Times.ToIconString()); ImUtf8.DrawFrameColumn(data.VisorToggled ? FontAwesomeIcon.Check.ToIconString() : FontAwesomeIcon.Times.ToIconString());
} }
using var mono = ImRaii.PushFont(UiBuilder.MonoFont); using var mono = Im.Font.PushMono();
ImUtf8.DrawFrameColumn(_customizeOrGear ? data.Customize.ToString() : data.WriteGear()); ImUtf8.DrawFrameColumn(_customizeOrGear ? data.Customize.ToString() : data.WriteGear());
} }
} }

View file

@ -1,4 +1,5 @@
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui; using OtterGui;
using OtterGui.Text; using OtterGui.Text;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
@ -21,7 +22,7 @@ public sealed class ObjectManagerPanel(ActorObjectManager objectManager, ActorMa
{ {
objectManager.Objects.DrawDebug(); objectManager.Objects.DrawDebug();
using (var table = ImUtf8.Table("##data"u8, 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit)) using (var table = Im.Table.Begin("##data"u8, 3, TableFlags.RowBackground | TableFlags.SizingFixedFit))
{ {
if (!table) if (!table)
return; return;
@ -57,9 +58,9 @@ public sealed class ObjectManagerPanel(ActorObjectManager objectManager, ActorMa
} }
var filterChanged = ImUtf8.InputText("##Filter"u8, ref _objectFilter, "Filter..."u8); var filterChanged = ImUtf8.InputText("##Filter"u8, ref _objectFilter, "Filter..."u8);
using var table2 = ImUtf8.Table("##data2"u8, 3, using var table2 = Im.Table.Begin("##data2"u8, 3,
ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.ScrollY, TableFlags.RowBackground | TableFlags.BordersOuter | TableFlags.ScrollY,
new Vector2(-1, 20 * ImGui.GetTextLineHeightWithSpacing())); new Vector2(-1, 20 * Im.Style.TextHeightWithSpacing));
if (!table2) if (!table2)
return; return;
@ -67,7 +68,7 @@ public sealed class ObjectManagerPanel(ActorObjectManager objectManager, ActorMa
ImGui.SetScrollY(0); ImGui.SetScrollY(0);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); var skips = ImGuiClip.GetNecessarySkips(Im.Style.TextHeightWithSpacing);
ImGui.TableNextRow(); ImGui.TableNextRow();
var remainder = ImGuiClip.FilteredClippedDraw(objectManager, skips, var remainder = ImGuiClip.FilteredClippedDraw(objectManager, skips,
@ -78,6 +79,6 @@ public sealed class ObjectManagerPanel(ActorObjectManager objectManager, ActorMa
ImUtf8.DrawTableColumn(p.Value.Label); ImUtf8.DrawTableColumn(p.Value.Label);
ImUtf8.DrawTableColumn(string.Join(", ", p.Value.Objects.OrderBy(a => a.Index).Select(a => a.Index.ToString()))); ImUtf8.DrawTableColumn(string.Join(", ", p.Value.Objects.OrderBy(a => a.Index).Select(a => a.Index.ToString())));
}); });
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeightWithSpacing()); ImGuiClip.DrawEndDummy(remainder, Im.Style.TextHeightWithSpacing);
} }
} }

View file

@ -1,9 +1,5 @@
using Dalamud.Interface.Utility; using Glamourer.Interop.Penumbra;
using Glamourer.Interop.Penumbra;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using OtterGui;
using OtterGui.Raii;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
@ -25,80 +21,76 @@ public sealed class PenumbraPanel(PenumbraService penumbra, PenumbraChangedItemT
public void Draw() public void Draw()
{ {
using var table = ImRaii.Table("##PenumbraTable", 3, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var table = Im.Table.Begin("##PenumbraTable"u8, 3, TableFlags.SizingFixedFit | TableFlags.RowBackground);
if (!table) if (!table)
return; return;
ImGuiUtil.DrawTableColumn("Available"); table.DrawDataPair("Available"u8, penumbra.Available);
ImGuiUtil.DrawTableColumn(penumbra.Available.ToString()); table.NextColumn();
ImGui.TableNextColumn(); if (Im.SmallButton("Unattach"u8))
if (ImGui.SmallButton("Unattach"))
penumbra.Unattach(); penumbra.Unattach();
Im.Line.Same(); Im.Line.SameInner();
if (ImGui.SmallButton("Reattach")) if (Im.SmallButton("Reattach"u8))
penumbra.Reattach(); penumbra.Reattach();
ImGuiUtil.DrawTableColumn("Version"); table.DrawDataPair("Version"u8, $"{penumbra.CurrentMajor}.{penumbra.CurrentMinor}");
ImGuiUtil.DrawTableColumn($"{penumbra.CurrentMajor}.{penumbra.CurrentMinor}"); table.NextColumn();
ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("Attached When"); table.DrawDataPair("Attached When"u8, penumbra.AttachTime.ToLocalTime().ToLongTimeString());
ImGuiUtil.DrawTableColumn(penumbra.AttachTime.ToLocalTime().ToLongTimeString()); table.NextColumn();
ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("Draw Object"); table.DrawFrameColumn("Draw Object"u8);
ImGui.TableNextColumn(); table.NextColumn();
var address = _drawObject.Address; var address = _drawObject.Address;
ImGui.SetNextItemWidth(200 * Im.Style.GlobalScale); Im.Item.SetNextWidthScaled(200);
if (ImGui.InputScalar("##drawObjectPtr", ImGuiDataType.U64, ref address, nint.Zero, nint.Zero, "%llx", if (Im.Input.Scalar("##drawObjectPtr"u8, ref address, "%llx"u8, flags: InputTextFlags.CharsHexadecimal))
ImGuiInputTextFlags.CharsHexadecimal))
_drawObject = address; _drawObject = address;
ImGuiUtil.DrawTableColumn(penumbra.Available table.NextColumn();
? $"0x{penumbra.GameObjectFromDrawObject(_drawObject).Address:X}" if (penumbra.Available)
: "Penumbra Unavailable"); Glamourer.Dynamis.DrawPointer(penumbra.GameObjectFromDrawObject(_drawObject).Address);
else
Im.Text("Penumbra Unavailable"u8);
ImGuiUtil.DrawTableColumn("Cutscene Object"); table.DrawFrameColumn("Cutscene Object"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImGui.SetNextItemWidth(200 * Im.Style.GlobalScale); Im.Item.SetNextWidthScaled(200);
ImGui.InputInt("##CutsceneIndex", ref _gameObjectIndex, 0, 0); Im.Input.Scalar("##CutsceneIndex"u8, ref _gameObjectIndex);
ImGuiUtil.DrawTableColumn(penumbra.Available table.DrawColumn(penumbra.Available ? $"{penumbra.CutsceneParent((ushort)_gameObjectIndex)}" : "Penumbra Unavailable"u8);
? penumbra.CutsceneParent((ushort)_gameObjectIndex).ToString()
: "Penumbra Unavailable");
ImGuiUtil.DrawTableColumn("Redraw Object"); table.DrawFrameColumn("Redraw Object"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImGui.SetNextItemWidth(200 * Im.Style.GlobalScale); Im.Item.SetNextWidthScaled(200);
ImGui.InputInt("##redrawObject", ref _gameObjectIndex, 0, 0); Im.Input.Scalar("##redrawObject"u8, ref _gameObjectIndex);
ImGui.TableNextColumn(); table.NextColumn();
using (_ = ImRaii.Disabled(!penumbra.Available)) using (Im.Disabled(!penumbra.Available))
{ {
if (ImGui.SmallButton("Redraw")) if (Im.Button("Redraw"u8))
penumbra.RedrawObject((ObjectIndex)_gameObjectIndex, RedrawType.Redraw); penumbra.RedrawObject((ObjectIndex)_gameObjectIndex, RedrawType.Redraw);
} }
ImGuiUtil.DrawTableColumn("Last Tooltip Date"); table.DrawColumn("Last Tooltip Date"u8);
ImGuiUtil.DrawTableColumn(penumbraTooltip.LastTooltip > DateTime.MinValue table.DrawColumn(penumbraTooltip.LastTooltip > DateTime.MinValue
? $"{penumbraTooltip.LastTooltip.ToLongTimeString()} ({penumbraTooltip.LastType} {penumbraTooltip.LastId})" ? $"{penumbraTooltip.LastTooltip.ToLongTimeString()} ({penumbraTooltip.LastType} {penumbraTooltip.LastId})"
: "Never"); : "Never"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImGuiUtil.DrawTableColumn("Last Click Date"); table.DrawColumn("Last Click Date"u8);
ImGuiUtil.DrawTableColumn(penumbraTooltip.LastClick > DateTime.MinValue ? penumbraTooltip.LastClick.ToLongTimeString() : "Never"); table.DrawColumn(penumbraTooltip.LastClick > DateTime.MinValue ? penumbraTooltip.LastClick.ToLongTimeString() : "Never"u8);
ImGui.TableNextColumn(); table.NextColumn();
ImGui.Separator(); Im.Separator();
ImGui.Separator(); Im.Separator();
foreach (var (slot, item) in penumbraTooltip.LastItems) foreach (var (slot, item) in penumbraTooltip.LastItems)
{ {
switch (slot) switch (slot)
{ {
case EquipSlot e: ImGuiUtil.DrawTableColumn($"{e.ToName()} Revert-Item"); break; case EquipSlot e: table.DrawColumn($"{e.ToNameU8()} Revert-Item"); break;
case BonusItemFlag f: ImGuiUtil.DrawTableColumn($"{f.ToName()} Revert-Item"); break; case BonusItemFlag f: table.DrawColumn($"{f.ToNameU8()} Revert-Item"); break;
default: ImGuiUtil.DrawTableColumn("Unk Revert-Item"); break; default: table.DrawColumn("Unk Revert-Item"u8); break;
} }
ImGuiUtil.DrawTableColumn(item.Valid ? item.Name : "None"); table.DrawColumn(item.Valid ? item.Name : "None"u8);
ImGui.TableNextColumn(); table.NextColumn();
} }
} }
} }

View file

@ -2,6 +2,7 @@
using Glamourer.Services; using Glamourer.Services;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -20,21 +21,21 @@ public sealed class UnlockableItemsPanel(ItemUnlockManager itemUnlocks, ItemMana
public void Draw() public void Draw()
{ {
using var table = ImRaii.Table("unlockableItem", 6, using var table = Im.Table.Begin("unlockableItem"u8, 6,
ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.BordersOuter, TableFlags.SizingFixedFit | TableFlags.RowBackground | TableFlags.ScrollY | TableFlags.BordersOuter,
new Vector2(ImGui.GetContentRegionAvail().X, 12 * ImGui.GetTextLineHeight())); Im.ContentRegion.Available with { Y = 12 * Im.Style.TextHeight });
if (!table) if (!table)
return; return;
ImGui.TableSetupColumn("ItemId", ImGuiTableColumnFlags.WidthFixed, 30 * Im.Style.GlobalScale); table.SetupColumn("ItemId"u8, TableColumnFlags.WidthFixed, 30 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthFixed, 400 * Im.Style.GlobalScale); table.SetupColumn("Name"u8, TableColumnFlags.WidthFixed, 400 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Slot", ImGuiTableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale); table.SetupColumn("Slot"u8, TableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Model", ImGuiTableColumnFlags.WidthFixed, 80 * Im.Style.GlobalScale); table.SetupColumn("Model"u8, TableColumnFlags.WidthFixed, 80 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Unlock", ImGuiTableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale); table.SetupColumn("Unlock"u8, TableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale);
ImGui.TableSetupColumn("Criteria", ImGuiTableColumnFlags.WidthStretch); table.SetupColumn("Criteria"u8, TableColumnFlags.WidthStretch);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); var skips = ImGuiClip.GetNecessarySkips(Im.Style.TextHeightWithSpacing);
ImGui.TableNextRow(); ImGui.TableNextRow();
var remainder = ImGuiClip.ClippedDraw(itemUnlocks.Unlockable, skips, t => var remainder = ImGuiClip.ClippedDraw(itemUnlocks.Unlockable, skips, t =>
{ {
@ -59,6 +60,6 @@ public sealed class UnlockableItemsPanel(ItemUnlockManager itemUnlocks, ItemMana
: "Never"); : "Never");
ImGuiUtil.DrawTableColumn(t.Value.ToString()); ImGuiUtil.DrawTableColumn(t.Value.ToString());
}, itemUnlocks.Unlockable.Count); }, itemUnlocks.Unlockable.Count);
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); ImGuiClip.DrawEndDummy(remainder, Im.Style.TextHeight);
} }
} }

View file

@ -52,23 +52,23 @@ public class DesignDetailTab
DrawDesignInfoTable(); DrawDesignInfoTable();
DrawDescription(); DrawDescription();
ImGui.NewLine(); Im.Line.New();
} }
private void DrawDesignInfoTable() private void DrawDesignInfoTable()
{ {
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f)); using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f));
using var table = ImUtf8.Table("Details"u8, 2); using var table = Im.Table.Begin("Details"u8, 2);
if (!table) if (!table)
return; return;
ImUtf8.TableSetupColumn("Type"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Reset Temporary Settings"u8).X); table.SetupColumn("Type"u8, TableColumnFlags.WidthFixed, Im.Font.CalculateSize("Reset Temporary Settings"u8).X);
ImUtf8.TableSetupColumn("Data"u8, ImGuiTableColumnFlags.WidthStretch); table.SetupColumn("Data"u8, TableColumnFlags.WidthStretch);
ImUtf8.DrawFrameColumn("Design Name"u8); ImUtf8.DrawFrameColumn("Design Name"u8);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var width = new Vector2(ImGui.GetContentRegionAvail().X, 0); var width = new Vector2(Im.ContentRegion.Available.X, 0);
var name = _newName ?? _selector.Selected!.Name; var name = _newName ?? _selector.Selected!.Name;
ImGui.SetNextItemWidth(width.X); ImGui.SetNextItemWidth(width.X);
if (ImUtf8.InputText("##Name"u8, ref name)) if (ImUtf8.InputText("##Name"u8, ref name))
@ -88,7 +88,7 @@ public class DesignDetailTab
ImUtf8.DrawFrameColumn("Unique Identifier"u8); ImUtf8.DrawFrameColumn("Unique Identifier"u8);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var fileName = _saveService.FileNames.DesignFile(_selector.Selected!); var fileName = _saveService.FileNames.DesignFile(_selector.Selected!);
using (ImRaii.PushFont(UiBuilder.MonoFont)) using (Im.Font.PushMono())
{ {
if (ImGui.Button(identifier, width)) if (ImGui.Button(identifier, width))
try try
@ -101,7 +101,7 @@ public class DesignDetailTab
NotificationType.Warning); NotificationType.Warning);
} }
if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) if (Im.Item.RightClicked())
ImGui.SetClipboardText(identifier); ImGui.SetClipboardText(identifier);
} }
@ -172,14 +172,14 @@ public class DesignDetailTab
if (_colorCombo.Draw("##colorCombo", colorName, "Associate a color with this design.\n" if (_colorCombo.Draw("##colorCombo", colorName, "Associate a color with this design.\n"
+ "Right-Click to revert to automatic coloring.\n" + "Right-Click to revert to automatic coloring.\n"
+ "Hold Control and scroll the mousewheel to scroll.", + "Hold Control and scroll the mousewheel to scroll.",
width.X - Im.Style.ItemSpacing.X - Im.Style.FrameHeight, ImGui.GetTextLineHeight()) width.X - Im.Style.ItemSpacing.X - Im.Style.FrameHeight, Im.Style.TextHeight)
&& _colorCombo.CurrentSelection != null) && _colorCombo.CurrentSelection != null)
{ {
colorName = _colorCombo.CurrentSelection is DesignColors.AutomaticName ? string.Empty : _colorCombo.CurrentSelection; colorName = _colorCombo.CurrentSelection is DesignColors.AutomaticName ? string.Empty : _colorCombo.CurrentSelection;
_manager.ChangeColor(_selector.Selected!, colorName); _manager.ChangeColor(_selector.Selected!, colorName);
} }
if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) if (Im.Item.RightClicked())
_manager.ChangeColor(_selector.Selected!, string.Empty); _manager.ChangeColor(_selector.Selected!, string.Empty);
if (_colors.TryGetValue(_selector.Selected!.Color, out var currentColor)) if (_colors.TryGetValue(_selector.Selected!.Color, out var currentColor))
@ -230,7 +230,7 @@ public class DesignDetailTab
private void DrawDescription() private void DrawDescription()
{ {
var desc = _selector.Selected!.Description; var desc = _selector.Selected!.Description;
var size = new Vector2(ImGui.GetContentRegionAvail().X, 12 * ImGui.GetTextLineHeightWithSpacing()); var size = new Vector2(Im.ContentRegion.Available.X, 12 * Im.Style.TextHeightWithSpacing);
if (!_editDescriptionMode) if (!_editDescriptionMode)
{ {
using (var textBox = ImUtf8.ListBox("##desc"u8, size)) using (var textBox = ImUtf8.ListBox("##desc"u8, size))

View file

@ -49,10 +49,10 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
{ } { }
protected override float CurrentWidth protected override float CurrentWidth
=> _config.Ephemeral.CurrentDesignSelectorWidth * ImUtf8.GlobalScale; => _config.Ephemeral.CurrentDesignSelectorWidth * Im.Style.GlobalScale;
protected override float MinimumAbsoluteRemainder protected override float MinimumAbsoluteRemainder
=> 470 * ImUtf8.GlobalScale; => 470 * Im.Style.GlobalScale;
protected override float MinimumScaling protected override float MinimumScaling
=> _config.Ephemeral.DesignSelectorMinimumScale; => _config.Ephemeral.DesignSelectorMinimumScale;
@ -63,7 +63,7 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
protected override void SetSize(Vector2 size) protected override void SetSize(Vector2 size)
{ {
base.SetSize(size); base.SetSize(size);
var adaptedSize = MathF.Round(size.X / ImUtf8.GlobalScale); var adaptedSize = MathF.Round(size.X / Im.Style.GlobalScale);
if (adaptedSize == _config.Ephemeral.CurrentDesignSelectorWidth) if (adaptedSize == _config.Ephemeral.CurrentDesignSelectorWidth)
return; return;
@ -136,18 +136,18 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
private void RenameLeafDesign(DesignFileSystem.Leaf leaf) private void RenameLeafDesign(DesignFileSystem.Leaf leaf)
{ {
ImGui.Separator(); Im.Separator();
RenameLeaf(leaf); RenameLeaf(leaf);
} }
private void RenameDesign(DesignFileSystem.Leaf leaf) private void RenameDesign(DesignFileSystem.Leaf leaf)
{ {
ImGui.Separator(); Im.Separator();
var currentName = leaf.Value.Name.Text; var currentName = leaf.Value.Name.Text;
if (ImGui.IsWindowAppearing()) if (ImGui.IsWindowAppearing())
ImGui.SetKeyboardFocusHere(0); ImGui.SetKeyboardFocusHere(0);
ImGui.TextUnformatted("Rename Design:"); ImGui.TextUnformatted("Rename Design:");
if (ImGui.InputText("##RenameDesign", ref currentName, 256, ImGuiInputTextFlags.EnterReturnsTrue)) if (Im.Input.Text("##RenameDesign"u8, ref currentName, StringU8.Empty, InputTextFlags.EnterReturnsTrue))
{ {
_designManager.Rename(leaf.Value, currentName); _designManager.Rename(leaf.Value, currentName);
ImGui.CloseCurrentPopup(); ImGui.CloseCurrentPopup();
@ -194,13 +194,13 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
=> _config.SortMode; => _config.SortMode;
protected override uint ExpandedFolderColor protected override uint ExpandedFolderColor
=> ColorId.FolderExpanded.Value(); => ColorId.FolderExpanded.Value().Color;
protected override uint CollapsedFolderColor protected override uint CollapsedFolderColor
=> ColorId.FolderCollapsed.Value(); => ColorId.FolderCollapsed.Value().Color;
protected override uint FolderLineColor protected override uint FolderLineColor
=> ColorId.FolderLine.Value(); => ColorId.FolderLine.Value().Color;
protected override bool FoldersDefaultOpen protected override bool FoldersDefaultOpen
=> _config.OpenFoldersByDefault; => _config.OpenFoldersByDefault;

View file

@ -74,13 +74,13 @@ public class DesignLinkDrawer(
private void DrawList() private void DrawList()
{ {
using var table = ImRaii.Table("table", 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter); using var table = Im.Table.Begin("table"u8, 3, TableFlags.RowBackground | TableFlags.BordersOuter);
if (!table) if (!table)
return; return;
ImGui.TableSetupColumn("Del", ImGuiTableColumnFlags.WidthFixed, Im.Style.FrameHeight); table.SetupColumn("Del"u8, TableColumnFlags.WidthFixed, Im.Style.FrameHeight);
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthStretch); table.SetupColumn("Name"u8, TableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("Detail", ImGuiTableColumnFlags.WidthFixed, table.SetupColumn("Detail"u8, TableColumnFlags.WidthFixed,
6 * Im.Style.FrameHeight + 5 * Im.Style.ItemInnerSpacing.X); 6 * Im.Style.FrameHeight + 5 * Im.Style.ItemInnerSpacing.X);
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Im.Style.ItemInnerSpacing); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Im.Style.ItemInnerSpacing);
@ -93,7 +93,7 @@ public class DesignLinkDrawer(
private void DrawSelf() private void DrawSelf()
{ {
using var id = ImRaii.PushId((int)LinkOrder.Self); using var id = Im.Id.Push((int)LinkOrder.Self);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var color = colorManager.GetColor(selector.Selected!); var color = colorManager.GetColor(selector.Selected!);
using (ImRaii.PushFont(UiBuilder.IconFont)) using (ImRaii.PushFont(UiBuilder.IconFont))
@ -123,7 +123,7 @@ public class DesignLinkDrawer(
private void DrawSubList(IReadOnlyList<DesignLink> list, LinkOrder order) private void DrawSubList(IReadOnlyList<DesignLink> list, LinkOrder order)
{ {
using var id = ImRaii.PushId((int)order); using var id = Im.Id.Push((int)order);
var buttonSize = new Vector2(Im.Style.FrameHeight); var buttonSize = new Vector2(Im.Style.FrameHeight);
for (var i = 0; i < list.Count; ++i) for (var i = 0; i < list.Count; ++i)
@ -157,7 +157,7 @@ public class DesignLinkDrawer(
var buttonSize = new Vector2(Im.Style.FrameHeight); var buttonSize = new Vector2(Im.Style.FrameHeight);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
combo.Draw(ImGui.GetContentRegionAvail().X); combo.Draw(Im.ContentRegion.Available.X);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
string ttBefore, ttAfter; string ttBefore, ttAfter;
bool canAddBefore, canAddAfter; bool canAddBefore, canAddAfter;
@ -218,9 +218,8 @@ public class DesignLinkDrawer(
{ {
var newType = current; var newType = current;
var newTypeInt = (uint)newType; var newTypeInt = (uint)newType;
using (ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, Im.Style.GlobalScale)) using (ImStyleBorder.Frame.Push(ColorId.FolderLine.Value()))
{ {
using var _ = ImRaii.PushColor(ImGuiCol.Border, ColorId.FolderLine.Value());
if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)ApplicationType.All)) if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)ApplicationType.All))
newType = (ApplicationType)newTypeInt; newType = (ApplicationType)newTypeInt;
} }

View file

@ -96,7 +96,7 @@ public class DesignPanel
} }
private void DrawHeader() private void DrawHeader()
=> HeaderDrawer.Draw(SelectionName, 0, ImGui.GetColorU32(ImGuiCol.FrameBg), _leftButtons, _rightButtons); => HeaderDrawer.Draw(SelectionName, 0, ImGuiColor.FrameBackground.Get().Color, _leftButtons, _rightButtons);
private string SelectionName private string SelectionName
=> _selector.Selected == null ? "No Selection" : _selector.IncognitoMode ? _selector.Selected.Incognito : _selector.Selected.Name.Text; => _selector.Selected == null ? "No Selection" : _selector.IncognitoMode ? _selector.Selected.Incognito : _selector.Selected.Name.Text;
@ -128,9 +128,9 @@ public class DesignPanel
_equipmentDrawer.DrawBonusItem(data); _equipmentDrawer.DrawBonusItem(data);
} }
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
DrawEquipmentMetaToggles(); DrawEquipmentMetaToggles();
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
_equipmentDrawer.DrawDragDropTooltip(); _equipmentDrawer.DrawDragDropTooltip();
} }
@ -168,17 +168,17 @@ public class DesignPanel
if (_config.HideDesignPanel.HasFlag(DesignPanelFlag.Customization)) if (_config.HideDesignPanel.HasFlag(DesignPanelFlag.Customization))
return; return;
var header = _selector.Selected!.DesignData.ModelId == 0 var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization);
? "Customization" using var h = Im.Tree.HeaderId(_selector.Selected!.DesignData.ModelId is 0
: $"Customization (Model Id #{_selector.Selected!.DesignData.ModelId})###Customization"; ? "Customization"
var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization); : $"Customization (Model Id #{_selector.Selected!.DesignData.ModelId})###Customization",
using var h = ImUtf8.CollapsingHeaderId(header, expand ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None); expand ? TreeNodeFlags.DefaultOpen : TreeNodeFlags.None);
if (!h) if (!h)
return; return;
if (_customizationDrawer.Draw(_selector.Selected!.DesignData.Customize, _selector.Selected.Application.Customize, if (_customizationDrawer.Draw(_selector.Selected!.DesignData.Customize, _selector.Selected.Application.Customize,
_selector.Selected!.WriteProtected(), false)) _selector.Selected!.WriteProtected(), false))
foreach (var idx in Enum.GetValues<CustomizeIndex>()) foreach (var idx in CustomizeIndex.Values)
{ {
var flag = idx.ToFlag(); var flag = idx.ToFlag();
var newValue = _customizationDrawer.ChangeApply.HasFlag(flag); var newValue = _customizationDrawer.ChangeApply.HasFlag(flag);
@ -188,7 +188,7 @@ public class DesignPanel
} }
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(MetaIndex.Wetness, _manager, _selector.Selected!)); EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(MetaIndex.Wetness, _manager, _selector.Selected!));
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
} }
private void DrawCustomizeParameters() private void DrawCustomizeParameters()
@ -226,11 +226,11 @@ public class DesignPanel
} }
var applyClan = _selector.Selected!.DoApplyCustomize(CustomizeIndex.Clan); var applyClan = _selector.Selected!.DoApplyCustomize(CustomizeIndex.Clan);
if (ImUtf8.Checkbox($"Apply {CustomizeIndex.Clan.ToDefaultName()}", ref applyClan)) if (ImUtf8.Checkbox($"Apply {CustomizeIndex.Clan.ToNameU8()}", ref applyClan))
_manager.ChangeApplyCustomize(_selector.Selected!, CustomizeIndex.Clan, applyClan); _manager.ChangeApplyCustomize(_selector.Selected!, CustomizeIndex.Clan, applyClan);
var applyGender = _selector.Selected!.DoApplyCustomize(CustomizeIndex.Gender); var applyGender = _selector.Selected!.DoApplyCustomize(CustomizeIndex.Gender);
if (ImUtf8.Checkbox($"Apply {CustomizeIndex.Gender.ToDefaultName()}", ref applyGender)) if (ImUtf8.Checkbox($"Apply {CustomizeIndex.Gender.ToNameU8()}", ref applyGender))
_manager.ChangeApplyCustomize(_selector.Selected!, CustomizeIndex.Gender, applyGender); _manager.ChangeApplyCustomize(_selector.Selected!, CustomizeIndex.Gender, applyGender);
@ -261,7 +261,7 @@ public class DesignPanel
if (!h) if (!h)
return; return;
using var disabled = ImRaii.Disabled(_selector.Selected!.WriteProtected()); using var disabled = Im.Disabled(_selector.Selected!.WriteProtected());
DrawAllButtons(); DrawAllButtons();
@ -274,7 +274,7 @@ public class DesignPanel
DrawMetaApplication(); DrawMetaApplication();
} }
ImGui.SameLine(210 * ImUtf8.GlobalScale + Im.Style.ItemSpacing.X); ImGui.SameLine(210 * Im.Style.GlobalScale + Im.Style.ItemSpacing.X);
using (var _ = ImRaii.Group()) using (var _ = ImRaii.Group())
{ {
void ApplyEquip(string label, EquipFlag allFlags, bool stain, IEnumerable<EquipSlot> slots) void ApplyEquip(string label, EquipFlag allFlags, bool stain, IEnumerable<EquipSlot> slots)
@ -327,7 +327,7 @@ public class DesignPanel
var enabled = _config.DeleteDesignModifier.IsActive(); var enabled = _config.DeleteDesignModifier.IsActive();
bool? equip = null; bool? equip = null;
bool? customize = null; bool? customize = null;
var size = new Vector2(210 * ImUtf8.GlobalScale, 0); var size = new Vector2(210 * Im.Style.GlobalScale, 0);
if (ImUtf8.ButtonEx("Disable Everything"u8, if (ImUtf8.ButtonEx("Disable Everything"u8,
"Disable application of everything, including any existing advanced dyes, advanced customizations, crests and wetness."u8, size, "Disable application of everything, including any existing advanced dyes, advanced customizations, crests and wetness."u8, size,
!enabled)) !enabled))
@ -505,16 +505,16 @@ public class DesignPanel
private void DrawPanel() private void DrawPanel()
{ {
using var table = ImUtf8.Table("##Panel", 1, ImGuiTableFlags.BordersOuter | ImGuiTableFlags.ScrollY, ImGui.GetContentRegionAvail()); using var table = Im.Table.Begin("##Panel"u8, 1, TableFlags.BordersOuter | TableFlags.ScrollY, Im.ContentRegion.Available);
if (!table || _selector.Selected == null) if (!table || _selector.Selected is null)
return; return;
ImGui.TableSetupScrollFreeze(0, 1); ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (_selector.Selected == null) if (_selector.Selected is null)
return; return;
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
DrawButtonRow(); DrawButtonRow();
ImGui.TableNextColumn(); ImGui.TableNextColumn();

View file

@ -43,7 +43,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
private void DrawCopyButtons() private void DrawCopyButtons()
{ {
var size = new Vector2((ImGui.GetContentRegionAvail().X - 2 * Im.Style.ItemSpacing.X) / 3, 0); var size = new Vector2((Im.ContentRegion.Available.X - 2 * Im.Style.ItemSpacing.X) / 3, 0);
if (ImGui.Button("Copy All to Clipboard", size)) if (ImGui.Button("Copy All to Clipboard", size))
_copy = selector.Selected!.AssociatedMods.Select(kvp => (kvp.Key, kvp.Value)).ToArray(); _copy = selector.Selected!.AssociatedMods.Select(kvp => (kvp.Key, kvp.Value)).ToArray();
@ -76,7 +76,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
if (config.Ephemeral.IncognitoMode) if (config.Ephemeral.IncognitoMode)
name = id.ShortGuid(); name = id.ShortGuid();
if (ImGuiUtil.DrawDisabledButton($"Try Applying All Associated Mods to {name}##applyAll", if (ImGuiUtil.DrawDisabledButton($"Try Applying All Associated Mods to {name}##applyAll",
new Vector2(ImGui.GetContentRegionAvail().X, 0), string.Empty, id == Guid.Empty)) new Vector2(Im.ContentRegion.Available.X, 0), string.Empty, id == Guid.Empty))
ApplyAll(); ApplyAll();
} }
@ -97,26 +97,25 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
private void DrawTable() private void DrawTable()
{ {
using var table = ImUtf8.Table("Mods"u8, config.UseTemporarySettings ? 7 : 6, ImGuiTableFlags.RowBg); using var table = Im.Table.Begin("Mods"u8, config.UseTemporarySettings ? 7 : 6, TableFlags.RowBackground);
if (!table) if (!table)
return; return;
ImUtf8.TableSetupColumn("##Buttons"u8, ImGuiTableColumnFlags.WidthFixed, table.SetupColumn("##Buttons"u8, TableColumnFlags.WidthFixed, Im.Style.FrameHeight * 3 + Im.Style.ItemInnerSpacing.X * 2);
Im.Style.FrameHeight * 3 + Im.Style.ItemInnerSpacing.X * 2); table.SetupColumn("Mod Name"u8, TableColumnFlags.WidthStretch);
ImUtf8.TableSetupColumn("Mod Name"u8, ImGuiTableColumnFlags.WidthStretch);
if (config.UseTemporarySettings) if (config.UseTemporarySettings)
ImUtf8.TableSetupColumn("Remove"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Remove"u8).X); table.SetupColumn("Remove"u8, TableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Remove"u8).X);
ImUtf8.TableSetupColumn("Inherit"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Inherit"u8).X); table.SetupColumn("Inherit"u8, TableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Inherit"u8).X);
ImUtf8.TableSetupColumn("State"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("State"u8).X); table.SetupColumn("State"u8, TableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("State"u8).X);
ImUtf8.TableSetupColumn("Priority"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Priority"u8).X); table.SetupColumn("Priority"u8, TableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Priority"u8).X);
ImUtf8.TableSetupColumn("##Options"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Applym"u8).X); table.SetupColumn("##Options"u8, TableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Applym"u8).X);
ImGui.TableHeadersRow(); table.HeaderRow();
Mod? removedMod = null; Mod? removedMod = null;
(Mod mod, ModSettings settings)? updatedMod = null; (Mod mod, ModSettings settings)? updatedMod = null;
foreach (var ((mod, settings), idx) in selector.Selected!.AssociatedMods.WithIndex()) foreach (var ((mod, settings), idx) in selector.Selected!.AssociatedMods.WithIndex())
{ {
using var id = ImRaii.PushId(idx); using var id = Im.Id.Push(idx);
DrawAssociatedModRow(mod, settings, out var removedModTmp, out var updatedModTmp); DrawAssociatedModRow(mod, settings, out var removedModTmp, out var updatedModTmp);
if (removedModTmp.HasValue) if (removedModTmp.HasValue)
removedMod = removedModTmp; removedMod = removedModTmp;
@ -150,11 +149,11 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
disabled: true); disabled: true);
} }
ImUtf8.SameLineInner(); Im.Line.SameInner();
if (ImUtf8.IconButton(FontAwesomeIcon.Clipboard, "Copy this mod setting to clipboard."u8)) if (ImUtf8.IconButton(FontAwesomeIcon.Clipboard, "Copy this mod setting to clipboard."u8))
_copy = [(mod, settings)]; _copy = [(mod, settings)];
ImUtf8.SameLineInner(); Im.Line.SameInner();
ImUtf8.IconButton(FontAwesomeIcon.RedoAlt, "Update the settings of this mod association."u8); ImUtf8.IconButton(FontAwesomeIcon.RedoAlt, "Update the settings of this mod association."u8);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
{ {
@ -166,9 +165,9 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
using var tt = ImUtf8.Tooltip(); using var tt = ImUtf8.Tooltip();
if (source.Length > 0) if (source.Length > 0)
ImUtf8.Text($"Using temporary settings made by {source}."); ImUtf8.Text($"Using temporary settings made by {source}.");
ImGui.Separator(); Im.Separator();
var namesDifferent = mod.Name != mod.DirectoryName; var namesDifferent = mod.Name != mod.DirectoryName;
ImGui.Dummy(new Vector2(300 * Im.Style.GlobalScale, 0)); Im.Dummy(new Vector2(300 * Im.Style.GlobalScale, 0));
using (ImRaii.Group()) using (ImRaii.Group())
{ {
if (namesDifferent) if (namesDifferent)
@ -220,11 +219,11 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var priority = settings.Priority; var priority = settings.Priority;
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
if (ImUtf8.InputScalarOnDeactivated("##Priority"u8, ref priority)) if (ImUtf8.InputScalarOnDeactivated("##Priority"u8, ref priority))
updatedMod = (mod, settings with { Priority = priority }); updatedMod = (mod, settings with { Priority = priority });
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGuiUtil.DrawDisabledButton("Apply", new Vector2(ImGui.GetContentRegionAvail().X, 0), string.Empty, if (ImGuiUtil.DrawDisabledButton("Apply", new Vector2(Im.ContentRegion.Available.X, 0), string.Empty,
!penumbra.Available)) !penumbra.Available))
{ {
var text = penumbra.SetMod(mod, settings, StateSource.Manual, false); var text = penumbra.SetMod(mod, settings, StateSource.Manual, false);
@ -243,13 +242,13 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
using var t = ImRaii.Tooltip(); using var t = ImRaii.Tooltip();
ImGui.TextUnformatted("This will also try to apply the following settings to the current collection:"); ImGui.TextUnformatted("This will also try to apply the following settings to the current collection:");
ImGui.NewLine(); Im.Line.New();
using (var _ = ImRaii.Group()) using (var _ = ImRaii.Group())
{ {
ModCombo.DrawSettingsLeft(settings); ModCombo.DrawSettingsLeft(settings);
} }
ImGui.SameLine(ImGui.GetContentRegionAvail().X / 2); ImGui.SameLine(Im.ContentRegion.Available.X / 2);
using (var _ = ImRaii.Group()) using (var _ = ImRaii.Group())
{ {
ModCombo.DrawSettingsRight(settings); ModCombo.DrawSettingsRight(settings);
@ -271,6 +270,6 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
manager.AddMod(selector.Selected!, _modCombo.CurrentSelection.Mod, _modCombo.CurrentSelection.Settings); manager.AddMod(selector.Selected!, _modCombo.CurrentSelection.Mod, _modCombo.CurrentSelection.Settings);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
_modCombo.Draw("##new", currentName.IsNullOrEmpty() ? "Select new Mod..." : currentName, string.Empty, _modCombo.Draw("##new", currentName.IsNullOrEmpty() ? "Select new Mod..." : currentName, string.Empty,
ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight()); Im.ContentRegion.Available.X, Im.Style.TextHeight);
} }
} }

View file

@ -1,11 +1,13 @@
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui.Classes; using OtterGui.Classes;
using OtterGui.Log; using OtterGui.Log;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Text; using OtterGui.Text;
using OtterGui.Widgets; using OtterGui.Widgets;
using MouseWheelType = OtterGui.Widgets.MouseWheelType;
namespace Glamourer.Gui.Tabs.DesignTab; namespace Glamourer.Gui.Tabs.DesignTab;
@ -29,11 +31,11 @@ public sealed class ModCombo : FilterComboCache<(Mod Mod, ModSettings Settings,
var color = settings.Enabled var color = settings.Enabled
? count > 0 ? count > 0
? ColorId.ContainsItemsEnabled.Value() ? ColorId.ContainsItemsEnabled.Value()
: ImGui.GetColorU32(ImGuiCol.Text) : ImGuiColor.Text.Get()
: count > 0 : count > 0
? ColorId.ContainsItemsDisabled.Value() ? ColorId.ContainsItemsDisabled.Value()
: ImGui.GetColorU32(ImGuiCol.TextDisabled); : ImGuiColor.TextDisabled.Get();
using (ImRaii.PushColor(ImGuiCol.Text, color)) using (ImGuiColor.Text.Push(color))
{ {
ret = ImUtf8.Selectable(mod.Name, selected); ret = ImUtf8.Selectable(mod.Name, selected);
} }
@ -43,7 +45,7 @@ public sealed class ModCombo : FilterComboCache<(Mod Mod, ModSettings Settings,
using var style = ImRaii.PushStyle(ImGuiStyleVar.PopupBorderSize, 2 * Im.Style.GlobalScale); using var style = ImRaii.PushStyle(ImGuiStyleVar.PopupBorderSize, 2 * Im.Style.GlobalScale);
using var tt = ImUtf8.Tooltip(); using var tt = ImUtf8.Tooltip();
var namesDifferent = mod.Name != mod.DirectoryName; var namesDifferent = mod.Name != mod.DirectoryName;
ImGui.Dummy(new Vector2(300 * Im.Style.GlobalScale, 0)); Im.Dummy(new Vector2(300 * Im.Style.GlobalScale, 0));
using (ImUtf8.Group()) using (ImUtf8.Group())
{ {
if (namesDifferent) if (namesDifferent)
@ -75,7 +77,7 @@ public sealed class ModCombo : FilterComboCache<(Mod Mod, ModSettings Settings,
{ {
ImUtf8.Text(setting.Key); ImUtf8.Text(setting.Key);
for (var i = 1; i < setting.Value.Count; ++i) for (var i = 1; i < setting.Value.Count; ++i)
ImGui.NewLine(); Im.Line.New();
} }
} }

View file

@ -27,7 +27,7 @@ public class MultiDesignPanel(
if (selector.SelectedPaths.Count == 0) if (selector.SelectedPaths.Count == 0)
return; return;
HeaderDrawer.Draw(string.Empty, 0, ImGui.GetColorU32(ImGuiCol.FrameBg), _leftButtons, _rightButtons); HeaderDrawer.Draw(string.Empty, 0, ImGuiColor.FrameBackground.Get().Color, _leftButtons, _rightButtons);
using var child = ImUtf8.Child("##MultiPanel"u8, default, true); using var child = ImUtf8.Child("##MultiPanel"u8, default, true);
if (!child) if (!child)
return; return;
@ -101,31 +101,31 @@ public class MultiDesignPanel(
private int DrawDesignList() private int DrawDesignList()
{ {
ResetCounts(); ResetCounts();
using var tree = ImUtf8.TreeNode("Currently Selected Objects"u8, ImGuiTreeNodeFlags.DefaultOpen | ImGuiTreeNodeFlags.NoTreePushOnOpen); using var tree = Im.Tree.Node("Currently Selected Objects"u8, TreeNodeFlags.DefaultOpen | TreeNodeFlags.NoTreePushOnOpen);
ImGui.Separator(); Im.Separator();
if (!tree) if (!tree)
return selector.SelectedPaths.Count(CountLeaves); return selector.SelectedPaths.Count(CountLeaves);
var sizeType = new Vector2(Im.Style.FrameHeight); var sizeType = new Vector2(Im.Style.FrameHeight);
var availableSizePercent = (ImGui.GetContentRegionAvail().X - sizeType.X - 4 * Im.Style.CellPadding.X) / 100; var availableSizePercent = (Im.ContentRegion.Available.X - sizeType.X - 4 * Im.Style.CellPadding.X) / 100;
var sizeMods = availableSizePercent * 35; var sizeMods = availableSizePercent * 35;
var sizeFolders = availableSizePercent * 65; var sizeFolders = availableSizePercent * 65;
var numDesigns = 0; var numDesigns = 0;
using (var table = ImUtf8.Table("mods"u8, 3, ImGuiTableFlags.RowBg)) using (var table = Im.Table.Begin("mods"u8, 3, TableFlags.RowBackground))
{ {
if (!table) if (!table)
return selector.SelectedPaths.Count(l => l is DesignFileSystem.Leaf); return selector.SelectedPaths.Count(l => l is DesignFileSystem.Leaf);
ImUtf8.TableSetupColumn("type"u8, ImGuiTableColumnFlags.WidthFixed, sizeType.X); table.SetupColumn("type"u8, TableColumnFlags.WidthFixed, sizeType.X);
ImUtf8.TableSetupColumn("mod"u8, ImGuiTableColumnFlags.WidthFixed, sizeMods); table.SetupColumn("mod"u8, TableColumnFlags.WidthFixed, sizeMods);
ImUtf8.TableSetupColumn("path"u8, ImGuiTableColumnFlags.WidthFixed, sizeFolders); table.SetupColumn("path"u8, TableColumnFlags.WidthFixed, sizeFolders);
var i = 0; var i = 0;
foreach (var (fullName, path) in selector.SelectedPaths.Select(p => (p.FullName(), p)) foreach (var (fullName, path) in selector.SelectedPaths.Select(p => (p.FullName(), p))
.OrderBy(p => p.Item1, StringComparer.OrdinalIgnoreCase)) .OrderBy(p => p.Item1, StringComparer.OrdinalIgnoreCase))
{ {
using var id = ImRaii.PushId(i++); using var id = Im.Id.Push(i++);
var (icon, text) = path is DesignFileSystem.Leaf l var (icon, text) = path is DesignFileSystem.Leaf l
? (FontAwesomeIcon.FileCircleMinus, l.Value.Name.Text) ? (FontAwesomeIcon.FileCircleMinus, l.Value.Name.Text)
: (FontAwesomeIcon.FolderMinus, string.Empty); : (FontAwesomeIcon.FolderMinus, string.Empty);
@ -141,7 +141,7 @@ public class MultiDesignPanel(
} }
} }
ImGui.Separator(); Im.Separator();
return numDesigns; return numDesigns;
} }
@ -162,7 +162,7 @@ public class MultiDesignPanel(
ImUtf8.TextFrameAligned("Multi Tagger:"u8); ImUtf8.TextFrameAligned("Multi Tagger:"u8);
Im.Line.Same(); Im.Line.Same();
var offset = ImGui.GetItemRectSize().X + Im.Style.WindowPadding.X; var offset = ImGui.GetItemRectSize().X + Im.Style.WindowPadding.X;
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 2 * (width.X + Im.Style.ItemSpacing.X)); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X - 2 * (width.X + Im.Style.ItemSpacing.X));
ImUtf8.InputText("##tag"u8, ref _tag, "Tag Name..."u8); ImUtf8.InputText("##tag"u8, ref _tag, "Tag Name..."u8);
UpdateTagCache(); UpdateTagCache();
@ -191,7 +191,7 @@ public class MultiDesignPanel(
if (ImUtf8.ButtonEx(label, tooltip, width, _removeDesigns.Count == 0)) if (ImUtf8.ButtonEx(label, tooltip, width, _removeDesigns.Count == 0))
foreach (var (design, index) in _removeDesigns) foreach (var (design, index) in _removeDesigns)
editor.RemoveTag(design, index); editor.RemoveTag(design, index);
ImGui.Separator(); Im.Separator();
return offset; return offset;
} }
@ -199,7 +199,7 @@ public class MultiDesignPanel(
{ {
ImUtf8.TextFrameAligned("Multi QDB:"u8); ImUtf8.TextFrameAligned("Multi QDB:"u8);
ImGui.SameLine(offset, Im.Style.ItemSpacing.X); ImGui.SameLine(offset, Im.Style.ItemSpacing.X);
var buttonWidth = new Vector2((ImGui.GetContentRegionAvail().X - Im.Style.ItemSpacing.X) / 2, 0); var buttonWidth = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X) / 2, 0);
var diff = _numDesigns - _numQuickDesignEnabled; var diff = _numDesigns - _numQuickDesignEnabled;
var tt = diff == 0 var tt = diff == 0
? $"All {_numDesigns} selected designs are already displayed in the quick design bar." ? $"All {_numDesigns} selected designs are already displayed in the quick design bar."
@ -220,14 +220,14 @@ public class MultiDesignPanel(
editor.SetQuickDesign(design.Value, false); editor.SetQuickDesign(design.Value, false);
} }
ImGui.Separator(); Im.Separator();
} }
private void DrawMultiLock(float offset) private void DrawMultiLock(float offset)
{ {
ImUtf8.TextFrameAligned("Multi Lock:"u8); ImUtf8.TextFrameAligned("Multi Lock:"u8);
ImGui.SameLine(offset, Im.Style.ItemSpacing.X); ImGui.SameLine(offset, Im.Style.ItemSpacing.X);
var buttonWidth = new Vector2((ImGui.GetContentRegionAvail().X - Im.Style.ItemSpacing.X) / 2, 0); var buttonWidth = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X) / 2, 0);
var diff = _numDesigns - _numDesignsLocked; var diff = _numDesigns - _numDesignsLocked;
var tt = diff == 0 var tt = diff == 0
? $"All {_numDesigns} selected designs are already write protected." ? $"All {_numDesigns} selected designs are already write protected."
@ -243,14 +243,14 @@ public class MultiDesignPanel(
if (ImUtf8.ButtonEx("Remove Write-Protection"u8, tt, buttonWidth, _numDesignsLocked == 0)) if (ImUtf8.ButtonEx("Remove Write-Protection"u8, tt, buttonWidth, _numDesignsLocked == 0))
foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>()) foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>())
editor.SetWriteProtection(design.Value, false); editor.SetWriteProtection(design.Value, false);
ImGui.Separator(); Im.Separator();
} }
private void DrawMultiResetSettings(float offset) private void DrawMultiResetSettings(float offset)
{ {
ImUtf8.TextFrameAligned("Settings:"u8); ImUtf8.TextFrameAligned("Settings:"u8);
ImGui.SameLine(offset, Im.Style.ItemSpacing.X); ImGui.SameLine(offset, Im.Style.ItemSpacing.X);
var buttonWidth = new Vector2((ImGui.GetContentRegionAvail().X - Im.Style.ItemSpacing.X) / 2, 0); var buttonWidth = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X) / 2, 0);
var diff = _numDesigns - _numDesignsResetSettings; var diff = _numDesigns - _numDesignsResetSettings;
var tt = diff == 0 var tt = diff == 0
? $"All {_numDesigns} selected designs already reset temporary settings." ? $"All {_numDesigns} selected designs already reset temporary settings."
@ -266,14 +266,14 @@ public class MultiDesignPanel(
if (ImUtf8.ButtonEx("Remove Reset Temp. Settings"u8, tt, buttonWidth, _numDesignsResetSettings == 0)) if (ImUtf8.ButtonEx("Remove Reset Temp. Settings"u8, tt, buttonWidth, _numDesignsResetSettings == 0))
foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>()) foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>())
editor.ChangeResetTemporarySettings(design.Value, false); editor.ChangeResetTemporarySettings(design.Value, false);
ImGui.Separator(); Im.Separator();
} }
private void DrawMultiResetDyes(float offset) private void DrawMultiResetDyes(float offset)
{ {
ImUtf8.TextFrameAligned("Adv. Dyes:"u8); ImUtf8.TextFrameAligned("Adv. Dyes:"u8);
ImGui.SameLine(offset, Im.Style.ItemSpacing.X); ImGui.SameLine(offset, Im.Style.ItemSpacing.X);
var buttonWidth = new Vector2((ImGui.GetContentRegionAvail().X - Im.Style.ItemSpacing.X) / 2, 0); var buttonWidth = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X) / 2, 0);
var diff = _numDesigns - _numDesignsResetDyes; var diff = _numDesigns - _numDesignsResetDyes;
var tt = diff == 0 var tt = diff == 0
? $"All {_numDesigns} selected designs already reset advanced dyes." ? $"All {_numDesigns} selected designs already reset advanced dyes."
@ -289,14 +289,14 @@ public class MultiDesignPanel(
if (ImUtf8.ButtonEx("Remove Reset Dyes"u8, tt, buttonWidth, _numDesignsResetDyes == 0)) if (ImUtf8.ButtonEx("Remove Reset Dyes"u8, tt, buttonWidth, _numDesignsResetDyes == 0))
foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>()) foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>())
editor.ChangeResetAdvancedDyes(design.Value, false); editor.ChangeResetAdvancedDyes(design.Value, false);
ImGui.Separator(); Im.Separator();
} }
private void DrawMultiForceRedraw(float offset) private void DrawMultiForceRedraw(float offset)
{ {
ImUtf8.TextFrameAligned("Redrawing:"u8); ImUtf8.TextFrameAligned("Redrawing:"u8);
ImGui.SameLine(offset, Im.Style.ItemSpacing.X); ImGui.SameLine(offset, Im.Style.ItemSpacing.X);
var buttonWidth = new Vector2((ImGui.GetContentRegionAvail().X - Im.Style.ItemSpacing.X) / 2, 0); var buttonWidth = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X) / 2, 0);
var diff = _numDesigns - _numDesignsForcedRedraw; var diff = _numDesigns - _numDesignsForcedRedraw;
var tt = diff == 0 var tt = diff == 0
? $"All {_numDesigns} selected designs already force redraws." ? $"All {_numDesigns} selected designs already force redraws."
@ -312,7 +312,7 @@ public class MultiDesignPanel(
if (ImUtf8.ButtonEx("Remove Forced Redraws"u8, tt, buttonWidth, _numDesignsForcedRedraw == 0)) if (ImUtf8.ButtonEx("Remove Forced Redraws"u8, tt, buttonWidth, _numDesignsForcedRedraw == 0))
foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>()) foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>())
editor.ChangeForcedRedraw(design.Value, false); editor.ChangeForcedRedraw(design.Value, false);
ImGui.Separator(); Im.Separator();
} }
private void DrawMultiColor(Vector2 width, float offset) private void DrawMultiColor(Vector2 width, float offset)
@ -320,7 +320,7 @@ public class MultiDesignPanel(
ImUtf8.TextFrameAligned("Multi Colors:"u8); ImUtf8.TextFrameAligned("Multi Colors:"u8);
ImGui.SameLine(offset, Im.Style.ItemSpacing.X); ImGui.SameLine(offset, Im.Style.ItemSpacing.X);
_colorCombo.Draw("##color", _colorCombo.CurrentSelection ?? string.Empty, "Select a design color.", _colorCombo.Draw("##color", _colorCombo.CurrentSelection ?? string.Empty, "Select a design color.",
ImGui.GetContentRegionAvail().X - 2 * (width.X + Im.Style.ItemSpacing.X), ImGui.GetTextLineHeight()); Im.ContentRegion.Available.X - 2 * (width.X + Im.Style.ItemSpacing.X), Im.Style.TextHeight);
UpdateColorCache(); UpdateColorCache();
var label = _addDesigns.Count > 0 var label = _addDesigns.Count > 0
@ -354,7 +354,7 @@ public class MultiDesignPanel(
editor.ChangeColor(design, string.Empty); editor.ChangeColor(design, string.Empty);
} }
ImGui.Separator(); Im.Separator();
} }
private void DrawAdvancedButtons(float offset) private void DrawAdvancedButtons(float offset)
@ -365,7 +365,7 @@ public class MultiDesignPanel(
var tt = _numDesignsWithAdvancedDyes is 0 var tt = _numDesignsWithAdvancedDyes is 0
? "No selected designs contain any advanced dyes." ? "No selected designs contain any advanced dyes."
: $"Delete {_numAdvancedDyes} advanced dyes from {_numDesignsWithAdvancedDyes} of the selected designs."; : $"Delete {_numAdvancedDyes} advanced dyes from {_numDesignsWithAdvancedDyes} of the selected designs.";
if (ImUtf8.ButtonEx("Delete All Advanced Dyes"u8, tt, new Vector2(ImGui.GetContentRegionAvail().X, 0), if (ImUtf8.ButtonEx("Delete All Advanced Dyes"u8, tt, new Vector2(Im.ContentRegion.Available.X, 0),
!enabled || _numDesignsWithAdvancedDyes is 0)) !enabled || _numDesignsWithAdvancedDyes is 0))
foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>()) foreach (var design in selector.SelectedPaths.OfType<DesignFileSystem.Leaf>())
@ -376,14 +376,14 @@ public class MultiDesignPanel(
if (!enabled && _numDesignsWithAdvancedDyes is not 0) if (!enabled && _numDesignsWithAdvancedDyes is not 0)
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {config.DeleteDesignModifier} while clicking to delete."); ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {config.DeleteDesignModifier} while clicking to delete.");
ImGui.Separator(); Im.Separator();
} }
private void DrawApplicationButtons(float offset) private void DrawApplicationButtons(float offset)
{ {
ImUtf8.TextFrameAligned("Application"u8); ImUtf8.TextFrameAligned("Application"u8);
ImGui.SameLine(offset, Im.Style.ItemSpacing.X); ImGui.SameLine(offset, Im.Style.ItemSpacing.X);
var width = new Vector2((ImGui.GetContentRegionAvail().X - Im.Style.ItemSpacing.X) / 2, 0); var width = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X) / 2, 0);
var enabled = config.DeleteDesignModifier.IsActive(); var enabled = config.DeleteDesignModifier.IsActive();
bool? equip = null; bool? equip = null;
bool? customize = null; bool? customize = null;
@ -462,7 +462,7 @@ public class MultiDesignPanel(
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {config.DeleteDesignModifier} while clicking."); ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {config.DeleteDesignModifier} while clicking.");
group.Dispose(); group.Dispose();
ImGui.Separator(); Im.Separator();
if (equip is null && customize is null) if (equip is null && customize is null)
return; return;

View file

@ -1,5 +1,4 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using OtterGui; using OtterGui;
@ -16,10 +15,10 @@ public static class HeaderDrawer
protected virtual string Description protected virtual string Description
=> string.Empty; => string.Empty;
protected virtual uint BorderColor protected virtual Rgba32 BorderColor
=> ColorId.HeaderButtons.Value(); => ColorId.HeaderButtons.Value();
protected virtual uint TextColor protected virtual Rgba32 TextColor
=> ColorId.HeaderButtons.Value(); => ColorId.HeaderButtons.Value();
protected virtual FontAwesomeIcon Icon protected virtual FontAwesomeIcon Icon
@ -36,8 +35,8 @@ public static class HeaderDrawer
if (!Visible) if (!Visible)
return; return;
using var color = ImRaii.PushColor(ImGuiCol.Border, BorderColor) using var color = ImGuiColor.Border.Push(BorderColor)
.Push(ImGuiCol.Text, TextColor, TextColor != 0); .Push(ImGuiColor.Text, TextColor, TextColor.IsVisible);
if (ImGuiUtil.DrawDisabledButton(Icon.ToIconString(), new Vector2(width, Im.Style.FrameHeight), string.Empty, Disabled, true)) if (ImGuiUtil.DrawDisabledButton(Icon.ToIconString(), new Vector2(width, Im.Style.FrameHeight), string.Empty, Disabled, true))
OnClick(); OnClick();
color.Pop(); color.Pop();
@ -94,7 +93,7 @@ public static class HeaderDrawer
} }
var rightButtonSize = rightButtons.Count(b => b.Visible) * width; var rightButtonSize = rightButtons.Count(b => b.Visible) * width;
var midSize = ImGui.GetContentRegionAvail().X - rightButtonSize - Im.Style.GlobalScale; var midSize = Im.ContentRegion.Available.X - rightButtonSize - Im.Style.GlobalScale;
style.Pop(); style.Pop();
style.Push(ImGuiStyleVar.ButtonTextAlign, new Vector2(0.5f + (rightButtonSize - leftButtonSize) / midSize, 0.5f)); style.Push(ImGuiStyleVar.ButtonTextAlign, new Vector2(0.5f + (rightButtonSize - leftButtonSize) / midSize, 0.5f));

View file

@ -1,4 +1,5 @@
using Dalamud.Interface; using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification;
using FFXIVClientStructs.FFXIV.Client.Game.Object; using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Glamourer.Designs; using Glamourer.Designs;
@ -6,11 +7,9 @@ using Glamourer.Gui.Customization;
using Glamourer.Gui.Equipment; using Glamourer.Gui.Equipment;
using Glamourer.Gui.Tabs.DesignTab; using Glamourer.Gui.Tabs.DesignTab;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using Luna; using Luna;
using OtterGui; using OtterGui;
using OtterGui.Classes;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Text; using OtterGui.Text;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -80,8 +79,8 @@ public class NpcPanel
private void DrawHeader() private void DrawHeader()
{ {
HeaderDrawer.Draw(_selector.HasSelection ? _selector.Selection.Name : "No Selection", ColorId.NormalDesign.Value(), HeaderDrawer.Draw(_selector.HasSelection ? _selector.Selection.Name : "No Selection", ColorId.NormalDesign.Value().Color,
ImGui.GetColorU32(ImGuiCol.FrameBg), _leftButtons, _rightButtons); ImGuiColor.FrameBackground.Get().Color, _leftButtons, _rightButtons);
SaveDesignDrawPopup(); SaveDesignDrawPopup();
} }
@ -92,7 +91,7 @@ public class NpcPanel
? "Remove this NPC appearance from your favorites." ? "Remove this NPC appearance from your favorites."
: "Add this NPC Appearance to your favorites."; : "Add this NPC Appearance to your favorites.";
protected override uint TextColor protected override Rgba32 TextColor
=> panel._favorites.IsFavorite(panel._selector.Selection) => panel._favorites.IsFavorite(panel._selector.Selection)
? ColorId.FavoriteStarOn.Value() ? ColorId.FavoriteStarOn.Value()
: 0x80000000; : 0x80000000;
@ -120,13 +119,13 @@ public class NpcPanel
private void DrawPanel() private void DrawPanel()
{ {
using var table = ImUtf8.Table("##Panel", 1, ImGuiTableFlags.BordersOuter | ImGuiTableFlags.ScrollY, ImGui.GetContentRegionAvail()); using var table = Im.Table.Begin("##Panel"u8, 1, TableFlags.BordersOuter | TableFlags.ScrollY, Im.ContentRegion.Available);
if (!table || !_selector.HasSelection) if (!table || !_selector.HasSelection)
return; return;
ImGui.TableSetupScrollFreeze(0, 1); ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
DrawButtonRow(); DrawButtonRow();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -147,16 +146,16 @@ public class NpcPanel
if (_config.HideDesignPanel.HasFlag(DesignPanelFlag.Customization)) if (_config.HideDesignPanel.HasFlag(DesignPanelFlag.Customization))
return; return;
var header = _selector.Selection.ModelId == 0 var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization);
? "Customization" using var h = Im.Tree.HeaderId(_selector.Selection.ModelId is 0
: $"Customization (Model Id #{_selector.Selection.ModelId})###Customization"; ? "Customization"u8
var expand = _config.AutoExpandDesignPanel.HasFlag(DesignPanelFlag.Customization); : $"Customization (Model Id #{_selector.Selection.ModelId})###Customization",
using var h = ImUtf8.CollapsingHeaderId(header, expand ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None); expand ? TreeNodeFlags.DefaultOpen : TreeNodeFlags.None);
if (!h) if (!h)
return; return;
_customizeDrawer.Draw(_selector.Selection.Customize, true, true); _customizeDrawer.Draw(_selector.Selection.Customize, true, true);
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
} }
private void DrawEquipment() private void DrawEquipment()
@ -178,9 +177,9 @@ public class NpcPanel
var offhandData = new EquipDrawData(EquipSlot.OffHand, designData) { Locked = true }; var offhandData = new EquipDrawData(EquipSlot.OffHand, designData) { Locked = true };
_equipDrawer.DrawWeapons(mainhandData, offhandData, false); _equipDrawer.DrawWeapons(mainhandData, offhandData, false);
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromValue(MetaIndex.VisorState, _selector.Selection.VisorToggled)); EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromValue(MetaIndex.VisorState, _selector.Selection.VisorToggled));
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); Im.Dummy(new Vector2(Im.Style.TextHeight / 2));
} }
private DesignData ToDesignData() private DesignData ToDesignData()
@ -237,22 +236,22 @@ public class NpcPanel
if (!h) if (!h)
return; return;
using var table = ImUtf8.Table("Details"u8, 2); using var table = Im.Table.Begin("Details"u8, 2);
if (!table) if (!table)
return; return;
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f)); using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f));
ImUtf8.TableSetupColumn("Type"u8, ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Last Update Datem").X); table.SetupColumn("Type"u8, TableColumnFlags.WidthFixed, Im.Font.CalculateSize("Last Update Datem"u8).X);
ImUtf8.TableSetupColumn("Data"u8, ImGuiTableColumnFlags.WidthStretch); table.SetupColumn("Data"u8, TableColumnFlags.WidthStretch);
var selection = _selector.Selection; var selection = _selector.Selection;
CopyButton("NPC Name"u8, selection.Name); CopyButton("NPC Name"u8, selection.Name);
CopyButton("NPC ID"u8, selection.Id.Id.ToString()); CopyButton("NPC ID"u8, selection.Id.Id.ToString());
ImGuiUtil.DrawFrameColumn("NPC Type"); ImGuiUtil.DrawFrameColumn("NPC Type");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var width = ImGui.GetContentRegionAvail().X; var width = Im.ContentRegion.Available.X;
ImGuiUtil.DrawTextButton(selection.Kind is ObjectKind.BattleNpc ? "Battle NPC" : "Event NPC", new Vector2(width, 0), ImEx.TextFramed(selection.Kind is ObjectKind.BattleNpc ? "Battle NPC"u8 : "Event NPC"u8, new Vector2(width, 0),
ImGui.GetColorU32(ImGuiCol.FrameBg)); ImGuiColor.FrameBackground.Get());
ImUtf8.DrawFrameColumn("Color"u8); ImUtf8.DrawFrameColumn("Color"u8);
var color = _favorites.GetColor(selection); var color = _favorites.GetColor(selection);
@ -262,14 +261,14 @@ public class NpcPanel
"Associate a color with this NPC appearance.\n" "Associate a color with this NPC appearance.\n"
+ "Right-Click to revert to automatic coloring.\n" + "Right-Click to revert to automatic coloring.\n"
+ "Hold Control and scroll the mousewheel to scroll.", + "Hold Control and scroll the mousewheel to scroll.",
width - Im.Style.ItemSpacing.X - Im.Style.FrameHeight, ImGui.GetTextLineHeight()) width - Im.Style.ItemSpacing.X - Im.Style.FrameHeight, Im.Style.TextHeight)
&& _colorCombo.CurrentSelection != null) && _colorCombo.CurrentSelection != null)
{ {
color = _colorCombo.CurrentSelection is DesignColors.AutomaticName ? string.Empty : _colorCombo.CurrentSelection; color = _colorCombo.CurrentSelection is DesignColors.AutomaticName ? string.Empty : _colorCombo.CurrentSelection;
_favorites.SetColor(selection, color); _favorites.SetColor(selection, color);
} }
if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) if (Im.Item.RightClicked())
{ {
_favorites.SetColor(selection, string.Empty); _favorites.SetColor(selection, string.Empty);
color = string.Empty; color = string.Empty;
@ -296,7 +295,7 @@ public class NpcPanel
{ {
ImUtf8.DrawFrameColumn(label); ImUtf8.DrawFrameColumn(label);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImUtf8.Button(text, new Vector2(ImGui.GetContentRegionAvail().X, 0))) if (ImUtf8.Button(text, new Vector2(Im.ContentRegion.Available.X, 0)))
ImUtf8.SetClipboardText(text); ImUtf8.SetClipboardText(text);
ImUtf8.HoverTooltip("Click to copy to clipboard."u8); ImUtf8.HoverTooltip("Click to copy to clipboard."u8);
} }

View file

@ -74,17 +74,17 @@ public class NpcSelector : IDisposable
private void DrawSelector() private void DrawSelector()
{ {
using var child = ImRaii.Child("##Selector", new Vector2(_width, ImGui.GetContentRegionAvail().Y), true); using var child = ImRaii.Child("##Selector", new Vector2(_width, Im.ContentRegion.Available.Y), true);
if (!child) if (!child)
return; return;
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing);
ImGuiClip.ClippedDraw(_visibleOrdered, DrawSelectable, ImGui.GetTextLineHeight()); ImGuiClip.ClippedDraw(_visibleOrdered, DrawSelectable, Im.Style.TextHeight);
} }
private void DrawSelectable(int globalIndex) private void DrawSelectable(int globalIndex)
{ {
using var id = ImRaii.PushId(globalIndex); using var id = Im.Id.Push(globalIndex);
using var color = ImGuiColor.Text.Push(_favorites.GetData(_npcs[globalIndex]).Color); using var color = ImGuiColor.Text.Push(_favorites.GetData(_npcs[globalIndex]).Color);
if (ImGui.Selectable(_npcs[globalIndex].Name, _selectedGlobalIndex == globalIndex, ImGuiSelectableFlags.AllowItemOverlap)) if (ImGui.Selectable(_npcs[globalIndex].Name, _selectedGlobalIndex == globalIndex, ImGuiSelectableFlags.AllowItemOverlap))
_selectedGlobalIndex = globalIndex; _selectedGlobalIndex = globalIndex;

View file

@ -1,7 +1,6 @@
using Dalamud.Interface; using Dalamud.Interface;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using Luna; using Luna;
using OtterGui.Filesystem; using OtterGui.Filesystem;
@ -27,7 +26,7 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule
public void Draw() public void Draw()
{ {
var show = ImGui.CollapsingHeader("Cheat Codes"); var show = Im.Tree.Header("Cheat Codes"u8);
DrawTooltip(); DrawTooltip();
if (!show) if (!show)
@ -42,22 +41,22 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule
private void DrawCodeInput() private void DrawCodeInput()
{ {
var color = codeService.CheckCode(_currentCode).Item2 is not 0 ? ColorId.ActorAvailable : ColorId.ActorUnavailable; var color = codeService.CheckCode(_currentCode).Item2 is not 0 ? ColorId.ActorAvailable : ColorId.ActorUnavailable;
using var border = ImRaii.PushFrameBorder(ImUtf8.GlobalScale, color.Value(), _currentCode.Length > 0); using var border = ImRaii.PushFrameBorder(Im.Style.GlobalScale, color.Value().Color, _currentCode.Length > 0);
ImGui.SetNextItemWidth(500 * ImUtf8.GlobalScale + ImUtf8.ItemSpacing.X); Im.Item.SetNextWidth(500 * Im.Style.GlobalScale + Im.Style.ItemSpacing.X);
if (ImUtf8.InputText("##Code"u8, ref _currentCode, "Enter Cheat Code..."u8, ImGuiInputTextFlags.EnterReturnsTrue)) if (Im.Input.Text("##Code"u8, ref _currentCode, "Enter Cheat Code..."u8, InputTextFlags.EnterReturnsTrue))
{ {
codeService.AddCode(_currentCode); codeService.AddCode(_currentCode);
_currentCode = string.Empty; _currentCode = string.Empty;
} }
Im.Line.Same(); Im.Line.Same();
ImUtf8.Icon(FontAwesomeIcon.ExclamationCircle, ImGui.GetColorU32(ImGuiCol.TextDisabled)); ImUtf8.Icon(FontAwesomeIcon.ExclamationCircle, ImGuiColor.TextDisabled.Get().Color);
DrawTooltip(); DrawTooltip();
} }
private void DrawCopyButtons() private void DrawCopyButtons()
{ {
var buttonSize = new Vector2(250 * ImUtf8.GlobalScale, 0); var buttonSize = new Vector2(250 * Im.Style.GlobalScale, 0);
if (ImUtf8.Button("Who am I?!?"u8, buttonSize)) if (ImUtf8.Button("Who am I?!?"u8, buttonSize))
funModule.WhoAmI(); funModule.WhoAmI();
ImUtf8.HoverTooltip( ImUtf8.HoverTooltip(
@ -95,17 +94,17 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule
} }
knownFlags |= flag; knownFlags |= flag;
ImUtf8.SameLineInner(); Im.Line.SameInner();
if (ImUtf8.Checkbox("\0"u8, ref state)) if (ImUtf8.Checkbox("\0"u8, ref state))
{ {
action!(state); action!(state);
codeService.SaveState(); codeService.SaveState();
} }
var hovered = ImGui.IsItemHovered(); var hovered = Im.Item.Hovered();
Im.Line.Same(); Im.Line.Same();
ImUtf8.Selectable(code, false); ImUtf8.Selectable(code);
hovered |= ImGui.IsItemHovered(); hovered |= Im.Item.Hovered();
DrawSource(i, code); DrawSource(i, code);
DrawTarget(i); DrawTarget(i);
if (hovered) if (hovered)
@ -151,7 +150,7 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule
if (!_showCodeHints) if (!_showCodeHints)
return; return;
foreach (var code in Enum.GetValues<CodeService.CodeFlag>()) foreach (var code in CodeService.CodeFlag.Values)
{ {
if (knownFlags.HasFlag(code)) if (knownFlags.HasFlag(code))
continue; continue;
@ -160,9 +159,9 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule
if (!data.Display) if (!data.Display)
continue; continue;
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImUtf8.Text(data.Effect); ImUtf8.Text(data.Effect);
using var indent = ImRaii.PushIndent(2); using var indent = ImRaii.PushIndent(2);
using (ImUtf8.Group()) using (ImUtf8.Group())
@ -171,10 +170,10 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule
ImUtf8.Text("Punctuation: "u8); ImUtf8.Text("Punctuation: "u8);
} }
ImUtf8.SameLineInner(); Im.Line.SameInner();
using (ImUtf8.Group()) using (ImUtf8.Group())
{ {
using var mono = ImRaii.PushFont(UiBuilder.MonoFont); using var mono = Im.Font.PushMono();
ImUtf8.Text($"{data.CapitalCount}"); ImUtf8.Text($"{data.CapitalCount}");
ImUtf8.Text($"{data.Punctuation}"); ImUtf8.Text($"{data.Punctuation}");
} }
@ -186,10 +185,10 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule
private static void DrawTooltip() private static void DrawTooltip()
{ {
if (!ImGui.IsItemHovered()) if (!Im.Item.Hovered())
return; return;
ImGui.SetNextWindowSize(new Vector2(400, 0)); Im.Window.SetNextSize(new Vector2(400, 0));
using var tt = ImUtf8.Tooltip(); using var tt = ImUtf8.Tooltip();
ImUtf8.TextWrapped(Tooltip); ImUtf8.TextWrapped(Tooltip);
} }

View file

@ -1,10 +1,7 @@
using Dalamud.Interface; using Dalamud.Interface;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using Luna; using Luna;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Widgets; using OtterGui.Widgets;
using Logger = OtterGui.Log.Logger; using Logger = OtterGui.Log.Logger;
using MouseWheelType = OtterGui.Widgets.MouseWheelType; using MouseWheelType = OtterGui.Widgets.MouseWheelType;
@ -20,17 +17,17 @@ public sealed class CollectionCombo(Configuration config, PenumbraService penumb
{ {
var (_, idShort, name) = Items[globalIdx]; var (_, idShort, name) = Items[globalIdx];
if (config.Ephemeral.IncognitoMode) if (config.Ephemeral.IncognitoMode)
using (ImRaii.PushFont(UiBuilder.MonoFont)) using (Im.Font.PushMono())
{ {
return ImGui.Selectable(idShort); return Im.Selectable(idShort);
} }
var ret = ImGui.Selectable(name, selected); var ret = Im.Selectable(name, selected);
Im.Line.Same(); Im.Line.Same();
using (ImRaii.PushFont(UiBuilder.MonoFont)) using (Im.Font.PushMono())
{ {
using var color = ImRaii.PushColor(ImGuiCol.Text, ImGui.GetColorU32(ImGuiCol.TextDisabled)); using var color = ImGuiColor.Text.Push(ImGuiColor.TextDisabled.Get());
ImGuiUtil.RightAlign($"({idShort})"); ImEx.TextRightAligned($"({idShort})");
} }
return ret; return ret;

View file

@ -1,7 +1,8 @@
using Dalamud.Interface; using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Glamourer.Services; using Glamourer.Services;
using Dalamud.Bindings.ImGui; using ImSharp;
using Luna; using Luna;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
@ -32,15 +33,15 @@ public class CollectionOverrideDrawer(
if (!header) if (!header)
return; return;
using var table = ImRaii.Table("table", 4, ImGuiTableFlags.RowBg); using var table = Im.Table.Begin("table"u8, 4, TableFlags.RowBackground);
if (!table) if (!table)
return; return;
var buttonSize = new Vector2(Im.Style.FrameHeight); var buttonSize = new Vector2(Im.Style.FrameHeight);
ImGui.TableSetupColumn("buttons", ImGuiTableColumnFlags.WidthFixed, buttonSize.X); table.SetupColumn("buttons"u8, TableColumnFlags.WidthFixed, buttonSize.X);
ImGui.TableSetupColumn("identifiers", ImGuiTableColumnFlags.WidthStretch, 0.35f); table.SetupColumn("identifiers"u8, TableColumnFlags.WidthStretch, 0.35f);
ImGui.TableSetupColumn("collections", ImGuiTableColumnFlags.WidthStretch, 0.4f); table.SetupColumn("collections"u8, TableColumnFlags.WidthStretch, 0.4f);
ImGui.TableSetupColumn("name", ImGuiTableColumnFlags.WidthStretch, 0.25f); table.SetupColumn("name"u8, TableColumnFlags.WidthStretch, 0.25f);
for (var i = 0; i < collectionOverrides.Overrides.Count; ++i) for (var i = 0; i < collectionOverrides.Overrides.Count; ++i)
DrawCollectionRow(ref i, buttonSize); DrawCollectionRow(ref i, buttonSize);
@ -50,7 +51,7 @@ public class CollectionOverrideDrawer(
private void DrawCollectionRow(ref int idx, Vector2 buttonSize) private void DrawCollectionRow(ref int idx, Vector2 buttonSize)
{ {
using var id = ImRaii.PushId(idx); using var id = Im.Id.Push(idx);
var (exists, actor, collection, name) = collectionOverrides.Fetch(idx); var (exists, actor, collection, name) = collectionOverrides.Fetch(idx);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -61,8 +62,8 @@ public class CollectionOverrideDrawer(
DrawActorIdentifier(idx, actor); DrawActorIdentifier(idx, actor);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (combo.Draw("##collection", name, $"Select the overriding collection. Current GUID:", ImGui.GetContentRegionAvail().X, if (combo.Draw("##collection", name, $"Select the overriding collection. Current GUID:", Im.ContentRegion.Available.X,
ImGui.GetTextLineHeight())) Im.Style.TextHeight))
{ {
var (guid, _, newName) = combo.CurrentSelection; var (guid, _, newName) = combo.CurrentSelection;
collectionOverrides.ChangeOverride(idx, guid, newName); collectionOverrides.ChangeOverride(idx, guid, newName);
@ -71,7 +72,7 @@ public class CollectionOverrideDrawer(
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
{ {
using var tt = ImRaii.Tooltip(); using var tt = ImRaii.Tooltip();
using var font = ImRaii.PushFont(UiBuilder.MonoFont); using var font = Im.Font.PushMono();
ImGui.TextUnformatted($" {collection}"); ImGui.TextUnformatted($" {collection}");
} }
@ -89,7 +90,7 @@ public class CollectionOverrideDrawer(
using var tt1 = ImRaii.Tooltip(); using var tt1 = ImRaii.Tooltip();
ImGui.TextUnformatted($"The design {name} with the GUID"); ImGui.TextUnformatted($"The design {name} with the GUID");
using (ImRaii.PushFont(UiBuilder.MonoFont)) using (Im.Font.PushMono())
{ {
ImGui.TextUnformatted($" {collection}"); ImGui.TextUnformatted($" {collection}");
} }
@ -103,7 +104,7 @@ public class CollectionOverrideDrawer(
return; return;
using var tt2 = ImRaii.Tooltip(); using var tt2 = ImRaii.Tooltip();
using var f = ImRaii.PushFont(UiBuilder.MonoFont); using var f = Im.Font.PushMono();
ImGui.TextUnformatted(collection.ToString()); ImGui.TextUnformatted(collection.ToString());
} }
@ -139,7 +140,7 @@ public class CollectionOverrideDrawer(
collectionOverrides.AddOverride([objects.PlayerData.Identifier], currentId, currentName); collectionOverrides.AddOverride([objects.PlayerData.Identifier], currentId, currentName);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
if (ImGui.InputTextWithHint("##newActor", "New Identifier...", ref _newIdentifier, 80)) if (ImGui.InputTextWithHint("##newActor", "New Identifier...", ref _newIdentifier, 80))
try try
{ {
@ -164,7 +165,7 @@ public class CollectionOverrideDrawer(
ImGui.SameLine(0, Im.Style.ItemInnerSpacing.X); ImGui.SameLine(0, Im.Style.ItemInnerSpacing.X);
using (ImRaii.PushFont(UiBuilder.IconFont)) using (ImRaii.PushFont(UiBuilder.IconFont))
{ {
using var color = ImRaii.PushColor(ImGuiCol.Text, ImGui.GetColorU32(ImGuiCol.TextDisabled)); using var color = ImGuiColor.Text.Push(Im.Style[ImGuiColor.TextDisabled]);
ImGui.TextUnformatted(FontAwesomeIcon.InfoCircle.ToIconString()); ImGui.TextUnformatted(FontAwesomeIcon.InfoCircle.ToIconString());
} }

View file

@ -57,10 +57,10 @@ public sealed class SettingsTab(
config.EnableAutoDesigns = v; config.EnableAutoDesigns = v;
autoDesignApplier.OnEnableAutoDesignsChanged(v); autoDesignApplier.OnEnableAutoDesignsChanged(v);
}); });
ImGui.NewLine(); Im.Line.New();
ImGui.NewLine(); Im.Line.New();
ImGui.NewLine(); Im.Line.New();
ImGui.NewLine(); Im.Line.New();
using (ImUtf8.Child("SettingsChild"u8, default)) using (ImUtf8.Child("SettingsChild"u8, default))
{ {
@ -110,7 +110,7 @@ public sealed class SettingsTab(
Checkbox("Prevent Random Design Repeats"u8, Checkbox("Prevent Random Design Repeats"u8,
"When using random designs, prevent the same design from being chosen twice in a row."u8, "When using random designs, prevent the same design from being chosen twice in a row."u8,
config.PreventRandomRepeats, v => config.PreventRandomRepeats = v); config.PreventRandomRepeats, v => config.PreventRandomRepeats = v);
ImGui.NewLine(); Im.Line.New();
} }
private void DrawPenumbraIntegrationSettings1() private void DrawPenumbraIntegrationSettings1()
@ -164,7 +164,7 @@ public sealed class SettingsTab(
config.DefaultDesignSettings.ResetTemporarySettings, v => config.DefaultDesignSettings.ResetTemporarySettings = v); config.DefaultDesignSettings.ResetTemporarySettings, v => config.DefaultDesignSettings.ResetTemporarySettings = v);
var tmp = config.PcpFolder; var tmp = config.PcpFolder;
ImGui.SetNextItemWidth(0.4f * ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(0.4f * Im.ContentRegion.Available.X);
if (ImUtf8.InputText("##pcpFolder"u8, ref tmp)) if (ImUtf8.InputText("##pcpFolder"u8, ref tmp))
config.PcpFolder = tmp; config.PcpFolder = tmp;
@ -175,7 +175,7 @@ public sealed class SettingsTab(
"The folder any designs created due to penumbra character packs are moved to on creation.\nLeave blank to import into Root."); "The folder any designs created due to penumbra character packs are moved to on creation.\nLeave blank to import into Root.");
tmp = config.PcpColor; tmp = config.PcpColor;
ImGui.SetNextItemWidth(0.4f * ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(0.4f * Im.ContentRegion.Available.X);
if (ImUtf8.InputText("##pcpColor"u8, ref tmp)) if (ImUtf8.InputText("##pcpColor"u8, ref tmp))
config.PcpColor = tmp; config.PcpColor = tmp;
@ -207,9 +207,9 @@ public sealed class SettingsTab(
config.ShowQuickBarInTabs, v => config.ShowQuickBarInTabs = v); config.ShowQuickBarInTabs, v => config.ShowQuickBarInTabs = v);
DrawQuickDesignBoxes(); DrawQuickDesignBoxes();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
Checkbox("Enable Game Context Menus"u8, "Whether to show a Try On via Glamourer button on context menus for equippable items."u8, Checkbox("Enable Game Context Menus"u8, "Whether to show a Try On via Glamourer button on context menus for equippable items."u8,
config.EnableGameContextMenu, v => config.EnableGameContextMenu, v =>
@ -239,9 +239,9 @@ public sealed class SettingsTab(
v => config.Ephemeral.LockMainWindow = v); v => config.Ephemeral.LockMainWindow = v);
Checkbox("Open Main Window at Game Start"u8, "Whether the main Glamourer window should be open or closed after launching the game."u8, Checkbox("Open Main Window at Game Start"u8, "Whether the main Glamourer window should be open or closed after launching the game."u8,
config.OpenWindowAtStart, v => config.OpenWindowAtStart = v); config.OpenWindowAtStart, v => config.OpenWindowAtStart = v);
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
Checkbox("Smaller Equip Display"u8, "Use single-line display without icons and small dye buttons instead of double-line display."u8, Checkbox("Smaller Equip Display"u8, "Use single-line display without icons and small dye buttons instead of double-line display."u8,
config.SmallEquip, v => config.SmallEquip = v); config.SmallEquip, v => config.SmallEquip = v);
@ -263,9 +263,9 @@ public sealed class SettingsTab(
v => config.OpenFoldersByDefault = v); v => config.OpenFoldersByDefault = v);
DrawFolderSortType(); DrawFolderSortType();
ImGui.NewLine(); Im.Line.New();
ImUtf8.Text("Show the following panels in their respective tabs:"u8); ImUtf8.Text("Show the following panels in their respective tabs:"u8);
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
DesignPanelFlagExtensions.DrawTable("##panelTable"u8, config.HideDesignPanel, config.AutoExpandDesignPanel, v => DesignPanelFlagExtensions.DrawTable("##panelTable"u8, config.HideDesignPanel, config.AutoExpandDesignPanel, v =>
{ {
config.HideDesignPanel = v; config.HideDesignPanel = v;
@ -277,9 +277,9 @@ public sealed class SettingsTab(
}); });
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
ImGui.Separator(); Im.Separator();
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
Checkbox("Allow Double-Clicking Designs to Apply"u8, Checkbox("Allow Double-Clicking Designs to Apply"u8,
"Tries to apply a design to the current player character When double-clicking it in the design selector."u8, "Tries to apply a design to the current player character When double-clicking it in the design selector."u8,
@ -295,7 +295,7 @@ public sealed class SettingsTab(
Checkbox("Show Palette+ Import Button"u8, Checkbox("Show Palette+ Import Button"u8,
"Show the import button that allows you to import Palette+ palettes onto a design in the Advanced Customization options section for designs."u8, "Show the import button that allows you to import Palette+ palettes onto a design in the Advanced Customization options section for designs."u8,
config.ShowPalettePlusImport, v => config.ShowPalettePlusImport = v); config.ShowPalettePlusImport, v => config.ShowPalettePlusImport = v);
using (ImRaii.PushId(1)) using (Im.Id.Push(1))
{ {
PaletteImportButton(); PaletteImportButton();
} }
@ -307,18 +307,17 @@ public sealed class SettingsTab(
Checkbox("Debug Mode"u8, "Show the debug tab. Only useful for debugging or advanced use. Not recommended in general."u8, Checkbox("Debug Mode"u8, "Show the debug tab. Only useful for debugging or advanced use. Not recommended in general."u8,
config.DebugMode, config.DebugMode,
v => config.DebugMode = v); v => config.DebugMode = v);
ImGui.NewLine(); Im.Line.New();
} }
private void DrawQuickDesignBoxes() private void DrawQuickDesignBoxes()
{ {
var showAuto = config.EnableAutoDesigns; var showAuto = config.EnableAutoDesigns;
var numColumns = 9 - (showAuto ? 0 : 2) - (config.UseTemporarySettings ? 0 : 1); var numColumns = 9 - (showAuto ? 0 : 2) - (config.UseTemporarySettings ? 0 : 1);
ImGui.NewLine(); Im.Line.New();
ImUtf8.Text("Show the Following Buttons in the Quick Design Bar:"u8); ImUtf8.Text("Show the Following Buttons in the Quick Design Bar:"u8);
ImGui.Dummy(Vector2.Zero); Im.Dummy(Vector2.Zero);
using var table = ImUtf8.Table("##tableQdb"u8, numColumns, using var table = Im.Table.Begin("##tableQdb"u8, numColumns, TableFlags.SizingFixedFit | TableFlags.Borders | TableFlags.NoHostExtendX);
ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.Borders | ImGuiTableFlags.NoHostExtendX);
if (!table) if (!table)
return; return;
@ -352,7 +351,7 @@ public sealed class SettingsTab(
var flag = columns[i].Item3; var flag = columns[i].Item3;
using var id = ImUtf8.PushId((int)flag); using var id = ImUtf8.PushId((int)flag);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var offset = (ImGui.GetContentRegionAvail().X - Im.Style.FrameHeight) / 2; var offset = (Im.ContentRegion.Available.X - Im.Style.FrameHeight) / 2;
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + offset); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + offset);
var value = config.QdbButtons.HasFlag(flag); var value = config.QdbButtons.HasFlag(flag);
if (!ImUtf8.Checkbox(""u8, ref value)) if (!ImUtf8.Checkbox(""u8, ref value))
@ -394,7 +393,7 @@ public sealed class SettingsTab(
using (var tree = ImUtf8.TreeNode("Color Settings"u8)) using (var tree = ImUtf8.TreeNode("Color Settings"u8))
{ {
if (tree) if (tree)
foreach (var color in Enum.GetValues<ColorId>()) foreach (var color in ColorId.Values)
{ {
var (defaultColor, name, description) = color.Data(); var (defaultColor, name, description) = color.Data();
var currentColor = config.Colors.GetValueOrDefault(color, defaultColor); var currentColor = config.Colors.GetValueOrDefault(color, defaultColor);
@ -403,7 +402,7 @@ public sealed class SettingsTab(
} }
} }
ImGui.NewLine(); Im.Line.New();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
@ -466,7 +465,7 @@ public sealed class SettingsTab(
using (var combo = ImUtf8.Combo("##renameSettings"u8, config.ShowRename.GetData().Name)) using (var combo = ImUtf8.Combo("##renameSettings"u8, config.ShowRename.GetData().Name))
{ {
if (combo) if (combo)
foreach (var value in Enum.GetValues<RenameField>()) foreach (var value in RenameField.Values)
{ {
var (name, desc) = value.GetData(); var (name, desc) = value.GetData();
if (ImGui.Selectable(name, config.ShowRename == value)) if (ImGui.Selectable(name, config.ShowRename == value))
@ -495,7 +494,7 @@ public sealed class SettingsTab(
using (var combo = ImUtf8.Combo("##heightUnit"u8, HeightDisplayTypeName(config.HeightDisplayType))) using (var combo = ImUtf8.Combo("##heightUnit"u8, HeightDisplayTypeName(config.HeightDisplayType)))
{ {
if (combo) if (combo)
foreach (var type in Enum.GetValues<HeightDisplayType>()) foreach (var type in HeightDisplayType.Values)
{ {
if (ImUtf8.Selectable(HeightDisplayTypeName(type), type == config.HeightDisplayType) && type != config.HeightDisplayType) if (ImUtf8.Selectable(HeightDisplayTypeName(type), type == config.HeightDisplayType) && type != config.HeightDisplayType)
{ {

View file

@ -7,6 +7,7 @@ using Glamourer.Services;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using Luna;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Text; using OtterGui.Text;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -34,8 +35,8 @@ public class UnlockOverview(
private Gender _selected3 = Gender.Unknown; private Gender _selected3 = Gender.Unknown;
private BonusItemFlag _selected4 = BonusItemFlag.Unknown; private BonusItemFlag _selected4 = BonusItemFlag.Unknown;
private uint _favoriteColor; private Rgba32 _favoriteColor;
private uint _moddedColor; private Rgba32 _moddedColor;
private void DrawSelector() private void DrawSelector()
{ {
@ -43,7 +44,7 @@ public class UnlockOverview(
if (!child) if (!child)
return; return;
foreach (var type in Enum.GetValues<FullEquipType>()) foreach (var type in FullEquipType.Values)
{ {
if (type.IsOffhandType() || type.IsBonus() || !items.ItemData.ByType.TryGetValue(type, out var value) || value.Count == 0) if (type.IsOffhandType() || type.IsBonus() || !items.ItemData.ByType.TryGetValue(type, out var value) || value.Count == 0)
continue; continue;
@ -83,7 +84,7 @@ public class UnlockOverview(
public void Draw() public void Draw()
{ {
using var color = ImRaii.PushColor(ImGuiCol.Border, ImGui.GetColorU32(ImGuiCol.TableBorderStrong)); using var color = ImGuiColor.Border.Push(Im.Style[ImGuiColor.TableBorderStrong]);
DrawSelector(); DrawSelector();
Im.Line.Same(); Im.Line.Same();
DrawPanel(); DrawPanel();
@ -128,8 +129,8 @@ public class UnlockOverview(
unlocked || codes.Enabled(CodeService.CodeFlag.Shirts) ? Vector4.One : UnavailableTint); unlocked || codes.Enabled(CodeService.CodeFlag.Shirts) ? Vector4.One : UnavailableTint);
if (favorites.Contains(_selected3, _selected2, customize.Index, customize.Value)) if (favorites.Contains(_selected3, _selected2, customize.Index, customize.Value))
ImGui.GetWindowDrawList().AddRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), _favoriteColor, Im.Window.DrawList.Shape.Rectangle(Im.Item.UpperLeftCorner, Im.Item.LowerRightCorner, _favoriteColor, 12 * Im.Style.GlobalScale,
12 * Im.Style.GlobalScale, ImDrawFlags.RoundCornersAll, 6 * Im.Style.GlobalScale); ImDrawFlagsRectangle.RoundCornersAll, 6 * Im.Style.GlobalScale);
if (hasIcon && ImGui.IsItemHovered()) if (hasIcon && ImGui.IsItemHovered())
{ {
@ -138,7 +139,7 @@ public class UnlockOverview(
if (size.X >= iconSize.X && size.Y >= iconSize.Y) if (size.X >= iconSize.X && size.Y >= iconSize.Y)
ImGui.Image(wrap.Handle, size); ImGui.Image(wrap.Handle, size);
ImGui.TextUnformatted(unlockData.Name); ImGui.TextUnformatted(unlockData.Name);
ImGui.TextUnformatted($"{customize.Index.ToDefaultName()} {customize.Value.Value}"); ImGui.TextUnformatted($"{customize.Index.ToNameU8()} {customize.Value.Value}");
ImGui.TextUnformatted(unlocked ? $"Unlocked on {time:g}" : "Not unlocked."); ImGui.TextUnformatted(unlocked ? $"Unlocked on {time:g}" : "Not unlocked.");
} }
@ -161,7 +162,7 @@ public class UnlockOverview(
var iconSize = ImGuiHelpers.ScaledVector2(64); var iconSize = ImGuiHelpers.ScaledVector2(64);
var iconsPerRow = IconsPerRow(iconSize.X, spacing.X); var iconsPerRow = IconsPerRow(iconSize.X, spacing.X);
var numRows = (items.DictBonusItems.Count + iconsPerRow - 1) / iconsPerRow; var numRows = (items.DictBonusItems.Count + iconsPerRow - 1) / iconsPerRow;
var numVisibleRows = (int)(Math.Ceiling(ImGui.GetContentRegionAvail().Y / (iconSize.Y + spacing.Y)) + 0.5f) + 1; var numVisibleRows = (int)(Math.Ceiling(Im.ContentRegion.Available.Y / (iconSize.Y + spacing.Y)) + 0.5f) + 1;
var skips = ImGuiClip.GetNecessarySkips(iconSize.Y + spacing.Y); var skips = ImGuiClip.GetNecessarySkips(iconSize.Y + spacing.Y);
var start = skips * iconsPerRow; var start = skips * iconsPerRow;
@ -183,7 +184,7 @@ public class UnlockOverview(
} }
if (ImGui.GetCursorPosX() != 0) if (ImGui.GetCursorPosX() != 0)
ImGui.NewLine(); Im.Line.New();
var remainder = numRows - numVisibleRows - skips; var remainder = numRows - numVisibleRows - skips;
if (remainder > 0) if (remainder > 0)
ImGuiClip.DrawEndDummy(remainder, iconSize.Y + spacing.Y); ImGuiClip.DrawEndDummy(remainder, iconSize.Y + spacing.Y);
@ -200,8 +201,8 @@ public class UnlockOverview(
ImGui.Image(icon, iconSize, Vector2.Zero, Vector2.One, ImGui.Image(icon, iconSize, Vector2.Zero, Vector2.One,
unlocked || codes.Enabled(CodeService.CodeFlag.Shirts) ? Vector4.One : UnavailableTint); unlocked || codes.Enabled(CodeService.CodeFlag.Shirts) ? Vector4.One : UnavailableTint);
if (favorites.Contains(item)) if (favorites.Contains(item))
ImGui.GetWindowDrawList().AddRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), _favoriteColor, Im.Window.DrawList.Shape.Rectangle(Im.Item.UpperLeftCorner, Im.Item.LowerRightCorner, _favoriteColor,
2 * Im.Style.GlobalScale, ImDrawFlags.RoundCornersAll, 4 * Im.Style.GlobalScale); 2 * Im.Style.GlobalScale, ImDrawFlagsRectangle.RoundCornersAll, 4 * Im.Style.GlobalScale);
var mods = DrawModdedMarker(item, iconSize); var mods = DrawModdedMarker(item, iconSize);
@ -234,7 +235,7 @@ public class UnlockOverview(
var iconSize = ImGuiHelpers.ScaledVector2(64); var iconSize = ImGuiHelpers.ScaledVector2(64);
var iconsPerRow = IconsPerRow(iconSize.X, spacing.X); var iconsPerRow = IconsPerRow(iconSize.X, spacing.X);
var numRows = (value.Count + iconsPerRow - 1) / iconsPerRow; var numRows = (value.Count + iconsPerRow - 1) / iconsPerRow;
var numVisibleRows = (int)(Math.Ceiling(ImGui.GetContentRegionAvail().Y / (iconSize.Y + spacing.Y)) + 0.5f) + 1; var numVisibleRows = (int)(Math.Ceiling(Im.ContentRegion.Available.Y / (iconSize.Y + spacing.Y)) + 0.5f) + 1;
var skips = ImGuiClip.GetNecessarySkips(iconSize.Y + spacing.Y); var skips = ImGuiClip.GetNecessarySkips(iconSize.Y + spacing.Y);
var end = Math.Min(numVisibleRows * iconsPerRow + skips * iconsPerRow, value.Count); var end = Math.Min(numVisibleRows * iconsPerRow + skips * iconsPerRow, value.Count);
@ -254,7 +255,7 @@ public class UnlockOverview(
} }
if (ImGui.GetCursorPosX() != 0) if (ImGui.GetCursorPosX() != 0)
ImGui.NewLine(); Im.Line.New();
var remainder = numRows - numVisibleRows - skips; var remainder = numRows - numVisibleRows - skips;
if (remainder > 0) if (remainder > 0)
ImGuiClip.DrawEndDummy(remainder, iconSize.Y + spacing.Y); ImGuiClip.DrawEndDummy(remainder, iconSize.Y + spacing.Y);
@ -271,15 +272,15 @@ public class UnlockOverview(
ImGui.Image(icon, iconSize, Vector2.Zero, Vector2.One, ImGui.Image(icon, iconSize, Vector2.Zero, Vector2.One,
unlocked || codes.Enabled(CodeService.CodeFlag.Shirts) ? Vector4.One : UnavailableTint); unlocked || codes.Enabled(CodeService.CodeFlag.Shirts) ? Vector4.One : UnavailableTint);
if (favorites.Contains(item)) if (favorites.Contains(item))
ImGui.GetWindowDrawList().AddRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), ColorId.FavoriteStarOn.Value(), Im.Window.DrawList.Shape.Rectangle(Im.Item.UpperLeftCorner, Im.Item.LowerRightCorner, ColorId.FavoriteStarOn.Value(),
2 * Im.Style.GlobalScale, ImDrawFlags.RoundCornersAll, 4 * Im.Style.GlobalScale); 2 * Im.Style.GlobalScale, ImDrawFlagsRectangle.RoundCornersAll, 4 * Im.Style.GlobalScale);
var mods = DrawModdedMarker(item, iconSize); var mods = DrawModdedMarker(item, iconSize);
if (ImGui.IsItemClicked()) if (ImGui.IsItemClicked())
Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString); Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString);
if (ImGui.IsItemClicked(ImGuiMouseButton.Right) && tooltip.Player(out var state)) if (Im.Item.RightClicked() && tooltip.Player(out var state))
tooltip.ApplyItem(state, item); tooltip.ApplyItem(state, item);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
@ -329,18 +330,18 @@ public class UnlockOverview(
=> ImGuiHelpers.ScaledVector2(2); => ImGuiHelpers.ScaledVector2(2);
private static int IconsPerRow(float iconWidth, float iconSpacing) private static int IconsPerRow(float iconWidth, float iconSpacing)
=> (int)(ImGui.GetContentRegionAvail().X / (iconWidth + iconSpacing)); => (int)(Im.ContentRegion.Available.X / (iconWidth + iconSpacing));
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
private (string ModDirectory, string ModName)[] DrawModdedMarker(in EquipItem item, Vector2 iconSize) private (string ModDirectory, string ModName)[] DrawModdedMarker(in EquipItem item, Vector2 iconSize)
{ {
var mods = penumbra.CheckCurrentChangedItem(item.Name); var mods = penumbra.CheckCurrentChangedItem(item.Name);
if (mods.Length == 0) if (mods.Length is 0)
return mods; return mods;
var center = ImGui.GetItemRectMin() + new Vector2(iconSize.X * 0.85f, iconSize.Y * 0.15f); var center = ImGui.GetItemRectMin() + new Vector2(iconSize.X * 0.85f, iconSize.Y * 0.15f);
ImGui.GetWindowDrawList().AddCircleFilled(center, iconSize.X * 0.1f, _moddedColor); Im.Window.DrawList.Shape.CircleFilled(center, iconSize.X * 0.1f, _moddedColor);
ImGui.GetWindowDrawList().AddCircle(center, iconSize.X * 0.1f, 0xFF000000); Im.Window.DrawList.Shape.Circle(center, iconSize.X * 0.1f, Rgba32.Black);
return mods; return mods;
} }
@ -351,14 +352,14 @@ public class UnlockOverview(
{ {
case 0: return; case 0: return;
case 1: case 1:
ImUtf8.Text("Modded by: "u8, _moddedColor); Im.Text("Modded by: "u8, _moddedColor);
ImGui.SameLine(0, 0); Im.Line.NoSpacing();
ImUtf8.Text(mods[0].ModName); Im.Text(mods[0].ModName);
return; return;
default: default:
ImUtf8.Text("Modded by:"u8, _moddedColor); Im.Text("Modded by:"u8, _moddedColor);
foreach (var (_, mod) in mods) foreach (var (_, mod) in mods)
ImUtf8.BulletText(mod); Im.BulletText(mod);
return; return;
} }
} }

View file

@ -136,7 +136,7 @@ public class UnlockTable : Table<EquipItem>, IDisposable
using (ImRaii.PushFont(UiBuilder.IconFont)) using (ImRaii.PushFont(UiBuilder.IconFont))
{ {
using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.ModdedItemMarker.Value()); using var color = ImGuiColor.Text.Push(ColorId.ModdedItemMarker.Value());
ImGuiUtil.Center(FontAwesomeIcon.Circle.ToIconString()); ImGuiUtil.Center(FontAwesomeIcon.Circle.ToIconString());
} }
@ -192,13 +192,13 @@ public class UnlockTable : Table<EquipItem>, IDisposable
if (_textures.TryLoadIcon(item.IconId.Id, out var iconHandle)) if (_textures.TryLoadIcon(item.IconId.Id, out var iconHandle))
ImGuiUtil.HoverIcon(iconHandle, new Vector2(Im.Style.FrameHeight)); ImGuiUtil.HoverIcon(iconHandle, new Vector2(Im.Style.FrameHeight));
else else
ImGui.Dummy(new Vector2(Im.Style.FrameHeight)); Im.Dummy(new Vector2(Im.Style.FrameHeight));
Im.Line.Same(); Im.Line.Same();
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
if (ImGui.Selectable(item.Name) && item.Id is { IsBonusItem: false, IsCustom: false }) if (ImGui.Selectable(item.Name) && item.Id is { IsBonusItem: false, IsCustom: false })
Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString); Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString);
if (ImGui.IsItemClicked(ImGuiMouseButton.Right) && _tooltip.Player(out var state)) if (Im.Item.RightClicked() && _tooltip.Player(out var state))
_tooltip.ApplyItem(state, item); _tooltip.ApplyItem(state, item);
if (ImGui.IsItemHovered() && _tooltip.Player()) if (ImGui.IsItemHovered() && _tooltip.Player())
@ -446,15 +446,15 @@ public class UnlockTable : Table<EquipItem>, IDisposable
Job.JobRole.Healer => 0xFFD0FFD0, Job.JobRole.Healer => 0xFFD0FFD0,
Job.JobRole.Crafter => 0xFF808080, Job.JobRole.Crafter => 0xFF808080,
Job.JobRole.Gatherer => 0xFFD0D0D0, Job.JobRole.Gatherer => 0xFFD0D0D0,
_ => ImGui.GetColorU32(ImGuiCol.Text), _ => ImGuiColor.Text.Get(),
}; };
bool r; bool r;
using (ImRaii.PushColor(ImGuiCol.Text, color)) using (ImGuiColor.Text.Push(color))
{ {
r = base.DrawCheckbox(idx, out ret); r = base.DrawCheckbox(idx, out ret);
} }
if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) if (Im.Item.RightClicked())
{ {
_filterValue = job.Flag & _filterValue; _filterValue = job.Flag & _filterValue;
ret = true; ret = true;

View file

@ -1,11 +1,8 @@
using Dalamud.Interface;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using Dalamud.Bindings.ImGui;
using ImSharp; using ImSharp;
using Lumina.Misc; using Lumina.Misc;
using OtterGui; using Luna;
using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -16,26 +13,26 @@ public static class UiHelpers
/// <summary> Open a combo popup with another method than the combo itself. </summary> /// <summary> Open a combo popup with another method than the combo itself. </summary>
public static void OpenCombo(string comboLabel) public static void OpenCombo(string comboLabel)
{ {
var windowId = ImGui.GetID(comboLabel); var windowId = Im.Id.Get(comboLabel);
var popupId = ~Crc32.Get("##ComboPopup", windowId); var popupId = ~Crc32.Get("##ComboPopup", windowId.Id);
ImGui.OpenPopup(popupId); Im.Popup.Open(popupId);
} }
public static void DrawIcon(this EquipItem item, TextureService textures, Vector2 size, EquipSlot slot) public static void DrawIcon(this EquipItem item, TextureService textures, Vector2 size, EquipSlot slot)
{ {
var isEmpty = item.PrimaryId.Id == 0; var isEmpty = item.PrimaryId.Id is 0;
var (ptr, textureSize, empty) = textures.GetIcon(item, slot); var (ptr, textureSize, empty) = textures.GetIcon(item, slot);
if (empty) if (empty)
{ {
var (bgColor, tint) = isEmpty var (bgColor, tint) = isEmpty
? (ImGui.GetColorU32(ImGuiCol.FrameBg), Vector4.One) ? (ImGuiColor.FrameBackground.Get(), Vector4.One)
: (ImGui.GetColorU32(ImGuiCol.FrameBgActive), new Vector4(0.3f, 0.3f, 0.3f, 1f)); : (ImGuiColor.FrameBackgroundActive.Get(), new Vector4(0.3f, 0.3f, 0.3f, 1f));
var pos = ImGui.GetCursorScreenPos(); var pos = Im.Cursor.ScreenPosition;
ImGui.GetWindowDrawList().AddRectFilled(pos, pos + size, bgColor, 5 * Im.Style.GlobalScale); Im.Window.DrawList.Shape.RectangleFilled(pos, pos + size, bgColor, 5 * Im.Style.GlobalScale);
if (!ptr.IsNull) if (!ptr.IsNull)
Im.Image.Draw(ptr, size, Vector2.Zero, Vector2.One, tint); Im.Image.Draw(ptr, size, Vector2.Zero, Vector2.One, tint);
else else
ImGui.Dummy(size); Im.Dummy(size);
} }
else else
{ {
@ -50,14 +47,14 @@ public static class UiHelpers
if (empty) if (empty)
{ {
var (bgColor, tint) = isEmpty var (bgColor, tint) = isEmpty
? (ImGui.GetColorU32(ImGuiCol.FrameBg), Vector4.One) ? (ImGuiColor.FrameBackground.Get(), Vector4.One)
: (ImGui.GetColorU32(ImGuiCol.FrameBgActive), new Vector4(0.3f, 0.3f, 0.3f, 1f)); : (ImGuiColor.FrameBackgroundActive.Get(), new Vector4(0.3f, 0.3f, 0.3f, 1f));
var pos = ImGui.GetCursorScreenPos(); var pos = Im.Cursor.ScreenPosition;
ImGui.GetWindowDrawList().AddRectFilled(pos, pos + size, bgColor, 5 * Im.Style.GlobalScale); Im.Window.DrawList.Shape.RectangleFilled(pos, pos + size, bgColor, 5 * Im.Style.GlobalScale);
if (!ptr.IsNull) if (!ptr.IsNull)
Im.Image.Draw(ptr, size, Vector2.Zero, Vector2.One, tint); Im.Image.Draw(ptr, size, Vector2.Zero, Vector2.One, tint);
else else
ImGui.Dummy(size); Im.Dummy(size);
} }
else else
{ {
@ -65,41 +62,41 @@ public static class UiHelpers
} }
} }
public static bool DrawCheckbox(string label, string tooltip, bool value, out bool on, bool locked) public static bool DrawCheckbox(ReadOnlySpan<byte> label, Utf8StringHandler<TextStringHandlerBuffer> tooltip, bool value, out bool on, bool locked)
{ {
var startsWithHash = label.StartsWith("##");
bool ret; bool ret;
using (_ = ImRaii.Disabled(locked)) using (Im.Disabled(locked))
{ {
ret = ImGuiUtil.Checkbox(startsWithHash ? label : "##" + label, string.Empty, value, v => value = v); using var id = Im.Id.Push(label);
ret = Im.Checkbox(StringU8.Empty, ref value);
} }
if (!startsWithHash) if (!label.StartsWith("##"u8))
{ {
ImGui.SameLine(0, Im.Style.ItemInnerSpacing.X); Im.Line.SameInner();
ImGui.AlignTextToFramePadding(); ImEx.TextFrameAligned(label);
ImGui.TextUnformatted(label);
} }
ImGuiUtil.HoverTooltip(tooltip, ImGuiHoveredFlags.AllowWhenDisabled); Im.Tooltip.OnHover(tooltip, HoveredFlags.AllowWhenDisabled);
on = value; on = value;
return ret; return ret;
} }
public static (bool, bool) DrawMetaToggle(string label, bool currentValue, bool currentApply, out bool newValue, public static (bool, bool) DrawMetaToggle(ReadOnlySpan<byte> label, bool currentValue, bool currentApply, out bool newValue,
out bool newApply, bool locked) out bool newApply, bool locked)
{ {
var flags = (sbyte)(currentApply ? currentValue ? 1 : -1 : 0); bool? apply = currentApply ? currentValue : null;
using (_ = ImRaii.Disabled(locked)) using (Im.Disabled(locked))
{ {
if (ImEx.TriStateCheckbox(ColorId.TriStateCross.Value(), ColorId.TriStateCheck.Value(), ColorId.TriStateNeutral.Value()).Draw( using var id = Im.Id.Push(label);
"##" + label, flags, out flags)) if (ImEx.TriStateCheckbox(StringU8.Empty, ref apply, ColorId.TriStateCross.Value(), ColorId.TriStateCheck.Value(),
ColorId.TriStateNeutral.Value()))
{ {
(newValue, newApply) = flags switch (newValue, newApply) = apply switch
{ {
-1 => (false, true), true => (true, true),
0 => (true, false), false => (false, true),
_ => (true, true), _ => (true, false),
}; };
} }
else else
@ -109,17 +106,17 @@ public static class UiHelpers
} }
} }
ImGuiUtil.HoverTooltip($"This attribute will be {(currentApply ? currentValue ? "enabled." : "disabled." : "kept as is.")}"); Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled,
$"This attribute will be {(currentApply ? currentValue ? "enabled." : "disabled." : "kept as is.")}");
ImGui.SameLine(0, Im.Style.ItemInnerSpacing.X); Im.Line.SameInner();
ImGui.AlignTextToFramePadding(); ImEx.TextFrameAligned(label);
ImGui.TextUnformatted(label);
return (currentValue != newValue, currentApply != newApply); return (currentValue != newValue, currentApply != newApply);
} }
public static (bool, bool) ConvertKeysToBool() public static (bool, bool) ConvertKeysToBool()
=> (ImGui.GetIO().KeyCtrl, ImGui.GetIO().KeyShift) switch => (Im.Io.KeyControl, Im.Io.KeyShift) switch
{ {
(false, false) => (true, true), (false, false) => (true, true),
(true, true) => (true, true), (true, true) => (true, true),
@ -130,14 +127,11 @@ public static class UiHelpers
public static bool DrawFavoriteStar(FavoriteManager favorites, EquipItem item) public static bool DrawFavoriteStar(FavoriteManager favorites, EquipItem item)
{ {
var favorite = favorites.Contains(item); var favorite = favorites.Contains(item);
var hovering = ImGui.IsMouseHoveringRect(ImGui.GetCursorScreenPos(), var hovering = Im.Mouse.IsHoveringRectangle(Rectangle.FromSize(Im.Cursor.ScreenPosition, new Vector2(Im.Style.TextHeight)));
ImGui.GetCursorScreenPos() + new Vector2(ImGui.GetTextLineHeight()));
using var font = ImRaii.PushFont(UiBuilder.IconFont); ImEx.Icon.DrawAligned(LunaStyle.FavoriteIcon,
using var c = ImRaii.PushColor(ImGuiCol.Text,
hovering ? ColorId.FavoriteStarHovered.Value() : favorite ? ColorId.FavoriteStarOn.Value() : ColorId.FavoriteStarOff.Value()); hovering ? ColorId.FavoriteStarHovered.Value() : favorite ? ColorId.FavoriteStarOn.Value() : ColorId.FavoriteStarOff.Value());
ImGui.TextUnformatted(FontAwesomeIcon.Star.ToIconString()); if (!Im.Item.Clicked())
if (!ImGui.IsItemClicked())
return false; return false;
if (favorite) if (favorite)
@ -145,21 +139,16 @@ public static class UiHelpers
else else
favorites.TryAdd(item); favorites.TryAdd(item);
return true; return true;
} }
public static bool DrawFavoriteStar(FavoriteManager favorites, StainId stain) public static bool DrawFavoriteStar(FavoriteManager favorites, StainId stain)
{ {
var favorite = favorites.Contains(stain); var favorite = favorites.Contains(stain);
var hovering = ImGui.IsMouseHoveringRect(ImGui.GetCursorScreenPos(), var hovering = Im.Mouse.IsHoveringRectangle(Rectangle.FromSize(Im.Cursor.ScreenPosition, new Vector2(Im.Style.TextHeight)));
ImGui.GetCursorScreenPos() + new Vector2(Im.Style.FrameHeight));
using var font = ImRaii.PushFont(UiBuilder.IconFont); ImEx.Icon.DrawAligned(LunaStyle.FavoriteIcon,
using var c = ImRaii.PushColor(ImGuiCol.Text,
hovering ? ColorId.FavoriteStarHovered.Value() : favorite ? ColorId.FavoriteStarOn.Value() : ColorId.FavoriteStarOff.Value()); hovering ? ColorId.FavoriteStarHovered.Value() : favorite ? ColorId.FavoriteStarOn.Value() : ColorId.FavoriteStarOff.Value());
ImGui.AlignTextToFramePadding(); if (!Im.Item.Clicked())
ImGui.TextUnformatted(FontAwesomeIcon.Star.ToIconString());
if (!ImGui.IsItemClicked())
return false; return false;
if (favorite) if (favorite)
@ -167,6 +156,5 @@ public static class UiHelpers
else else
favorites.TryAdd(stain); favorites.TryAdd(stain);
return true; return true;
} }
} }

View file

@ -1,3 +1,5 @@
using ImSharp;
using Luna;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
namespace Glamourer.Services; namespace Glamourer.Services;
@ -36,7 +38,7 @@ public class CodeService
} }
public static readonly CodeFlag AllHintCodes = public static readonly CodeFlag AllHintCodes =
Enum.GetValues<CodeFlag>().Where(f => GetData(f).Display).Aggregate((CodeFlag)0, (f1, f2) => f1 | f2); CodeFlag.Values.Where(f => GetData(f).Display).Aggregate((CodeFlag)0, (f1, f2) => f1 | f2);
public const CodeFlag DyeCodes = public const CodeFlag DyeCodes =
CodeFlag.Clown | CodeFlag.World | CodeFlag.Elephants | CodeFlag.Dolphins; CodeFlag.Clown | CodeFlag.World | CodeFlag.Elephants | CodeFlag.Dolphins;
@ -138,7 +140,7 @@ public class CodeService
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(name)); using var stream = new MemoryStream(Encoding.UTF8.GetBytes(name));
var sha = (ReadOnlySpan<byte>)_hasher.ComputeHash(stream); var sha = (ReadOnlySpan<byte>)_hasher.ComputeHash(stream);
foreach (var flag in Enum.GetValues<CodeFlag>()) foreach (var flag in CodeFlag.Values)
{ {
if (sha.SequenceEqual(GetSha(flag))) if (sha.SequenceEqual(GetSha(flag)))
return flag; return flag;

View file

@ -1,5 +1,7 @@
using Glamourer.Automation; using Glamourer.Automation;
using Glamourer.Gui; using Glamourer.Gui;
using ImSharp;
using Luna;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace Glamourer.Services; namespace Glamourer.Services;
@ -104,7 +106,7 @@ public class ConfigMigrationService(SaveService saveService, FixedDesignMigrator
private static void AddColors(Configuration config, bool forceSave) private static void AddColors(Configuration config, bool forceSave)
{ {
var save = false; var save = false;
foreach (var color in Enum.GetValues<ColorId>()) foreach (var color in ColorId.Values)
save |= config.Colors.TryAdd(color, color.Data().DefaultColor); save |= config.Colors.TryAdd(color, color.Data().DefaultColor);
if (save || forceSave) if (save || forceSave)

View file

@ -427,7 +427,7 @@ public unsafe class FunModule : IDisposable
return; return;
var set = _customizations.Manager.GetSet(customize.Clan, customize.Gender); var set = _customizations.Manager.GetSet(customize.Clan, customize.Gender);
foreach (var index in Enum.GetValues<CustomizeIndex>()) foreach (var index in CustomizeIndex.Values)
{ {
if (index is CustomizeIndex.Face || !set.IsAvailable(index)) if (index is CustomizeIndex.Face || !set.IsAvailable(index))
continue; continue;

View file

@ -4,6 +4,7 @@ using Glamourer.Events;
using Glamourer.GameData; using Glamourer.GameData;
using Glamourer.Interop.Material; using Glamourer.Interop.Material;
using Glamourer.Services; using Glamourer.Services;
using ImSharp;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -64,7 +65,7 @@ public class InternalStateEditor(
state.Sources[CustomizeIndex.Clan] = source; state.Sources[CustomizeIndex.Clan] = source;
state.Sources[CustomizeIndex.Gender] = source; state.Sources[CustomizeIndex.Gender] = source;
var set = customizations.Manager.GetSet(state.ModelData.Customize.Clan, state.ModelData.Customize.Gender); var set = customizations.Manager.GetSet(state.ModelData.Customize.Clan, state.ModelData.Customize.Gender);
foreach (var index in Enum.GetValues<CustomizeIndex>().Where(set.IsAvailable)) foreach (var index in CustomizeIndex.Values.Where(set.IsAvailable))
state.Sources[index] = source; state.Sources[index] = source;
} }
else else
@ -107,7 +108,7 @@ public class InternalStateEditor(
state.ModelData.Customize = customize; state.ModelData.Customize = customize;
applied |= changed; applied |= changed;
foreach (var type in Enum.GetValues<CustomizeIndex>()) foreach (var type in CustomizeIndex.Values)
{ {
if (applied.HasFlag(type.ToFlag())) if (applied.HasFlag(type.ToFlag()))
state.Sources[type] = source(type); state.Sources[type] = source(type);
@ -120,7 +121,7 @@ public class InternalStateEditor(
public bool ChangeHumanCustomize(ActorState state, in CustomizeArray customizeInput, Func<CustomizeIndex, bool> applyWhich, public bool ChangeHumanCustomize(ActorState state, in CustomizeArray customizeInput, Func<CustomizeIndex, bool> applyWhich,
Func<CustomizeIndex, StateSource> source, out CustomizeArray old, out CustomizeFlag changed, uint key = 0) Func<CustomizeIndex, StateSource> source, out CustomizeArray old, out CustomizeFlag changed, uint key = 0)
{ {
var apply = Enum.GetValues<CustomizeIndex>().Where(applyWhich).Aggregate((CustomizeFlag)0, (current, type) => current | type.ToFlag()); var apply = CustomizeIndex.Values.Where(applyWhich).Aggregate((CustomizeFlag)0, (current, type) => current | type.ToFlag());
return ChangeHumanCustomize(state, customizeInput, apply, source, out old, out changed, key); return ChangeHumanCustomize(state, customizeInput, apply, source, out old, out changed, key);
} }

View file

@ -56,7 +56,7 @@ public class StateEditor(
var actors = Applier.ChangeCustomize(state, settings.Source.RequiresChange()); var actors = Applier.ChangeCustomize(state, settings.Source.RequiresChange());
Glamourer.Log.Verbose( Glamourer.Log.Verbose(
$"Set {idx.ToDefaultName()} customizations in state {state.Identifier.Incognito(null)} from {old.Value} to {value.Value}. [Affecting {actors.ToLazyString("nothing")}.]"); $"Set {idx.ToName()} customizations in state {state.Identifier.Incognito(null)} from {old.Value} to {value.Value}. [Affecting {actors.ToLazyString("nothing")}.]");
StateChanged.Invoke(StateChangeType.Customize, settings.Source, state, actors, new CustomizeTransaction(idx, old, value)); StateChanged.Invoke(StateChangeType.Customize, settings.Source, state, actors, new CustomizeTransaction(idx, old, value));
} }

View file

@ -5,7 +5,6 @@ using ImSharp;
using Luna; using Luna;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using System.Collections.Frozen; using System.Collections.Frozen;
using static OtterGui.ItemSelector<T>;
namespace Glamourer.State; namespace Glamourer.State;
@ -226,7 +225,7 @@ public readonly record struct StateIndex(int Value) : IEqualityOperators<StateIn
=> GetFlag() switch => GetFlag() switch
{ {
EquipFlag e => GetName(e), EquipFlag e => GetName(e),
CustomizeFlag c => c.ToIndex().ToDefaultName(), CustomizeFlag c => c.ToIndex().ToNameU8(),
MetaFlag m => m.ToIndex().ToNameU8(), MetaFlag m => m.ToIndex().ToNameU8(),
CrestFlag c => c.ToLabelU8(), CrestFlag c => c.ToLabelU8(),
CustomizeParameterFlag c => c.ToNameU8(), CustomizeParameterFlag c => c.ToNameU8(),

View file

@ -9,6 +9,7 @@ using Glamourer.Interop.Material;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Glamourer.Interop.Structs; using Glamourer.Interop.Structs;
using Glamourer.Services; using Glamourer.Services;
using ImSharp;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -248,7 +249,7 @@ public sealed class StateManager(
state.ModelData = state.BaseData; state.ModelData = state.BaseData;
state.ModelData.SetIsWet(false); state.ModelData.SetIsWet(false);
foreach (var index in Enum.GetValues<CustomizeIndex>()) foreach (var index in CustomizeIndex.Values)
state.Sources[index] = StateSource.Game; state.Sources[index] = StateSource.Game;
foreach (var slot in EquipSlotExtensions.FullSlots) foreach (var slot in EquipSlotExtensions.FullSlots)
@ -260,7 +261,7 @@ public sealed class StateManager(
foreach (var slot in BonusExtensions.AllFlags) foreach (var slot in BonusExtensions.AllFlags)
state.Sources[slot] = StateSource.Game; state.Sources[slot] = StateSource.Game;
foreach (var type in Enum.GetValues<MetaIndex>()) foreach (var type in MetaIndex.Values)
state.Sources[type] = StateSource.Game; state.Sources[type] = StateSource.Game;
foreach (var slot in CrestExtensions.AllRelevantSet) foreach (var slot in CrestExtensions.AllRelevantSet)
@ -432,7 +433,7 @@ public sealed class StateManager(
if (!state.Unlock(key)) if (!state.Unlock(key))
return; return;
foreach (var index in Enum.GetValues<CustomizeIndex>().Where(i => state.Sources[i] is StateSource.Fixed)) foreach (var index in CustomizeIndex.Values.Where(i => state.Sources[i] is StateSource.Fixed))
{ {
state.Sources[index] = StateSource.Game; state.Sources[index] = StateSource.Game;
state.ModelData.Customize[index] = state.BaseData.Customize[index]; state.ModelData.Customize[index] = state.BaseData.Customize[index];

View file

@ -1,7 +1,9 @@
using Penumbra.GameData.Enums; using Luna.Generators;
using Penumbra.GameData.Enums;
namespace Glamourer.State; namespace Glamourer.State;
[NamedEnum(Utf16: false)]
public enum StateSource : byte public enum StateSource : byte
{ {
Game, Game,
@ -15,7 +17,7 @@ public enum StateSource : byte
IpcPending, IpcPending,
} }
public static class StateSourceExtensions public static partial class StateSourceExtensions
{ {
public static StateSource Base(this StateSource source) public static StateSource Base(this StateSource source)
=> source switch => source switch

2
Luna

@ -1 +1 @@
Subproject commit 206221cec8eb23f4291e9204c079b179a7051799 Subproject commit 2cc9a03ba52a781f474d1b14d5b8c616fa719284