More stuff to Luna.
Some checks are pending
.NET Build / build (push) Waiting to run

This commit is contained in:
Ottermandias 2025-11-02 14:55:57 +01:00
parent 019b9533bf
commit 5a2fddab89
58 changed files with 792 additions and 843 deletions

2
Luna

@ -1 +1 @@
Subproject commit c8f90e537ae2b5ab1a9db53eafe3f7f5b2e68f38
Subproject commit 2e984d9c21370c778d172ab955def18c0dbe8c7d

@ -1 +1 @@
Subproject commit c8611a0c546b6b2ec29214ab319fc2c38fe74793
Subproject commit 4aac62e73b89a0c538a7a0a5c22822f15b13c0cc

View file

@ -98,8 +98,8 @@ public class FileEditor<T>(
private void DefaultInput()
{
using var spacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemSpacing with { X = Im.Style.GlobalScale * 3 });
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X - 2 * (Im.Style.GlobalScale * 3 + Im.Style.FrameHeight));
using var spacing = ImStyleDouble.ItemSpacing.PushX(Im.Style.GlobalScale * 3);
Im.Item.SetNextWidth(Im.ContentRegion.Available.X - 2 * (Im.Style.GlobalScale * 3 + Im.Style.FrameHeight));
ImGui.InputTextWithHint("##defaultInput", "Input game path to compare...", ref _defaultPath, Utf8GamePath.MaxGamePathLength);
_inInput = ImGui.IsItemActive();
if (ImGui.IsItemDeactivatedAfterEdit() && _defaultPath.Length > 0)
@ -245,7 +245,7 @@ public class FileEditor<T>(
{
if (_currentFile == null)
{
ImGui.TextUnformatted($"Could not parse selected {fileType} file.");
Im.Text($"Could not parse selected {fileType} file.");
if (_currentException != null)
{
using var tab = ImRaii.PushIndent();
@ -265,13 +265,13 @@ public class FileEditor<T>(
{
Im.Line.New();
Im.Line.New();
ImGui.TextUnformatted($"Preview of {_defaultPath}:");
ImGui.Separator();
Im.Text($"Preview of {_defaultPath}:");
Im.Separator();
}
if (_defaultFile == null)
{
ImGui.TextUnformatted($"Could not parse provided {fileType} game file:\n");
Im.Text($"Could not parse provided {fileType} game file:\n");
if (_defaultException != null)
{
using var tab = ImRaii.PushIndent();
@ -306,8 +306,8 @@ public class FileEditor<T>(
if (Im.Item.Hovered())
{
using var tt = ImRaii.Tooltip();
ImGui.TextUnformatted("All Game Paths");
ImGui.Separator();
Im.Text("All Game Paths"u8);
Im.Separator();
using var t = Im.Table.Begin("##Tooltip"u8, 2, TableFlags.SizingFixedFit);
foreach (var (option, gamePath) in file.SubModUsage)
{
@ -315,7 +315,7 @@ public class FileEditor<T>(
ImUtf8.Text(gamePath.Path.Span);
ImGui.TableNextColumn();
using var color = ImGuiColor.Text.Push(ColorId.ItemId.Value());
ImGui.TextUnformatted(option.GetFullName());
Im.Text(option.GetFullName());
}
}

View file

@ -106,7 +106,7 @@ public class ItemSwapTab : IDisposable, ITab
foreach (var swap in _swapData.Swaps)
DrawSwap(swap);
else
ImGui.TextUnformatted(NonExistentText());
Im.Text(NonExistentText());
}
public void Dispose()
@ -419,7 +419,7 @@ public class ItemSwapTab : IDisposable, ITab
{
var newModAvailable = _loadException == null && _swapData.Loaded;
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
if (ImGui.InputTextWithHint("##newModName", "New Mod Name...", ref _newModName, 64))
{ }
@ -438,12 +438,12 @@ public class ItemSwapTab : IDisposable, ITab
ImGuiUtil.HoverTooltip("Instead of writing every single non-default file to the newly created mod or option,\n"
+ "even those available from game files, use File Swaps to default game files where possible.");
ImGui.SetNextItemWidth((width - ImGui.GetStyle().ItemSpacing.X) / 2);
Im.Item.SetNextWidth((width - Im.Style.ItemSpacing.X) / 2);
if (ImGui.InputTextWithHint("##groupName", "Group Name...", ref _newGroupName, 32))
UpdateOption();
Im.Line.Same();
ImGui.SetNextItemWidth((width - ImGui.GetStyle().ItemSpacing.X) / 2);
Im.Item.SetNextWidth((width - Im.Style.ItemSpacing.X) / 2);
if (ImGui.InputTextWithHint("##optionName", "New Option Name...", ref _newOptionName, 32))
UpdateOption();
@ -512,10 +512,10 @@ public class ItemSwapTab : IDisposable, ITab
var (article1, article2, selector) = GetAccessorySelector(_slotFrom, true);
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"Take {article1}");
Im.Text($"Take {article1}");
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(100 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(100 * Im.Style.GlobalScale);
using (var combo = ImRaii.Combo("##fromType", ToName(_slotFrom)))
{
if (combo)
@ -539,10 +539,10 @@ public class ItemSwapTab : IDisposable, ITab
(article1, _, selector) = GetAccessorySelector(_slotTo, false);
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"and put {article2} on {article1}");
Im.Text($"and put {article2} on {article1}");
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(100 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(100 * Im.Style.GlobalScale);
using (var combo = ImRaii.Combo("##toType", ToName(_slotTo)))
{
if (combo)
@ -598,7 +598,7 @@ public class ItemSwapTab : IDisposable, ITab
using var table = Im.Table.Begin("##settings"u8, 2, TableFlags.SizingFixedFit);
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted(text1);
Im.Text(text1);
ImGui.TableNextColumn();
_dirty |= sourceSelector.Draw("##itemSource", sourceSelector.CurrentSelection.Item.Name, string.Empty, InputWidth * 2 * Im.Style.GlobalScale,
Im.Style.TextHeightWithSpacing);
@ -611,7 +611,7 @@ public class ItemSwapTab : IDisposable, ITab
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted(text2);
Im.Text(text2);
ImGui.TableNextColumn();
_dirty |= targetSelector.Draw("##itemTarget", targetSelector.CurrentSelection.Item.Name, string.Empty, InputWidth * 2 * Im.Style.GlobalScale,
Im.Style.TextHeightWithSpacing);
@ -675,10 +675,10 @@ public class ItemSwapTab : IDisposable, ITab
{
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted(text);
Im.Text(text);
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(InputWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(InputWidth * Im.Style.GlobalScale);
if (ImGui.InputInt("##targetId", ref _targetId))
_targetId = Math.Clamp(_targetId, 0, byte.MaxValue);
@ -689,10 +689,10 @@ public class ItemSwapTab : IDisposable, ITab
{
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted(text);
Im.Text(text);
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(InputWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(InputWidth * Im.Style.GlobalScale);
if (ImGui.InputInt("##sourceId", ref _sourceId))
_sourceId = Math.Clamp(_sourceId, 0, byte.MaxValue);
@ -703,7 +703,7 @@ public class ItemSwapTab : IDisposable, ITab
{
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted(text);
Im.Text(text);
ImGui.TableNextColumn();
_dirty |= Combos.Gender("##Gender", _currentGender, out _currentGender);
@ -727,25 +727,25 @@ public class ItemSwapTab : IDisposable, ITab
}
}
private string NonExistentText()
private ReadOnlySpan<byte> NonExistentText()
=> _lastTab switch
{
SwapType.Hat => "One of the selected hats does not seem to exist.",
SwapType.Top => "One of the selected tops does not seem to exist.",
SwapType.Gloves => "One of the selected pairs of gloves does not seem to exist.",
SwapType.Pants => "One of the selected pants does not seem to exist.",
SwapType.Shoes => "One of the selected pairs of shoes does not seem to exist.",
SwapType.Earrings => "One of the selected earrings does not seem to exist.",
SwapType.Necklace => "One of the selected necklaces does not seem to exist.",
SwapType.Bracelet => "One of the selected bracelets does not seem to exist.",
SwapType.Ring => "One of the selected rings does not seem to exist.",
SwapType.Glasses => "One of the selected glasses does not seem to exist.",
SwapType.Hair => "One of the selected hairstyles does not seem to exist for this gender and race combo.",
SwapType.Face => "One of the selected faces does not seem to exist for this gender and race combo.",
SwapType.Ears => "One of the selected ear types does not seem to exist for this gender and race combo.",
SwapType.Tail => "One of the selected tails does not seem to exist for this gender and race combo.",
SwapType.Weapon => "One of the selected weapons or tools does not seem to exist.",
_ => string.Empty,
SwapType.Hat => "One of the selected hats does not seem to exist."u8,
SwapType.Top => "One of the selected tops does not seem to exist."u8,
SwapType.Gloves => "One of the selected pairs of gloves does not seem to exist."u8,
SwapType.Pants => "One of the selected pants does not seem to exist."u8,
SwapType.Shoes => "One of the selected pairs of shoes does not seem to exist."u8,
SwapType.Earrings => "One of the selected earrings does not seem to exist."u8,
SwapType.Necklace => "One of the selected necklaces does not seem to exist."u8,
SwapType.Bracelet => "One of the selected bracelets does not seem to exist."u8,
SwapType.Ring => "One of the selected rings does not seem to exist."u8,
SwapType.Glasses => "One of the selected glasses does not seem to exist."u8,
SwapType.Hair => "One of the selected hairstyles does not seem to exist for this gender and race combo."u8,
SwapType.Face => "One of the selected faces does not seem to exist for this gender and race combo."u8,
SwapType.Ears => "One of the selected ear types does not seem to exist for this gender and race combo."u8,
SwapType.Tail => "One of the selected tails does not seem to exist for this gender and race combo."u8,
SwapType.Weapon => "One of the selected weapons or tools does not seem to exist."u8,
_ => StringU8.Empty,
};
private static void DrawSwap(Swap swap)

View file

@ -1,16 +1,12 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Text;
using Luna;
using OtterGui.Text.Widget.Editors;
using Penumbra.Interop.Services;
using Penumbra.Interop.Structs;
namespace Penumbra.UI.AdvancedWindow.Materials;
public sealed unsafe class MaterialTemplatePickers : Luna.IUiService
public sealed unsafe class MaterialTemplatePickers : IUiService
{
private const float MaximumTextureSize = 64.0f;
@ -45,17 +41,17 @@ public sealed unsafe class MaterialTemplatePickers : Luna.IUiService
public bool DrawTextureArrayIndexPicker(ReadOnlySpan<byte> label, ReadOnlySpan<byte> description, ref ushort value, bool compact,
ReadOnlySpan<FFXIVClientStructs.Interop.Pointer<TextureResourceHandle>> textureRHs)
{
TextureResourceHandle* firstNonNullTextureRH = null;
TextureResourceHandle* firstNonNullTextureRh = null;
foreach (var texture in textureRHs)
{
if (texture.Value != null && texture.Value->CsHandle.Texture != null)
{
firstNonNullTextureRH = texture;
firstNonNullTextureRh = texture;
break;
}
}
var firstNonNullTexture = firstNonNullTextureRH != null ? firstNonNullTextureRH->CsHandle.Texture : null;
var firstNonNullTexture = firstNonNullTextureRh != null ? firstNonNullTextureRh->CsHandle.Texture : null;
var textureSize = firstNonNullTexture != null
? new Vector2(firstNonNullTexture->ActualWidth, firstNonNullTexture->ActualHeight).Contain(new Vector2(MaximumTextureSize))
@ -64,70 +60,66 @@ public sealed unsafe class MaterialTemplatePickers : Luna.IUiService
var ret = false;
var framePadding = ImGui.GetStyle().FramePadding;
var itemSpacing = ImGui.GetStyle().ItemSpacing;
using (var font = ImRaii.PushFont(UiBuilder.MonoFont))
var framePadding = Im.Style.FramePadding;
var itemSpacing = Im.Style.ItemSpacing;
using (Im.Font.PushMono())
{
var spaceSize = ImUtf8.CalcTextSize(" "u8).X;
var spaces = (int)((ImGui.CalcItemWidth()
var spaceSize = Im.Font.Mono.GetCharacterAdvance(' ');
var spaces = (int)((Im.Item.CalculateWidth()
- framePadding.X * 2.0f
- (compact ? 0.0f : (textureSize.X + itemSpacing.X) * textureRHs.Length))
/ spaceSize);
using var padding = ImRaii.PushStyle(ImGuiStyleVar.FramePadding,
using var padding = ImStyleDouble.FramePadding.Push(
framePadding + new Vector2(0.0f, Math.Max(textureSize.Y - Im.Style.FrameHeight + itemSpacing.Y, 0.0f) * 0.5f), !compact);
using var combo = ImUtf8.Combo(label, (value == ushort.MaxValue ? "-" : value.ToString()).PadLeft(spaces),
ImGuiComboFlags.NoArrowButton | ImGuiComboFlags.HeightLarge);
if (combo.Success && firstNonNullTextureRH != null)
using var combo = Im.Combo.Begin(label, (value is ushort.MaxValue ? "-" : value.ToString()).PadLeft(spaces),
ComboFlags.NoArrowButton | ComboFlags.HeightLarge);
if (combo.Success && firstNonNullTextureRh != null)
{
var lineHeight = Math.Max(Im.Style.TextHeightWithSpacing, framePadding.Y * 2.0f + textureSize.Y);
var itemWidth = Math.Max(Im.ContentRegion.Available.X,
ImUtf8.CalcTextSize("MMM"u8).X + (itemSpacing.X + textureSize.X) * textureRHs.Length + framePadding.X * 2.0f);
using var center = ImRaii.PushStyle(ImGuiStyleVar.SelectableTextAlign, new Vector2(0, 0.5f));
using var clipper = ImUtf8.ListClipper(count, lineHeight);
while (clipper.Step())
Im.Font.CalculateSize("MMM"u8).X + (itemSpacing.X + textureSize.X) * textureRHs.Length + framePadding.X * 2.0f);
using var center = ImStyleDouble.SelectableTextAlign.Push(new Vector2(0, 0.5f));
using var clipper = new Im.ListClipper(count, lineHeight);
foreach (var index in clipper)
{
for (var i = clipper.DisplayStart; i < clipper.DisplayEnd && i < count; i++)
if (Im.Selectable($"{index,3}", index == value, size: new Vector2(itemWidth, lineHeight)))
{
if (ImUtf8.Selectable($"{i,3}", i == value, size: new Vector2(itemWidth, lineHeight)))
{
ret = value != i;
value = (ushort)i;
}
var rectMin = ImGui.GetItemRectMin();
var rectMax = ImGui.GetItemRectMax();
var textureRegionStart = new Vector2(
rectMax.X - framePadding.X - textureSize.X * textureRHs.Length - itemSpacing.X * (textureRHs.Length - 1),
rectMin.Y + framePadding.Y);
var maxSize = new Vector2(textureSize.X, rectMax.Y - framePadding.Y - textureRegionStart.Y);
DrawTextureSlices(textureRegionStart, maxSize, itemSpacing.X, textureRHs, (byte)i);
ret = value != index;
value = (ushort)index;
}
var rectMin = Im.Item.UpperLeftCorner;
var rectMax = Im.Item.LowerRightCorner;
var textureRegionStart = new Vector2(
rectMax.X - framePadding.X - textureSize.X * textureRHs.Length - itemSpacing.X * (textureRHs.Length - 1),
rectMin.Y + framePadding.Y);
var maxSize = textureSize with { Y = rectMax.Y - framePadding.Y - textureRegionStart.Y };
DrawTextureSlices(textureRegionStart, maxSize, itemSpacing.X, textureRHs, (byte)index);
}
}
}
if (!compact && value != ushort.MaxValue)
if (!compact && value is not ushort.MaxValue)
{
var cbRectMin = ImGui.GetItemRectMin();
var cbRectMax = ImGui.GetItemRectMax();
var cbRectMin = Im.Item.UpperLeftCorner;
var cbRectMax = Im.Item.LowerRightCorner;
var cbTextureRegionStart =
new Vector2(cbRectMax.X - framePadding.X - textureSize.X * textureRHs.Length - itemSpacing.X * (textureRHs.Length - 1),
cbRectMin.Y + framePadding.Y);
var cbMaxSize = new Vector2(textureSize.X, cbRectMax.Y - framePadding.Y - cbTextureRegionStart.Y);
var cbMaxSize = textureSize with { Y = cbRectMax.Y - framePadding.Y - cbTextureRegionStart.Y };
DrawTextureSlices(cbTextureRegionStart, cbMaxSize, itemSpacing.X, textureRHs, (byte)value);
}
if (Im.Item.Hovered(HoveredFlags.AllowWhenDisabled) && (description.Length > 0 || compact && value != ushort.MaxValue))
if (Im.Item.Hovered(HoveredFlags.AllowWhenDisabled) && (description.Length > 0 || compact && value is not ushort.MaxValue))
{
using var disabled = ImRaii.Enabled();
using var tt = ImUtf8.Tooltip();
using var disabled = Im.Enabled();
using var tt = Im.Tooltip.Begin();
if (description.Length > 0)
ImUtf8.Text(description);
Im.Text(description);
if (compact && value != ushort.MaxValue)
{
ImGui.Dummy(new Vector2(textureSize.X * textureRHs.Length + itemSpacing.X * (textureRHs.Length - 1), textureSize.Y));
var rectMin = ImGui.GetItemRectMin();
var rectMax = ImGui.GetItemRectMax();
Im.Dummy(textureSize with { X = textureSize.X * textureRHs.Length + itemSpacing.X * (textureRHs.Length - 1) });
var rectMin = Im.Item.UpperLeftCorner;
DrawTextureSlices(rectMin, textureSize, itemSpacing.X, textureRHs, (byte)value);
}
}
@ -176,7 +168,7 @@ public sealed unsafe class MaterialTemplatePickers : Luna.IUiService
var value = ushort.CreateSaturating(MathF.Round(values[valueIdx]));
if (disabled)
{
using var _ = ImRaii.Disabled();
using var _ = Im.Disabled();
draw(helper.Id, default, ref value, true);
}
else

View file

@ -1,6 +1,7 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using ImSharp;
using Luna;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Text;
@ -24,19 +25,18 @@ public partial class MtrlTab
private void DrawColorTablePairSelector(ColorTable table, bool disabled)
{
var style = ImGui.GetStyle();
var itemSpacing = style.ItemSpacing.X;
var itemInnerSpacing = style.ItemInnerSpacing.X;
var framePadding = style.FramePadding;
var itemSpacing = Im.Style.ItemSpacing.X;
var itemInnerSpacing = Im.Style.ItemInnerSpacing.X;
var framePadding = Im.Style.FramePadding;
var buttonWidth = (Im.ContentRegion.Available.X - itemSpacing * 7.0f) * 0.125f;
var frameHeight = Im.Style.FrameHeight;
var highlighterSize = ImUtf8.CalcIconSize(FontAwesomeIcon.Crosshairs) + framePadding * 2.0f;
var highlighterSize = ImEx.Icon.CalculateSize(FontAwesomeIcon.Crosshairs.Icon()) + framePadding * 2.0f;
using var font = ImRaii.PushFont(UiBuilder.MonoFont);
using var alignment = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f));
using var font = Im.Font.PushMono();
using var alignment = ImStyleDouble.ButtonTextAlign.Push(new Vector2(0, 0.5f));
// This depends on the font being pushed for "proper" alignment of the pair indices in the buttons.
var spaceWidth = ImUtf8.CalcTextSize(" "u8).X;
var spaceWidth = Im.Font.Mono.GetCharacterAdvance(' ');
var spacePadding = (int)MathF.Ceiling((highlighterSize.X + framePadding.X + itemInnerSpacing) / spaceWidth);
for (var i = 0; i < ColorTable.NumRows >> 1; i += 8)
@ -46,13 +46,13 @@ public partial class MtrlTab
var pairIndex = i + j;
using (ImGuiColor.Button.Push(Im.Style[ImGuiColor.ButtonActive], pairIndex == _colorTableSelectedPair))
{
if (ImUtf8.Button($"#{pairIndex + 1}".PadLeft(3 + spacePadding),
if (Im.Button($"#{pairIndex + 1}".PadLeft(3 + spacePadding),
new Vector2(buttonWidth, Im.Style.FrameHeightWithSpacing + frameHeight)))
_colorTableSelectedPair = pairIndex;
}
var rcMin = ImGui.GetItemRectMin() + framePadding;
var rcMax = ImGui.GetItemRectMax() - framePadding;
var rcMin = Im.Item.UpperLeftCorner + framePadding;
var rcMax = Im.Item.LowerRightCorner - framePadding;
CtBlendRect(
rcMin with { X = rcMax.X - frameHeight * 3 - itemInnerSpacing * 2 },
rcMax with { X = rcMax.X - (frameHeight + itemInnerSpacing) * 2 },
@ -73,12 +73,12 @@ public partial class MtrlTab
if (j < 7)
Im.Line.Same();
var cursor = ImGui.GetCursorScreenPos();
ImGui.SetCursorScreenPos(rcMin with { Y = float.Lerp(rcMin.Y, rcMax.Y, 0.5f) - highlighterSize.Y * 0.5f });
var cursor = Im.Cursor.ScreenPosition;
Im.Cursor.ScreenPosition = rcMin with { Y = float.Lerp(rcMin.Y, rcMax.Y, 0.5f) - highlighterSize.Y * 0.5f };
font.Pop();
ColorTablePairHighlightButton(pairIndex, disabled);
font.Push(UiBuilder.MonoFont);
ImGui.SetCursorScreenPos(cursor);
font.Push(Im.Font.Mono);
Im.Cursor.ScreenPosition = cursor;
}
}
}
@ -241,9 +241,9 @@ public partial class MtrlTab
private bool DrawRowHeader(int rowIdx, bool disabled)
{
ColorTableCopyClipboardButton(rowIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
var ret = ColorTablePasteFromClipboardButton(rowIdx, disabled);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ColorTableRowHighlightButton(rowIdx, disabled);
Im.Line.Same();
@ -255,8 +255,8 @@ public partial class MtrlTab
private static bool DrawColors(ColorTable table, ColorDyeTable? dyeTable, DyePack? dyePack, int rowIdx)
{
var dyeOffset = Im.ContentRegion.Available.X
+ ImGui.GetStyle().ItemSpacing.X
- ImGui.GetStyle().ItemInnerSpacing.X
+ Im.Style.ItemSpacing.X
- Im.Style.ItemInnerSpacing.X
- Im.Style.FrameHeight * 2.0f;
var ret = false;
@ -267,10 +267,10 @@ public partial class MtrlTab
c => table[rowIdx].DiffuseColor = c);
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeDiffuseColor"u8, "Apply Diffuse Color on Dye"u8, dye.DiffuseColor,
b => dyeTable[rowIdx].DiffuseColor = b);
ImUtf8.SameLineInner();
Im.Line.SameInner();
CtColorPicker("##dyePreviewDiffuseColor"u8, "Dye Preview for Diffuse Color"u8, dyePack?.DiffuseColor);
}
@ -278,10 +278,10 @@ public partial class MtrlTab
c => table[rowIdx].SpecularColor = c);
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeSpecularColor"u8, "Apply Specular Color on Dye"u8, dye.SpecularColor,
b => dyeTable[rowIdx].SpecularColor = b);
ImUtf8.SameLineInner();
Im.Line.SameInner();
CtColorPicker("##dyePreviewSpecularColor"u8, "Dye Preview for Specular Color"u8, dyePack?.SpecularColor);
}
@ -289,10 +289,10 @@ public partial class MtrlTab
c => table[rowIdx].EmissiveColor = c);
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeEmissiveColor"u8, "Apply Emissive Color on Dye"u8, dye.EmissiveColor,
b => dyeTable[rowIdx].EmissiveColor = b);
ImUtf8.SameLineInner();
Im.Line.SameInner();
CtColorPicker("##dyePreviewEmissiveColor"u8, "Dye Preview for Emissive Color"u8, dyePack?.EmissiveColor);
}
@ -303,8 +303,8 @@ public partial class MtrlTab
{
var scalarSize = ColorTableScalarSize * Im.Style.GlobalScale;
var dyeOffset = Im.ContentRegion.Available.X
+ ImGui.GetStyle().ItemSpacing.X
- ImGui.GetStyle().ItemInnerSpacing.X
+ Im.Style.ItemSpacing.X
- Im.Style.ItemInnerSpacing.X
- Im.Style.FrameHeight
- scalarSize;
@ -314,17 +314,17 @@ public partial class MtrlTab
ref var row = ref table[rowIdx];
var dye = dyeTable?[rowIdx] ?? default;
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf(isRowB ? "Field #19"u8 : "Anisotropy Degree"u8, default, row.Anisotropy, "%.2f"u8, 0.0f, HalfMaxValue, 0.1f,
v => table[rowIdx].Anisotropy = v);
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeAnisotropy"u8, isRowB ? "Apply Field #19 on Dye"u8 : "Apply Anisotropy Degree on Dye"u8,
dye.Anisotropy,
b => dyeTable[rowIdx].Anisotropy = b);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
CtDragHalf("##dyePreviewAnisotropy"u8, isRowB ? "Dye Preview for Field #19"u8 : "Dye Preview for Anisotropy Degree"u8,
dyePack?.Anisotropy, "%.2f"u8);
}
@ -335,37 +335,37 @@ public partial class MtrlTab
private bool DrawTemplate(ColorTable table, ColorDyeTable? dyeTable, DyePack? dyePack, int rowIdx)
{
var scalarSize = ColorTableScalarSize * Im.Style.GlobalScale;
var itemSpacing = ImGui.GetStyle().ItemSpacing.X;
var dyeOffset = Im.ContentRegion.Available.X - ImGui.GetStyle().ItemInnerSpacing.X - Im.Style.FrameHeight - scalarSize - 64.0f;
var itemSpacing = Im.Style.ItemSpacing.X;
var dyeOffset = Im.ContentRegion.Available.X - Im.Style.ItemInnerSpacing.X - Im.Style.FrameHeight - scalarSize - 64.0f;
var subColWidth = CalculateSubColumnWidth(2);
var ret = false;
ref var row = ref table[rowIdx];
var dye = dyeTable?[rowIdx] ?? default;
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Shader ID"u8, default, row.ShaderId, "%d"u8, (ushort)0, (ushort)255, 0.25f,
v => table[rowIdx].ShaderId = v);
ImGui.Dummy(new Vector2(Im.Style.TextHeight / 2));
ImGui.SetNextItemWidth(scalarSize + itemSpacing + 64.0f);
Im.Item.SetNextWidth(scalarSize + itemSpacing + 64.0f);
ret |= CtSphereMapIndexPicker("###SphereMapIndex"u8, default, row.SphereMapIndex, false,
v => table[rowIdx].SphereMapIndex = v);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImUtf8.Text("Sphere Map"u8);
if (dyeTable != null)
{
var textRectMin = ImGui.GetItemRectMin();
var textRectMax = ImGui.GetItemRectMax();
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
var cursor = ImGui.GetCursorScreenPos();
ImGui.SetCursorScreenPos(cursor with { Y = float.Lerp(textRectMin.Y, textRectMax.Y, 0.5f) - Im.Style.FrameHeight * 0.5f });
ret |= CtApplyStainCheckbox("##dyeSphereMapIndex"u8, "Apply Sphere Map on Dye"u8, dye.SphereMapIndex,
b => dyeTable[rowIdx].SphereMapIndex = b);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImGui.SetCursorScreenPos(ImGui.GetCursorScreenPos() with { Y = cursor.Y });
ImGui.SetNextItemWidth(scalarSize + itemSpacing + 64.0f);
Im.Item.SetNextWidth(scalarSize + itemSpacing + 64.0f);
using var dis = ImRaii.Disabled();
CtSphereMapIndexPicker("###SphereMapIndexDye"u8, "Dye Preview for Sphere Map"u8, dyePack?.SphereMapIndex ?? ushort.MaxValue, false,
Nop);
@ -373,49 +373,49 @@ public partial class MtrlTab
ImGui.Dummy(new Vector2(64.0f, 0.0f));
Im.Line.Same();
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Sphere Map Intensity"u8, default, (float)row.SphereMapMask * 100.0f, "%.0f%%"u8, HalfMinValue * 100.0f,
HalfMaxValue * 100.0f, 1.0f,
v => table[rowIdx].SphereMapMask = (Half)(v * 0.01f));
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeSphereMapMask"u8, "Apply Sphere Map Intensity on Dye"u8, dye.SphereMapMask,
b => dyeTable[rowIdx].SphereMapMask = b);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
CtDragScalar("##dyeSphereMapMask"u8, "Dye Preview for Sphere Map Intensity"u8, (float?)dyePack?.SphereMapMask * 100.0f, "%.0f%%"u8);
}
ImGui.Dummy(new Vector2(Im.Style.TextHeight / 2));
var leftLineHeight = 64.0f + ImGui.GetStyle().FramePadding.Y * 2.0f;
var rightLineHeight = 3.0f * Im.Style.FrameHeight + 2.0f * ImGui.GetStyle().ItemSpacing.Y;
var leftLineHeight = 64.0f + Im.Style.FramePadding.Y * 2.0f;
var rightLineHeight = 3.0f * Im.Style.FrameHeight + 2.0f * Im.Style.ItemSpacing.Y;
var lineHeight = Math.Max(leftLineHeight, rightLineHeight);
var cursorPos = ImGui.GetCursorScreenPos();
ImGui.SetCursorScreenPos(cursorPos + new Vector2(0.0f, (lineHeight - leftLineHeight) * 0.5f));
ImGui.SetNextItemWidth(scalarSize + (itemSpacing + 64.0f) * 2.0f);
Im.Item.SetNextWidth(scalarSize + (itemSpacing + 64.0f) * 2.0f);
ret |= CtTileIndexPicker("###TileIndex"u8, default, row.TileIndex, false,
v => table[rowIdx].TileIndex = v);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImUtf8.Text("Tile"u8);
ImGui.SameLine(subColWidth);
Im.Line.Same(subColWidth);
ImGui.SetCursorScreenPos(ImGui.GetCursorScreenPos() with { Y = cursorPos.Y + (lineHeight - rightLineHeight) * 0.5f });
using (ImUtf8.Child("###TileProperties"u8,
new Vector2(Im.ContentRegion.Available.X, float.Lerp(rightLineHeight, lineHeight, 0.5f))))
{
ImGui.Dummy(new Vector2(scalarSize, 0.0f));
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Tile Opacity"u8, default, (float)row.TileAlpha * 100.0f, "%.0f%%"u8, 0.0f, HalfMaxValue * 100.0f, 1.0f,
v => table[rowIdx].TileAlpha = (Half)(v * 0.01f));
ret |= CtTileTransformMatrix(row.TileTransform, scalarSize, true,
m => table[rowIdx].TileTransform = m);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImGui.SetCursorScreenPos(ImGui.GetCursorScreenPos()
- new Vector2(0.0f, (Im.Style.FrameHeight + ImGui.GetStyle().ItemSpacing.Y) * 0.5f));
- new Vector2(0.0f, (Im.Style.FrameHeight + Im.Style.ItemSpacing.Y) * 0.5f));
ImUtf8.Text("Tile Transform"u8);
}
@ -425,10 +425,10 @@ public partial class MtrlTab
private static bool DrawPbr(ColorTable table, ColorDyeTable? dyeTable, DyePack? dyePack, int rowIdx)
{
var scalarSize = ColorTableScalarSize * Im.Style.GlobalScale;
var subColWidth = CalculateSubColumnWidth(2) + ImGui.GetStyle().ItemSpacing.X;
var subColWidth = CalculateSubColumnWidth(2) + Im.Style.ItemSpacing.X;
var dyeOffset = subColWidth
- ImGui.GetStyle().ItemSpacing.X * 2.0f
- ImGui.GetStyle().ItemInnerSpacing.X
- Im.Style.ItemSpacing.X * 2.0f
- Im.Style.ItemInnerSpacing.X
- Im.Style.FrameHeight
- scalarSize;
@ -436,32 +436,32 @@ public partial class MtrlTab
ref var row = ref table[rowIdx];
var dye = dyeTable?[rowIdx] ?? default;
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Roughness"u8, default, (float)row.Roughness * 100.0f, "%.0f%%"u8, HalfMinValue * 100.0f, HalfMaxValue * 100.0f,
1.0f,
v => table[rowIdx].Roughness = (Half)(v * 0.01f));
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeRoughness"u8, "Apply Roughness on Dye"u8, dye.Roughness,
b => dyeTable[rowIdx].Roughness = b);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
CtDragScalar("##dyePreviewRoughness"u8, "Dye Preview for Roughness"u8, (float?)dyePack?.Roughness * 100.0f, "%.0f%%"u8);
}
ImGui.SameLine(subColWidth);
ImGui.SetNextItemWidth(scalarSize);
Im.Line.Same(subColWidth);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Metalness"u8, default, (float)row.Metalness * 100.0f, "%.0f%%"u8, HalfMinValue * 100.0f, HalfMaxValue * 100.0f,
1.0f,
v => table[rowIdx].Metalness = (Half)(v * 0.01f));
if (dyeTable != null)
{
ImGui.SameLine(subColWidth + dyeOffset);
Im.Line.Same(subColWidth + dyeOffset);
ret |= CtApplyStainCheckbox("##dyeMetalness"u8, "Apply Metalness on Dye"u8, dye.Metalness,
b => dyeTable[rowIdx].Metalness = b);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
CtDragScalar("##dyePreviewMetalness"u8, "Dye Preview for Metalness"u8, (float?)dyePack?.Metalness * 100.0f, "%.0f%%"u8);
}
@ -471,10 +471,10 @@ public partial class MtrlTab
private static bool DrawSheen(ColorTable table, ColorDyeTable? dyeTable, DyePack? dyePack, int rowIdx)
{
var scalarSize = ColorTableScalarSize * Im.Style.GlobalScale;
var subColWidth = CalculateSubColumnWidth(2) + ImGui.GetStyle().ItemSpacing.X;
var subColWidth = CalculateSubColumnWidth(2) + Im.Style.ItemSpacing.X;
var dyeOffset = subColWidth
- ImGui.GetStyle().ItemSpacing.X * 2.0f
- ImGui.GetStyle().ItemInnerSpacing.X
- Im.Style.ItemSpacing.X * 2.0f
- Im.Style.ItemInnerSpacing.X
- Im.Style.FrameHeight
- scalarSize;
@ -482,45 +482,45 @@ public partial class MtrlTab
ref var row = ref table[rowIdx];
var dye = dyeTable?[rowIdx] ?? default;
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Sheen"u8, default, (float)row.SheenRate * 100.0f, "%.0f%%"u8, HalfMinValue * 100.0f, HalfMaxValue * 100.0f, 1.0f,
v => table[rowIdx].SheenRate = (Half)(v * 0.01f));
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeSheenRate"u8, "Apply Sheen on Dye"u8, dye.SheenRate,
b => dyeTable[rowIdx].SheenRate = b);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
CtDragScalar("##dyePreviewSheenRate"u8, "Dye Preview for Sheen"u8, (float?)dyePack?.SheenRate * 100.0f, "%.0f%%"u8);
}
ImGui.SameLine(subColWidth);
ImGui.SetNextItemWidth(scalarSize);
Im.Line.Same(subColWidth);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Sheen Tint"u8, default, (float)row.SheenTintRate * 100.0f, "%.0f%%"u8, HalfMinValue * 100.0f,
HalfMaxValue * 100.0f, 1.0f,
v => table[rowIdx].SheenTintRate = (Half)(v * 0.01f));
if (dyeTable != null)
{
ImGui.SameLine(subColWidth + dyeOffset);
Im.Line.Same(subColWidth + dyeOffset);
ret |= CtApplyStainCheckbox("##dyeSheenTintRate"u8, "Apply Sheen Tint on Dye"u8, dye.SheenTintRate,
b => dyeTable[rowIdx].SheenTintRate = b);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
CtDragScalar("##dyePreviewSheenTintRate"u8, "Dye Preview for Sheen Tint"u8, (float?)dyePack?.SheenTintRate * 100.0f, "%.0f%%"u8);
}
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Sheen Roughness"u8, default, 100.0f / (float)row.SheenAperture, "%.0f%%"u8, 100.0f / HalfMaxValue,
100.0f / HalfEpsilon, 1.0f,
v => table[rowIdx].SheenAperture = (Half)(100.0f / v));
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeSheenRoughness"u8, "Apply Sheen Roughness on Dye"u8, dye.SheenAperture,
b => dyeTable[rowIdx].SheenAperture = b);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
CtDragScalar("##dyePreviewSheenRoughness"u8, "Dye Preview for Sheen Roughness"u8, 100.0f / (float?)dyePack?.SheenAperture,
"%.0f%%"u8);
}
@ -531,10 +531,10 @@ public partial class MtrlTab
private static bool DrawFurther(ColorTable table, ColorDyeTable? dyeTable, DyePack? dyePack, int rowIdx)
{
var scalarSize = ColorTableScalarSize * Im.Style.GlobalScale;
var subColWidth = CalculateSubColumnWidth(2) + ImGui.GetStyle().ItemSpacing.X;
var subColWidth = CalculateSubColumnWidth(2) + Im.Style.ItemSpacing.X;
var dyeOffset = subColWidth
- ImGui.GetStyle().ItemSpacing.X * 2.0f
- ImGui.GetStyle().ItemInnerSpacing.X
- Im.Style.ItemSpacing.X * 2.0f
- Im.Style.ItemInnerSpacing.X
- Im.Style.FrameHeight
- scalarSize;
@ -542,49 +542,49 @@ public partial class MtrlTab
ref var row = ref table[rowIdx];
var dye = dyeTable?[rowIdx] ?? default;
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf("Field #11"u8, default, row.Scalar11, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f,
v => table[rowIdx].Scalar11 = v);
if (dyeTable != null)
{
ImGui.SameLine(dyeOffset);
Im.Line.Same(dyeOffset);
ret |= CtApplyStainCheckbox("##dyeScalar11"u8, "Apply Field #11 on Dye"u8, dye.Scalar3,
b => dyeTable[rowIdx].Scalar3 = b);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(scalarSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(scalarSize);
CtDragHalf("##dyePreviewScalar11"u8, "Dye Preview for Field #11"u8, dyePack?.Scalar3, "%.2f"u8);
}
ImGui.Dummy(new Vector2(Im.Style.TextHeight / 2));
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf("Field #3"u8, default, row.Scalar3, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f,
v => table[rowIdx].Scalar3 = v);
ImGui.SameLine(subColWidth);
ImGui.SetNextItemWidth(scalarSize);
Im.Line.Same(subColWidth);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf("Field #7"u8, default, row.Scalar7, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f,
v => table[rowIdx].Scalar7 = v);
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf("Field #15"u8, default, row.Scalar15, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f,
v => table[rowIdx].Scalar15 = v);
ImGui.SameLine(subColWidth);
ImGui.SetNextItemWidth(scalarSize);
Im.Line.Same(subColWidth);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf("Field #17"u8, default, row.Scalar17, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f,
v => table[rowIdx].Scalar17 = v);
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf("Field #20"u8, default, row.Scalar20, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f,
v => table[rowIdx].Scalar20 = v);
ImGui.SameLine(subColWidth);
ImGui.SetNextItemWidth(scalarSize);
Im.Line.Same(subColWidth);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf("Field #22"u8, default, row.Scalar22, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f,
v => table[rowIdx].Scalar22 = v);
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragHalf("Field #23"u8, default, row.Scalar23, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f,
v => table[rowIdx].Scalar23 = v);
@ -594,28 +594,28 @@ public partial class MtrlTab
private bool DrawDye(ColorDyeTable dyeTable, DyePack? dyePack, int rowIdx)
{
var scalarSize = ColorTableScalarSize * Im.Style.GlobalScale;
var applyButtonWidth = ImUtf8.CalcTextSize("Apply Preview Dye"u8).X + ImGui.GetStyle().FramePadding.X * 2.0f;
var applyButtonWidth = ImUtf8.CalcTextSize("Apply Preview Dye"u8).X + Im.Style.FramePadding.X * 2.0f;
var subColWidth = CalculateSubColumnWidth(2, applyButtonWidth);
var ret = false;
ref var dye = ref dyeTable[rowIdx];
ImGui.SetNextItemWidth(scalarSize);
Im.Item.SetNextWidth(scalarSize);
ret |= CtDragScalar("Dye Channel"u8, default, dye.Channel + 1, "%d"u8, 1, StainService.ChannelCount, 0.1f,
value => dyeTable[rowIdx].Channel = (byte)(Math.Clamp(value, 1, StainService.ChannelCount) - 1));
ImGui.SameLine(subColWidth);
ImGui.SetNextItemWidth(scalarSize);
Im.Line.Same(subColWidth);
Im.Item.SetNextWidth(scalarSize);
_stainService.GudTemplateCombo.CurrentDyeChannel = dye.Channel;
if (_stainService.GudTemplateCombo.Draw("##dyeTemplate", dye.Template.ToString(), string.Empty,
scalarSize + ImGui.GetStyle().ScrollbarSize / 2, Im.Style.TextHeightWithSpacing, ImGuiComboFlags.NoArrowButton))
scalarSize + Im.Style.ScrollbarSize / 2, Im.Style.TextHeightWithSpacing, ImGuiComboFlags.NoArrowButton))
{
dye.Template = _stainService.GudTemplateCombo.CurrentSelection.UShort;
ret = true;
}
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImUtf8.Text("Dye Template"u8);
ImGui.SameLine(Im.ContentRegion.Available.X - applyButtonWidth + ImGui.GetStyle().ItemSpacing.X);
Im.Line.Same(Im.ContentRegion.Available.X - applyButtonWidth + Im.Style.ItemSpacing.X);
using var dis = ImRaii.Disabled(!dyePack.HasValue);
if (ImUtf8.Button("Apply Preview Dye"u8))
ret |= Mtrl.ApplyDyeToRow(_stainService.GudStmFile, [
@ -633,12 +633,12 @@ public partial class MtrlTab
{
var width = ImGui.CalcTextSize(text).X;
ImGui.SetCursorScreenPos(ImGui.GetCursorScreenPos() + new Vector2((Im.ContentRegion.Available.X - width) * alignment, 0.0f));
ImGui.TextUnformatted(text);
Im.Text(text);
}
private static float CalculateSubColumnWidth(int numSubColumns, float reservedSpace = 0.0f)
{
var itemSpacing = ImGui.GetStyle().ItemSpacing.X;
var itemSpacing = Im.Style.ItemSpacing.X;
return (Im.ContentRegion.Available.X - reservedSpace - itemSpacing * (numSubColumns - 1)) / numSubColumns + itemSpacing;
}
}

View file

@ -305,9 +305,8 @@ public partial class MtrlTab
private static void CtBlendRect(Vector2 rcMin, Vector2 rcMax, uint topColor, uint bottomColor)
{
var style = ImGui.GetStyle();
var frameRounding = style.FrameRounding;
var frameThickness = style.FrameBorderSize;
var frameRounding = Im.Style.FrameRounding;
var frameThickness = Im.Style.FrameBorderThickness;
var borderColor = ImGuiColor.Border.Get();
var drawList = ImGui.GetWindowDrawList();
if (topColor == bottomColor)
@ -504,17 +503,17 @@ public partial class MtrlTab
if (_config.EditRawTileTransforms)
{
var tmp = value;
ImGui.SetNextItemWidth(floatSize);
Im.Item.SetNextWidth(floatSize);
ret |= CtDragHalf("##TileTransformUU"u8, "Tile Repeat U"u8, ref tmp.UU, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(floatSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(floatSize);
ret |= CtDragHalf("##TileTransformVV"u8, "Tile Repeat V"u8, ref tmp.VV, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f);
if (!twoRowLayout)
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(floatSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(floatSize);
ret |= CtDragHalf("##TileTransformUV"u8, "Tile Skew U"u8, ref tmp.UV, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(floatSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(floatSize);
ret |= CtDragHalf("##TileTransformVU"u8, "Tile Skew V"u8, ref tmp.VU, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f);
if (!ret || tmp == value)
return false;
@ -526,23 +525,23 @@ public partial class MtrlTab
value.Decompose(out var scale, out var rotation, out var shear);
rotation *= 180.0f / MathF.PI;
shear *= 180.0f / MathF.PI;
ImGui.SetNextItemWidth(floatSize);
Im.Item.SetNextWidth(floatSize);
var scaleXChanged = CtDragScalar("##TileScaleU"u8, "Tile Scale U"u8, ref scale.X, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f);
var activated = ImGui.IsItemActivated();
var deactivated = ImGui.IsItemDeactivated();
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(floatSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(floatSize);
var scaleYChanged = CtDragScalar("##TileScaleV"u8, "Tile Scale V"u8, ref scale.Y, "%.2f"u8, HalfMinValue, HalfMaxValue, 0.1f);
activated |= ImGui.IsItemActivated();
deactivated |= ImGui.IsItemDeactivated();
if (!twoRowLayout)
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(floatSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(floatSize);
var rotationChanged = CtDragScalar("##TileRotation"u8, "Tile Rotation"u8, ref rotation, "%.0f°"u8, -180.0f, 180.0f, 1.0f);
activated |= ImGui.IsItemActivated();
deactivated |= ImGui.IsItemDeactivated();
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(floatSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(floatSize);
var shearChanged = CtDragScalar("##TileShear"u8, "Tile Shear"u8, ref shear, "%.0f°"u8, -90.0f, 90.0f, 1.0f);
activated |= ImGui.IsItemActivated();
deactivated |= ImGui.IsItemDeactivated();

View file

@ -173,7 +173,7 @@ public partial class MtrlTab
if (buffer.Length > 0)
{
using var id = ImRaii.PushId($"##{constant.Id:X8}:{slice.Start}");
ImGui.SetNextItemWidth(MaterialConstantSize * Im.Style.GlobalScale);
Im.Item.SetNextWidth(MaterialConstantSize * Im.Style.GlobalScale);
if (editor.Draw(buffer[slice], disabled))
{
ret = true;
@ -186,7 +186,7 @@ public partial class MtrlTab
var canReset = _associatedShpk?.MaterialParamsDefaults != null
? defaultValue.Length > 0 && !defaultValue.SequenceEqual(buffer[slice])
: buffer[slice].ContainsAnyExcept((byte)0);
ImUtf8.SameLineInner();
Im.Line.SameInner();
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Backspace.ToIconString(), Im.Style.FrameHeight * Vector2.One,
"Reset this constant to its default value.\n\nHold Ctrl to unlock.", !ImGui.GetIO().KeyCtrl || !canReset, true))
{
@ -204,7 +204,7 @@ public partial class MtrlTab
if (description.Length > 0)
ImGuiUtil.LabeledHelpMarker(label, description);
else
ImGui.TextUnformatted(label);
Im.Text(label);
}
}
}

View file

@ -103,9 +103,9 @@ public partial class MtrlTab
var intSize = LegacyColorTableIntegerSize * Im.Style.GlobalScale;
ImGui.TableNextColumn();
ColorTableCopyClipboardButton(rowIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
var ret = ColorTablePasteFromClipboardButton(rowIdx, disabled);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ColorTableRowHighlightButton(rowIdx, disabled);
ImGui.TableNextColumn();
@ -120,7 +120,7 @@ public partial class MtrlTab
c => table[rowIdx].DiffuseColor = c);
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeDiffuse"u8, "Apply Diffuse Color on Dye"u8, dye.DiffuseColor,
b => dyeTable[rowIdx].DiffuseColor = b);
}
@ -130,19 +130,19 @@ public partial class MtrlTab
c => table[rowIdx].SpecularColor = c);
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeSpecular"u8, "Apply Specular Color on Dye"u8, dye.SpecularColor,
b => dyeTable[rowIdx].SpecularColor = b);
}
Im.Line.Same();
ImGui.SetNextItemWidth(pctSize);
Im.Item.SetNextWidth(pctSize);
ret |= CtDragScalar("##SpecularMask"u8, "Specular Strength"u8, (float)row.SpecularMask * 100.0f, "%.0f%%"u8, 0f, HalfMaxValue * 100.0f,
1.0f,
v => table[rowIdx].SpecularMask = (Half)(v * 0.01f));
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeSpecularMask"u8, "Apply Specular Strength on Dye"u8, dye.SpecularMask,
b => dyeTable[rowIdx].SpecularMask = b);
}
@ -152,13 +152,13 @@ public partial class MtrlTab
c => table[rowIdx].EmissiveColor = c);
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeEmissive"u8, "Apply Emissive Color on Dye"u8, dye.EmissiveColor,
b => dyeTable[rowIdx].EmissiveColor = b);
}
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(floatSize);
Im.Item.SetNextWidth(floatSize);
var glossStrengthMin = ImGui.GetIO().KeyCtrl ? 0.0f : HalfEpsilon;
ret |= CtDragHalf("##Shininess"u8, "Gloss Strength"u8, row.Shininess, "%.1f"u8, glossStrengthMin, HalfMaxValue,
Math.Max(0.1f, (float)row.Shininess * 0.025f),
@ -166,13 +166,13 @@ public partial class MtrlTab
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeShininess"u8, "Apply Gloss Strength on Dye"u8, dye.Shininess,
b => dyeTable[rowIdx].Shininess = b);
}
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(intSize);
Im.Item.SetNextWidth(intSize);
ret |= CtTileIndexPicker("##TileIndex"u8, "Tile Index"u8, row.TileIndex, true,
value => table[rowIdx].TileIndex = value);
@ -184,7 +184,7 @@ public partial class MtrlTab
{
ImGui.TableNextColumn();
if (_stainService.LegacyTemplateCombo.Draw("##dyeTemplate", dye.Template.ToString(), string.Empty, intSize
+ ImGui.GetStyle().ScrollbarSize / 2, Im.Style.TextHeightWithSpacing, ImGuiComboFlags.NoArrowButton))
+ Im.Style.ScrollbarSize / 2, Im.Style.TextHeightWithSpacing, ImGuiComboFlags.NoArrowButton))
{
dyeTable[rowIdx].Template = _stainService.LegacyTemplateCombo.CurrentSelection.UShort;
ret = true;
@ -210,9 +210,9 @@ public partial class MtrlTab
var byteSize = LegacyColorTableByteSize * Im.Style.GlobalScale;
ImGui.TableNextColumn();
ColorTableCopyClipboardButton(rowIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
var ret = ColorTablePasteFromClipboardButton(rowIdx, disabled);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ColorTableRowHighlightButton(rowIdx, disabled);
ImGui.TableNextColumn();
@ -227,7 +227,7 @@ public partial class MtrlTab
c => table[rowIdx].DiffuseColor = c);
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeDiffuse"u8, "Apply Diffuse Color on Dye"u8, dye.DiffuseColor,
b => dyeTable[rowIdx].DiffuseColor = b);
}
@ -237,18 +237,18 @@ public partial class MtrlTab
c => table[rowIdx].SpecularColor = c);
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeSpecular"u8, "Apply Specular Color on Dye"u8, dye.SpecularColor,
b => dyeTable[rowIdx].SpecularColor = b);
}
Im.Line.Same();
ImGui.SetNextItemWidth(pctSize);
Im.Item.SetNextWidth(pctSize);
ret |= CtDragScalar("##SpecularMask"u8, "Specular Strength"u8, (float)row.Scalar7 * 100.0f, "%.0f%%"u8, 0f, HalfMaxValue * 100.0f, 1.0f,
v => table[rowIdx].Scalar7 = (Half)(v * 0.01f));
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeSpecularMask"u8, "Apply Specular Strength on Dye"u8, dye.Metalness,
b => dyeTable[rowIdx].Metalness = b);
}
@ -258,13 +258,13 @@ public partial class MtrlTab
c => table[rowIdx].EmissiveColor = c);
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeEmissive"u8, "Apply Emissive Color on Dye"u8, dye.EmissiveColor,
b => dyeTable[rowIdx].EmissiveColor = b);
}
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(floatSize);
Im.Item.SetNextWidth(floatSize);
var glossStrengthMin = ImGui.GetIO().KeyCtrl ? 0.0f : HalfEpsilon;
ret |= CtDragHalf("##Shininess"u8, "Gloss Strength"u8, row.Scalar3, "%.1f"u8, glossStrengthMin, HalfMaxValue,
Math.Max(0.1f, (float)row.Scalar3 * 0.025f),
@ -272,17 +272,17 @@ public partial class MtrlTab
if (dyeTable != null)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
ret |= CtApplyStainCheckbox("##dyeShininess"u8, "Apply Gloss Strength on Dye"u8, dye.Scalar3,
b => dyeTable[rowIdx].Scalar3 = b);
}
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(intSize);
Im.Item.SetNextWidth(intSize);
ret |= CtTileIndexPicker("##TileIndex"u8, "Tile Index"u8, row.TileIndex, true,
value => table[rowIdx].TileIndex = value);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(pctSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(pctSize);
ret |= CtDragScalar("##TileAlpha"u8, "Tile Opacity"u8, (float)row.TileAlpha * 100.0f, "%.0f%%"u8, 0f, HalfMaxValue * 100.0f, 1.0f,
v => table[rowIdx].TileAlpha = (Half)(v * 0.01f));
@ -293,13 +293,13 @@ public partial class MtrlTab
if (dyeTable != null)
{
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(byteSize);
Im.Item.SetNextWidth(byteSize);
ret |= CtDragScalar("##DyeChannel"u8, "Dye Channel"u8, dye.Channel + 1, "%hhd"u8, 1, StainService.ChannelCount, 0.25f,
value => dyeTable[rowIdx].Channel = (byte)(Math.Clamp(value, 1, StainService.ChannelCount) - 1));
ImUtf8.SameLineInner();
Im.Line.SameInner();
_stainService.LegacyTemplateCombo.CurrentDyeChannel = dye.Channel;
if (_stainService.LegacyTemplateCombo.Draw("##dyeTemplate", dye.Template.ToString(), string.Empty, intSize
+ ImGui.GetStyle().ScrollbarSize / 2, Im.Style.TextHeightWithSpacing, ImGuiComboFlags.NoArrowButton))
+ Im.Style.ScrollbarSize / 2, Im.Style.TextHeightWithSpacing, ImGuiComboFlags.NoArrowButton))
{
dyeTable[rowIdx].Template = _stainService.LegacyTemplateCombo.CurrentSelection.UShort;
ret = true;
@ -320,7 +320,7 @@ public partial class MtrlTab
if (stain == 0 || !_stainService.LegacyStmFile.TryGetValue(dye.Template, stain, out var values))
return false;
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemSpacing / 2);
using var style = ImStyleDouble.ItemSpacing.Push(Im.Style.ItemSpacing / 2);
var ret = ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.PaintBrush.ToIconString(), new Vector2(Im.Style.FrameHeight),
"Apply the selected dye to this row.", disabled, true);
@ -339,7 +339,7 @@ public partial class MtrlTab
if (stain == 0 || !_stainService.LegacyStmFile.TryGetValue(dye.Template, stain, out var values))
return false;
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemSpacing / 2);
using var style = ImStyleDouble.ItemSpacing.Push(Im.Style.ItemSpacing / 2);
var ret = ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.PaintBrush.ToIconString(), new Vector2(Im.Style.FrameHeight),
"Apply the selected dye to this row.", disabled, true);
@ -359,17 +359,17 @@ public partial class MtrlTab
private static void DrawLegacyDyePreview(LegacyDyePack values, float floatSize)
{
CtColorPicker("##diffusePreview"u8, default, values.DiffuseColor, "D"u8);
ImUtf8.SameLineInner();
Im.Line.SameInner();
CtColorPicker("##specularPreview"u8, default, values.SpecularColor, "S"u8);
ImUtf8.SameLineInner();
Im.Line.SameInner();
CtColorPicker("##emissivePreview"u8, default, values.EmissiveColor, "E"u8);
ImUtf8.SameLineInner();
Im.Line.SameInner();
using var dis = ImRaii.Disabled();
ImGui.SetNextItemWidth(floatSize);
Im.Item.SetNextWidth(floatSize);
var shininess = (float)values.Shininess;
ImGui.DragFloat("##shininessPreview", ref shininess, 0, shininess, shininess, "%.1f G");
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(floatSize);
Im.Line.SameInner();
Im.Item.SetNextWidth(floatSize);
var specularMask = (float)values.SpecularMask * 100.0f;
ImGui.DragFloat("##specularMaskPreview", ref specularMask, 0, specularMask, specularMask, "%.0f%% S");
}

