mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-07 16:34:36 +01:00
Apply ImRaii to UldWidget
This commit is contained in:
parent
e44fda1911
commit
e4ef56b878
1 changed files with 28 additions and 43 deletions
|
|
@ -12,6 +12,7 @@ using Dalamud.Interface.Colors;
|
|||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Textures.Internal;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Memory;
|
||||
using Lumina.Data.Files;
|
||||
using Lumina.Data.Parsing.Uld;
|
||||
|
|
@ -159,17 +160,19 @@ internal class UldWidget : IDataWindowWidget
|
|||
ImGuiColors.DalamudRed,
|
||||
$"Error: {nameof(UldFile.AssetData)} is not populated.");
|
||||
}
|
||||
else if (ImGui.BeginTable("##uldTextureEntries"u8, 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders))
|
||||
else
|
||||
{
|
||||
ImGui.TableSetupColumn("Id"u8, ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("000000"u8).X);
|
||||
ImGui.TableSetupColumn("Path"u8, ImGuiTableColumnFlags.WidthStretch);
|
||||
ImGui.TableSetupColumn("Actions"u8, ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Preview___"u8).X);
|
||||
ImGui.TableHeadersRow();
|
||||
using var table = ImRaii.Table("##uldTextureEntries"u8, 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders);
|
||||
if (table.Success)
|
||||
{
|
||||
ImGui.TableSetupColumn("Id"u8, ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("000000"u8).X);
|
||||
ImGui.TableSetupColumn("Path"u8, ImGuiTableColumnFlags.WidthStretch);
|
||||
ImGui.TableSetupColumn("Actions"u8, ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Preview___"u8).X);
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
foreach (var textureEntry in uld.AssetData)
|
||||
this.DrawTextureEntry(textureEntry, textureManager);
|
||||
|
||||
ImGui.EndTable();
|
||||
foreach (var textureEntry in uld.AssetData)
|
||||
this.DrawTextureEntry(textureEntry, textureManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -283,7 +286,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
using var tooltip = ImRaii.Tooltip();
|
||||
|
||||
var texturePath = GetStringNullTerminated(textureEntry.Path);
|
||||
ImGui.Text($"Base path at {texturePath}:");
|
||||
|
|
@ -301,8 +304,6 @@ internal class UldWidget : IDataWindowWidget
|
|||
else if (e is not null)
|
||||
ImGui.Text(e.ToString());
|
||||
}
|
||||
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -311,15 +312,14 @@ internal class UldWidget : IDataWindowWidget
|
|||
ImGui.SliderInt("FrameData"u8, ref this.selectedFrameData, 0, timeline.FrameData.Length - 1);
|
||||
var frameData = timeline.FrameData[this.selectedFrameData];
|
||||
ImGui.Text($"FrameInfo: {frameData.StartFrame} -> {frameData.EndFrame}");
|
||||
ImGui.Indent();
|
||||
|
||||
using var indent = ImRaii.PushIndent();
|
||||
foreach (var frameDataKeyGroup in frameData.KeyGroups)
|
||||
{
|
||||
ImGui.Text($"{frameDataKeyGroup.Usage:G} {frameDataKeyGroup.Type:G}");
|
||||
foreach (var keyframe in frameDataKeyGroup.Frames)
|
||||
this.DrawTimelineKeyGroupFrame(keyframe);
|
||||
}
|
||||
|
||||
ImGui.Unindent();
|
||||
}
|
||||
|
||||
private void DrawTimelineKeyGroupFrame(IKeyframe frame)
|
||||
|
|
@ -327,8 +327,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
switch (frame)
|
||||
{
|
||||
case BaseKeyframeData baseKeyframeData:
|
||||
ImGui.Text(
|
||||
$"Time: {baseKeyframeData.Time} | Interpolation: {baseKeyframeData.Interpolation} | Acceleration: {baseKeyframeData.Acceleration} | Deceleration: {baseKeyframeData.Deceleration}");
|
||||
ImGui.Text($"Time: {baseKeyframeData.Time} | Interpolation: {baseKeyframeData.Interpolation} | Acceleration: {baseKeyframeData.Acceleration} | Deceleration: {baseKeyframeData.Deceleration}");
|
||||
break;
|
||||
case Float1Keyframe float1Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(float1Keyframe.Keyframe);
|
||||
|
|
@ -343,8 +342,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
case Float3Keyframe float3Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(float3Keyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Value1: {float3Keyframe.Value[0]} | Value2: {float3Keyframe.Value[1]} | Value3: {float3Keyframe.Value[2]}");
|
||||
ImGui.Text($" | Value1: {float3Keyframe.Value[0]} | Value2: {float3Keyframe.Value[1]} | Value3: {float3Keyframe.Value[2]}");
|
||||
break;
|
||||
case SByte1Keyframe sbyte1Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(sbyte1Keyframe.Keyframe);
|
||||
|
|
@ -359,8 +357,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
case SByte3Keyframe sbyte3Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(sbyte3Keyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Value1: {sbyte3Keyframe.Value[0]} | Value2: {sbyte3Keyframe.Value[1]} | Value3: {sbyte3Keyframe.Value[2]}");
|
||||
ImGui.Text($" | Value1: {sbyte3Keyframe.Value[0]} | Value2: {sbyte3Keyframe.Value[1]} | Value3: {sbyte3Keyframe.Value[2]}");
|
||||
break;
|
||||
case Byte1Keyframe byte1Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(byte1Keyframe.Keyframe);
|
||||
|
|
@ -375,8 +372,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
case Byte3Keyframe byte3Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(byte3Keyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Value1: {byte3Keyframe.Value[0]} | Value2: {byte3Keyframe.Value[1]} | Value3: {byte3Keyframe.Value[2]}");
|
||||
ImGui.Text($" | Value1: {byte3Keyframe.Value[0]} | Value2: {byte3Keyframe.Value[1]} | Value3: {byte3Keyframe.Value[2]}");
|
||||
break;
|
||||
case Short1Keyframe short1Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(short1Keyframe.Keyframe);
|
||||
|
|
@ -391,8 +387,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
case Short3Keyframe short3Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(short3Keyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Value1: {short3Keyframe.Value[0]} | Value2: {short3Keyframe.Value[1]} | Value3: {short3Keyframe.Value[2]}");
|
||||
ImGui.Text($" | Value1: {short3Keyframe.Value[0]} | Value2: {short3Keyframe.Value[1]} | Value3: {short3Keyframe.Value[2]}");
|
||||
break;
|
||||
case UShort1Keyframe ushort1Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(ushort1Keyframe.Keyframe);
|
||||
|
|
@ -407,8 +402,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
case UShort3Keyframe ushort3Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(ushort3Keyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Value1: {ushort3Keyframe.Value[0]} | Value2: {ushort3Keyframe.Value[1]} | Value3: {ushort3Keyframe.Value[2]}");
|
||||
ImGui.Text($" | Value1: {ushort3Keyframe.Value[0]} | Value2: {ushort3Keyframe.Value[1]} | Value3: {ushort3Keyframe.Value[2]}");
|
||||
break;
|
||||
case Int1Keyframe int1Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(int1Keyframe.Keyframe);
|
||||
|
|
@ -423,8 +417,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
case Int3Keyframe int3Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(int3Keyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Value1: {int3Keyframe.Value[0]} | Value2: {int3Keyframe.Value[1]} | Value3: {int3Keyframe.Value[2]}");
|
||||
ImGui.Text($" | Value1: {int3Keyframe.Value[0]} | Value2: {int3Keyframe.Value[1]} | Value3: {int3Keyframe.Value[2]}");
|
||||
break;
|
||||
case UInt1Keyframe uint1Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(uint1Keyframe.Keyframe);
|
||||
|
|
@ -439,8 +432,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
case UInt3Keyframe uint3Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(uint3Keyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Value1: {uint3Keyframe.Value[0]} | Value2: {uint3Keyframe.Value[1]} | Value3: {uint3Keyframe.Value[2]}");
|
||||
ImGui.Text($" | Value1: {uint3Keyframe.Value[0]} | Value2: {uint3Keyframe.Value[1]} | Value3: {uint3Keyframe.Value[2]}");
|
||||
break;
|
||||
case Bool1Keyframe bool1Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(bool1Keyframe.Keyframe);
|
||||
|
|
@ -455,28 +447,22 @@ internal class UldWidget : IDataWindowWidget
|
|||
case Bool3Keyframe bool3Keyframe:
|
||||
this.DrawTimelineKeyGroupFrame(bool3Keyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Value1: {bool3Keyframe.Value[0]} | Value2: {bool3Keyframe.Value[1]} | Value3: {bool3Keyframe.Value[2]}");
|
||||
ImGui.Text($" | Value1: {bool3Keyframe.Value[0]} | Value2: {bool3Keyframe.Value[1]} | Value3: {bool3Keyframe.Value[2]}");
|
||||
break;
|
||||
case ColorKeyframe colorKeyframe:
|
||||
this.DrawTimelineKeyGroupFrame(colorKeyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | Add: {colorKeyframe.AddRed} {colorKeyframe.AddGreen} {colorKeyframe.AddBlue} | Multiply: {colorKeyframe.MultiplyRed} {colorKeyframe.MultiplyGreen} {colorKeyframe.MultiplyBlue}");
|
||||
ImGui.Text($" | Add: {colorKeyframe.AddRed} {colorKeyframe.AddGreen} {colorKeyframe.AddBlue} | Multiply: {colorKeyframe.MultiplyRed} {colorKeyframe.MultiplyGreen} {colorKeyframe.MultiplyBlue}");
|
||||
break;
|
||||
case LabelKeyframe labelKeyframe:
|
||||
this.DrawTimelineKeyGroupFrame(labelKeyframe.Keyframe);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.Text(
|
||||
$" | LabelCommand: {labelKeyframe.LabelCommand} | JumpId: {labelKeyframe.JumpId} | LabelId: {labelKeyframe.LabelId}");
|
||||
ImGui.Text($" | LabelCommand: {labelKeyframe.LabelCommand} | JumpId: {labelKeyframe.JumpId} | LabelId: {labelKeyframe.LabelId}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawParts(
|
||||
UldRoot.PartsData partsData,
|
||||
UldRoot.TextureEntry[] textureEntries,
|
||||
TextureManager textureManager)
|
||||
private void DrawParts(UldRoot.PartsData partsData, UldRoot.TextureEntry[] textureEntries, TextureManager textureManager)
|
||||
{
|
||||
for (var index = 0; index < partsData.Parts.Length; index++)
|
||||
{
|
||||
|
|
@ -542,10 +528,9 @@ internal class UldWidget : IDataWindowWidget
|
|||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
using var tooltip = ImRaii.Tooltip();
|
||||
ImGui.Text("Click to copy:"u8);
|
||||
ImGui.Text(texturePath);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue