- Switch SeString to ReadOnlySeString

- Utf8String to ReadOnlySeString avoiding Marshal
- Remove unnecessary ImRaii checks
- Switch default to 0
This commit is contained in:
Infi 2026-01-05 03:15:01 +01:00
parent bcc16c9b0e
commit bd05f4c1a5
17 changed files with 104 additions and 129 deletions

View file

@ -2,9 +2,7 @@ using System.Numerics;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal.UiDebug2.Utility; using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using Dalamud.Memory;
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
@ -28,7 +26,6 @@ public unsafe partial class AddonTree
if (tree.Success) if (tree.Success)
{ {
using var tbl = ImRaii.Table("atkUnitBase_atkValueTable"u8, 3, ImGuiTableFlags.Borders | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var tbl = ImRaii.Table("atkUnitBase_atkValueTable"u8, 3, ImGuiTableFlags.Borders | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
if (tbl.Success) if (tbl.Success)
{ {
ImGui.TableSetupColumn("Index"u8); ImGui.TableSetupColumn("Index"u8);

View file

@ -41,7 +41,7 @@ public unsafe partial class AddonTree
{ {
foreach (var t in from t in ClientStructsAssembly.GetTypes() foreach (var t in from t in ClientStructsAssembly.GetTypes()
where t.IsPublic where t.IsPublic
let xivAddonAttr = (AddonAttribute?)t.GetCustomAttribute(typeof(AddonAttribute), false) let xivAddonAttr = t.GetCustomAttribute<AddonAttribute>(false)
where xivAddonAttr != null where xivAddonAttr != null
where xivAddonAttr.AddonIdentifiers.Contains(this.AddonName) where xivAddonAttr.AddonIdentifiers.Contains(this.AddonName)
select t) select t)

View file

@ -4,7 +4,6 @@ using System.Numerics;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;

View file

@ -28,11 +28,9 @@ public static class Events
} }
using var tree = ImRaii.TreeNode($"Events##{(nint)node:X}eventTree"); using var tree = ImRaii.TreeNode($"Events##{(nint)node:X}eventTree");
if (tree.Success) if (tree.Success)
{ {
using var tbl = ImRaii.Table($"##{(nint)node:X}eventTable", 7, Resizable | SizingFixedFit | Borders | RowBg); using var tbl = ImRaii.Table($"##{(nint)node:X}eventTable", 7, Resizable | SizingFixedFit | Borders | RowBg);
if (tbl.Success) if (tbl.Success)
{ {
ImGui.TableSetupColumn("#"u8, WidthFixed); ImGui.TableSetupColumn("#"u8, WidthFixed);
@ -50,18 +48,25 @@ public static class Events
{ {
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text($"{i++}"); ImGui.Text($"{i++}");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text($"{evt->State.EventType}"); ImGui.Text($"{evt->State.EventType}");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text($"{evt->Param}"); ImGui.Text($"{evt->Param}");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text($"{evt->State.StateFlags}"); ImGui.Text($"{evt->State.StateFlags}");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text($"{evt->State.ReturnFlags}"); ImGui.Text($"{evt->State.ReturnFlags}");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Target:X}", default, new Vector4(0.6f, 0.6f, 0.6f, 1)); ImGuiHelpers.ClickToCopyText($"{(nint)evt->Target:X}", default, new Vector4(0.6f, 0.6f, 0.6f, 1));
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Listener:X}", default, new Vector4(0.6f, 0.6f, 0.6f, 1)); ImGuiHelpers.ClickToCopyText($"{(nint)evt->Listener:X}", default, new Vector4(0.6f, 0.6f, 0.6f, 1));
evt = evt->NextEvent; evt = evt->NextEvent;
} }
} }

View file

@ -3,6 +3,8 @@ using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Text.ReadOnly;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui; using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util; using static Dalamud.Utility.Util;
using static FFXIVClientStructs.FFXIV.Component.GUI.ComponentType; using static FFXIVClientStructs.FFXIV.Component.GUI.ComponentType;
@ -89,14 +91,14 @@ internal unsafe class ComponentNodeTree : ResNodeTree
{ {
case TextInput: case TextInput:
var textInputComponent = (AtkComponentTextInput*)this.Component; var textInputComponent = (AtkComponentTextInput*)this.Component;
ImGui.Text($"InputBase Text1: {Marshal.PtrToStringAnsi(new(textInputComponent->AtkComponentInputBase.EvaluatedString.StringPtr))}"); ImGui.Text($"InputBase Text1 (Lumina): {new ReadOnlySeStringSpan(textInputComponent->AtkComponentInputBase.EvaluatedString.AsSpan()).ToMacroString()}");
ImGui.Text($"InputBase Text2: {Marshal.PtrToStringAnsi(new(textInputComponent->AtkComponentInputBase.RawString.StringPtr))}"); ImGui.Text($"InputBase Text2 (Lumina): {new ReadOnlySeStringSpan(textInputComponent->AtkComponentInputBase.RawString.AsSpan()).ToMacroString()}");
// TODO: Reenable when unknowns have been unprivated / named // TODO: Reenable when unknowns have been unprivated / named
// ImGui.Text($"Text1: {Marshal.PtrToStringAnsi(new(textInputComponent->UnkText01.StringPtr))}"); // ImGui.Text($"Text1: {new ReadOnlySeStringSpan(textInputComponent->UnkText01.AsSpan()).ToMacroString()}");
// ImGui.Text($"Text2: {Marshal.PtrToStringAnsi(new(textInputComponent->UnkText02.StringPtr))}"); // ImGui.Text($"Text2: {new ReadOnlySeStringSpan(textInputComponent->UnkText02.AsSpan()).ToMacroString()}");
ImGui.Text($"AvailableLines: {Marshal.PtrToStringAnsi(new(textInputComponent->AvailableLines.StringPtr))}"); ImGui.Text($"AvailableLines: {new ReadOnlySeStringSpan(textInputComponent->AvailableLines.AsSpan()).ToMacroString()}");
ImGui.Text($"HighlightedAutoTranslateOptionColorPrefix: {Marshal.PtrToStringAnsi(new(textInputComponent->HighlightedAutoTranslateOptionColorPrefix.StringPtr))}"); ImGui.Text($"HighlightedAutoTranslateOptionColorPrefix: {new ReadOnlySeStringSpan(textInputComponent->HighlightedAutoTranslateOptionColorPrefix.AsSpan()).ToMacroString()}");
ImGui.Text($"HighlightedAutoTranslateOptionColorSuffix: {Marshal.PtrToStringAnsi(new(textInputComponent->HighlightedAutoTranslateOptionColorSuffix.StringPtr))}"); ImGui.Text($"HighlightedAutoTranslateOptionColorSuffix: {new ReadOnlySeStringSpan(textInputComponent->HighlightedAutoTranslateOptionColorSuffix.AsSpan()).ToMacroString()}");
break; break;
case List: case List:
case TreeList: case TreeList:

View file

@ -1,5 +1,7 @@
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Text.ReadOnly;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui; using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util; using static Dalamud.Utility.Util;
@ -30,7 +32,7 @@ internal unsafe partial class CounterNodeTree : ResNodeTree
{ {
if (!isEditorOpen) if (!isEditorOpen)
{ {
PrintFieldValuePairs(("Text", ((AtkCounterNode*)this.Node)->NodeText.ToString())); PrintFieldValuePairs(("Text", new ReadOnlySeStringSpan(((AtkCounterNode*)this.Node)->NodeText.AsSpan()).ToMacroString()));
} }
} }
} }

View file

@ -7,6 +7,8 @@ using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Text.ReadOnly;
using static Dalamud.Bindings.ImGui.ImGuiColorEditFlags; using static Dalamud.Bindings.ImGui.ImGuiColorEditFlags;
using static Dalamud.Bindings.ImGui.ImGuiInputTextFlags; using static Dalamud.Bindings.ImGui.ImGuiInputTextFlags;
using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags; using static Dalamud.Bindings.ImGui.ImGuiTableColumnFlags;
@ -27,10 +29,10 @@ internal unsafe partial class ResNodeTree
private protected void DrawNodeEditorTable() private protected void DrawNodeEditorTable()
{ {
using var tbl = ImRaii.Table($"###Editor{(nint)this.Node}", 2, SizingStretchProp | NoHostExtendX); using var tbl = ImRaii.Table($"###Editor{(nint)this.Node}", 2, SizingStretchProp | NoHostExtendX);
if (tbl.Success) if (!tbl.Success)
{ return;
this.DrawEditorRows();
} this.DrawEditorRows();
} }
/// <summary> /// <summary>
@ -59,7 +61,7 @@ internal unsafe partial class ResNodeTree
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.SetNextItemWidth(150); ImGui.SetNextItemWidth(150);
if (ImGui.DragFloat2($"##{(nint)this.Node:X}position", ref pos, 1, default, default, "%.0f")) if (ImGui.DragFloat2($"##{(nint)this.Node:X}position", ref pos, 1, 0, 0, "%.0f"))
{ {
this.Node->X = pos.X; this.Node->X = pos.X;
this.Node->Y = pos.Y; this.Node->Y = pos.Y;
@ -73,7 +75,7 @@ internal unsafe partial class ResNodeTree
ImGui.Text("Size:"u8); ImGui.Text("Size:"u8);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.SetNextItemWidth(150); ImGui.SetNextItemWidth(150);
if (ImGui.DragFloat2($"##{(nint)this.Node:X}size", ref size, 1, 0, default, "%.0f")) if (ImGui.DragFloat2($"##{(nint)this.Node:X}size", ref size, 1, 0, 0, "%.0f"))
{ {
this.Node->Width = (ushort)Math.Max(size.X, 0); this.Node->Width = (ushort)Math.Max(size.X, 0);
this.Node->Height = (ushort)Math.Max(size.Y, 0); this.Node->Height = (ushort)Math.Max(size.Y, 0);
@ -101,7 +103,7 @@ internal unsafe partial class ResNodeTree
ImGui.Text("Origin:"u8); ImGui.Text("Origin:"u8);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.SetNextItemWidth(150); ImGui.SetNextItemWidth(150);
if (ImGui.DragFloat2($"##{(nint)this.Node:X}origin", ref origin, 1, default, default, "%.0f")) if (ImGui.DragFloat2($"##{(nint)this.Node:X}origin", ref origin, 1, 0, 0, "%.0f"))
{ {
this.Node->OriginX = origin.X; this.Node->OriginX = origin.X;
this.Node->OriginY = origin.Y; this.Node->OriginY = origin.Y;
@ -120,7 +122,7 @@ internal unsafe partial class ResNodeTree
angle -= 360; angle -= 360;
} }
if (ImGui.DragFloat($"##{(nint)this.Node:X}rotation", ref angle, 0.05f, default, default, "%.2f°")) if (ImGui.DragFloat($"##{(nint)this.Node:X}rotation", ref angle, 0.05f, 0, 0, "%.2f°"))
{ {
this.Node->Rotation = (float)(angle / (180 / Math.PI)); this.Node->Rotation = (float)(angle / (180 / Math.PI));
this.Node->DrawFlags |= 0xD; this.Node->DrawFlags |= 0xD;
@ -168,7 +170,6 @@ internal unsafe partial class ResNodeTree
ImGui.Text("Add:"u8); ImGui.Text("Add:"u8);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.SetNextItemWidth(124); ImGui.SetNextItemWidth(124);
if (ImGui.DragFloat3($"##{(nint)this.Node:X}addRGB", ref add, 1, -255, 255, "%.0f")) if (ImGui.DragFloat3($"##{(nint)this.Node:X}addRGB", ref add, 1, -255, 255, "%.0f"))
{ {
this.Node->AddRed = (short)add.X; this.Node->AddRed = (short)add.X;
@ -199,7 +200,7 @@ internal unsafe partial class CounterNodeTree
{ {
base.DrawEditorRows(); base.DrawEditorRows();
var str = this.CntNode->NodeText.ToString(); var str = new ReadOnlySeStringSpan(this.CntNode->NodeText.AsSpan()).ToMacroString();
ImGui.TableNextRow(); ImGui.TableNextRow();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -299,7 +300,7 @@ internal unsafe partial class TextNodeTree
{ {
base.DrawEditorRows(); base.DrawEditorRows();
var text = this.TxtNode->NodeText.ToString(); var text = new ReadOnlySeStringSpan(this.TxtNode->NodeText.AsSpan()).ToMacroString();
var fontIndex = FontList.IndexOf(this.TxtNode->FontType); var fontIndex = FontList.IndexOf(this.TxtNode->FontType);
int fontSize = this.TxtNode->FontSize; int fontSize = this.TxtNode->FontSize;
var alignment = this.TxtNode->AlignmentType; var alignment = this.TxtNode->AlignmentType;

View file

@ -2,7 +2,6 @@ using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
@ -64,7 +63,6 @@ internal unsafe partial class ImageNodeTree : ResNodeTree
} }
using var tree = ImRaii.TreeNode($"Texture##texture{(nint)this.TexData.Texture->D3D11ShaderResourceView:X}", SpanFullWidth); using var tree = ImRaii.TreeNode($"Texture##texture{(nint)this.TexData.Texture->D3D11ShaderResourceView:X}", SpanFullWidth);
if (tree.Success) if (tree.Success)
{ {
PrintFieldValuePairs( PrintFieldValuePairs(

View file

@ -1,6 +1,5 @@
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal.UiDebug2.Utility; using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
@ -61,10 +60,10 @@ internal unsafe partial class NineGridNodeTree : ImageNodeTree
var ngCol = RgbaVector4ToUint(col with { W = 0.75f * col.W }); var ngCol = RgbaVector4ToUint(col with { W = 0.75f * col.W });
ImGui.GetWindowDrawList() var windowDrawList = ImGui.GetWindowDrawList();
.AddRect(partBegin, partEnd, RgbaVector4ToUint(col)); windowDrawList.AddRect(partBegin, partEnd, RgbaVector4ToUint(col));
ImGui.GetWindowDrawList().AddRect(ngBegin1, ngEnd1, ngCol); windowDrawList.AddRect(ngBegin1, ngEnd1, ngCol);
ImGui.GetWindowDrawList().AddRect(ngBegin2, ngEnd2, ngCol); windowDrawList.AddRect(ngBegin2, ngEnd2, ngCol);
ImGui.SetCursorPos(cursorLocalPos + uv + new Vector2(0, -20)); ImGui.SetCursorPos(cursorLocalPos + uv + new Vector2(0, -20));
ImGui.TextColored(col, $"[#{partId}]\t{part.U}, {part.V}\t{part.Width}x{part.Height}"); ImGui.TextColored(col, $"[#{partId}]\t{part.U}, {part.V}\t{part.Width}x{part.Height}");

View file

@ -5,7 +5,6 @@ using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Internal.UiDebug2.Utility; using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
@ -138,7 +137,6 @@ internal unsafe partial class ResNodeTree : IDisposable
PrintNodeList(nodeList, count, addonTree); PrintNodeList(nodeList, count, addonTree);
var lineEnd = lineStart with { Y = ImGui.GetCursorScreenPos().Y - 7 }; var lineEnd = lineStart with { Y = ImGui.GetCursorScreenPos().Y - 7 };
if (lineStart.Y < lineEnd.Y) if (lineStart.Y < lineEnd.Y)
{ {
ImGui.GetWindowDrawList().AddLine(lineStart, lineEnd, RgbaVector4ToUint(color), 1); ImGui.GetWindowDrawList().AddLine(lineStart, lineEnd, RgbaVector4ToUint(color), 1);

View file

@ -2,15 +2,14 @@ using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface.ImGuiSeStringRenderer; using Dalamud.Interface.ImGuiSeStringRenderer;
using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.System.String; using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Text.ReadOnly;
using static Dalamud.Interface.ColorHelpers; using static Dalamud.Interface.ColorHelpers;
using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui; using static Dalamud.Interface.Internal.UiDebug2.Utility.Gui;
using static Dalamud.Utility.Util; using static Dalamud.Utility.Util;
@ -64,7 +63,7 @@ internal unsafe partial class TextNodeTree : ResNodeTree
} }
catch catch
{ {
ImGui.Text(Marshal.PtrToStringAnsi(new(this.NodeText.StringPtr)) ?? string.Empty); ImGui.Text(new ReadOnlySeStringSpan(this.NodeText.AsSpan()).ToMacroString());
} }
PrintFieldValuePairs( PrintFieldValuePairs(
@ -82,36 +81,24 @@ internal unsafe partial class TextNodeTree : ResNodeTree
private void PrintPayloads() private void PrintPayloads()
{ {
using var tree = ImRaii.TreeNode($"Text Payloads##{(nint)this.Node:X}"); using var tree = ImRaii.TreeNode($"Text Payloads##{(nint)this.Node:X}");
if (tree.Success) if (tree.Success)
{ {
var utf8String = this.NodeText; var idx = 0;
var seStringBytes = new byte[utf8String.BufUsed]; foreach (var payload in new ReadOnlySeString(this.NodeText.AsSpan()))
for (var i = 0L; i < utf8String.BufUsed; i++)
{ {
seStringBytes[i] = utf8String.StringPtr.Value[i]; ImGui.Text($"[{idx}]");
}
var seString = SeString.Parse(seStringBytes);
for (var i = 0; i < seString.Payloads.Count; i++)
{
var payload = seString.Payloads[i];
ImGui.Text($"[{i}]");
ImGui.SameLine(); ImGui.SameLine();
switch (payload.Type) switch (payload.Type)
{ {
case PayloadType.RawText when payload is TextPayload tp: case ReadOnlySePayloadType.Text:
{ PrintFieldValuePair("Raw Text", payload.ToString());
Gui.PrintFieldValuePair("Raw Text", tp.Text ?? string.Empty);
break; break;
}
default: default:
{
ImGui.Text(payload.ToString()); ImGui.Text(payload.ToString());
break; break;
}
} }
idx++;
} }
} }
} }

View file

@ -57,7 +57,6 @@ public readonly unsafe partial struct TimelineTree
if (animationCount > 0) if (animationCount > 0)
{ {
using var tree = ImRaii.TreeNode($"Timeline##{(nint)this.node:X}timeline", SpanFullWidth); using var tree = ImRaii.TreeNode($"Timeline##{(nint)this.node:X}timeline", SpanFullWidth);
if (tree.Success) if (tree.Success)
{ {
PrintFieldValuePair("Timeline", $"{(nint)this.NodeTimeline:X}"); PrintFieldValuePair("Timeline", $"{(nint)this.NodeTimeline:X}");
@ -89,7 +88,6 @@ public readonly unsafe partial struct TimelineTree
if (labelSetCount > 0 && this.Resource->LabelSets is not null) if (labelSetCount > 0 && this.Resource->LabelSets is not null)
{ {
using var tree = ImRaii.TreeNode($"Timeline Label Sets##{(nint)this.node:X}LabelSets", SpanFullWidth); using var tree = ImRaii.TreeNode($"Timeline Label Sets##{(nint)this.node:X}LabelSets", SpanFullWidth);
if (tree.Success) if (tree.Success)
{ {
this.DrawLabelSets(); this.DrawLabelSets();
@ -324,7 +322,6 @@ public readonly unsafe partial struct TimelineTree
using (ImRaii.PushColor(ImGuiCol.Text, new Vector4(1, 0.65F, 0.4F, 1), isActive)) using (ImRaii.PushColor(ImGuiCol.Text, new Vector4(1, 0.65F, 0.4F, 1), isActive))
{ {
using var tree = ImRaii.TreeNode($"[#{a}] [Frames {animation.StartFrameIdx}-{animation.EndFrameIdx}] {(isActive ? " (Active)" : string.Empty)}###{(nint)this.node}animTree{a}"); using var tree = ImRaii.TreeNode($"[#{a}] [Frames {animation.StartFrameIdx}-{animation.EndFrameIdx}] {(isActive ? " (Active)" : string.Empty)}###{(nint)this.node}animTree{a}");
if (tree.Success) if (tree.Success)
{ {
PrintFieldValuePair("Animation", $"{address:X}"); PrintFieldValuePair("Animation", $"{address:X}");
@ -334,7 +331,6 @@ public readonly unsafe partial struct TimelineTree
if (columns.Count > 0) if (columns.Count > 0)
{ {
using var tbl = ImRaii.Table($"##{(nint)this.node}animTable{a}", columns.Count, Borders | SizingFixedFit | RowBg | NoHostExtendX); using var tbl = ImRaii.Table($"##{(nint)this.node}animTable{a}", columns.Count, Borders | SizingFixedFit | RowBg | NoHostExtendX);
if (tbl.Success) if (tbl.Success)
{ {
foreach (var c in columns) foreach (var c in columns)

View file

@ -159,65 +159,61 @@ internal unsafe class ElementSelector : IDisposable
if (ch.Success) if (ch.Success)
{ {
using var gr = ImRaii.Group(); using var gr = ImRaii.Group();
if (gr.Success) Gui.PrintFieldValuePair("Mouse Position", $"{mousePos.X}, {mousePos.Y}");
ImGui.Spacing();
ImGui.Text("RESULTS:\n"u8);
var i = 0;
foreach (var a in addonResults)
{ {
Gui.PrintFieldValuePair("Mouse Position", $"{mousePos.X}, {mousePos.Y}"); var name = a.Addon->NameString;
ImGui.Spacing(); ImGui.Text($"[Addon] {name}");
ImGui.Text("RESULTS:\n"u8);
var i = 0; using var indent = ImRaii.PushIndent(15.0f);
foreach (var a in addonResults) foreach (var n in a.Nodes)
{ {
var name = a.Addon->NameString; var nSelected = i++ == this.index;
ImGui.Text($"[Addon] {name}");
ImGui.Indent(15); PrintNodeHeaderOnly(n.Node, nSelected, a.Addon);
foreach (var n in a.Nodes)
if (nSelected && ImGui.IsMouseClicked(ImGuiMouseButton.Left))
{ {
var nSelected = i++ == this.index; this.Active = false;
PrintNodeHeaderOnly(n.Node, nSelected, a.Addon); this.uiDebug2.SelectedAddonName = a.Addon->NameString;
if (nSelected && ImGui.IsMouseClicked(ImGuiMouseButton.Left)) var ptrList = new List<nint> { (nint)n.Node };
var nextNode = n.Node->ParentNode;
while (nextNode != null)
{ {
this.Active = false; ptrList.Add((nint)nextNode);
nextNode = nextNode->ParentNode;
this.uiDebug2.SelectedAddonName = a.Addon->NameString;
var ptrList = new List<nint> { (nint)n.Node };
var nextNode = n.Node->ParentNode;
while (nextNode != null)
{
ptrList.Add((nint)nextNode);
nextNode = nextNode->ParentNode;
}
SearchResults = [.. ptrList];
Countdown = 100;
Scrolled = false;
} }
if (nSelected) SearchResults = [.. ptrList];
{ Countdown = 100;
n.NodeBounds.DrawFilled(new(1, 1, 0.2f, 1)); Scrolled = false;
}
} }
ImGui.Indent(-15); if (nSelected)
{
n.NodeBounds.DrawFilled(new(1, 1, 0.2f, 1));
}
}
}
if (i != 0)
{
this.index -= (int)ImGui.GetIO().MouseWheel;
while (this.index < 0)
{
this.index += i;
} }
if (i != 0) while (this.index >= i)
{ {
this.index -= (int)ImGui.GetIO().MouseWheel; this.index -= i;
while (this.index < 0)
{
this.index += i;
}
while (this.index >= i)
{
this.index -= i;
}
} }
} }
} }

View file

@ -39,7 +39,7 @@ internal class AddonPopoutWindow : Window, IDisposable
/// <inheritdoc/> /// <inheritdoc/>
public override void Draw() public override void Draw()
{ {
using var ch = ImRaii.Child($"{this.WindowName}child", new(-1, -1), true); using var ch = ImRaii.Child($"{this.WindowName}child", Vector2.Zero, true);
if (ch.Success) if (ch.Success)
{ {
this.addonTree.Draw(); this.addonTree.Draw();

View file

@ -38,7 +38,7 @@ internal unsafe class NodePopoutWindow : Window, IDisposable
this.PositionCondition = ImGuiCond.Once; this.PositionCondition = ImGuiCond.Once;
this.SizeCondition = ImGuiCond.Once; this.SizeCondition = ImGuiCond.Once;
this.Size = new(700, 200); this.Size = new(700, 200);
this.SizeConstraints = new() { MinimumSize = new(100, 100) }; this.SizeConstraints = new() { MinimumSize = new Vector2(100, 100) };
} }
private AddonTree AddonTree => this.resNodeTree.AddonTree; private AddonTree AddonTree => this.resNodeTree.AddonTree;
@ -50,7 +50,7 @@ internal unsafe class NodePopoutWindow : Window, IDisposable
{ {
if (this.Node != null && this.AddonTree.ContainsNode(this.Node)) if (this.Node != null && this.AddonTree.ContainsNode(this.Node))
{ {
using var ch = ImRaii.Child($"{(nint)this.Node:X}popoutChild", new(-1, -1), true); using var ch = ImRaii.Child($"{(nint)this.Node:X}popoutChild", Vector2.Zero, true);
if (ch.Success) if (ch.Success)
{ {
ResNodeTree.GetOrCreate(this.Node, this.AddonTree).Print(null, this.firstDraw); ResNodeTree.GetOrCreate(this.Node, this.AddonTree).Print(null, this.firstDraw);

View file

@ -104,12 +104,8 @@ internal static class Gui
var index = (int)Math.Floor(prog * tooltips.Length); var index = (int)Math.Floor(prog * tooltips.Length);
using var tt = ImRaii.Tooltip(); using var tooltip = ImRaii.Tooltip();
ImGui.Text(tooltips[index]);
if (tt.Success)
{
ImGui.Text(tooltips[index]);
}
return true; return true;
} }
@ -123,13 +119,14 @@ internal static class Gui
{ {
if ((mask & 0b10) > 0) if ((mask & 0b10) > 0)
{ {
ImGui.Dummy(new(padding * ImGui.GetIO().FontGlobalScale)); ImGuiHelpers.ScaledDummy(padding);
} }
ImGui.Separator(); ImGui.Separator();
if ((mask & 0b01) > 0) if ((mask & 0b01) > 0)
{ {
ImGui.Dummy(new(padding * ImGui.GetIO().FontGlobalScale)); ImGuiHelpers.ScaledDummy(padding);
} }
} }
} }

View file

@ -61,10 +61,11 @@ public unsafe struct NodeBounds
return; return;
} }
var backgroundDrawList = ImGui.GetBackgroundDrawList();
if (this.Points.Count == 1) if (this.Points.Count == 1)
{ {
ImGui.GetBackgroundDrawList().AddCircle(this.Points[0], 10, RgbaVector4ToUint(col with { W = col.W / 2 }), 12, thickness); backgroundDrawList.AddCircle(this.Points[0], 10, RgbaVector4ToUint(col with { W = col.W / 2 }), 12, thickness);
ImGui.GetBackgroundDrawList().AddCircle(this.Points[0], thickness, RgbaVector4ToUint(col), 12, thickness + 1); backgroundDrawList.AddCircle(this.Points[0], thickness, RgbaVector4ToUint(col), 12, thickness + 1);
} }
else else
{ {
@ -74,8 +75,7 @@ public unsafe struct NodeBounds
path.Add(p); path.Add(p);
} }
ImGui.GetBackgroundDrawList() backgroundDrawList.AddPolyline(ref path[0], path.Length, RgbaVector4ToUint(col), ImDrawFlags.Closed, thickness);
.AddPolyline(ref path[0], path.Length, RgbaVector4ToUint(col), ImDrawFlags.Closed, thickness);
path.Dispose(); path.Dispose();
} }
@ -93,11 +93,11 @@ public unsafe struct NodeBounds
return; return;
} }
var backgroundDrawList = ImGui.GetBackgroundDrawList();
if (this.Points.Count == 1) if (this.Points.Count == 1)
{ {
ImGui.GetBackgroundDrawList() backgroundDrawList.AddCircleFilled(this.Points[0], 10, RgbaVector4ToUint(col with { W = col.W / 2 }), 12);
.AddCircleFilled(this.Points[0], 10, RgbaVector4ToUint(col with { W = col.W / 2 }), 12); backgroundDrawList.AddCircle(this.Points[0], 10, RgbaVector4ToUint(col), 12, thickness);
ImGui.GetBackgroundDrawList().AddCircle(this.Points[0], 10, RgbaVector4ToUint(col), 12, thickness);
} }
else else
{ {
@ -107,10 +107,8 @@ public unsafe struct NodeBounds
path.Add(p); path.Add(p);
} }
ImGui.GetBackgroundDrawList() backgroundDrawList.AddConvexPolyFilled(ref path[0], path.Length, RgbaVector4ToUint(col with { W = col.W / 2 }));
.AddConvexPolyFilled(ref path[0], path.Length, RgbaVector4ToUint(col with { W = col.W / 2 })); backgroundDrawList.AddPolyline(ref path[0], path.Length, RgbaVector4ToUint(col), ImDrawFlags.Closed, thickness);
ImGui.GetBackgroundDrawList()
.AddPolyline(ref path[0], path.Length, RgbaVector4ToUint(col), ImDrawFlags.Closed, thickness);
path.Dispose(); path.Dispose();
} }