View file

@ -355,12 +355,12 @@ public partial class MtrlTab
{
if (disabled)
{
ImGui.TextUnformatted("Shader Package: " + Mtrl.ShaderPackage.Name);
Im.Text($"Shader Package: {Mtrl.ShaderPackage.Name}");
return false;
}
var ret = false;
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 250.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 250.0f);
using var c = ImRaii.Combo("Shader Package", Mtrl.ShaderPackage.Name);
if (c)
foreach (var value in GetShpkNames())
@ -382,7 +382,7 @@ public partial class MtrlTab
private bool DrawShaderFlagsInput(bool disabled)
{
var shpkFlags = (int)Mtrl.ShaderPackage.Flags;
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 250.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 250.0f);
if (!ImGui.InputInt("Shader Flags", ref shpkFlags, 0, 0,
flags: ImGuiInputTextFlags.CharsHexadecimal | (disabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None)))
return false;
@ -456,7 +456,7 @@ public partial class MtrlTab
values.FirstOrNull(v => v.Value == currentValue) ?? ($"0x{currentValue:X8}", currentValue, string.Empty);
if (!disabled && shpkKey.HasValue)
{
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 250.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 250.0f);
using (var c = ImUtf8.Combo(""u8, currentLabel))
{
if (c)

View file

@ -82,7 +82,7 @@ public partial class MtrlTab
float helpWidth;
using (var _ = ImRaii.PushFont(UiBuilder.IconFont))
{
helpWidth = ImGui.GetStyle().ItemSpacing.X + ImGui.CalcTextSize(FontAwesomeIcon.InfoCircle.ToIconString()).X;
helpWidth = Im.Style.ItemSpacing.X + ImGui.CalcTextSize(FontAwesomeIcon.InfoCircle.ToIconString()).X;
}
foreach (var (label, _, _, description, monoFont) in Textures)
@ -151,7 +151,7 @@ public partial class MtrlTab
}
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
Im.Item.SetNextWidth(Im.ContentRegion.Available.X);
if (ImGui.InputText(string.Empty, ref tmp, Utf8GamePath.MaxGamePathLength,
disabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None)
&& tmp.Length > 0
@ -168,7 +168,7 @@ public partial class MtrlTab
if (description.Length > 0)
ImGuiUtil.LabeledHelpMarker(label, description);
else
ImGui.TextUnformatted(label);
Im.Text(label);
}
if (unfolded)
@ -221,7 +221,7 @@ public partial class MtrlTab
{
ref var samplerFlags = ref Wrap(ref sampler.Flags);
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 100.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 100.0f);
var addressMode = samplerFlags.UAddressMode;
if (ComboTextureAddressMode("##UAddressMode"u8, ref addressMode))
{
@ -234,7 +234,7 @@ public partial class MtrlTab
ImUtf8.LabeledHelpMarker("U Address Mode"u8,
"Method to use for resolving a U texture coordinate that is outside the 0 to 1 range.");
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 100.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 100.0f);
addressMode = samplerFlags.VAddressMode;
if (ComboTextureAddressMode("##VAddressMode"u8, ref addressMode))
{
@ -248,7 +248,7 @@ public partial class MtrlTab
"Method to use for resolving a V texture coordinate that is outside the 0 to 1 range.");
var lodBias = samplerFlags.LodBias;
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 100.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 100.0f);
if (ImUtf8.DragScalar("##LoDBias"u8, ref lodBias, -8.0f, 7.984375f, 0.1f))
{
samplerFlags.LodBias = lodBias;
@ -261,7 +261,7 @@ public partial class MtrlTab
"Offset from the calculated mipmap level.\n\nHigher means that the texture will start to lose detail nearer.\nLower means that the texture will keep its detail until farther.");
var minLod = samplerFlags.MinLod;
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 100.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 100.0f);
if (ImUtf8.DragScalar("##MinLoD"u8, ref minLod, 0, 15, 0.1f))
{
samplerFlags.MinLod = minLod;
@ -282,12 +282,12 @@ public partial class MtrlTab
if (!t)
return ret;
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 100.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 100.0f);
if (ImUtf8.InputScalar("Texture Flags"u8, ref texture.Flags, "%04X"u8,
flags: disabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None))
ret = true;
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 100.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 100.0f);
if (ImUtf8.InputScalar("Sampler Flags"u8, ref sampler.Flags, "%08X"u8,
flags: ImGuiInputTextFlags.CharsHexadecimal | (disabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None)))
{

View file

@ -139,7 +139,7 @@ public sealed partial class MtrlTab : IWritable, IDisposable
ImGuiComponents.HelpMarker("Enabling transparency for shader package characterstockings.shpk will crash the game.");
}
ImGui.SameLine(200 * Im.Style.GlobalScale + ImGui.GetStyle().ItemSpacing.X + ImGui.GetStyle().WindowPadding.X);
Im.Line.Same(200 * Im.Style.GlobalScale + Im.Style.ItemSpacing.X + Im.Style.WindowPadding.X);
tmp = shaderFlags.HideBackfaces;
if (ImUtf8.Checkbox("Hide Backfaces"u8, ref tmp))
{
@ -150,7 +150,7 @@ public sealed partial class MtrlTab : IWritable, IDisposable
if (_shpkLoading)
{
ImGui.SameLine(400 * Im.Style.GlobalScale + 2 * ImGui.GetStyle().ItemSpacing.X + ImGui.GetStyle().WindowPadding.X);
Im.Line.Same(400 * Im.Style.GlobalScale + 2 * Im.Style.ItemSpacing.X + Im.Style.WindowPadding.X);
ImUtf8.Text("Loading shader (.shpk) file. Some functionality will only be available after this is done."u8,
ImGuiUtil.HalfBlendText(0x808000u)); // Half cyan

View file

@ -205,7 +205,7 @@ public sealed class AtchMetaDrawer : MetaDrawer<AtchIdentifier, AtchEntry>
return false;
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(200 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(200 * Im.Style.GlobalScale);
if (ImUtf8.InputText("##BoneName"u8, entry.FullSpan, out TerminatedByteString newBone))
{
entry.SetBoneName(newBone);
@ -214,31 +214,31 @@ public sealed class AtchMetaDrawer : MetaDrawer<AtchIdentifier, AtchEntry>
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, "Bone Name"u8);
ImGui.SetNextItemWidth(200 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(200 * Im.Style.GlobalScale);
changes |= ImUtf8.InputScalar("##AtchScale"u8, ref entry.Scale);
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, "Scale"u8);
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(120 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(120 * Im.Style.GlobalScale);
changes |= ImUtf8.InputScalar("##AtchOffsetX"u8, ref entry.OffsetX);
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, "Offset X-Coordinate"u8);
ImGui.SetNextItemWidth(120 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(120 * Im.Style.GlobalScale);
changes |= ImUtf8.InputScalar("##AtchRotationX"u8, ref entry.RotationX);
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, "Rotation X-Axis"u8);
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(120 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(120 * Im.Style.GlobalScale);
changes |= ImUtf8.InputScalar("##AtchOffsetY"u8, ref entry.OffsetY);
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, "Offset Y-Coordinate"u8);
ImGui.SetNextItemWidth(120 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(120 * Im.Style.GlobalScale);
changes |= ImUtf8.InputScalar("##AtchRotationY"u8, ref entry.RotationY);
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, "Rotation Y-Axis"u8);
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(120 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(120 * Im.Style.GlobalScale);
changes |= ImUtf8.InputScalar("##AtchOffsetZ"u8, ref entry.OffsetZ);
Im.Tooltip.OnHover("Offset Z-Coordinate"u8);
ImGui.SetNextItemWidth(120 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(120 * Im.Style.GlobalScale);
changes |= ImUtf8.InputScalar("##AtchRotationZ"u8, ref entry.RotationZ);
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, "Rotation Z-Axis"u8);
@ -280,7 +280,7 @@ public sealed class AtchMetaDrawer : MetaDrawer<AtchIdentifier, AtchEntry>
private static bool DrawEntryIndexInput(ref AtchIdentifier identifier, AtchPoint currentAtchPoint)
{
var index = identifier.EntryIndex;
ImGui.SetNextItemWidth(40 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(40 * Im.Style.GlobalScale);
var ret = ImUtf8.DragScalar("##AtchEntry"u8, ref index, 0, (ushort)(currentAtchPoint.Entries.Length - 1), 0.05f,
ImGuiSliderFlags.AlwaysClamp);
Im.Tooltip.OnHover("State Entry Index"u8);

View file

@ -150,11 +150,11 @@ public sealed class AtrMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
? "When using all slots, you also need to use all IDs."u8
: "Enable this attribute for all model IDs."u8);
ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X);
Im.Line.Same(0, Im.Style.ItemInnerSpacing.X);
if (all)
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0.05f, 0.5f));
ImUtf8.TextFramed("All IDs"u8, ImGuiColor.FrameBackground.Get(all || allSlots ? ImGui.GetStyle().DisabledAlpha : 1f).Color,
using var style = ImStyleDouble.ButtonTextAlign.Push(new Vector2(0.05f, 0.5f));
ImUtf8.TextFramed("All IDs"u8, ImGuiColor.FrameBackground.Get(all || allSlots ? Im.Style.DisabledAlpha : 1f).Color,
new Vector2(unscaledWidth, 0), ImGuiColor.TextDisabled.Get().Color);
}
else
@ -175,7 +175,7 @@ public sealed class AtrMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
public bool DrawHumanSlot(ref AtrIdentifier identifier, float unscaledWidth = 150)
{
var ret = false;
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
using (var combo = ImUtf8.Combo("##atrSlot"u8, ShpMetaDrawer.SlotName(identifier.Slot)))
{
if (combo)
@ -215,7 +215,7 @@ public sealed class AtrMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
private static bool DrawGenderRaceConditionInput(ref AtrIdentifier identifier, float unscaledWidth = 250)
{
var ret = false;
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
using (var combo = ImUtf8.Combo("##shpGenderRace"u8,
identifier.GenderRaceCondition is GenderRace.Unknown
@ -257,7 +257,7 @@ public sealed class AtrMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
var span = new Span<byte>(ptr, ShapeAttributeString.MaxLength + 1);
using (ImStyleBorder.Frame.Push(Colors.RegexWarningBorder, Im.Style.GlobalScale, !valid))
{
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
if (ImUtf8.InputText("##atrAttribute"u8, span, out int newLength, "Attribute..."u8))
{
buffer.ForceLength((byte)newLength);

View file

@ -98,7 +98,7 @@ public sealed class EqpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
DrawBox(ref entry, 0);
for (var i = 1; i < Eqp.EqpAttributes[slot].Count; ++i)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
DrawBox(ref entry, i);
}

View file

@ -86,7 +86,7 @@ public sealed class GlobalEqpMetaDrawer(ModMetaEditor editor, MetaFileManager me
public static bool DrawType(ref GlobalEqpManipulation identifier, float unscaledWidth = 250)
{
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
using var combo = ImUtf8.Combo("##geqpType"u8, identifier.Type.ToName());
if (!combo)
return false;

View file

@ -106,7 +106,7 @@ public sealed class GmpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
changes = true;
}
ImUtf8.SameLineInner();
Im.Line.SameInner();
if (DragInput("##gmpRotationB"u8, "Rotation B in Degrees"u8, rotationWidth, entry.RotationB, defaultEntry.RotationB, out var rotationB,
(ushort)0, (ushort)360, 0.05f, !disabled))
{
@ -114,7 +114,7 @@ public sealed class GmpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
changes = true;
}
ImUtf8.SameLineInner();
Im.Line.SameInner();
if (DragInput("##gmpRotationC"u8, "Rotation C in Degrees"u8, rotationWidth, entry.RotationC, defaultEntry.RotationC, out var rotationC,
(ushort)0, (ushort)360, 0.05f, !disabled))
{
@ -131,7 +131,7 @@ public sealed class GmpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
changes = true;
}
ImUtf8.SameLineInner();
Im.Line.SameInner();
if (DragInput("##gmpUnkB"u8, "Animation Type B?"u8, unkWidth, entry.UnknownB, defaultEntry.UnknownB, out var unknownB,
(byte)0, (byte)15, 0.01f, !disabled))
{

View file

@ -124,14 +124,14 @@ public sealed class ImcMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
{
ImGui.TableNextColumn();
var change = DrawMaterialId(defaultEntry, ref entry, addDefault);
ImUtf8.SameLineInner();
Im.Line.SameInner();
change |= DrawMaterialAnimationId(defaultEntry, ref entry, addDefault);
ImGui.TableNextColumn();
change |= DrawDecalId(defaultEntry, ref entry, addDefault);
ImUtf8.SameLineInner();
Im.Line.SameInner();
change |= DrawVfxId(defaultEntry, ref entry, addDefault);
ImUtf8.SameLineInner();
Im.Line.SameInner();
change |= DrawSoundId(defaultEntry, ref entry, addDefault);
ImGui.TableNextColumn();
@ -296,7 +296,7 @@ public sealed class ImcMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
}
if (i < ImcEntry.NumAttributes - 1)
ImUtf8.SameLineInner();
Im.Line.SameInner();
}
return changes;

View file

@ -79,7 +79,7 @@ public abstract class MetaDrawer<TIdentifier, TEntry>(ModMetaEditor editor, Meta
bool border)
{
int tmp = currentId;
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
using var style = ImStyleBorder.Frame.Push(Colors.RegexWarningBorder, Im.Style.GlobalScale, border);
if (ImUtf8.InputScalar(label, ref tmp))
tmp = Math.Clamp(tmp, minId, maxId);
@ -98,7 +98,7 @@ public abstract class MetaDrawer<TIdentifier, TEntry>(ModMetaEditor editor, Meta
newValue = currentValue;
var c = defaultValue > currentValue ? ColorId.DecreasedMetaValue.Value() : ColorId.IncreasedMetaValue.Value();
using var color = ImGuiColor.FrameBackground.Push(c, defaultValue != currentValue);
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
if (ImUtf8.DragScalar(label, ref newValue, minValue, maxValue, speed))
newValue = newValue <= minValue ? minValue : newValue >= maxValue ? maxValue : newValue;

View file

@ -158,11 +158,11 @@ public sealed class ShpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
Im.Tooltip.OnHover(allSlots ? "When using all slots, you also need to use all IDs."u8 : "Enable this shape key for all model IDs."u8);
ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X);
Im.Line.Same(0, Im.Style.ItemInnerSpacing.X);
if (all)
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0.05f, 0.5f));
ImUtf8.TextFramed("All IDs"u8, ImGuiColor.FrameBackground.Get(all || allSlots ? ImGui.GetStyle().DisabledAlpha : 1f).Color,
using var style = ImStyleDouble.ButtonTextAlign.Push(new Vector2(0.05f, 0.5f));
ImUtf8.TextFramed("All IDs"u8, ImGuiColor.FrameBackground.Get(all || allSlots ? Im.Style.DisabledAlpha : 1f).Color,
new Vector2(unscaledWidth, 0), ImGuiColor.TextDisabled.Get().Color);
}
else
@ -183,7 +183,7 @@ public sealed class ShpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
public bool DrawHumanSlot(ref ShpIdentifier identifier, float unscaledWidth = 170)
{
var ret = false;
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
using (var combo = ImUtf8.Combo("##shpSlot"u8, SlotName(identifier.Slot)))
{
if (combo)
@ -235,7 +235,7 @@ public sealed class ShpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
var span = new Span<byte>(ptr, ShapeAttributeString.MaxLength + 1);
using (ImStyleBorder.Frame.Push(Colors.RegexWarningBorder, Im.Style.GlobalScale, !valid))
{
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
if (ImUtf8.InputText("##shpShape"u8, span, out int newLength, "Shape Key..."u8))
{
buffer.ForceLength((byte)newLength);
@ -253,7 +253,7 @@ public sealed class ShpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
private static bool DrawConnectorConditionInput(ref ShpIdentifier identifier, float unscaledWidth = 80)
{
var ret = false;
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
var (showWrists, showWaist, showAnkles, disable) = identifier.Slot switch
{
HumanSlot.Unknown => (true, true, true, false),
@ -290,7 +290,7 @@ public sealed class ShpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
private static bool DrawGenderRaceConditionInput(ref ShpIdentifier identifier, float unscaledWidth = 250)
{
var ret = false;
ImGui.SetNextItemWidth(unscaledWidth * Im.Style.GlobalScale);
Im.Item.SetNextWidth(unscaledWidth * Im.Style.GlobalScale);
using (var combo = ImUtf8.Combo("##shpGenderRace"u8, identifier.GenderRaceCondition is GenderRace.Unknown
? "Any Gender & Race"

View file

@ -30,16 +30,16 @@ public partial class ModEditWindow
private void DrawGenderRaceSelector(PbdTab tab)
{
using var group = ImUtf8.Group();
var width = ImUtf8.CalcTextSize("Hellsguard - Female (Child)____0000"u8).X + 2 * ImGui.GetStyle().WindowPadding.X;
using (ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 0)
.Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero))
var width = ImUtf8.CalcTextSize("Hellsguard - Female (Child)____0000"u8).X + 2 * Im.Style.WindowPadding.X;
using (ImStyleSingle.FrameRounding.Push(0)
.Push(ImStyleDouble.ItemSpacing, Vector2.Zero))
{
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ImUtf8.InputText("##grFilter"u8, ref _pbdData.RaceCodeFilter, "Filter..."u8);
}
using var child = ImUtf8.Child("GenderRace"u8,
new Vector2(width, ImGui.GetContentRegionMax().Y - Im.Style.FrameHeight - ImGui.GetStyle().WindowPadding.Y), true);
new Vector2(width, ImGui.GetContentRegionMax().Y - Im.Style.FrameHeight - Im.Style.WindowPadding.Y), true);
if (!child)
return;
@ -70,15 +70,15 @@ public partial class ModEditWindow
{
using var group = ImUtf8.Group();
var width = 200 * Im.Style.GlobalScale;
using (ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 0)
.Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero))
using (ImStyleSingle.FrameRounding.Push(0)
.Push(ImStyleDouble.ItemSpacing, Vector2.Zero))
{
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ImUtf8.InputText("##boneFilter"u8, ref _pbdData.BoneFilter, "Filter..."u8);
}
using var child = ImUtf8.Child("Bone"u8,
new Vector2(width, ImGui.GetContentRegionMax().Y - Im.Style.FrameHeight - ImGui.GetStyle().WindowPadding.Y), true);
new Vector2(width, ImGui.GetContentRegionMax().Y - Im.Style.FrameHeight - Im.Style.WindowPadding.Y), true);
if (!child)
return;
@ -107,7 +107,7 @@ public partial class ModEditWindow
private bool DrawBoneData(PbdTab tab, bool disabled)
{
using var child = ImUtf8.Child("Data"u8,
Im.ContentRegion.Available with { Y = ImGui.GetContentRegionMax().Y - ImGui.GetStyle().WindowPadding.Y }, true);
Im.ContentRegion.Available with { Y = ImGui.GetContentRegionMax().Y - Im.Style.WindowPadding.Y }, true);
if (!child)
return false;
@ -117,12 +117,12 @@ public partial class ModEditWindow
if (!_pbdData.SelectedDeformer!.DeformMatrices.TryGetValue(_pbdData.SelectedBone, out var matrix))
return false;
var width = UiBuilder.MonoFont.GetCharAdvance('0') * 12 + ImGui.GetStyle().FramePadding.X * 2;
var width = UiBuilder.MonoFont.GetCharAdvance('0') * 12 + Im.Style.FramePadding.X * 2;
var dummyHeight = Im.Style.TextHeight / 2;
var ret = DrawAddNewBone(tab, disabled, matrix, width);
ImUtf8.Dummy(0, dummyHeight);
ImGui.Separator();
Im.Separator();
ImUtf8.Dummy(0, dummyHeight);
ret |= DrawDeformerMatrix(disabled, matrix, width);
ImUtf8.Dummy(0, dummyHeight);
@ -130,7 +130,7 @@ public partial class ModEditWindow
ImUtf8.Dummy(0, dummyHeight);
ImGui.Separator();
Im.Separator();
ImUtf8.Dummy(0, dummyHeight);
ret |= DrawDecomposedData(disabled, matrix, width);
@ -141,20 +141,20 @@ public partial class ModEditWindow
{
var ret = false;
ImUtf8.TextFrameAligned("Copy the values of the bone "u8);
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
using (ImGuiColor.Text.Push(ColorId.NewMod.Value()))
{
ImUtf8.TextFrameAligned(_pbdData.SelectedBone);
}
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
ImUtf8.TextFrameAligned(" to a new bone of name"u8);
var fullWidth = width * 4 + ImGui.GetStyle().ItemSpacing.X * 3;
ImGui.SetNextItemWidth(fullWidth);
var fullWidth = width * 4 + Im.Style.ItemSpacing.X * 3;
Im.Item.SetNextWidth(fullWidth);
ImUtf8.InputText("##newBone"u8, ref _pbdData.NewBoneName, "New Bone Name..."u8);
ImUtf8.TextFrameAligned("for all races that have a corresponding bone."u8);
ImGui.SameLine(0, fullWidth - width - ImGui.GetItemRectSize().X);
Im.Line.Same(0, fullWidth - width - ImGui.GetItemRectSize().X);
if (ImUtf8.ButtonEx("Apply"u8, ""u8, new Vector2(width, 0),
disabled || _pbdData.NewBoneName.Length == 0 || _pbdData.SelectedBone == null))
{
@ -198,7 +198,7 @@ public partial class ModEditWindow
for (var j = 0; j < 4; ++j)
{
using var id = ImUtf8.PushId(i * 4 + j);
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
var tmp = matrix[i, j];
if (ImUtf8.InputScalar(""u8, ref tmp, "% 12.8f"u8))
{
@ -261,42 +261,42 @@ public partial class ModEditWindow
using var font = ImRaii.PushFont(UiBuilder.MonoFont);
using var _ = ImRaii.Disabled(disabled);
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##ScaleX"u8, ref scale.X, "% 12.8f"u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##ScaleY"u8, ref scale.Y, "% 12.8f"u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##ScaleZ"u8, ref scale.Z, "% 12.8f"u8);
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##TranslationX"u8, ref translation.X, "% 12.8f"u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##TranslationY"u8, ref translation.Y, "% 12.8f"u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##TranslationZ"u8, ref translation.Z, "% 12.8f"u8);
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##RotationR"u8, ref rotation.W, "% 12.8f"u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##RotationI"u8, ref rotation.X, "% 12.8f"u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##RotationJ"u8, ref rotation.Y, "% 12.8f"u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
ret |= ImUtf8.InputScalar("##RotationK"u8, ref rotation.Z, "% 12.8f"u8);
}

View file

@ -59,7 +59,7 @@ public partial class ModEditWindow
private void DrawFilesOverviewMode()
{
var height = Im.Style.TextHeightWithSpacing + 2 * ImGui.GetStyle().CellPadding.Y;
var height = Im.Style.TextHeightWithSpacing + 2 * Im.Style.CellPadding.Y;
var skips = ImGuiClip.GetNecessarySkips(height);
using var table = Im.Table.Begin("##table"u8, 3, TableFlags.RowBackground | TableFlags.BordersInnerVertical, -Vector2.One);
@ -70,7 +70,7 @@ public partial class ModEditWindow
var width = Im.ContentRegion.Available.X / 8;
table.SetupColumn("##file"u8, TableColumnFlags.WidthFixed, width * 3);
table.SetupColumn("##path"u8, TableColumnFlags.WidthFixed, width * 3 + ImGui.GetStyle().FrameBorderSize);
table.SetupColumn("##path"u8, TableColumnFlags.WidthFixed, width * 3 + Im.Style.FrameBorderThickness);
table.SetupColumn("##option"u8, TableColumnFlags.WidthFixed, width * 2);
var idx = 0;
@ -258,7 +258,7 @@ public partial class ModEditWindow
ImGui.TableNextColumn();
var tmp = _fileIdx == i && _pathIdx == j ? _gamePathEdit : gamePath.ToString();
var pos = ImGui.GetCursorPosX() - Im.Style.FrameHeight;
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
if (ImGui.InputText(string.Empty, ref tmp, Utf8GamePath.MaxGamePathLength))
{
_fileIdx = i;
@ -303,7 +303,7 @@ public partial class ModEditWindow
{
var tmp = _fileIdx == i && _pathIdx == -1 ? _gamePathEdit : string.Empty;
var pos = ImGui.GetCursorPosX() - Im.Style.FrameHeight;
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
if (ImGui.InputTextWithHint("##new", "Add New Path...", ref tmp, Utf8GamePath.MaxGamePathLength))
{
_fileIdx = i;
@ -346,8 +346,8 @@ public partial class ModEditWindow
{
Im.Line.New();
using var spacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(3 * Im.Style.GlobalScale, 0));
ImGui.SetNextItemWidth(30 * Im.Style.GlobalScale);
using var spacing = ImStyleDouble.ItemSpacing.Push(new Vector2(3 * Im.Style.GlobalScale, 0));
Im.Item.SetNextWidth(30 * Im.Style.GlobalScale);
ImGui.DragInt("##skippedFolders", ref _folderSkip, 0.01f, 0, 10);
ImGuiUtil.HoverTooltip("Skip the first N folders when automatically constructing the game path from the file path.");
Im.Line.Same();
@ -403,7 +403,7 @@ public partial class ModEditWindow
private void DrawFileManagementNormal()
{
ImGui.SetNextItemWidth(250 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(250 * Im.Style.GlobalScale);
Im.Input.Text("##filter"u8, ref _fileFilter, "Filter paths..."u8);
Im.Line.Same();
ImGui.Checkbox("Show Game Paths", ref _showGamePaths);
@ -430,19 +430,19 @@ public partial class ModEditWindow
private void DrawFileManagementOverview()
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 0)
.Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
.Push(ImGuiStyleVar.FrameBorderSize, ImGui.GetStyle().ChildBorderSize);
using var style = ImStyleSingle.FrameRounding.Push(0)
.Push(ImStyleDouble.ItemSpacing, Vector2.Zero)
.Push(ImStyleSingle.FrameBorderThickness, Im.Style.ChildBorderThickness);
var width = Im.ContentRegion.Available.X / 8;
ImGui.SetNextItemWidth(width * 3);
Im.Item.SetNextWidth(width * 3);
Im.Input.Text("##fileFilter"u8, ref _fileOverviewFilter1, "Filter file..."u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width * 3);
Im.Item.SetNextWidth(width * 3);
Im.Input.Text("##pathFilter"u8, ref _fileOverviewFilter2, "Filter path..."u8);
Im.Line.Same();
ImGui.SetNextItemWidth(width * 2);
Im.Item.SetNextWidth(width * 2);
Im.Input.Text("##optionFilter"u8, ref _fileOverviewFilter3, "Filter option..."u8);
}
}

View file

@ -54,7 +54,7 @@ public partial class ModEditWindow
ImGui.TableNextColumn();
ImUtf8.Text(info.Path.InternalName.Span[(Mod!.ModPath.FullName.Length + 1)..]);
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(400 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(400 * Im.Style.GlobalScale);
var tmp = info.CurrentMaterials[0];
if (ImUtf8.InputText("##0"u8, ref tmp))
info.SetMaterial(tmp, 0);
@ -66,7 +66,7 @@ public partial class ModEditWindow
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(400 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(400 * Im.Style.GlobalScale);
tmp = info.CurrentMaterials[i];
if (ImUtf8.InputText(""u8, ref tmp))
info.SetMaterial(tmp, i);

View file

@ -142,7 +142,7 @@ public partial class ModEditWindow
var text = $"{otherOptionData.TotalCount} Edits in other Options";
var size = ImGui.CalcTextSize(text).X;
ImGui.SetCursorPos(new Vector2(Im.ContentRegion.Available.X - size, oldPos + ImGui.GetStyle().FramePadding.Y));
ImGui.SetCursorPos(new Vector2(Im.ContentRegion.Available.X - size, oldPos + Im.Style.FramePadding.Y));
Im.Text(text, ColorId.RedundantAssignment.Value().FullAlpha());
if (Im.Item.Hovered())
{

View file

@ -103,7 +103,7 @@ public partial class ModEditWindow
if (!ImGui.CollapsingHeader("Import / Export"))
return;
var childSize = new Vector2((Im.ContentRegion.Available.X - ImGui.GetStyle().ItemSpacing.X) / 2, 0);
var childSize = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X) / 2, 0);
DrawImport(tab, childSize, disabled);
Im.Line.Same();
@ -123,7 +123,7 @@ public partial class ModEditWindow
if (!GetFirstModel(m.Files, out var file))
return false;
ImGui.TextUnformatted($"Dragging model for editing: {Path.GetFileName(file)}");
Im.Text($"Dragging model for editing: {Path.GetFileName(file)}");
return true;
});
@ -155,7 +155,7 @@ public partial class ModEditWindow
if (tab.GamePaths == null)
{
ImGui.TextUnformatted(tab.IoExceptions.Count == 0 ? "Resolving model game paths." : "Failed to resolve model game paths.");
Im.Text(tab.IoExceptions.Count is 0 ? "Resolving model game paths."u8 : "Failed to resolve model game paths."u8);
return;
}
@ -200,7 +200,7 @@ public partial class ModEditWindow
using var frame = ImRaii.FramedGroup("Exceptions", size, headerPreIcon: FontAwesomeIcon.TimesCircle,
borderColor: Colors.RegexWarningBorder);
var spaceAvail = Im.ContentRegion.Available.X - ImGui.GetStyle().ItemSpacing.X - 100;
var spaceAvail = Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X - 100;
foreach (var (index, exception) in tab.IoExceptions.Index())
{
using var id = ImRaii.PushId(index);
@ -226,7 +226,7 @@ public partial class ModEditWindow
var size = new Vector2(Im.ContentRegion.Available.X, 0);
using var frame = ImRaii.FramedGroup("Warnings", size, headerPreIcon: FontAwesomeIcon.ExclamationCircle, borderColor: 0xFF40FFFF);
var spaceAvail = Im.ContentRegion.Available.X - ImGui.GetStyle().ItemSpacing.X - 100;
var spaceAvail = Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X - 100;
foreach (var (index, warning) in tab.IoWarnings.Index())
{
using var id = ImRaii.PushId(index);
@ -257,7 +257,7 @@ public partial class ModEditWindow
return;
}
ImGui.TextUnformatted("No associated game path detected. Valid game paths are currently necessary for exporting.");
Im.Text("No associated game path detected. Valid game paths are currently necessary for exporting."u8);
if (!ImGui.InputTextWithHint("##customInput", "Enter custom game path...", ref _customPath, 256))
return;
@ -270,22 +270,22 @@ public partial class ModEditWindow
{
const string label = "Game Path";
var preview = tab.GamePaths![tab.GamePathIndex].ToString();
var labelWidth = ImGui.CalcTextSize(label).X + ImGui.GetStyle().ItemInnerSpacing.X;
var buttonWidth = Im.ContentRegion.Available.X - labelWidth - ImGui.GetStyle().ItemSpacing.X;
var labelWidth = ImGui.CalcTextSize(label).X + Im.Style.ItemInnerSpacing.X;
var buttonWidth = Im.ContentRegion.Available.X - labelWidth - Im.Style.ItemSpacing.X;
if (tab.GamePaths!.Count == 1)
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f));
using var style = ImStyleDouble.ButtonTextAlign.Push(new Vector2(0, 0.5f));
using var color = ImGuiColor.Button.Push(Im.Style[ImGuiColor.FrameBackground])
.Push(ImGuiColor.ButtonHovered, Im.Style[ImGuiColor.FrameBackgroundHovered])
.Push(ImGuiColor.ButtonActive, Im.Style[ImGuiColor.FrameBackgroundActive]);
using var group = ImRaii.Group();
using var group = Im.Group();
ImGui.Button(preview, new Vector2(buttonWidth, 0));
ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X);
ImGui.TextUnformatted("Game Path");
Im.Line.Same(0, Im.Style.ItemInnerSpacing.X);
Im.Text("Game Path"u8);
}
else
{
ImGui.SetNextItemWidth(buttonWidth);
Im.Item.SetNextWidth(buttonWidth);
using var combo = ImRaii.Combo("Game Path", preview);
if (combo.Success)
foreach (var (index, path) in tab.GamePaths.Index())
@ -306,7 +306,7 @@ public partial class ModEditWindow
{
const string text = "Documentation →";
var framePadding = ImGui.GetStyle().FramePadding;
var framePadding = Im.Style.FramePadding;
var width = ImGui.CalcTextSize(text).X + framePadding.X * 2;
// Draw the link button. We set the background colour to transparent to mimic the look of a link.
@ -331,7 +331,7 @@ public partial class ModEditWindow
{
var text = $"{invalidMaterialCount} invalid material{(invalidMaterialCount > 1 ? "s" : "")}";
var size = ImGui.CalcTextSize(text).X;
ImGui.SetCursorPos(new Vector2(Im.ContentRegion.Available.X - size, oldPos + ImGui.GetStyle().FramePadding.Y));
ImGui.SetCursorPos(new Vector2(Im.ContentRegion.Available.X - size, oldPos + Im.Style.FramePadding.Y));
ImGuiUtil.TextColored(0xFF0000FF, text);
ImGui.SetCursorPos(newPos);
}
@ -364,7 +364,7 @@ public partial class ModEditWindow
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
ImGui.InputTextWithHint("##newMaterial", "Add new material...", ref _modelNewMaterial, Utf8GamePath.MaxGamePathLength, inputFlags);
var validName = tab.ValidateMaterial(_modelNewMaterial);
ImGui.TableNextColumn();
@ -388,11 +388,11 @@ public partial class ModEditWindow
var ret = false;
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"Material #{materialIndex + 1}");
Im.Text($"Material #{materialIndex + 1}");
var temp = materials[materialIndex];
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
if (ImGui.InputText($"##material{materialIndex}", ref temp, Utf8GamePath.MaxGamePathLength, inputFlags)
&& temp.Length > 0
&& temp != materials[materialIndex]
@ -477,7 +477,7 @@ public partial class ModEditWindow
// Vertex elements
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Vertex Elements");
Im.Text("Vertex Elements"u8);
ImGui.TableNextColumn();
DrawVertexElementDetails(file.VertexDeclarations[meshIndex].VertexElements);
@ -485,7 +485,7 @@ public partial class ModEditWindow
// Mesh material
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Material");
Im.Text("Material"u8);
ImGui.TableNextColumn();
var ret = DrawMaterialCombo(tab, meshIndex, disabled);
@ -521,13 +521,13 @@ public partial class ModEditWindow
foreach (var element in vertexElements)
{
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{(MdlFile.VertexUsage)element.Usage}");
Im.Text($"{(MdlFile.VertexUsage)element.Usage}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{(MdlFile.VertexType)element.Type}");
Im.Text($"{(MdlFile.VertexType)element.Type}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{element.Stream}");
Im.Text($"{element.Stream}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{element.Offset}");
Im.Text($"{element.Offset}");
}
}
@ -535,7 +535,7 @@ public partial class ModEditWindow
{
var mesh = tab.Mdl.Meshes[meshIndex];
using var _ = ImRaii.Disabled(disabled);
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
using var materialCombo = ImRaii.Combo("##material", tab.Mdl.Materials[mesh.MaterialIndex]);
if (!materialCombo)
@ -563,7 +563,7 @@ public partial class ModEditWindow
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"Attributes #{subMeshOffset + 1}");
Im.Text($"Attributes #{subMeshOffset + 1}");
ImGui.TableNextColumn();
var data = disabled ? _preview : _main;

View file

@ -302,7 +302,7 @@ public partial class ModEditWindow
var ret = false;
if (!disabled)
{
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 150.0f);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 150.0f);
if (ImGuiUtil.InputUInt16($"{char.ToUpper(slotLabel[0])}{slotLabel[1..].ToLower()}", ref resource.Slot, ImGuiInputTextFlags.None))
ret = true;
}
@ -363,8 +363,8 @@ public partial class ModEditWindow
{
using var font = ImRaii.PushFont(UiBuilder.MonoFont);
var pos = ImGui.GetCursorScreenPos()
+ new Vector2(ImGui.CalcTextSize(label).X + 3 * ImGui.GetStyle().ItemInnerSpacing.X + Im.Style.FrameHeight,
ImGui.GetStyle().FramePadding.Y);
+ new Vector2(ImGui.CalcTextSize(label).X + 3 * Im.Style.ItemInnerSpacing.X + Im.Style.FrameHeight,
Im.Style.FramePadding.Y);
var ret = ImUtf8.CollapsingHeader(label);
ImGui.GetWindowDrawList()
@ -491,10 +491,10 @@ public partial class ModEditWindow
private static void DrawShaderPackageStartCombo(ShpkTab tab)
{
using var s = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemInnerSpacing);
using (ImRaii.PushFont(UiBuilder.MonoFont))
using var s = ImStyleDouble.ItemSpacing.Push(Im.Style.ItemInnerSpacing);
using (Im.Font.PushMono())
{
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 400);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 400);
using var c = ImUtf8.Combo("##Start", tab.Orphans[tab.NewMaterialParamStart].Name);
if (c)
foreach (var(idx, start) in tab.Orphans.Index())
@ -510,10 +510,10 @@ public partial class ModEditWindow
private static void DrawShaderPackageEndCombo(ShpkTab tab)
{
using var s = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemInnerSpacing);
using (var _ = ImRaii.PushFont(UiBuilder.MonoFont))
using var s = ImStyleDouble.ItemSpacing.Push(Im.Style.ItemInnerSpacing);
using (Im.Font.PushMono())
{
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 400);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 400);
using var c = ImUtf8.Combo("##End", tab.Orphans[tab.NewMaterialParamEnd].Name);
if (c)
{
@ -542,7 +542,7 @@ public partial class ModEditWindow
DrawShaderPackageStartCombo(tab);
DrawShaderPackageEndCombo(tab);
ImGui.SetNextItemWidth(Im.Style.GlobalScale * 400);
Im.Item.SetNextWidth(Im.Style.GlobalScale * 400);
var newName = tab.NewMaterialParamName.Value!;
if (ImUtf8.InputText("Name", ref newName))
tab.NewMaterialParamName = newName;

View file

@ -81,7 +81,7 @@ public partial class ModEditWindow
private void SaveAsCombo()
{
var (text, desc) = SaveAsStrings[_currentSaveAs];
ImGui.SetNextItemWidth(-Im.Style.FrameHeight - ImGui.GetStyle().ItemSpacing.X);
Im.Item.SetNextWidth(-Im.Style.FrameHeight - Im.Style.ItemSpacing.X);
using var combo = ImRaii.Combo("##format", text);
ImGuiUtil.HoverTooltip(desc);
if (!combo)
@ -137,8 +137,8 @@ public partial class ModEditWindow
? "This saves the texture in place. This is not revertible."
: $"This saves the texture in place. This is not revertible. Hold {_config.DeleteModModifier} to save.";
var buttonSize2 = new Vector2((Im.ContentRegion.Available.X - ImGui.GetStyle().ItemSpacing.X) / 2, 0);
var buttonSize3 = new Vector2((Im.ContentRegion.Available.X - ImGui.GetStyle().ItemSpacing.X * 2) / 3, 0);
var buttonSize2 = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X) / 2, 0);
var buttonSize3 = new Vector2((Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X * 2) / 3, 0);
if (ImGuiUtil.DrawDisabledButton("Save in place", buttonSize2,
tt, !isActive || !canSaveInPlace || _center.IsLeftCopy && _currentSaveAs == (int)CombinedTexture.TextureSaveType.AsIs))
{
@ -204,7 +204,7 @@ public partial class ModEditWindow
case TaskStatus.Canceled:
case TaskStatus.Faulted:
{
ImGui.TextUnformatted("Could not save file:");
Im.Text("Could not save file:"u8);
using var color = ImGuiColor.Text.Push(new Vector4(1, 0, 0, 1));
ImGuiUtil.TextWrapped(_center.SaveTask.Exception?.ToString() ?? "Unknown Error");
break;
@ -283,11 +283,11 @@ public partial class ModEditWindow
var windowWidth = Im.Window.MaximumContentRegion.X - Im.Window.MinimumContentRegion.X - Im.Style.TextHeight;
if (_overlayCollapsed)
{
var width = windowWidth - ImGui.GetStyle().FramePadding.X * 3;
var width = windowWidth - Im.Style.FramePadding.X * 3;
return new Vector2(width / 2, -1);
}
return new Vector2((windowWidth - ImGui.GetStyle().FramePadding.X * 5) / 3, -1);
return new Vector2((windowWidth - Im.Style.FramePadding.X * 5) / 3, -1);
}
private void DrawTextureTab()
@ -304,11 +304,11 @@ public partial class ModEditWindow
if (!GetFirstTexture(m.Files, out var file))
return false;
ImGui.TextUnformatted($"Dragging texture for editing: {Path.GetFileName(file)}");
Im.Text($"Dragging texture for editing: {Path.GetFileName(file)}");
return true;
});
var childWidth = GetChildWidth();
var imageSize = new Vector2(childWidth.X - ImGui.GetStyle().FramePadding.X * 2);
var imageSize = new Vector2(childWidth.X - Im.Style.FramePadding.X * 2);
DrawInputChild("Input Texture", _left, childWidth, imageSize);
Im.Line.Same();
DrawOutputChild(childWidth, imageSize);

View file

@ -253,7 +253,7 @@ public partial class ModEditWindow : IndexedWindow, IDisposable
private static void DrawRaceCodeCombo(Vector2 buttonSize)
{
ImGui.SetNextItemWidth(buttonSize.X);
Im.Item.SetNextWidth(buttonSize.X);
using var combo = ImRaii.Combo("##RaceCode", RaceCodeName(_raceCode));
if (!combo)
return;
@ -269,10 +269,10 @@ public partial class ModEditWindow : IndexedWindow, IDisposable
{
DrawRaceCodeCombo(buttonSize);
Im.Line.Same();
ImGui.SetNextItemWidth(buttonSize.X);
Im.Item.SetNextWidth(buttonSize.X);
ImGui.InputTextWithHint("##suffixFrom", "From...", ref _materialSuffixFrom, 32);
Im.Line.Same();
ImGui.SetNextItemWidth(buttonSize.X);
Im.Item.SetNextWidth(buttonSize.X);
ImGui.InputTextWithHint("##suffixTo", "To...", ref _materialSuffixTo, 32);
Im.Line.Same();
var disabled = !MdlMaterialEditor.ValidString(_materialSuffixTo);
@ -334,7 +334,7 @@ public partial class ModEditWindow : IndexedWindow, IDisposable
foreach (var path in _editor.Files.Missing)
{
ImGui.TableNextColumn();
ImGui.TextUnformatted(path.FullName);
Im.Text(path.FullName);
}
}
@ -384,7 +384,7 @@ public partial class ModEditWindow : IndexedWindow, IDisposable
if (_editor.Duplicates.Duplicates.Count == 0)
{
Im.Line.New();
ImGui.TextUnformatted("No duplicates found.");
Im.Text("No duplicates found."u8);
return;
}
@ -394,7 +394,7 @@ public partial class ModEditWindow : IndexedWindow, IDisposable
if (_editor.Duplicates.SavedSpace > 0)
{
Im.Line.Same();
ImGui.TextUnformatted($"Frees up {Functions.HumanReadableSize(_editor.Duplicates.SavedSpace)} from your hard drive.");
Im.Text($"Frees up {Functions.HumanReadableSize(_editor.Duplicates.SavedSpace)} from your hard drive.");
}
using var child = ImRaii.Child("##duptable", -Vector2.One, true);
@ -445,7 +445,7 @@ public partial class ModEditWindow : IndexedWindow, IDisposable
private bool DrawOptionSelectHeader()
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero).Push(ImGuiStyleVar.FrameRounding, 0);
using var style = ImStyleDouble.ItemSpacing.Push(Vector2.Zero).Push(ImStyleSingle.FrameRounding, 0);
var width = new Vector2(Im.ContentRegion.Available.X / 3, 0);
var ret = false;
if (ImUtf8.ButtonEx("Default Option"u8, "Switch to the default option for the mod.\nThis resets unsaved changes."u8, width,
@ -527,13 +527,13 @@ public partial class ModEditWindow : IndexedWindow, IDisposable
ImGui.TableNextColumn();
var tmp = file.FullName;
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
if (ImGui.InputText("##value", ref tmp, Utf8GamePath.MaxGamePathLength) && tmp.Length > 0)
_editor.SwapEditor.Change(gamePath, new FullPath(tmp));
ImGui.TableNextColumn();
tmp = gamePath.Path.ToString();
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
if (ImGui.InputText("##key", ref tmp, Utf8GamePath.MaxGamePathLength)
&& Utf8GamePath.FromString(tmp, out var path)
&& !_editor.SwapEditor.Swaps.ContainsKey(path))
@ -555,10 +555,10 @@ public partial class ModEditWindow : IndexedWindow, IDisposable
}
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
ImGui.InputTextWithHint("##swapKey", "Load this file...", ref _newSwapValue, Utf8GamePath.MaxGamePathLength);
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
ImGui.InputTextWithHint("##swapValue", "... instead of this file.", ref _newSwapKey, Utf8GamePath.MaxGamePathLength);
}

View file

@ -31,7 +31,7 @@ public class ModMergeTab(ModMerger modMerger, ModComboWithoutCurrent combo) : Lu
DrawMergeIntoDesc();
ImGui.Dummy(Vector2.One);
ImGui.Separator();
Im.Separator();
ImGui.Dummy(Vector2.One);
DrawSplitOff(size);
@ -45,16 +45,16 @@ public class ModMergeTab(ModMerger modMerger, ModComboWithoutCurrent combo) : Lu
private void DrawMergeInto(float size)
{
using var bigGroup = ImRaii.Group();
using var bigGroup = Im.Group();
var minComboSize = 300 * Im.Style.GlobalScale;
var textSize = ImUtf8.CalcTextSize($"Merge {modMerger.MergeFromMod!.Name} into ").X;
ImGui.AlignTextToFramePadding();
using (ImRaii.Group())
using (Im.Group())
{
ImUtf8.Text("Merge "u8);
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
if (size - textSize < minComboSize)
{
Im.Text("selected mod"u8, ColorId.FolderLine.Value());
@ -65,24 +65,23 @@ public class ModMergeTab(ModMerger modMerger, ModComboWithoutCurrent combo) : Lu
Im.Text(modMerger.MergeFromMod!.Name, ColorId.FolderLine.Value());
}
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
ImUtf8.Text(" into"u8);
}
Im.Line.Same();
DrawCombo(size - ImGui.GetItemRectSize().X - ImGui.GetStyle().ItemSpacing.X);
DrawCombo(size - ImGui.GetItemRectSize().X - Im.Style.ItemSpacing.X);
using (ImRaii.Group())
using (Im.Group())
{
using var disabled = ImRaii.Disabled(modMerger.MergeFromMod.HasOptions);
var buttonWidth = (size - ImGui.GetStyle().ItemSpacing.X) / 2;
using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 1);
var buttonWidth = (size - Im.Style.ItemSpacing.X) / 2;
var group = modMerger.MergeToMod?.Groups.FirstOrDefault(g => g.Name == modMerger.OptionGroupName);
var color = group != null || modMerger.OptionGroupName.Length == 0 && modMerger.OptionName.Length == 0
var color = group != null || modMerger.OptionGroupName.Length is 0 && modMerger.OptionName.Length is 0
? Colors.PressEnterWarningBg
: Colors.DiscordColor;
using var c = ImGuiColor.Border.Push(color);
ImGui.SetNextItemWidth(buttonWidth);
using var style = ImStyleBorder.Frame.Push(color);
Im.Item.SetNextWidth(buttonWidth);
ImGui.InputTextWithHint("##optionGroupInput", "Target Option Group", ref modMerger.OptionGroupName, 64);
ImGuiUtil.HoverTooltip(
"The name of the new or existing option group to find or create the option in. Leave both group and option name blank for the default option.\n"
@ -95,8 +94,8 @@ public class ModMergeTab(ModMerger modMerger, ModComboWithoutCurrent combo) : Lu
: group == null || group.Options.Any(o => o.Name == modMerger.OptionName)
? Colors.PressEnterWarningBg
: Colors.DiscordColor;
c.Push(ImGuiColor.Border, color);
ImGui.SetNextItemWidth(buttonWidth);
style.Push(ImGuiColor.Border, color);
Im.Item.SetNextWidth(buttonWidth);
ImGui.InputTextWithHint("##optionInput", "Target Option Name", ref modMerger.OptionName, 64);
ImGuiUtil.HoverTooltip(
"The name of the new or existing option to merge this mod into. Leave both group and option name blank for the default option.\n"
@ -128,8 +127,8 @@ public class ModMergeTab(ModMerger modMerger, ModComboWithoutCurrent combo) : Lu
private void DrawSplitOff(float size)
{
using var group = ImRaii.Group();
ImGui.SetNextItemWidth(size);
using var group = Im.Group();
Im.Item.SetNextWidth(size);
ImGui.InputTextWithHint("##newModInput", "New Mod Name...", ref _newModName, 64);
ImGuiUtil.HoverTooltip("Choose a name for the newly created mod. This does not need to be unique.");
var tt = _newModName.Length == 0
@ -143,7 +142,7 @@ public class ModMergeTab(ModMerger modMerger, ModComboWithoutCurrent combo) : Lu
modMerger.SplitIntoMod(_newModName);
ImGui.Dummy(Vector2.One);
var buttonSize = new Vector2((size - 2 * ImGui.GetStyle().ItemSpacing.X) / 3, 0);
var buttonSize = new Vector2((size - 2 * Im.Style.ItemSpacing.X) / 3, 0);
if (ImGui.Button("Select All", buttonSize))
modMerger.SelectedOptions.UnionWith(modMerger.MergeFromMod!.AllDataContainers);
Im.Line.Same();
@ -246,13 +245,13 @@ public class ModMergeTab(ModMerger modMerger, ModComboWithoutCurrent combo) : Lu
if (modMerger.Warnings.Count == 0)
return;
ImGui.Separator();
Im.Separator();
ImGui.Dummy(Vector2.One);
using var color = ImGuiColor.Text.Push(Colors.TutorialBorder);
foreach (var warning in modMerger.Warnings.SkipLast(1))
{
ImGuiUtil.TextWrapped(warning);
ImGui.Separator();
Im.Separator();
}
ImGuiUtil.TextWrapped(modMerger.Warnings[^1]);
@ -263,7 +262,7 @@ public class ModMergeTab(ModMerger modMerger, ModComboWithoutCurrent combo) : Lu
if (modMerger.Error == null)
return;
ImGui.Separator();
Im.Separator();
ImGui.Dummy(Vector2.One);
using var color = ImGuiColor.Text.Push(Colors.RegexWarningBorder);
ImGuiUtil.TextWrapped(modMerger.Error.ToString());

View file

@ -1,15 +1,10 @@
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.Utility;
using Dalamud.Plugin.Services;
using ImSharp;
using Lumina.Data;
using Luna;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Text;
using Penumbra.Api.Enums;
using Penumbra.Communication;
using Penumbra.GameData.Files;
@ -58,20 +53,19 @@ public class ResourceTreeViewer(
DrawControls();
_task ??= RefreshCharacterList();
using var child = ImRaii.Child("##Data");
using var child = Im.Child.Begin("##Data"u8);
if (!child)
return;
if (!_task.IsCompleted)
{
Im.Line.New();
ImGui.TextUnformatted("Calculating character list...");
Im.Text("Calculating character list...");
}
else if (_task.Exception != null)
{
Im.Line.New();
using var color = ImGuiColor.Text.Push(Colors.RegexWarningBorder);
ImGui.TextUnformatted($"Error during calculation of character list:\n\n{_task.Exception}");
Im.Text($"Error during calculation of character list:\n\n{_task.Exception}", Colors.RegexWarningBorder);
}
else if (_task.IsCompletedSuccessfully)
{
@ -84,12 +78,12 @@ public class ResourceTreeViewer(
using (ImGuiColor.Text.Push(CategoryColor(category).Value()))
{
var isOpen = ImGui.CollapsingHeader($"{(incognito.IncognitoMode ? tree.AnonymizedName : tree.Name)}###{index}",
index == 0 ? ImGuiTreeNodeFlags.DefaultOpen : 0);
var isOpen = Im.Tree.Header($"{(incognito.IncognitoMode ? tree.AnonymizedName : tree.Name)}###{index}",
index == 0 ? TreeNodeFlags.DefaultOpen : 0);
if (debugMode)
{
using var _ = ImRaii.PushFont(UiBuilder.MonoFont);
ImGuiUtil.HoverTooltip(
using var _ = Im.Font.PushMono();
Im.Tooltip.OnHover(
$"Object Index: {tree.GameObjectIndex}\nObject Address: 0x{tree.GameObjectAddress:X16}\nDraw Object Address: 0x{tree.DrawObjectAddress:X16}");
}
@ -97,11 +91,11 @@ public class ResourceTreeViewer(
continue;
}
using var id = ImRaii.PushId(index);
using var id = Im.Id.Push(index);
ImUtf8.TextFrameAligned($"Collection: {(incognito.IncognitoMode ? tree.AnonymizedCollectionName : tree.CollectionName)}");
ImEx.TextFrameAligned($"Collection: {(incognito.IncognitoMode ? tree.AnonymizedCollectionName : tree.CollectionName)}");
Im.Line.Same();
if (ImUtf8.ButtonEx("Export Character Pack"u8,
if (ImEx.Button("Export Character Pack"u8,
"Note that this recomputes the current data of the actor if it still exists, and does not use the cached data."u8))
{
pcpService.CreatePcp((ObjectIndex)tree.GameObjectIndex, null, _note).ContinueWith(t =>
@ -116,10 +110,12 @@ public class ResourceTreeViewer(
_note = string.Empty;
}
ImUtf8.SameLineInner();
if (ImUtf8.ButtonEx("Export To..."u8,
Im.Line.SameInner();
if (ImEx.Button("Export To..."u8,
"Note that this recomputes the current data of the actor if it still exists, and does not use the cached data."u8))
fileDialog.OpenSavePicker("Export PCP...", $"Penumbra Mod Packs{{.pcp,.pmp}},{config.PcpSettings.PcpExtension},Any File{{.*}}", PcpService.ModName(tree.Name, _note, DateTime.Now),
fileDialog.OpenSavePicker("Export PCP...",
$"Penumbra Mod Packs{{.pcp,.pmp}},{config.PcpSettings.PcpExtension},Any File{{.*}}",
PcpService.ModName(tree.Name, _note, DateTime.Now),
config.PcpSettings.PcpExtension,
(selected, path) =>
{
@ -137,9 +133,9 @@ public class ResourceTreeViewer(
});
_note = string.Empty;
}, config.ExportDirectory, false);
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
ImUtf8.InputText("##note"u8, ref _note, "Export note..."u8);
Im.Line.SameInner();
Im.Item.SetNextWidth(Im.ContentRegion.Available.X);
Im.Input.Text("##note"u8, ref _note, "Export note..."u8);
using var table = Im.Table.Begin("##ResourceTree"u8, 4,
@ -152,9 +148,9 @@ public class ResourceTreeViewer(
table.SetupColumn("Actual Path"u8, TableColumnFlags.WidthStretch, 0.5f);
table.SetupColumn(StringU8.Empty, TableColumnFlags.WidthFixed,
actionCapacity * 3 * Im.Style.GlobalScale + (actionCapacity + 1) * Im.Style.FrameHeight);
ImGui.TableHeadersRow();
table.HeaderRow();
DrawNodes(tree.Nodes, 0, unchecked(tree.DrawObjectAddress * 31), 0);
DrawNodes(table, tree.Nodes, 0, unchecked(tree.DrawObjectAddress * 31), 0);
}
}
}
@ -166,59 +162,56 @@ public class ResourceTreeViewer(
using var style = ImGuiColor.Text.Push(ImGuiColors.DalamudOrange);
ImUtf8.TextWrapped(
Im.TextWrapped(
"Dalamud is reporting your FFXIV installation has modified game files. Any mods installed through TexTools will produce this message."u8);
ImUtf8.TextWrapped("Penumbra and some other plugins assume your FFXIV installation is unmodified in order to work."u8);
ImUtf8.TextWrapped(
Im.TextWrapped("Penumbra and some other plugins assume your FFXIV installation is unmodified in order to work."u8);
Im.TextWrapped(
"Data displayed here may be inaccurate because of this, which, in turn, can break functionality relying on it, such as Character Pack exports/imports, or mod synchronization functions provided by other plugins."u8);
ImUtf8.TextWrapped(
Im.TextWrapped(
"Exit the game, open XIVLauncher, click the arrow next to Log In and select \"repair game files\" to resolve this issue. Afterwards, do not install any mods with TexTools. Your plugin configurations will remain, as will mods enabled in Penumbra."u8);
ImGui.Separator();
Im.Separator();
}
private void DrawControls()
{
var yOffset = (ChangedItemDrawer.TypeFilterIconSize.Y - Im.Style.FrameHeight) / 2f;
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + yOffset);
Im.Cursor.Y += yOffset;
if (ImGui.Button("Refresh Character List"))
if (Im.Button("Refresh Character List"u8))
_task = RefreshCharacterList();
var checkSpacing = ImGui.GetStyle().ItemInnerSpacing.X;
var checkPadding = 10 * Im.Style.GlobalScale + ImGui.GetStyle().ItemSpacing.X;
ImGui.SameLine(0, checkPadding);
var checkSpacing = Im.Style.ItemInnerSpacing.X;
var checkPadding = 10 * Im.Style.GlobalScale + Im.Style.ItemSpacing.X;
Im.Line.Same(0, checkPadding);
using (ImRaii.PushId("TreeCategoryFilter"))
using (Im.Id.Push("TreeCategoryFilter"u8))
{
var categoryFilter = (uint)_categoryFilter;
foreach (var category in Enum.GetValues<TreeCategory>())
{
using var c = ImGuiColor.CheckMark.Push(CategoryColor(category).Value());
ImGui.CheckboxFlags($"##{category}", ref categoryFilter, (uint)category);
ImGuiUtil.HoverTooltip(CategoryFilterDescription(category));
ImGui.SameLine(0.0f, checkSpacing);
Im.Checkbox($"##{category}", ref _categoryFilter, category);
Im.Tooltip.OnHover(CategoryFilterDescription(category));
Im.Line.Same(0.0f, checkSpacing);
}
_categoryFilter = (TreeCategory)categoryFilter;
}
ImGui.SameLine(0, checkPadding);
Im.Line.Same(0, checkPadding);
var filterChanged = false;
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - yOffset);
using (ImRaii.Child("##typeFilter", new Vector2(Im.ContentRegion.Available.X, ChangedItemDrawer.TypeFilterIconSize.Y)))
Im.Cursor.Y -= yOffset;
using (Im.Child.Begin("##typeFilter"u8, new Vector2(Im.ContentRegion.Available.X, ChangedItemDrawer.TypeFilterIconSize.Y)))
{
filterChanged |= changedItemDrawer.DrawTypeFilter(ref _typeFilter);
}
var fieldWidth = (Im.ContentRegion.Available.X - checkSpacing * 2.0f - Im.Style.FrameHeightWithSpacing) / 2.0f;
ImGui.SetNextItemWidth(fieldWidth);
filterChanged |= ImGui.InputTextWithHint("##TreeNameFilter", "Filter by Character/Entity Name...", ref _nameFilter, 128);
ImGui.SameLine(0, checkSpacing);
ImGui.SetNextItemWidth(fieldWidth);
filterChanged |= ImGui.InputTextWithHint("##NodeFilter", "Filter by Item/Part Name or Path...", ref _nodeFilter, 128);
ImGui.SameLine(0, checkSpacing);
Im.Item.SetNextWidth(fieldWidth);
filterChanged |= Im.Input.Text("##TreeNameFilter"u8, ref _nameFilter, "Filter by Character/Entity Name..."u8);
Im.Line.Same(0, checkSpacing);
Im.Item.SetNextWidth(fieldWidth);
filterChanged |= Im.Input.Text("##NodeFilter"u8, ref _nodeFilter, "Filter by Item/Part Name or Path..."u8);
Im.Line.Same(0, checkSpacing);
incognito.DrawToggle(Im.Style.FrameHeightWithSpacing);
if (filterChanged)
@ -243,7 +236,7 @@ public class ResourceTreeViewer(
}
});
private void DrawNodes(IEnumerable<ResourceNode> resourceNodes, int level, nint pathHash,
private void DrawNodes(in Im.TableDisposable table, IEnumerable<ResourceNode> resourceNodes, int level, nint pathHash,
ChangedItemIconFlag parentFilterIconFlag)
{
var debugMode = config.DebugMode;
@ -257,26 +250,25 @@ public class ResourceTreeViewer(
if (visibility == NodeVisibility.Hidden)
continue;
using var mutedColor = ImGuiColor.Text.Push(ImGuiUtil.HalfTransparentText(), resourceNode.Internal);
using var mutedColor = ImGuiColor.Text.Push(Im.Style[ImGuiColor.Text].WithAlpha(0.5f), resourceNode.Internal);
var filterIcon = resourceNode.IconFlag != 0 ? resourceNode.IconFlag : parentFilterIconFlag;
using var id = ImRaii.PushId(index);
ImGui.TableNextColumn();
using var id = Im.Id.Push(index);
table.NextColumn();
var unfolded = _unfolded.Contains(nodePathHash);
using (var indent = ImRaii.PushIndent(level))
using (Im.Indent(level))
{
var hasVisibleChildren = resourceNode.Children.Any(child
=> GetNodeVisibility(unchecked(nodePathHash * 31 + child.ResourceHandle), child, filterIcon) != NodeVisibility.Hidden);
var unfoldable = hasVisibleChildren && visibility != NodeVisibility.DescendentsOnly;
if (unfoldable)
{
using var font = ImRaii.PushFont(UiBuilder.IconFont);
var icon = (unfolded ? FontAwesomeIcon.CaretDown : FontAwesomeIcon.CaretRight).ToIconString();
var offset = (Im.Style.FrameHeight - ImGui.CalcTextSize(icon).X) / 2;
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + offset);
ImGui.TextUnformatted(icon);
ImGui.SameLine(0f, offset + ImGui.GetStyle().ItemInnerSpacing.X);
var icon = unfolded ? LunaStyle.CollapseUpIcon : LunaStyle.ExpandDownIcon;
var offset = (Im.Style.FrameHeight - ImEx.Icon.CalculateSize(icon).X) / 2;
Im.Cursor.X += offset;
ImEx.Icon.Draw(icon);
Im.Line.Same(0f, offset + Im.Style.ItemInnerSpacing.X);
}
else
{
@ -286,14 +278,14 @@ public class ResourceTreeViewer(
unfolded = true;
}
ImGui.Dummy(new Vector2(Im.Style.FrameHeight));
ImGui.SameLine(0f, ImGui.GetStyle().ItemInnerSpacing.X);
Im.FrameDummy();
Im.Line.SameInner();
}
changedItemDrawer.DrawCategoryIcon(resourceNode.IconFlag);
ImGui.SameLine(0f, ImGui.GetStyle().ItemInnerSpacing.X);
ImGui.TableHeader(resourceNode.Name);
if (ImGui.IsItemClicked() && unfoldable)
Im.Line.SameInner();
table.Header(resourceNode.Name!);
if (unfoldable && Im.Item.Clicked())
{
if (unfolded)
_unfolded.Remove(nodePathHash);
@ -304,46 +296,47 @@ public class ResourceTreeViewer(
if (debugMode)
{
using var _ = ImRaii.PushFont(UiBuilder.MonoFont);
ImGuiUtil.HoverTooltip(
using var _ = Im.Font.PushMono();
Im.Tooltip.OnHover(
$"Resource Type: {resourceNode.Type}\nObject Address: 0x{resourceNode.ObjectAddress:X16}\nResource Handle: 0x{resourceNode.ResourceHandle:X16}\nLength: 0x{resourceNode.Length:X16}");
}
}
ImGui.TableNextColumn();
table.NextColumn();
var hasGamePaths = resourceNode.PossibleGamePaths.Length > 0;
ImGui.Selectable(resourceNode.PossibleGamePaths.Length switch
Im.Selectable(resourceNode.PossibleGamePaths.Length switch
{
0 => "(none)",
1 => resourceNode.GamePath.ToString(),
_ => "(multiple)",
}, false, hasGamePaths ? 0 : ImGuiSelectableFlags.Disabled, new Vector2(Im.ContentRegion.Available.X, frameHeight));
if (hasGamePaths)
0 => "(none)"u8,
1 => $"{resourceNode.GamePath}",
_ => "(multiple)"u8,
}, false, hasGamePaths ? 0 : SelectableFlags.Disabled, Im.ContentRegion.Available with { Y = frameHeight });
if (hasGamePaths && Im.Item.Hovered())
{
var allPaths = string.Join('\n', resourceNode.PossibleGamePaths);
if (ImGui.IsItemClicked())
ImGui.SetClipboardText(allPaths);
ImGuiUtil.HoverTooltip($"{allPaths}\n\nClick to copy to clipboard.");
var allPaths = StringU8.Join((byte)'\n', resourceNode.PossibleGamePaths.AsEnumerable());
if (Im.Item.Clicked())
Im.Clipboard.Set(allPaths);
using var tt = Im.Tooltip.Begin();
Im.Text(allPaths);
Im.Text("\n\nClick to copy to clipboard."u8);
}
ImGui.TableNextColumn();
table.NextColumn();
if (resourceNode.FullPath.FullName.Length > 0)
{
var hasMod = resourceNode.Mod.TryGetTarget(out var mod);
if (resourceNode is { ModName: not null, ModRelativePath: not null })
{
var modName = $"[{(hasMod ? mod!.Name : resourceNode.ModName)}]";
var textPos = ImGui.GetCursorPosX() + ImUtf8.CalcTextSize(modName).X + ImGui.GetStyle().ItemInnerSpacing.X;
using var group = ImUtf8.Group();
var textPos = Im.Cursor.X + Im.Font.CalculateSize(modName).X + Im.Style.ItemInnerSpacing.X;
using var group = Im.Group();
using (ImGuiColor.Text.Push((hasMod ? ColorId.NewMod : ColorId.DisabledMod).Value()))
{
ImUtf8.Selectable(modName, false, ImGuiSelectableFlags.AllowItemOverlap,
new Vector2(Im.ContentRegion.Available.X, frameHeight));
Im.Selectable(modName, false, SelectableFlags.AllowOverlap, Im.ContentRegion.Available with { Y = frameHeight });
}
Im.Line.Same();
ImGui.SetCursorPosX(textPos);
ImUtf8.Text(resourceNode.ModRelativePath);
Im.Cursor.X = textPos;
Im.Text(resourceNode.ModRelativePath);
}
else if (resourceNode.FullPath.IsRooted)
{
@ -354,40 +347,38 @@ public class ResourceTreeViewer(
: -1;
if (secondLastDirectorySeparator >= 0)
path = $"…{path.AsSpan(secondLastDirectorySeparator)}";
ImGui.Selectable(path.AsSpan(), false, ImGuiSelectableFlags.AllowItemOverlap,
new Vector2(Im.ContentRegion.Available.X, frameHeight));
Im.Selectable(path, false, SelectableFlags.AllowOverlap, Im.ContentRegion.Available with { Y = frameHeight });
}
else
{
ImGui.Selectable(resourceNode.FullPath.ToPath(), false, ImGuiSelectableFlags.AllowItemOverlap,
new Vector2(Im.ContentRegion.Available.X, frameHeight));
Im.Selectable(resourceNode.FullPath.ToPath(), false, SelectableFlags.AllowOverlap,
Im.ContentRegion.Available with { Y = frameHeight });
}
if (ImGui.IsItemClicked())
ImGui.SetClipboardText(resourceNode.FullPath.ToPath());
if (hasMod && Im.Item.RightClicked() && ImGui.GetIO().KeyCtrl)
if (Im.Item.Clicked())
Im.Clipboard.Set(resourceNode.FullPath.ToPath());
if (hasMod && Im.Item.RightClicked() && Im.Io.KeyControl)
communicator.SelectTab.Invoke(new SelectTab.Arguments(TabType.Mods, mod));
ImGuiUtil.HoverTooltip(
Im.Tooltip.OnHover(
$"{resourceNode.FullPath.ToPath()}\n\nClick to copy to clipboard.{(hasMod ? "\nControl + Right-Click to jump to mod." : string.Empty)}{GetAdditionalDataSuffix(resourceNode.AdditionalData)}");
}
else
{
ImUtf8.Selectable(GetPathStatusLabel(resourceNode.FullPathStatus), false, ImGuiSelectableFlags.Disabled,
new Vector2(Im.ContentRegion.Available.X, frameHeight));
ImGuiUtil.HoverTooltip(
Im.Selectable(GetPathStatusLabel(resourceNode.FullPathStatus), false, SelectableFlags.Disabled,
Im.ContentRegion.Available with { Y = frameHeight });
Im.Tooltip.OnHover(
$"{GetPathStatusDescription(resourceNode.FullPathStatus)}{GetAdditionalDataSuffix(resourceNode.AdditionalData)}");
}
mutedColor.Dispose();
mutedColor.Pop();
ImGui.TableNextColumn();
using var spacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing,
ImGui.GetStyle().ItemSpacing with { X = 3 * Im.Style.GlobalScale });
table.NextColumn();
using var spacing = ImStyleDouble.ItemSpacing.PushX(3 * Im.Style.GlobalScale);
DrawActions(resourceNode, new Vector2(frameHeight));
if (unfolded)
DrawNodes(resourceNode.Children, level + 1, unchecked(nodePathHash * 31), filterIcon);
DrawNodes(table, resourceNode.Children, level + 1, unchecked(nodePathHash * 31), filterIcon);
}
return;
@ -440,7 +431,7 @@ public class ResourceTreeViewer(
void DrawActions(ResourceNode resourceNode, Vector2 buttonSize)
{
if (!_writableCache!.TryGetValue(resourceNode.FullPath, out var writable))
if (!_writableCache.TryGetValue(resourceNode.FullPath, out var writable))
{
var path = resourceNode.FullPath.ToPath();
if (resourceNode.FullPath.IsRooted)
@ -456,8 +447,7 @@ public class ResourceTreeViewer(
_writableCache.Add(resourceNode.FullPath, writable);
}
if (ImUtf8.IconButton(FontAwesomeIcon.Save, "Export this file."u8, buttonSize,
resourceNode.FullPath.FullName.Length is 0 || writable is null))
if (ImEx.Icon.Button(LunaStyle.SaveIcon, "Export this file."u8, resourceNode.FullPath.FullName.Length is 0 || writable is null, buttonSize))
{
var fullPathStr = resourceNode.FullPath.FullName;
var ext = resourceNode.PossibleGamePaths.Length == 1
@ -493,13 +483,13 @@ public class ResourceTreeViewer(
_ => "(unavailable)"u8,
};
private static string GetPathStatusDescription(ResourceNode.PathStatus status)
private static ReadOnlySpan<byte> GetPathStatusDescription(ResourceNode.PathStatus status)
=> status switch
{
ResourceNode.PathStatus.External => "The actual path to this file is unavailable, because it is managed by external tools.",
ResourceNode.PathStatus.External => "The actual path to this file is unavailable, because it is managed by external tools."u8,
ResourceNode.PathStatus.NonExistent =>
"The actual path to this file is unavailable, because it seems to have been moved or deleted since it was loaded.",
_ => "The actual path to this file is unavailable.",
"The actual path to this file is unavailable, because it seems to have been moved or deleted since it was loaded."u8,
_ => "The actual path to this file is unavailable."u8,
};
[Flags]
@ -529,13 +519,13 @@ public class ResourceTreeViewer(
_ => throw new ArgumentException(),
};
private static string CategoryFilterDescription(TreeCategory category)
private static ReadOnlySpan<byte> CategoryFilterDescription(TreeCategory category)
=> category switch
{
TreeCategory.LocalPlayer => "Show you and what you own (mount, minion, accessory, pets and so on).",
TreeCategory.Player => "Show other players and what they own.",
TreeCategory.Networked => "Show non-player entities handled by the game server.",
TreeCategory.NonNetworked => "Show non-player entities handled locally.",
TreeCategory.LocalPlayer => "Show you and what you own (mount, minion, accessory, pets and so on)."u8,
TreeCategory.Player => "Show other players and what they own."u8,
TreeCategory.Networked => "Show non-player entities handled by the game server."u8,
TreeCategory.NonNetworked => "Show non-player entities handled locally."u8,
_ => throw new ArgumentException(),
};

View file

@ -41,12 +41,12 @@ public class AddGroupDrawer : Luna.IUiService
private void DrawBasicGroups(Mod mod, float width, Vector2 buttonWidth)
{
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
if (ImUtf8.InputText("##name"u8, ref _groupName, "Enter New Name..."u8))
_groupNameValid = ModGroupEditor.VerifyFileName(mod, null, _groupName, false);
DrawSingleGroupButton(mod, buttonWidth);
ImUtf8.SameLineInner();
Im.Line.SameInner();
DrawMultiGroupButton(mod, buttonWidth);
DrawCombiningGroupButton(mod, buttonWidth);
}
@ -93,27 +93,27 @@ public class AddGroupDrawer : Luna.IUiService
private void DrawImcInput(float width)
{
var change = ImcMetaDrawer.DrawObjectType(ref _imcIdentifier, width);
ImUtf8.SameLineInner();
Im.Line.SameInner();
change |= ImcMetaDrawer.DrawPrimaryId(ref _imcIdentifier, width);
if (_imcIdentifier.ObjectType is ObjectType.Weapon or ObjectType.Monster)
{
change |= ImcMetaDrawer.DrawSecondaryId(ref _imcIdentifier, width);
ImUtf8.SameLineInner();
Im.Line.SameInner();
change |= ImcMetaDrawer.DrawVariant(ref _imcIdentifier, width);
}
else if (_imcIdentifier.ObjectType is ObjectType.DemiHuman)
{
var quarterWidth = (width - ImUtf8.ItemInnerSpacing.X / Im.Style.GlobalScale) / 2;
change |= ImcMetaDrawer.DrawSecondaryId(ref _imcIdentifier, width);
ImUtf8.SameLineInner();
Im.Line.SameInner();
change |= ImcMetaDrawer.DrawSlot(ref _imcIdentifier, quarterWidth);
ImUtf8.SameLineInner();
Im.Line.SameInner();
change |= ImcMetaDrawer.DrawVariant(ref _imcIdentifier, quarterWidth);
}
else
{
change |= ImcMetaDrawer.DrawSlot(ref _imcIdentifier, width);
ImUtf8.SameLineInner();
Im.Line.SameInner();
change |= ImcMetaDrawer.DrawVariant(ref _imcIdentifier, width);
}
@ -144,7 +144,7 @@ public class AddGroupDrawer : Luna.IUiService
if (_entryInvalid)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
var text = _imcFileExists
? "IMC Entry Does Not Exist"u8
: "IMC File Does Not Exist"u8;

View file

@ -18,16 +18,16 @@ public readonly struct CombiningModGroupEditDrawer(ModGroupEditDrawer editor, Co
using var id = ImUtf8.PushId(optionIdx);
editor.DrawOptionPosition(group, option, optionIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDefaultMultiBehaviour(group, option, optionIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionName(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDescription(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDelete(option);
}
@ -60,7 +60,7 @@ public readonly struct CombiningModGroupEditDrawer(ModGroupEditDrawer editor, Co
new Vector2(400 * Im.Style.GlobalScale, 0)))
ImUtf8.OpenPopup("DataContainerNames"u8);
var sizeX = group.OptionData.Count * (ImGui.GetStyle().ItemInnerSpacing.X + Im.Style.FrameHeight) + 300 * Im.Style.GlobalScale;
var sizeX = group.OptionData.Count * (Im.Style.ItemInnerSpacing.X + Im.Style.FrameHeight) + 300 * Im.Style.GlobalScale;
ImGui.SetNextWindowSize(new Vector2(sizeX, Im.Style.FrameHeightWithSpacing * Math.Min(16, group.Data.Count) + 200 * Im.Style.GlobalScale));
using var popup = ImUtf8.Popup("DataContainerNames"u8);
if (!popup)
@ -69,11 +69,11 @@ public readonly struct CombiningModGroupEditDrawer(ModGroupEditDrawer editor, Co
foreach (var option in group.OptionData)
{
ImUtf8.RotatedText(option.Name, true);
ImUtf8.SameLineInner();
Im.Line.SameInner();
}
Im.Line.New();
ImGui.Separator();
Im.Separator();
using var child = ImUtf8.Child("##Child"u8, Im.ContentRegion.Available);
ImGuiClip.ClippedDraw(group.Data, DrawRow, Im.Style.FrameHeightWithSpacing);
}
@ -88,7 +88,7 @@ public readonly struct CombiningModGroupEditDrawer(ModGroupEditDrawer editor, Co
id.Push(i);
var check = (index & (1 << i)) != 0;
ImUtf8.Checkbox(""u8, ref check);
ImUtf8.SameLineInner();
Im.Line.SameInner();
id.Pop();
}
}

View file

@ -25,7 +25,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr
var width = editor.AvailableWidth.X - 3 * ImUtf8.ItemInnerSpacing.X - Im.Style.ItemSpacing.X - ImUtf8.CalcTextSize("All Variants"u8).X - ImUtf8.CalcTextSize("Only Attributes"u8).X - 2 * ImUtf8.FrameHeight;
ImEx.TextFramed(identifier.ToString(), new Vector2(width, 0), Rgba32.Transparent);
ImUtf8.SameLineInner();
Im.Line.SameInner();
var allVariants = group.AllVariants;
if (ImUtf8.Checkbox("All Variants"u8, ref allVariants))
editor.ModManager.OptionEditor.ImcEditor.ChangeAllVariants(group, allVariants);
@ -52,7 +52,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr
changes |= ImcMetaDrawer.DrawDecalId(defaultEntry, ref entry, true);
}
ImGui.SameLine(0, editor.PriorityWidth);
Im.Line.Same(0, editor.PriorityWidth);
using (ImUtf8.Group())
{
ImUtf8.TextFrameAligned("Material Animation ID"u8);
@ -88,7 +88,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr
ImUtf8.TextFrameAligned(option.Name);
}
ImUtf8.SameLineInner();
Im.Line.SameInner();
using (ImUtf8.Group())
{
DrawAttributes(editor.ModManager.OptionEditor.ImcEditor, attributeCache, group.DefaultEntry.AttributeMask, group);
@ -108,18 +108,18 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr
using var id = ImRaii.PushId(optionIdx);
editor.DrawOptionPosition(group, option, optionIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDefaultMultiBehaviour(group, option, optionIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionName(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDescription(option);
if (!option.IsDisableSubMod)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDelete(option);
}
}
@ -164,7 +164,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, "ABCDEFGHIJ"u8.Slice(i, 1));
if (i != 9)
ImUtf8.SameLineInner();
Im.Line.SameInner();
}
}

View file

@ -202,14 +202,14 @@ public sealed class ModGroupDrawer : Luna.IUiService
private void DrawMultiPopup(IModGroup group, int groupIdx, string label)
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.PopupBorderSize, 1);
using var style = ImStyleSingle.PopupBorderThickness.Push(Im.Style.GlobalScale);
using var popup = ImRaii.Popup(label);
if (!popup)
return;
ImGui.TextUnformatted(group.Name);
Im.Text(group.Name);
using var disabled = ImRaii.Disabled(_locked);
ImGui.Separator();
Im.Separator();
if (ImUtf8.Selectable("Enable All"u8))
SetModSetting(group, groupIdx, Setting.AllBits(group.Options.Count));
@ -230,13 +230,13 @@ public sealed class ModGroupDrawer : Luna.IUiService
var buttonTextShow = $"Show {options.Count} Options";
var buttonTextHide = $"Hide {options.Count} Options";
var buttonWidth = Math.Max(ImUtf8.CalcTextSize(buttonTextShow).X, ImUtf8.CalcTextSize(buttonTextHide).X)
+ 2 * ImGui.GetStyle().FramePadding.X;
+ 2 * Im.Style.FramePadding.X;
minWidth = Math.Max(buttonWidth, minWidth);
if (shown)
{
var pos = ImGui.GetCursorPos();
ImGui.Dummy(UiHelpers.IconButtonSize);
using (var _ = ImRaii.Group())
using (Im.Group())
{
draw();
}
@ -253,9 +253,9 @@ public sealed class ModGroupDrawer : Luna.IUiService
else
{
var optionWidth = options.Max(o => ImUtf8.CalcTextSize(o.Name).X)
+ ImGui.GetStyle().ItemInnerSpacing.X
+ Im.Style.ItemInnerSpacing.X
+ Im.Style.FrameHeight
+ ImGui.GetStyle().FramePadding.X;
+ Im.Style.FramePadding.X;
var width = Math.Max(optionWidth, minWidth);
if (ImUtf8.Button(buttonTextShow, new Vector2(width, 0)))
ImGui.GetStateStorage().SetBool(collapseId, !shown);

View file

@ -84,22 +84,22 @@ public sealed class ModGroupEditDrawer(
private void DrawGroupNameRow(IModGroup group, int idx)
{
DrawGroupName(group);
ImUtf8.SameLineInner();
Im.Line.SameInner();
DrawGroupMoveButtons(group, idx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
DrawGroupOpenFile(group, idx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
DrawGroupDescription(group);
ImUtf8.SameLineInner();
Im.Line.SameInner();
DrawGroupDelete(group);
ImUtf8.SameLineInner();
Im.Line.SameInner();
DrawGroupPriority(group);
}
private void DrawGroupName(IModGroup group)
{
var text = _currentGroupEdited == group ? _currentGroupName ?? group.Name : group.Name;
ImGui.SetNextItemWidth(_groupNameWidth);
Im.Item.SetNextWidth(_groupNameWidth);
using var border = ImRaii.PushFrameBorder(Im.Style.GlobalScale * 2, Colors.RegexWarningBorder, !_isGroupNameValid);
if (ImUtf8.InputText("##GroupName"u8, ref text))
{
@ -140,7 +140,7 @@ public sealed class ModGroupEditDrawer(
var priority = _currentGroupEdited == group
? (_currentGroupPriority ?? group.Priority).Value
: group.Priority.Value;
ImGui.SetNextItemWidth(PriorityWidth);
Im.Item.SetNextWidth(PriorityWidth);
if (ImGui.InputInt("##GroupPriority", ref priority))
{
_currentGroupEdited = group;
@ -177,7 +177,7 @@ public sealed class ModGroupEditDrawer(
Im.Tooltip.OnHover($"Move this group up to group {idx}.");
ImUtf8.SameLineInner();
Im.Line.SameInner();
var isLast = idx == group.Mod.Groups.Count - 1;
if (ImUtf8.IconButton(FontAwesomeIcon.ArrowDown, isLast))
ActionQueue.Enqueue(() => ModManager.OptionEditor.MoveModGroup(group, idx + 1));
@ -247,7 +247,7 @@ public sealed class ModGroupEditDrawer(
internal void DrawOptionPriority(MultiSubMod option)
{
var priority = option.Priority.Value;
ImGui.SetNextItemWidth(PriorityWidth);
Im.Item.SetNextWidth(PriorityWidth);
if (ImUtf8.InputScalarOnDeactivated("##Priority"u8, ref priority))
ModManager.OptionEditor.MultiEditor.ChangeOptionPriority(option, new ModPriority(priority));
Im.Tooltip.OnHover("Option priority inside the mod."u8);
@ -257,7 +257,7 @@ public sealed class ModGroupEditDrawer(
internal void DrawOptionName(IModOption option)
{
var name = option.Name;
ImGui.SetNextItemWidth(_optionNameWidth);
Im.Item.SetNextWidth(_optionNameWidth);
if (ImUtf8.InputTextOnDeactivated("##Name"u8, ref name))
ModManager.OptionEditor.RenameOption(option, name);
}
@ -282,11 +282,11 @@ public sealed class ModGroupEditDrawer(
ImUtf8.Selectable($"Option #{count + 1}", false, size: OptionIdxSelectable);
Target(group, count);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImUtf8.IconDummy();
ImUtf8.SameLineInner();
ImGui.SetNextItemWidth(_optionNameWidth);
Im.Line.SameInner();
Im.Item.SetNextWidth(_optionNameWidth);
var newName = _newOptionGroup == group
? NewOptionName ?? string.Empty
: string.Empty;
@ -296,7 +296,7 @@ public sealed class ModGroupEditDrawer(
_newOptionGroup = group;
}
ImUtf8.SameLineInner();
Im.Line.SameInner();
return newName;
}
@ -362,7 +362,7 @@ public sealed class ModGroupEditDrawer(
PriorityWidth = 50 * Im.Style.GlobalScale;
AvailableWidth = new Vector2(totalWidth + 3 * _spacing + 2 * _buttonSize.X + PriorityWidth, 0);
_groupNameWidth = totalWidth - 3 * (_buttonSize.X + _spacing);
_spacing = ImGui.GetStyle().ItemInnerSpacing.X;
_spacing = Im.Style.ItemInnerSpacing.X;
OptionIdxSelectable = ImUtf8.CalcTextSize("Option #88."u8);
_optionNameWidth = totalWidth - OptionIdxSelectable.X - _buttonSize.X - 2 * _spacing;
_deleteEnabled = config.DeleteModModifier.IsActive();

View file

@ -1,4 +1,5 @@
using Dalamud.Interface;
using ImSharp;
using OtterGui.Raii;
using OtterGui.Text;
using Penumbra.Mods.Groups;
@ -14,19 +15,19 @@ public readonly struct MultiModGroupEditDrawer(ModGroupEditDrawer editor, MultiM
using var id = ImRaii.PushId(optionIdx);
editor.DrawOptionPosition(group, option, optionIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDefaultMultiBehaviour(group, option, optionIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionName(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDescription(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDelete(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionPriority(option);
}

View file

@ -16,19 +16,19 @@ public readonly struct SingleModGroupEditDrawer(ModGroupEditDrawer editor, Singl
using var id = ImRaii.PushId(optionIdx);
editor.DrawOptionPosition(group, option, optionIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDefaultSingleBehaviour(group, option, optionIdx);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionName(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDescription(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
editor.DrawOptionDelete(option);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImGui.Dummy(new Vector2(editor.PriorityWidth, 0));
}

View file

@ -263,9 +263,9 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
var remainingSpace = maxWidth - itemPos;
var offset = remainingSpace - size;
if (ImGui.GetScrollMaxY() == 0)
offset -= ImGui.GetStyle().ItemInnerSpacing.X;
offset -= Im.Style.ItemInnerSpacing.X;
if (offset > ImGui.GetStyle().ItemSpacing.X)
if (offset > Im.Style.ItemSpacing.X)
ImGui.GetWindowDrawList().AddText(new Vector2(itemPos + offset, line), ColorId.SelectorPriority.Value().Color, priorityString);
}
}
@ -391,13 +391,13 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
private void RenameLeafMod(ModFileSystem.Leaf leaf)
{
ImGui.Separator();
Im.Separator();
RenameLeaf(leaf);
}
private void RenameMod(ModFileSystem.Leaf leaf)
{
ImGui.Separator();
Im.Separator();
var currentName = leaf.Value.Name;
if (ImGui.IsWindowAppearing())
ImGui.SetKeyboardFocusHere(0);
@ -796,8 +796,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
if (!combo)
return ret;
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing,
ImGui.GetStyle().ItemSpacing with { Y = 3 * Im.Style.GlobalScale });
using var style = ImStyleDouble.ItemSpacing.PushY(3 * Im.Style.GlobalScale);
if (ImUtf8.Checkbox("Everything"u8, ref everything))
{
@ -814,7 +813,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
foreach (var group in ModFilterExtensions.Groups)
{
ImGui.Separator();
Im.Separator();
foreach (var (flag, name) in group)
{
if (ImUtf8.Checkbox(name, ref _stateFilter, flag))

View file

@ -226,12 +226,12 @@ public class ModPanelChangedItemsTab(
_stateStorage = ImGui.GetStateStorage();
cache.Update(selector.Selected, drawer, config.Ephemeral.ChangedItemFilter, config.ChangedItemDisplay);
ImGui.Separator();
_buttonSize = new Vector2(ImGui.GetStyle().ItemSpacing.Y + Im.Style.FrameHeight);
using var style = ImRaii.PushStyle(ImGuiStyleVar.CellPadding, Vector2.Zero)
.Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
.Push(ImGuiStyleVar.FramePadding, Vector2.Zero)
.Push(ImGuiStyleVar.SelectableTextAlign, new Vector2(0.01f, 0.5f));
Im.Separator();
_buttonSize = new Vector2(Im.Style.ItemSpacing.Y + Im.Style.FrameHeight);
using var style = ImStyleDouble.CellPadding.Push(Vector2.Zero)
.Push(ImStyleDouble.ItemSpacing, Vector2.Zero)
.Push(ImStyleDouble.FramePadding, Vector2.Zero)
.Push(ImStyleDouble.SelectableTextAlign, new Vector2(0.01f, 0.5f));
using var color = ImGuiColor.Button.Push(Rgba32.Transparent)
.Push(ImGuiColor.ButtonActive, Rgba32.Transparent)
.Push(ImGuiColor.ButtonHovered, Rgba32.Transparent);
@ -348,7 +348,7 @@ public class ModPanelChangedItemsTab(
ImGui.TableNextColumn();
using var indent = ImRaii.PushIndent(1, obj.Child);
drawer.DrawCategoryIcon(obj.Icon, _buttonSize.Y);
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
var clicked = ImUtf8.Selectable(obj.Text.Span, false, ImGuiSelectableFlags.None, _buttonSize with { X = 0 });
drawer.ChangedItemHandling(obj.Data, clicked);
ChangedItemDrawer.DrawModelData(obj.ModelData.Span, _buttonSize.Y);

View file

@ -39,7 +39,7 @@ public class ModPanelCollectionsTab(CollectionManager manager, ModFileSystemSele
ImUtf8.Text($"It is also implicitly used in {inherited} {(inherited == 1 ? "collection" : "collections")} through inheritance.");
Im.Line.New();
ImGui.Separator();
Im.Separator();
Im.Line.New();
using var table = Im.Table.Begin("##modCollections"u8, 3, TableFlags.SizingFixedFit | TableFlags.RowBackground);
if (!table)
@ -65,7 +65,7 @@ public class ModPanelCollectionsTab(CollectionManager manager, ModFileSystemSele
if (context)
{
ImUtf8.Text(collection.Identity.Name);
ImGui.Separator();
Im.Separator();
using (ImRaii.Disabled(state is ModState.Enabled && parent == collection))
{
if (ImUtf8.MenuItem("Enable"u8))

View file

@ -30,7 +30,7 @@ public class ModPanelDescriptionTab(
ImGui.Dummy(ImEx.ScaledVector(2));
var (predefinedTagsEnabled, predefinedTagButtonOffset) = predefinedTagsConfig.Enabled
? (true, Im.Style.FrameHeight + ImGui.GetStyle().WindowPadding.X + (ImGui.GetScrollMaxY() > 0 ? ImGui.GetStyle().ScrollbarSize : 0))
? (true, Im.Style.FrameHeight + Im.Style.WindowPadding.X + (ImGui.GetScrollMaxY() > 0 ? Im.Style.ScrollbarSize : 0))
: (false, 0);
var tagIdx = _localTags.Draw("Local Tags: ",
"Custom tags you can set personally that will not be exported to the mod data but only set for you.\n"
@ -50,7 +50,7 @@ public class ModPanelDescriptionTab(
ImGui.CalcTextSize("Local ").X - ImGui.CalcTextSize("Mod ").X);
ImGui.Dummy(ImEx.ScaledVector(2));
ImGui.Separator();
Im.Separator();
ImGuiUtil.TextWrapped(selector.Selected!.Description);
}

View file

@ -70,7 +70,7 @@ public class ModPanelEditTab(
UiHelpers.DefaultLineSpace();
var sharedTagsEnabled = predefinedTagManager.Enabled;
var sharedTagButtonOffset = sharedTagsEnabled ? Im.Style.FrameHeight + ImGui.GetStyle().FramePadding.X : 0;
var sharedTagButtonOffset = sharedTagsEnabled ? Im.Style.FrameHeight + Im.Style.FramePadding.X : 0;
var tagIdx = _modTags.Draw("Mod Tags: ", "Edit tags by clicking them, or add new tags. Empty tags are removed.", _mod.ModTags,
out var editedTag, rightEndOffset: sharedTagButtonOffset);
if (tagIdx >= 0)
@ -181,7 +181,7 @@ public class ModPanelEditTab(
UiHelpers.InputTextWidth.X))
modManager.DataEditor.ChangeModWebsite(_mod, newWebsite);
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(Im.Style.GlobalScale * 3));
using var style = ImStyleDouble.ItemSpacing.Push(new Vector2(Im.Style.GlobalScale * 3));
var reducedSize = new Vector2(UiHelpers.InputTextMinusButton3, 0);
if (ImGui.Button("Edit Description", reducedSize))
@ -210,7 +210,7 @@ public class ModPanelEditTab(
{
ImEx.TextFramed($"{DateTimeOffset.FromUnixTimeMilliseconds(_mod.ImportDate).ToLocalTime():yyyy/MM/dd HH:mm}",
new Vector2(UiHelpers.InputTextMinusButton3, 0), ImGuiColor.FrameBackground.Get(0.5f));
ImGui.SameLine(0, 3 * Im.Style.GlobalScale);
Im.Line.Same(0, 3 * Im.Style.GlobalScale);
var canRefresh = config.DeleteModModifier.IsActive();
var tt = canRefresh
@ -219,7 +219,7 @@ public class ModPanelEditTab(
if (ImUtf8.IconButton(FontAwesomeIcon.Sync, tt, disabled: !canRefresh))
modManager.DataEditor.ResetModImportDate(_mod);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImUtf8.Text("Import Date"u8);
}
@ -260,7 +260,7 @@ public class ModPanelEditTab(
public static void Draw(ModManager modManager, Mod mod, Vector2 buttonSize)
{
ImGui.SetNextItemWidth(buttonSize.X * 2 + ImGui.GetStyle().ItemSpacing.X);
Im.Item.SetNextWidth(buttonSize.X * 2 + Im.Style.ItemSpacing.X);
var tmp = _currentModDirectory ?? mod.ModPath.Name;
if (ImGui.InputText("##newModMove", ref tmp, 64))
{
@ -323,7 +323,7 @@ public class ModPanelEditTab(
public static bool Text(string label, int field, int option, string oldValue, out string value, uint maxLength, float width)
{
var tmp = field == _currentField && option == _optionIndex ? _currentEdit ?? oldValue : oldValue;
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
if (ImGui.InputText(label, ref tmp))
{
@ -347,7 +347,7 @@ public class ModPanelEditTab(
public static bool Priority(string label, int field, int option, ModPriority oldValue, out ModPriority value, float width)
{
var tmp = (field == _currentField && option == _optionIndex ? _currentGroupPriority ?? oldValue : oldValue).Value;
ImGui.SetNextItemWidth(width);
Im.Item.SetNextWidth(width);
if (ImGui.InputInt(label, ref tmp, 0, 0))
{
_currentGroupPriority = new ModPriority(tmp);

View file

@ -41,7 +41,7 @@ public class ModPanelHeader : IDisposable
using var child = _lastPreSettingsHeight > maxHeight && _communicator.PreSettingsTabBarDraw.HasSubscribers
? ImRaii.Child("HeaderChild", new Vector2(Im.ContentRegion.Available.X, maxHeight), false)
: null;
using (ImRaii.Group())
using (Im.Group())
{
var offset = DrawModName();
DrawVersion(offset);
@ -75,7 +75,7 @@ public class ModPanelHeader : IDisposable
{
using var f = _nameFont.Push();
_modName = name;
_modNameWidth = ImGui.CalcTextSize(name).X + 2 * (ImGui.GetStyle().FramePadding.X + 2 * Im.Style.GlobalScale);
_modNameWidth = ImGui.CalcTextSize(name).X + 2 * (Im.Style.FramePadding.X + 2 * Im.Style.GlobalScale);
}
// Author
@ -84,7 +84,7 @@ public class ModPanelHeader : IDisposable
var author = _mod.Author.Length is 0 ? string.Empty : $"by {_mod.Author}";
_modAuthor = _mod.Author;
_modAuthorWidth = ImGui.CalcTextSize(author).X;
_secondRowWidth = _modAuthorWidth + _modWebsiteButtonWidth + ImGui.GetStyle().ItemSpacing.X;
_secondRowWidth = _modAuthorWidth + _modWebsiteButtonWidth + Im.Style.ItemSpacing.X;
}
// Version
@ -103,9 +103,9 @@ public class ModPanelHeader : IDisposable
&& (uriResult.Scheme == Uri.UriSchemeHttps || uriResult.Scheme == Uri.UriSchemeHttp);
_modWebsiteButton = _websiteValid ? "Open Website" : _modWebsite.Length == 0 ? string.Empty : $"from {_modWebsite}";
_modWebsiteButtonWidth = _websiteValid
? ImGui.CalcTextSize(_modWebsiteButton).X + 2 * ImGui.GetStyle().FramePadding.X
? ImGui.CalcTextSize(_modWebsiteButton).X + 2 * Im.Style.FramePadding.X
: ImGui.CalcTextSize(_modWebsiteButton).X;
_secondRowWidth = _modAuthorWidth + _modWebsiteButtonWidth + ImGui.GetStyle().ItemSpacing.X;
_secondRowWidth = _modAuthorWidth + _modWebsiteButtonWidth + Im.Style.ItemSpacing.X;
}
}
@ -141,7 +141,7 @@ public class ModPanelHeader : IDisposable
var decidingWidth = Math.Max(_secondRowWidth, ImGui.GetWindowWidth());
var offsetWidth = (decidingWidth - _modNameWidth) / 2;
var offsetVersion = _modVersion.Length > 0
? _modVersionWidth + ImGui.GetStyle().ItemSpacing.X + ImGui.GetStyle().WindowPadding.X
? _modVersionWidth + Im.Style.ItemSpacing.X + Im.Style.WindowPadding.X
: 0;
var offset = Math.Max(offsetWidth, offsetVersion);
if (offset > 0)
@ -160,8 +160,8 @@ public class ModPanelHeader : IDisposable
private void DrawVersion(float offset)
{
var oldPos = ImGui.GetCursorPos();
ImGui.SetCursorPos(new Vector2(2 * offset + _modNameWidth - _modVersionWidth - ImGui.GetStyle().WindowPadding.X,
ImGui.GetStyle().FramePadding.Y));
ImGui.SetCursorPos(new Vector2(2 * offset + _modNameWidth - _modVersionWidth - Im.Style.WindowPadding.X,
Im.Style.FramePadding.Y));
ImGuiUtil.TextColored(Colors.MetaInfoText, _modVersion);
ImGui.SetCursorPos(oldPos);
}
@ -196,7 +196,7 @@ public class ModPanelHeader : IDisposable
{
ImGui.SetCursorPosX(offset);
DrawAuthor();
ImGui.SameLine(offset + _modNameWidth - _modWebsiteButtonWidth);
Im.Line.Same(offset + _modNameWidth - _modWebsiteButtonWidth);
DrawWebsite();
}
else
@ -216,11 +216,11 @@ public class ModPanelHeader : IDisposable
/// <summary> Draw the author text. </summary>
private void DrawAuthor()
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
using var style = ImStyleDouble.ItemSpacing.Push(Vector2.Zero);
ImGuiUtil.TextColored(Colors.MetaInfoText, "by ");
Im.Line.Same();
style.Pop();
ImGui.TextUnformatted(_modAuthor);
Im.Text(_modAuthor);
}
/// <summary>
@ -251,11 +251,11 @@ public class ModPanelHeader : IDisposable
}
else
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
using var style = ImStyleDouble.ItemSpacing.Push(Vector2.Zero);
ImGuiUtil.TextColored(Colors.MetaInfoText, "from ");
Im.Line.Same();
style.Pop();
ImGui.TextUnformatted(_modWebsite);
Im.Text(_modWebsite);
}
}

View file

@ -142,7 +142,7 @@ public class ModPanelSettingsTab(
using var group = ImUtf8.Group();
var settings = selection.Settings;
var priority = _currentPriority ?? settings.Priority.Value;
ImGui.SetNextItemWidth(50 * Im.Style.GlobalScale);
Im.Item.SetNextWidth(50 * Im.Style.GlobalScale);
using var disabled = ImRaii.Disabled(_locked);
if (ImUtf8.InputScalar("##Priority"u8, ref priority))
_currentPriority = priority;
@ -184,12 +184,12 @@ public class ModPanelSettingsTab(
private void DrawRemoveSettings()
{
var drawInherited = !_inherited && !selection.Settings.IsEmpty;
var scroll = ImGui.GetScrollMaxY() > 0 ? ImGui.GetStyle().ScrollbarSize + ImGui.GetStyle().ItemInnerSpacing.X : 0;
var scroll = ImGui.GetScrollMaxY() > 0 ? Im.Style.ScrollbarSize + Im.Style.ItemInnerSpacing.X : 0;
var buttonSize = ImUtf8.CalcTextSize("Turn Permanent_"u8).X;
var offset = drawInherited
? buttonSize + ImUtf8.CalcTextSize("Inherit Settings"u8).X + ImGui.GetStyle().FramePadding.X * 4 + ImGui.GetStyle().ItemSpacing.X
: buttonSize + ImGui.GetStyle().FramePadding.X * 2;
ImGui.SameLine(ImGui.GetWindowWidth() - offset - scroll);
? buttonSize + ImUtf8.CalcTextSize("Inherit Settings"u8).X + Im.Style.FramePadding.X * 4 + Im.Style.ItemSpacing.X
: buttonSize + Im.Style.FramePadding.X * 2;
Im.Line.Same(ImGui.GetWindowWidth() - offset - scroll);
var enabled = config.DeleteModModifier.IsActive();
if (drawInherited)
{

View file

@ -130,8 +130,8 @@ public class ModPanelTabBar : IUiService
private void DrawFavoriteButton(Mod mod, float height)
{
var size = ImEx.Icon.CalculateSize(LunaStyle.FavoriteIcon) + ImGui.GetStyle().FramePadding * 2;
var newPos = new Vector2(ImGui.GetWindowWidth() - size.X - ImGui.GetStyle().ItemSpacing.X, height);
var size = ImEx.Icon.CalculateSize(LunaStyle.FavoriteIcon) + Im.Style.FramePadding * 2;
var newPos = new Vector2(ImGui.GetWindowWidth() - size.X - Im.Style.ItemSpacing.X, height);
if (ImGui.GetScrollMaxX() > 0)
newPos.X += ImGui.GetScrollX();

View file

@ -44,14 +44,14 @@ public class MultiModPanel(ModFileSystemSelector selector, ModDataEditor editor,
{
using var tree = ImUtf8.TreeNode("Currently Selected Objects###Selected"u8,
ImGuiTreeNodeFlags.DefaultOpen | ImGuiTreeNodeFlags.NoTreePushOnOpen);
ImGui.Separator();
Im.Separator();
if (!tree)
return selector.SelectedPaths.Count(l => l is ModFileSystem.Leaf);
var sizeType = new Vector2(Im.Style.FrameHeight);
var availableSizePercent = (Im.ContentRegion.Available.X - sizeType.X - 4 * ImGui.GetStyle().CellPadding.X) / 100;
var availableSizePercent = (Im.ContentRegion.Available.X - sizeType.X - 4 * Im.Style.CellPadding.X) / 100;
var sizeMods = availableSizePercent * 35;
var sizeFolders = availableSizePercent * 65;
@ -84,7 +84,7 @@ public class MultiModPanel(ModFileSystemSelector selector, ModDataEditor editor,
}
}
ImGui.Separator();
Im.Separator();
return leaves;
}
@ -100,9 +100,9 @@ public class MultiModPanel(ModFileSystemSelector selector, ModDataEditor editor,
var predefinedTagsEnabled = tagManager.Enabled;
var inputWidth = predefinedTagsEnabled
? Im.ContentRegion.Available.X - 2 * width.X - 3 * ImGui.GetStyle().ItemInnerSpacing.X - Im.Style.FrameHeight
: Im.ContentRegion.Available.X - 2 * (width.X + ImGui.GetStyle().ItemInnerSpacing.X);
ImGui.SetNextItemWidth(inputWidth);
? Im.ContentRegion.Available.X - 2 * width.X - 3 * Im.Style.ItemInnerSpacing.X - Im.Style.FrameHeight
: Im.ContentRegion.Available.X - 2 * (width.X + Im.Style.ItemInnerSpacing.X);
Im.Item.SetNextWidth(inputWidth);
ImUtf8.InputText("##tag"u8, ref _tag, "Local Tag Name..."u8);
UpdateTagCache();
@ -114,7 +114,7 @@ public class MultiModPanel(ModFileSystemSelector selector, ModDataEditor editor,
? "No tag specified."
: $"All mods selected already contain the tag \"{_tag}\", either locally or as mod data."
: $"Add the tag \"{_tag}\" to {_addMods.Count} mods as a local tag:\n\n\t{string.Join("\n\t", _addMods.Select(m => m.Name))}";
ImUtf8.SameLineInner();
Im.Line.SameInner();
if (ImUtf8.ButtonEx(label, tooltip, width, _addMods.Count == 0))
foreach (var mod in _addMods)
editor.ChangeLocalTag(mod, mod.LocalTags.Count, _tag);
@ -127,19 +127,19 @@ public class MultiModPanel(ModFileSystemSelector selector, ModDataEditor editor,
? "No tag specified."
: $"No selected mod contains the tag \"{_tag}\" locally."
: $"Remove the local tag \"{_tag}\" from {_removeMods.Count} mods:\n\n\t{string.Join("\n\t", _removeMods.Select(m => m.Item1.Name))}";
ImUtf8.SameLineInner();
Im.Line.SameInner();
if (ImUtf8.ButtonEx(label, tooltip, width, _removeMods.Count == 0))
foreach (var (mod, index) in _removeMods)
editor.ChangeLocalTag(mod, index, string.Empty);
if (predefinedTagsEnabled)
{
ImUtf8.SameLineInner();
Im.Line.SameInner();
tagManager.DrawToggleButton();
tagManager.DrawListMulti(selector.SelectedPaths.OfType<ModFileSystem.Leaf>().Select(l => l.Value));
}
ImGui.Separator();
Im.Separator();
}
private void UpdateTagCache()

View file

@ -68,14 +68,14 @@ internal sealed class ResourceWatcherTable : Table<Record>
else
{
var fileName = path.LastIndexOf((byte)'/');
using (ImRaii.Group())
using (Im.Group())
{
CiByteString shortPath;
if (fileName != -1)
{
using var font = ImRaii.PushFont(UiBuilder.IconFont);
clicked = ImUtf8.Selectable(FontAwesomeIcon.EllipsisH.ToIconString());
ImUtf8.SameLineInner();
Im.Line.SameInner();
shortPath = path.Substring(fileName, path.Length - fileName);
}
else
@ -124,14 +124,14 @@ internal sealed class ResourceWatcherTable : Table<Record>
public override void DrawColumn(Record item, int idx)
{
ImGui.TextUnformatted(item.RecordType switch
Im.Text(item.RecordType switch
{
RecordType.Request => "REQ",
RecordType.ResourceLoad => "LOAD",
RecordType.FileLoad => "FILE",
RecordType.Destruction => "DEST",
RecordType.ResourceComplete => "DONE",
_ => string.Empty,
RecordType.Request => "REQ"u8,
RecordType.ResourceLoad => "LOAD"u8,
RecordType.FileLoad => "FILE"u8,
RecordType.Destruction => "DEST"u8,
RecordType.ResourceComplete => "DONE"u8,
_ => StringU8.Empty,
});
}
}
@ -145,7 +145,7 @@ internal sealed class ResourceWatcherTable : Table<Record>
=> lhs.Time.CompareTo(rhs.Time);
public override void DrawColumn(Record item, int _)
=> ImGui.TextUnformatted($"{item.Time.ToLongTimeString()}.{item.Time.Millisecond:D4}");
=> Im.Text($"{item.Time.ToLongTimeString()}.{item.Time.Millisecond:D4}");
}
private sealed class Crc64Column : ColumnString<Record>
@ -228,7 +228,7 @@ internal sealed class ResourceWatcherTable : Table<Record>
public override void DrawColumn(Record item, int idx)
{
ImGui.TextUnformatted(item.Category.ToString());
Im.Text($"{item.Category}");
}
}
@ -265,7 +265,7 @@ internal sealed class ResourceWatcherTable : Table<Record>
public override void DrawColumn(Record item, int idx)
{
ImGui.TextUnformatted(item.ResourceType.ToString().ToLowerInvariant());
Im.Text($"{item.ResourceType.ToString().ToLowerInvariant()}");
}
}
@ -406,12 +406,13 @@ internal sealed class ResourceWatcherTable : Table<Record>
protected static void DrawColumn(OptionalBool b)
{
using var font = ImRaii.PushFont(UiBuilder.IconFont);
ImGui.TextUnformatted(b.Value switch
if (!b.HasValue)
return;
ImEx.Icon.Draw(b.Value switch
{
null => string.Empty,
true => FontAwesomeIcon.Check.ToIconString(),
false => FontAwesomeIcon.Times.ToIconString(),
true => FontAwesomeIcon.Check.Icon(),
_ => FontAwesomeIcon.Times.Icon(),
});
}
}

View file

@ -25,9 +25,9 @@ public class ChangedItemsTab(
public ReadOnlySpan<byte> Label
=> "Changed Items"u8;
private string _changedItemFilter = string.Empty;
private string _changedItemModFilter = string.Empty;
private Vector2 _buttonSize;
private string _changedItemFilter = string.Empty;
private string _changedItemModFilter = string.Empty;
private Vector2 _buttonSize;
public void DrawContent()
{
@ -38,14 +38,14 @@ public class ChangedItemsTab(
if (!child)
return;
_buttonSize = new Vector2(ImGui.GetStyle().ItemSpacing.Y + Im.Style.FrameHeight);
using var style = ImRaii.PushStyle(ImGuiStyleVar.CellPadding, Vector2.Zero)
.Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
.Push(ImGuiStyleVar.FramePadding, Vector2.Zero)
.Push(ImGuiStyleVar.SelectableTextAlign, new Vector2(0.01f, 0.5f));
_buttonSize = new Vector2(Im.Style.ItemSpacing.Y + Im.Style.FrameHeight);
using var style = ImStyleDouble.CellPadding.Push(Vector2.Zero)
.Push(ImStyleDouble.ItemSpacing, Vector2.Zero)
.Push(ImStyleDouble.FramePadding, Vector2.Zero)
.Push(ImStyleDouble.SelectableTextAlign, new Vector2(0.01f, 0.5f));
var skips = ImGuiClip.GetNecessarySkips(_buttonSize.Y);
using var table = Im.Table.Begin("##changedItems"u8, 3, TableFlags.RowBackground, -Vector2.One);
using var table = Im.Table.Begin("##changedItems"u8, 3, TableFlags.RowBackground, -Vector2.One);
if (!table)
return;
@ -64,11 +64,11 @@ public class ChangedItemsTab(
{
var varWidth = Im.ContentRegion.Available.X
- 450 * Im.Style.GlobalScale
- ImGui.GetStyle().ItemSpacing.X;
ImGui.SetNextItemWidth(450 * Im.Style.GlobalScale);
- Im.Style.ItemSpacing.X;
Im.Item.SetNextWidth(450 * Im.Style.GlobalScale);
Im.Input.Text("##changedItemsFilter"u8, ref _changedItemFilter, "Filter Item..."u8);
Im.Line.Same();
ImGui.SetNextItemWidth(varWidth);
Im.Item.SetNextWidth(varWidth);
Im.Input.Text("##changedItemsModFilter"u8, ref _changedItemModFilter, "Filter Mods..."u8);
return varWidth;
}
@ -76,14 +76,15 @@ public class ChangedItemsTab(
/// <summary> Apply the current filters. </summary>
private bool FilterChangedItem(KeyValuePair<string, (Luna.SingleArray<IMod>, IIdentifiedObjectData)> item)
=> drawer.FilterChangedItem(item.Key, item.Value.Item2, _changedItemFilter)
&& (_changedItemModFilter.Length is 0 || item.Value.Item1.Any(m => m.Name.Contains(_changedItemModFilter, StringComparison.OrdinalIgnoreCase)));
&& (_changedItemModFilter.Length is 0
|| item.Value.Item1.Any(m => m.Name.Contains(_changedItemModFilter, StringComparison.OrdinalIgnoreCase)));
/// <summary> Draw a full column for a changed item. </summary>
private void DrawChangedItemColumn(KeyValuePair<string, (Luna.SingleArray<IMod>, IIdentifiedObjectData)> item)
{
ImGui.TableNextColumn();
drawer.DrawCategoryIcon(item.Value.Item2, _buttonSize.Y);
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
var name = item.Value.Item2.ToName(item.Key);
var clicked = ImUtf8.Selectable(name, false, ImGuiSelectableFlags.None, _buttonSize with { X = 0 });
drawer.ChangedItemHandling(item.Value.Item2, clicked);

View file

@ -60,7 +60,7 @@ public sealed class CollectionsTab : IDisposable, ITab, Luna.IUiService
public void DrawContent()
{
var width = ImGui.CalcTextSize("nnnnnnnnnnnnnnnnnnnnnnnnnn").X;
using (var group = ImRaii.Group())
using (Im.Group())
{
_selector.Draw(width);
}
@ -68,7 +68,7 @@ public sealed class CollectionsTab : IDisposable, ITab, Luna.IUiService
_tutorial.OpenTutorial(BasicTutorialSteps.EditingCollections);
Im.Line.Same();
using (var group = ImRaii.Group())
using (Im.Group())
{
DrawHeaderLine();
DrawPanel();
@ -83,10 +83,10 @@ public sealed class CollectionsTab : IDisposable, ITab, Luna.IUiService
private void DrawHeaderLine()
{
var withSpacing = Im.Style.FrameHeightWithSpacing;
using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 0).Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
using var style = ImStyleSingle.FrameRounding.Push(0).Push(ImStyleDouble.ItemSpacing, Vector2.Zero);
var buttonSize = new Vector2((Im.ContentRegion.Available.X - withSpacing) / 4f, Im.Style.FrameHeight);
using var _ = ImRaii.Group();
using var _ = Im.Group();
var tabSelectedColor = Im.Style[ImGuiColor.TabSelected];
using var color = ImGuiColor.Button.Push(tabSelectedColor, Mode is PanelMode.SimpleAssignment);
if (ImGui.Button("Simple Assignments", buttonSize))
@ -121,8 +121,8 @@ public sealed class CollectionsTab : IDisposable, ITab, Luna.IUiService
private void DrawPanel()
{
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
using var child = ImRaii.Child("##CollectionSettings", new Vector2(Im.ContentRegion.Available.X, 0), true);
using var style = ImStyleDouble.ItemSpacing.Push(Vector2.Zero);
using var child = ImRaii.Child("##CollectionSettings", Im.ContentRegion.Available with { Y = 0 }, true);
if (!child)
return;
@ -143,6 +143,6 @@ public sealed class CollectionsTab : IDisposable, ITab, Luna.IUiService
break;
}
style.Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
style.Push(ImStyleDouble.ItemSpacing, Vector2.Zero);
}
}

View file

@ -10,33 +10,33 @@ public static class CrashDataExtensions
{
public static void DrawMeta(this CrashData data)
{
using (ImRaii.Group())
using (Im.Group())
{
ImGui.TextUnformatted(nameof(data.Mode));
ImGui.TextUnformatted(nameof(data.CrashTime));
ImGui.TextUnformatted("Current Age");
ImGui.TextUnformatted(nameof(data.Version));
ImGui.TextUnformatted(nameof(data.GameVersion));
ImGui.TextUnformatted(nameof(data.ExitCode));
ImGui.TextUnformatted(nameof(data.ProcessId));
ImGui.TextUnformatted(nameof(data.TotalModdedFilesLoaded));
ImGui.TextUnformatted(nameof(data.TotalCharactersLoaded));
ImGui.TextUnformatted(nameof(data.TotalVFXFuncsInvoked));
Im.Text(nameof(data.Mode));
Im.Text(nameof(data.CrashTime));
Im.Text("Current Age"u8);
Im.Text(nameof(data.Version));
Im.Text(nameof(data.GameVersion));
Im.Text(nameof(data.ExitCode));
Im.Text(nameof(data.ProcessId));
Im.Text(nameof(data.TotalModdedFilesLoaded));
Im.Text(nameof(data.TotalCharactersLoaded));
Im.Text(nameof(data.TotalVFXFuncsInvoked));
}
Im.Line.Same();
using (ImRaii.Group())
using (Im.Group())
{
ImGui.TextUnformatted(data.Mode);
ImGui.TextUnformatted(data.CrashTime.ToString());
ImGui.TextUnformatted((DateTimeOffset.UtcNow - data.CrashTime).ToString(@"dd\.hh\:mm\:ss"));
ImGui.TextUnformatted(data.Version);
ImGui.TextUnformatted(data.GameVersion);
ImGui.TextUnformatted(data.ExitCode.ToString());
ImGui.TextUnformatted(data.ProcessId.ToString());
ImGui.TextUnformatted(data.TotalModdedFilesLoaded.ToString());
ImGui.TextUnformatted(data.TotalCharactersLoaded.ToString());
ImGui.TextUnformatted(data.TotalVFXFuncsInvoked.ToString());
Im.Text(data.Mode);
Im.Text($"{data.CrashTime}");
Im.Text((DateTimeOffset.UtcNow - data.CrashTime).ToString(@"dd\.hh\:mm\:ss"));
Im.Text(data.Version);
Im.Text(data.GameVersion);
Im.Text($"{data.ExitCode}");
Im.Text($"{data.ProcessId}");
Im.Text($"{data.TotalModdedFilesLoaded}");
Im.Text($"{data.TotalCharactersLoaded}");
Im.Text($"{data.TotalVFXFuncsInvoked}");
}
}

View file

@ -25,7 +25,7 @@ public class CrashHandlerPanel(CrashHandlerService service, Configuration config
private void DrawData()
{
using var _ = ImRaii.Group();
using var _ = Im.Group();
using var header = ImRaii.CollapsingHeader("Crash Handler");
if (!header)
return;
@ -76,7 +76,7 @@ public class CrashHandlerPanel(CrashHandlerService service, Configuration config
{
dragDrop.CreateImGuiSource("LogDragDrop", m => m.Files.Any(f => f.EndsWith("Penumbra.log")), m =>
{
ImGui.TextUnformatted("Dragging Penumbra.log for import.");
Im.Text("Dragging Penumbra.log for import."u8);
return true;
});
}
@ -118,7 +118,7 @@ public class CrashHandlerPanel(CrashHandlerService service, Configuration config
if (data == null)
{
ImGui.TextUnformatted("Nothing loaded.");
Im.Text("Nothing loaded."u8);
return;
}

View file

@ -344,7 +344,7 @@ public class DebugTab : Window, ITab
ImGui.TableNextColumn();
var index = mod.Index;
if (index != lastIndex + 1)
ImGui.TextUnformatted("!!!");
Im.Text("!!!"u8);
lastIndex = index;
}
}
@ -364,7 +364,7 @@ public class DebugTab : Window, ITab
PrintValue("Import Window Was Drawn", _importPopup.WasDrawn.ToString());
PrintValue("Import Popup Was Drawn", _importPopup.PopupWasDrawn.ToString());
ImGui.TableNextColumn();
ImGui.TextUnformatted("Import Batches");
Im.Text("Import Batches"u8);
ImGui.TableNextColumn();
foreach (var (index, batch) in _modImporter.ModBatches.Index())
{
@ -373,13 +373,13 @@ public class DebugTab : Window, ITab
}
ImGui.TableNextColumn();
ImGui.TextUnformatted("Addable Mods");
Im.Text("Addable Mods"u8);
ImGui.TableNextColumn();
foreach (var mod in _modImporter.AddableMods)
{
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.TextUnformatted(mod.Name);
Im.Text(mod.Name);
}
}
}
@ -582,7 +582,7 @@ public class DebugTab : Window, ITab
if (!ImGui.CollapsingHeader("Path Resolver"))
return;
ImGui.TextUnformatted(
Im.Text(
$"Last Game Object: 0x{_collectionResolver.IdentifyLastGameObjectCollection(true).AssociatedGameObject:X} ({_collectionResolver.IdentifyLastGameObjectCollection(true).ModCollection.Identity.Name})");
using (var drawTree = Im.Tree.Node("Draw Object to Object"u8))
{
@ -627,9 +627,9 @@ public class DebugTab : Window, ITab
foreach (var data in _pathState.CurrentData)
{
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{data.AssociatedGameObject:X}");
Im.Text($"{data.AssociatedGameObject:X}");
ImGui.TableNextColumn();
ImGui.TextUnformatted(data.ModCollection.Identity.Name);
Im.Text(data.ModCollection.Identity.Name);
}
}
}
@ -726,7 +726,7 @@ public class DebugTab : Window, ITab
agent = &AgentBannerMIP.Instance()->AgentBannerInterface;
ImUtf8.Text("Agent: ");
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
Penumbra.Dynamis.DrawPointer((nint)agent);
if (agent->Data != null)
{
@ -742,7 +742,7 @@ public class DebugTab : Window, ITab
}
else
{
ImGui.TextUnformatted("INACTIVE");
Im.Text("INACTIVE"u8);
}
}
}
@ -877,9 +877,9 @@ public class DebugTab : Window, ITab
p =>
{
ImGui.TableNextColumn();
ImGui.TextUnformatted(p.Key);
Im.Text(p.Key);
ImGui.TableNextColumn();
ImGui.TextUnformatted(string.Join(", ", p.Value.Select(v => v.Name.ToDalamudString().TextValue)));
Im.Text(StringU8.Join(", "u8, p.Value.Select(v => v.Name.ToDalamudString().TextValue)));
});
ImGuiClip.DrawEndDummy(dummy, Im.Style.TextHeightWithSpacing);
}
@ -952,7 +952,7 @@ public class DebugTab : Window, ITab
var frame = new Vector2(Im.Style.TextHeight);
ImGui.ColorButton("###color", new Vector4(MtrlTab.PseudoSqrtRgb((Vector3)color), 1), 0, frame);
Im.Line.Same();
ImGui.TextUnformatted($"{color.Red:F6} | {color.Green:F6} | {color.Blue:F6}");
Im.Text($"{color.Red:F6} | {color.Green:F6} | {color.Blue:F6}");
}
foreach (var list in data.Scalars)
@ -989,68 +989,41 @@ public class DebugTab : Window, ITab
table.SetupColumn("\u0394 Slow-Path Calls"u8, TableColumnFlags.WidthStretch, 0.2f);
ImGui.TableHeadersRow();
ImGui.TableNextColumn();
ImGui.TextUnformatted("characterglass.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedCharacterGlassShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.CharacterGlass}");
table.DrawColumn("characterglass.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedCharacterGlassShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.CharacterGlass}");
ImGui.TableNextColumn();
ImGui.TextUnformatted("characterlegacy.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedCharacterLegacyShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.CharacterLegacy}");
table.DrawColumn("characterlegacy.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedCharacterLegacyShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.CharacterLegacy}");
ImGui.TableNextColumn();
ImGui.TextUnformatted("characterocclusion.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedCharacterOcclusionShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.CharacterOcclusion}");
table.DrawColumn("characterocclusion.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedCharacterOcclusionShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.CharacterOcclusion}");
ImGui.TableNextColumn();
ImGui.TextUnformatted("characterstockings.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedCharacterStockingsShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.CharacterStockings}");
table.DrawColumn("characterstockings.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedCharacterStockingsShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.CharacterStockings}");
ImGui.TableNextColumn();
ImGui.TextUnformatted("charactertattoo.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedCharacterTattooShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.CharacterTattoo}");
table.DrawColumn("charactertattoo.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedCharacterTattooShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.CharacterTattoo}");
ImGui.TableNextColumn();
ImGui.TextUnformatted("charactertransparency.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedCharacterTransparencyShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.CharacterTransparency}");
table.DrawColumn("charactertransparency.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedCharacterTransparencyShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.CharacterTransparency}");
ImGui.TableNextColumn();
ImGui.TextUnformatted("hairmask.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedHairMaskShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.HairMask}");
table.DrawColumn("hairmask.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedHairMaskShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.HairMask}");
ImGui.TableNextColumn();
ImGui.TextUnformatted("iris.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedIrisShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.Iris}");
table.DrawColumn("iris.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedIrisShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.Iris}");
ImGui.TableNextColumn();
ImGui.TextUnformatted("skin.shpk");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{_shaderReplacementFixer.ModdedSkinShpkCount}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{slowPathCallDeltas.Skin}");
table.DrawColumn("skin.shpk"u8);
table.DrawColumn($"{_shaderReplacementFixer.ModdedSkinShpkCount}");
table.DrawColumn($"{slowPathCallDeltas.Skin}");
}
/// <summary> Draw information about the models, materials and resources currently loaded by the local player. </summary>
@ -1102,7 +1075,7 @@ public class DebugTab : Window, ITab
var imc = (ResourceHandle*)model->IMCArray[i];
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TextUnformatted($"Slot {i}");
Im.Text($"Slot {i}");
ImGui.TableNextColumn();
Penumbra.Dynamis.DrawPointer((nint)imc);
ImGui.TableNextColumn();
@ -1200,18 +1173,12 @@ public class DebugTab : Window, ITab
if (r->RefCount < 10000)
return;
ImGui.TableNextColumn();
ImGui.TextUnformatted(((ResourceCategory)r->Type.Value).ToString());
ImGui.TableNextColumn();
ImGui.TextUnformatted(r->FileType.ToString("X"));
ImGui.TableNextColumn();
ImGui.TextUnformatted(r->Id.ToString("X"));
ImGui.TableNextColumn();
ImGui.TextUnformatted(((ulong)r).ToString("X"));
ImGui.TableNextColumn();
ImGui.TextUnformatted(r->RefCount.ToString());
ImGui.TableNextColumn();
Im.Text(r->FileName.AsSpan());
Im.Table.DrawColumn($"{(ResourceCategory)r->Type.Value}");
Im.Table.DrawColumn($"{r->FileType:X}");
Im.Table.DrawColumn($"{r->Id:X}");
Im.Table.DrawColumn($"{(ulong)r:X}");
Im.Table.DrawColumn($"{r->RefCount}");
Im.Table.DrawColumn(r->FileName.AsSpan());
});
}
@ -1266,9 +1233,9 @@ public class DebugTab : Window, ITab
private static void PrintValue(string name, string value)
{
ImGui.TableNextColumn();
ImGui.TextUnformatted(name);
Im.Text(name);
ImGui.TableNextColumn();
ImGui.TextUnformatted(value);
Im.Text(value);
}
public override void Draw()
@ -1289,7 +1256,7 @@ public class DebugTab : Window, ITab
public static unsafe void DrawCopyableAddress(ReadOnlySpan<byte> label, nint address)
{
Penumbra.Dynamis.DrawPointer(address);
ImUtf8.SameLineInner();
Im.Line.SameInner();
ImUtf8.Text(label);
}
}

View file

@ -53,7 +53,7 @@ public class RenderTargetDrawer(RenderTargetHdrEnabler renderTargetHdrEnabler, D
DrawStatistics();
ImUtf8.Dummy(0);
ImGui.Separator();
Im.Separator();
ImUtf8.Dummy(0);
var report = renderTargetHdrEnabler.TextureReport;
if (report == null)

View file

@ -96,7 +96,7 @@ public class ShapeInspector(ObjectManager objects, CollectionResolver resolver)
{
using var color = ImGuiColor.Text.Push(disabledColor, !value);
ImUtf8.Text("All, "u8);
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
}
foreach (var slot in ShapeAttributeManager.UsedModels)
@ -106,7 +106,7 @@ public class ShapeInspector(ObjectManager objects, CollectionResolver resolver)
using var color = ImGuiColor.Text.Push(disabledColor, !value2);
ImUtf8.Text($"All {slot.ToName()}, ");
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
}
foreach (var gr in ShapeAttributeHashSet.GenderRaceValues.Skip(1))
@ -115,7 +115,7 @@ public class ShapeInspector(ObjectManager objects, CollectionResolver resolver)
{
using var color = ImGuiColor.Text.Push(disabledColor, !value3);
ImUtf8.Text($"All {gr.ToName()}, ");
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
}
else
{
@ -126,7 +126,7 @@ public class ShapeInspector(ObjectManager objects, CollectionResolver resolver)
using var color = ImGuiColor.Text.Push(disabledColor, !value4);
ImUtf8.Text($"All {gr.ToName()} {slot.ToName()}, ");
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
}
}
}
@ -141,7 +141,7 @@ public class ShapeInspector(ObjectManager objects, CollectionResolver resolver)
{
using var color = ImGuiColor.Text.Push(disabledColor, !enabled);
ImUtf8.Text($"{slot.ToName()} {id.Id:D4}, ");
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
}
}
else
@ -156,7 +156,7 @@ public class ShapeInspector(ObjectManager objects, CollectionResolver resolver)
{
using var color = ImGuiColor.Text.Push(disabledColor, !enabled);
ImUtf8.Text($"{gr.ToName()} {slot.ToName()} #{id.Id:D4}, ");
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
}
currentFlags &= ~0x3u;
@ -208,10 +208,10 @@ public class ShapeInspector(ObjectManager objects, CollectionResolver resolver)
var disabled = (mask & (1u << flag)) is 0;
using var color = ImGuiColor.Text.Push(disabledColor, disabled);
ImUtf8.Text(shape.AsSpan());
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
ImUtf8.Text(", "u8);
if (idx % 8 < 7)
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
}
}
else
@ -265,10 +265,10 @@ public class ShapeInspector(ObjectManager objects, CollectionResolver resolver)
var disabled = (mask & (1u << flag)) is 0;
using var color = ImGuiColor.Text.Push(disabledColor, disabled);
ImUtf8.Text(attribute.AsSpan());
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
ImUtf8.Text(", "u8);
if (idx % 8 < 7)
ImGui.SameLine(0, 0);
Im.Line.Same(0, 0);
}
}
else

View file

@ -30,7 +30,7 @@ public class EffectiveTab(CollectionManager collectionManager, CollectionSelectH
if (!child)
return;
var height = Im.Style.TextHeightWithSpacing + 2 * ImGui.GetStyle().CellPadding.Y;
var height = Im.Style.TextHeightWithSpacing + 2 * Im.Style.CellPadding.Y;
var skips = ImGuiClip.GetNecessarySkips(height);
using var table = Im.Table.Begin("##EffectiveChangesTable"u8, 3, TableFlags.RowBackground);
if (!table)
@ -73,12 +73,12 @@ public class EffectiveTab(CollectionManager collectionManager, CollectionSelectH
private void DrawFilters()
{
var tmp = _effectiveGamePathFilter;
ImGui.SetNextItemWidth(_effectiveLeftTextLength);
Im.Item.SetNextWidth(_effectiveLeftTextLength);
if (ImGui.InputTextWithHint("##gamePathFilter", "Filter game path...", ref tmp, 256))
_effectiveGamePathFilter = tmp;
ImGui.SameLine(_effectiveArrowLength + _effectiveLeftTextLength + 3 * ImGui.GetStyle().ItemSpacing.X);
ImGui.SetNextItemWidth(-1);
Im.Line.Same(_effectiveArrowLength + _effectiveLeftTextLength + 3 * Im.Style.ItemSpacing.X);
Im.Item.SetNextWidth(-1);
tmp = _effectiveFilePathFilter;
if (ImGui.InputTextWithHint("##fileFilter", "Filter file path...", ref tmp, 256))
_effectiveFilePathFilter = tmp;

View file

@ -56,21 +56,21 @@ public class ModsTab(
selector.Draw();
Im.Line.Same();
ImGui.SetCursorPosX(MathF.Round(ImGui.GetCursorPosX()));
using var group = ImRaii.Group();
using var group = Im.Group();
collectionHeader.Draw(false);
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
using (var child = ImRaii.Child("##ModsTabMod", new Vector2(Im.ContentRegion.Available.X, config.HideRedrawBar ? 0 : -Im.Style.FrameHeight),
using var style = ImStyleDouble.ItemSpacing.Push(Vector2.Zero);
using (var child = ImRaii.Child("##ModsTabMod", Im.ContentRegion.Available with { Y = config.HideRedrawBar ? 0 : -Im.Style.FrameHeight },
true, ImGuiWindowFlags.HorizontalScrollbar))
{
style.Pop();
if (child)
panel.Draw();
style.Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
style.Push(ImStyleDouble.ItemSpacing, Vector2.Zero);
}
style.Push(ImGuiStyleVar.FrameRounding, 0);
style.Push(ImStyleSingle.FrameRounding, 0);
DrawRedrawLine();
}
catch (Exception e)
@ -96,7 +96,7 @@ public class ModsTab(
var frameHeight = new Vector2(0, Im.Style.FrameHeight);
var frameColor = ImGuiColor.FrameBackground.Get().Color;
using (var _ = ImRaii.Group())
using (Im.Group())
{
using (ImRaii.PushFont(UiBuilder.IconFont))
{

View file

@ -25,7 +25,7 @@ public class ResourceTab(Configuration config, ResourceManagerService resourceMa
public void DrawContent()
{
// Filter for resources containing the input string.
ImGui.SetNextItemWidth(-1);
Im.Item.SetNextWidth(-1);
ImGui.InputTextWithHint("##resourceFilter", "Filter...", ref _resourceManagerFilter, Utf8GamePath.MaxGamePathLength);
using var child = ImRaii.Child("##ResourceManagerTab", -Vector2.One);
@ -40,9 +40,9 @@ public class ResourceTab(Configuration config, ResourceManagerService resourceMa
Im.Line.New();
unsafe
{
ImGui.TextUnformatted(
Im.Text(
$"Static Address: 0x{(ulong)resourceManager.ResourceManagerAddress:X} (+0x{(ulong)resourceManager.ResourceManagerAddress - (ulong)sigScanner.Module.BaseAddress:X})");
ImGui.TextUnformatted($"Actual Address: 0x{(ulong)resourceManager.ResourceManager:X}");
Im.Text($"Actual Address: 0x{(ulong)resourceManager.ResourceManager:X}");
}
}

View file

@ -339,9 +339,9 @@ public class SettingsTab : ITab, IUiService
_newModDirectory = _config.ModDirectory;
bool save, selected;
using (ImRaii.Group())
using (Im.Group())
{
ImGui.SetNextItemWidth(UiHelpers.InputTextMinusButton3);
Im.Item.SetNextWidth(UiHelpers.InputTextMinusButton3);
using (var color = ImStyleBorder.Frame.Push(Colors.RegexWarningBorder, Im.Style.GlobalScale, !_modManager.Valid))
{
color.Push(ImGuiColor.TextDisabled, Colors.RegexWarningBorder, !_modManager.Valid);
@ -350,7 +350,7 @@ public class SettingsTab : ITab, IUiService
}
selected = ImGui.IsItemActive();
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(Im.Style.GlobalScale * 3, 0));
using var style = ImStyleDouble.ItemSpacing.Push(new Vector2(Im.Style.GlobalScale * 3, 0));
Im.Line.Same();
DrawDirectoryPickerButton();
style.Pop();
@ -365,7 +365,7 @@ public class SettingsTab : ITab, IUiService
ImGuiComponents.HelpMarker(tt);
_tutorial.OpenTutorial(BasicTutorialSteps.GeneralTooltips);
Im.Line.Same();
ImGui.TextUnformatted("Root Directory");
Im.Text("Root Directory"u8);
ImGuiUtil.HoverTooltip(tt);
}
@ -444,7 +444,7 @@ public class SettingsTab : ITab, IUiService
if (_singleGroupRadioMax == int.MaxValue)
_singleGroupRadioMax = _config.SingleGroupRadioMax;
ImGui.SetNextItemWidth(UiHelpers.InputTextWidth.X);
Im.Item.SetNextWidth(UiHelpers.InputTextWidth.X);
if (ImGui.DragInt("##SingleSelectRadioMax", ref _singleGroupRadioMax, 0.01f, 1))
_singleGroupRadioMax = Math.Max(1, _singleGroupRadioMax);
@ -472,7 +472,7 @@ public class SettingsTab : ITab, IUiService
if (_collapsibleGroupMin == int.MaxValue)
_collapsibleGroupMin = _config.OptionGroupCollapsibleMin;
ImGui.SetNextItemWidth(UiHelpers.InputTextWidth.X);
Im.Item.SetNextWidth(UiHelpers.InputTextWidth.X);
if (ImGui.DragInt("##CollapsibleGroupMin", ref _collapsibleGroupMin, 0.01f, 1))
_collapsibleGroupMin = Math.Max(2, _collapsibleGroupMin);
@ -598,7 +598,7 @@ public class SettingsTab : ITab, IUiService
private void DrawFolderSortType()
{
var sortMode = _config.SortMode;
ImGui.SetNextItemWidth(UiHelpers.InputTextWidth.X);
Im.Item.SetNextWidth(UiHelpers.InputTextWidth.X);
using (var combo = ImUtf8.Combo("##sortMode", sortMode.Name))
{
if (combo)
@ -620,7 +620,7 @@ public class SettingsTab : ITab, IUiService
private void DrawRenameSettings()
{
ImGui.SetNextItemWidth(UiHelpers.InputTextWidth.X);
Im.Item.SetNextWidth(UiHelpers.InputTextWidth.X);
using (var combo = ImRaii.Combo("##renameSettings", _config.ShowRename.GetData().Name))
{
if (combo)
@ -643,7 +643,7 @@ public class SettingsTab : ITab, IUiService
"Select which of the two renaming input fields are visible when opening the right-click context menu of a mod in the mod selector.";
ImGuiComponents.HelpMarker(tt);
Im.Line.Same();
ImGui.TextUnformatted("Rename Fields in Mod Context Menu");
Im.Text("Rename Fields in Mod Context Menu"u8);
ImGuiUtil.HoverTooltip(tt);
}
@ -740,9 +740,9 @@ public class SettingsTab : ITab, IUiService
{
var tmp = _config.DefaultModImportPath;
var spacing = new Vector2(Im.Style.GlobalScale * 3);
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing);
using var style = ImStyleDouble.ItemSpacing.Push(spacing);
ImGui.SetNextItemWidth(UiHelpers.InputTextMinusButton3);
Im.Item.SetNextWidth(UiHelpers.InputTextMinusButton3);
if (ImGui.InputText("##defaultModImport", ref tmp, 256))
_config.DefaultModImportPath = tmp;
@ -781,8 +781,8 @@ public class SettingsTab : ITab, IUiService
{
var tmp = _config.ExportDirectory;
var spacing = new Vector2(Im.Style.GlobalScale * 3);
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing);
ImGui.SetNextItemWidth(UiHelpers.InputTextMinusButton3);
using var style = ImStyleDouble.ItemSpacing.Push(spacing);
Im.Item.SetNextWidth(UiHelpers.InputTextMinusButton3);
if (ImGui.InputText("##defaultModExport", ref tmp, 256))
_tempExportDirectory = tmp;
@ -818,8 +818,8 @@ public class SettingsTab : ITab, IUiService
{
var tmp = _tempWatchDirectory ?? _config.WatchDirectory;
var spacing = new Vector2(Im.Style.GlobalScale * 3);
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing);
ImGui.SetNextItemWidth(UiHelpers.InputTextMinusButton3);
using var style = ImStyleDouble.ItemSpacing.Push(spacing);
Im.Item.SetNextWidth(UiHelpers.InputTextMinusButton3);
if (ImGui.InputText("##fileWatchPath", ref tmp, 256))
_tempWatchDirectory = tmp;
@ -830,7 +830,7 @@ public class SettingsTab : ITab, IUiService
_tempWatchDirectory = null;
}
ImGui.SameLine();
Im.Line.Same();
if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Folder.ToIconString()}##fileWatch", UiHelpers.IconButtonSize,
"Select a directory via dialog.", false, true))
{
@ -855,7 +855,7 @@ public class SettingsTab : ITab, IUiService
private void DrawDefaultModAuthor()
{
var tmp = _config.DefaultModAuthor;
ImGui.SetNextItemWidth(UiHelpers.InputTextWidth.X);
Im.Item.SetNextWidth(UiHelpers.InputTextWidth.X);
if (ImGui.InputText("##defaultAuthor", ref tmp, 64))
_config.DefaultModAuthor = tmp;
@ -869,7 +869,7 @@ public class SettingsTab : ITab, IUiService
private void DrawDefaultModImportFolder()
{
var tmp = _config.DefaultImportFolder;
ImGui.SetNextItemWidth(UiHelpers.InputTextWidth.X);
Im.Item.SetNextWidth(UiHelpers.InputTextWidth.X);
if (ImGui.InputText("##defaultImportFolder", ref tmp, 64))
_config.DefaultImportFolder = tmp;
@ -884,7 +884,7 @@ public class SettingsTab : ITab, IUiService
private void DrawPcpFolder()
{
var tmp = _config.PcpSettings.FolderName;
ImGui.SetNextItemWidth(UiHelpers.InputTextWidth.X);
Im.Item.SetNextWidth(UiHelpers.InputTextWidth.X);
if (ImUtf8.InputText("##pcpFolder"u8, ref tmp))
_config.PcpSettings.FolderName = tmp;
@ -898,7 +898,7 @@ public class SettingsTab : ITab, IUiService
private void DrawPcpExtension()
{
var tmp = _config.PcpSettings.PcpExtension;
ImGui.SetNextItemWidth(UiHelpers.InputTextWidth.X);
Im.Item.SetNextWidth(UiHelpers.InputTextWidth.X);
if (ImUtf8.InputText("##pcpExtension"u8, ref tmp))
_config.PcpSettings.PcpExtension = tmp;
@ -975,10 +975,10 @@ public class SettingsTab : ITab, IUiService
DrawWaitForPluginsReflection();
DrawEnableHttpApiBox();
DrawEnableDebugModeBox();
ImGui.Separator();
Im.Separator();
DrawReloadResourceButton();
DrawReloadFontsButton();
ImGui.Separator();
Im.Separator();
DrawCleanupButtons();
Im.Line.New();
}
@ -1027,7 +1027,7 @@ public class SettingsTab : ITab, IUiService
if (_compactor.MassCompactRunning)
{
ImGui.ProgressBar((float)_compactor.CurrentIndex / _compactor.TotalFiles,
new Vector2(Im.ContentRegion.Available.X - ImGui.GetStyle().ItemSpacing.X - UiHelpers.IconButtonSize.X,
new Vector2(Im.ContentRegion.Available.X - Im.Style.ItemSpacing.X - UiHelpers.IconButtonSize.X,
Im.Style.FrameHeight),
_compactor.CurrentFile?.FullName[(_modManager.BasePath.FullName.Length + 1)..] ?? "Gathering Files...");
Im.Line.Same();
@ -1055,19 +1055,19 @@ public class SettingsTab : ITab, IUiService
? "Height is smaller than default: This may look undesirable."
: string.Empty;
var buttonWidth = UiHelpers.InputTextWidth.X / 2.5f;
ImGui.SetNextItemWidth(buttonWidth);
Im.Item.SetNextWidth(buttonWidth);
if (ImGui.DragInt("##xMinSize", ref x, 0.1f, 500, 1500))
_minimumX = x;
var edited = ImGui.IsItemDeactivatedAfterEdit();
Im.Line.Same();
ImGui.SetNextItemWidth(buttonWidth);
Im.Item.SetNextWidth(buttonWidth);
if (ImGui.DragInt("##yMinSize", ref y, 0.1f, 300, 1500))
_minimumY = y;
edited |= ImGui.IsItemDeactivatedAfterEdit();
Im.Line.Same();
if (ImGuiUtil.DrawDisabledButton("Reset##resetMinSize", new Vector2(buttonWidth / 2 - ImGui.GetStyle().ItemSpacing.X * 2, 0),
if (ImGuiUtil.DrawDisabledButton("Reset##resetMinSize", new Vector2(buttonWidth / 2 - Im.Style.ItemSpacing.X * 2, 0),
$"Reset minimum dimensions to ({Configuration.Constants.MinimumSizeX}, {Configuration.Constants.MinimumSizeY}).",
x == Configuration.Constants.MinimumSizeX && y == Configuration.Constants.MinimumSizeY))
{
@ -1095,7 +1095,7 @@ public class SettingsTab : ITab, IUiService
private void DrawHdrRenderTargets()
{
ImGui.SetNextItemWidth(ImUtf8.CalcTextSize("M"u8).X * 5.0f + Im.Style.FrameHeight);
Im.Item.SetNextWidth(ImUtf8.CalcTextSize("M"u8).X * 5.0f + Im.Style.FrameHeight);
using (var combo = ImUtf8.Combo("##hdrRenderTarget"u8, _config.HdrRenderTargets ? "HDR"u8 : "SDR"u8))
{
if (combo)
@ -1234,11 +1234,11 @@ public class SettingsTab : ITab, IUiService
/// <summary> Draw the support button group on the right-hand side of the window. </summary>
private void DrawSupportButtons()
{
var width = ImGui.CalcTextSize(UiHelpers.SupportInfoButtonText).X + ImGui.GetStyle().FramePadding.X * 2;
var width = ImGui.CalcTextSize(UiHelpers.SupportInfoButtonText).X + Im.Style.FramePadding.X * 2;
var xPos = ImGui.GetWindowWidth() - width;
// Respect the scroll bar width.
if (ImGui.GetScrollMaxY() > 0)
xPos -= ImGui.GetStyle().ScrollbarSize + ImGui.GetStyle().FramePadding.X;
xPos -= Im.Style.ScrollbarSize + Im.Style.FramePadding.X;
ImGui.SetCursorPos(new Vector2(xPos, Im.Style.FrameHeightWithSpacing));
UiHelpers.DrawSupportButton(_penumbra);