mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-09 17:44:38 +01:00
Misc UiDebug2 Fixes
- The widget will now only check the `FFXIVClientStructs` assembly for addon type information. - Updated ImRaii usage - Clarified suppression in `NodeTree.Text.cs` - Restored the original Addon Inspector in the Data window, so that both versions can coexist for the time being
This commit is contained in:
parent
e19f9284e5
commit
552aafd70d
17 changed files with 379 additions and 347 deletions
|
|
@ -51,8 +51,8 @@ internal unsafe partial class ImageNodeTree : ResNodeTree
|
|||
|
||||
/// <summary>
|
||||
/// Draws the texture inside the window, in either of two styles.<br/><br/>
|
||||
/// <term>Full Image</term>presents the texture in full as a spritesheet.<br/>
|
||||
/// <term>Parts List</term>presents the individual parts as rows in a table.
|
||||
/// <term>Full Image (0)</term>presents the texture in full as a spritesheet.<br/>
|
||||
/// <term>Parts List (1)</term>presents the individual parts as rows in a table.
|
||||
/// </summary>
|
||||
private protected void DrawTextureAndParts()
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ internal unsafe partial class ImageNodeTree : ResNodeTree
|
|||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -99,8 +99,6 @@ internal unsafe partial class ImageNodeTree : ResNodeTree
|
|||
this.DrawFullTexture();
|
||||
}
|
||||
}
|
||||
|
||||
tree.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -191,58 +189,62 @@ internal unsafe partial class ImageNodeTree : ResNodeTree
|
|||
|
||||
private void PrintPartsTable()
|
||||
{
|
||||
var tab = ImRaii.Table($"partsTable##{(nint)this.TexData.Texture->D3D11ShaderResourceView:X}", 3, Borders | RowBg | Reorderable);
|
||||
ImGui.TableSetupColumn("Part ID", WidthFixed);
|
||||
ImGui.TableSetupColumn("Part Texture", WidthFixed);
|
||||
ImGui.TableSetupColumn("Coordinates", WidthFixed);
|
||||
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var tWidth = this.TexData.Texture->Width;
|
||||
var tHeight = this.TexData.Texture->Height;
|
||||
var textureSize = new Vector2(tWidth, tHeight);
|
||||
|
||||
for (ushort i = 0; i < this.TexData.PartCount; i++)
|
||||
using (ImRaii.Table($"partsTable##{(nint)this.TexData.Texture->D3D11ShaderResourceView:X}", 3, Borders | RowBg | Reorderable))
|
||||
{
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableSetupColumn("Part ID", WidthFixed);
|
||||
ImGui.TableSetupColumn("Part Texture", WidthFixed);
|
||||
ImGui.TableSetupColumn("Coordinates", WidthFixed);
|
||||
|
||||
var col = i == this.TexData.PartId ? new Vector4(0, 0.85F, 1, 1) : new(1);
|
||||
ImGui.TextColored(col, $"#{i.ToString().PadLeft(this.TexData.PartCount.ToString().Length, '0')}");
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
var tWidth = this.TexData.Texture->Width;
|
||||
var tHeight = this.TexData.Texture->Height;
|
||||
var textureSize = new Vector2(tWidth, tHeight);
|
||||
|
||||
var part = this.TexData.PartsList->Parts[i];
|
||||
var hiRes = this.TexData.HiRes;
|
||||
for (ushort i = 0; i < this.TexData.PartCount; i++)
|
||||
{
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
var u = hiRes ? part.U * 2f : part.U;
|
||||
var v = hiRes ? part.V * 2f : part.V;
|
||||
var width = hiRes ? part.Width * 2f : part.Width;
|
||||
var height = hiRes ? part.Height * 2f : part.Height;
|
||||
var col = i == this.TexData.PartId ? new Vector4(0, 0.85F, 1, 1) : new(1);
|
||||
ImGui.TextColored(col, $"#{i.ToString().PadLeft(this.TexData.PartCount.ToString().Length, '0')}");
|
||||
|
||||
ImGui.Image(new(this.TexData.Texture->D3D11ShaderResourceView), new(width, height), new Vector2(u, v) / textureSize, new Vector2(u + width, v + height) / textureSize);
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
var part = this.TexData.PartsList->Parts[i];
|
||||
var hiRes = this.TexData.HiRes;
|
||||
|
||||
ImGui.TextColored(!hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Standard:\t");
|
||||
ImGui.SameLine();
|
||||
var cursX = ImGui.GetCursorPosX();
|
||||
var u = hiRes ? part.U * 2f : part.U;
|
||||
var v = hiRes ? part.V * 2f : part.V;
|
||||
var width = hiRes ? part.Width * 2f : part.Width;
|
||||
var height = hiRes ? part.Height * 2f : part.Height;
|
||||
|
||||
PrintPartCoords(u / 2f, v / 2f, width / 2f, height / 2f);
|
||||
ImGui.Image(
|
||||
new(this.TexData.Texture->D3D11ShaderResourceView),
|
||||
new(width, height),
|
||||
new Vector2(u, v) / textureSize,
|
||||
new Vector2(u + width, v + height) / textureSize);
|
||||
|
||||
ImGui.TextColored(hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Hi-Res:\t");
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosX(cursX);
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
PrintPartCoords(u, v, width, height);
|
||||
ImGui.TextColored(!hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Standard:\t");
|
||||
ImGui.SameLine();
|
||||
var cursX = ImGui.GetCursorPosX();
|
||||
|
||||
ImGui.Text("UV:\t");
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosX(cursX);
|
||||
PrintPartCoords(u / 2f, v / 2f, width / 2f, height / 2f);
|
||||
|
||||
PrintPartCoords(u / tWidth, v / tWidth, (u + width) / tWidth, (v + height) / tHeight, true, true);
|
||||
ImGui.TextColored(hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Hi-Res:\t");
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosX(cursX);
|
||||
|
||||
PrintPartCoords(u, v, width, height);
|
||||
|
||||
ImGui.Text("UV:\t");
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosX(cursX);
|
||||
|
||||
PrintPartCoords(u / tWidth, v / tWidth, (u + width) / tWidth, (v + height) / tHeight, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
tab.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue