Skip to content

Commit 7dabb3c

Browse files
committed
Add some Redrawing Debug UI.
1 parent 79c43fe commit 7dabb3c

File tree

2 files changed

+59
-3
lines changed

2 files changed

+59
-3
lines changed

Penumbra/Interop/Services/RedrawService.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ public unsafe partial class RedrawService
1818
public const int GPoseSlots = 42;
1919
public const int GPoseEndIdx = GPosePlayerIdx + GPoseSlots;
2020

21-
private readonly string?[] _gPoseNames = new string?[GPoseSlots];
21+
private readonly string?[] _gPoseNames = new string?[GPoseSlots];
2222
private int _gPoseNameCounter;
2323

24-
private bool InGPose
24+
internal IReadOnlyList<string?> GPoseNames
25+
=> _gPoseNames;
26+
27+
internal bool InGPose
2528
=> _clientState.IsGPosing;
2629

2730
// VFuncs that disable and enable draw, used only for GPose actors.
@@ -108,6 +111,15 @@ public sealed unsafe partial class RedrawService : IDisposable
108111
private readonly List<int> _afterGPoseQueue = new(GPoseSlots);
109112
private int _target = -1;
110113

114+
internal IReadOnlyList<int> Queue
115+
=> _queue;
116+
117+
internal IReadOnlyList<int> AfterGPoseQueue
118+
=> _afterGPoseQueue;
119+
120+
internal int Target
121+
=> _target;
122+
111123
public event GameObjectRedrawnDelegate? GameObjectRedrawn;
112124

113125
public RedrawService(IFramework framework, IObjectTable objects, ITargetManager targets, ICondition conditions, IClientState clientState)

Penumbra/UI/Tabs/DebugTab.cs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,15 @@ public class DebugTab : Window, ITab
6565
private readonly TextureManager _textureManager;
6666
private readonly SkinFixer _skinFixer;
6767
private readonly IdentifierService _identifier;
68+
private readonly RedrawService _redraws;
6869

6970
public DebugTab(StartTracker timer, PerformanceTracker performance, Configuration config, CollectionManager collectionManager,
7071
ValidityChecker validityChecker, ModManager modManager, HttpApi httpApi, ActorService actorService,
7172
DalamudServices dalamud, StainService stains, CharacterUtility characterUtility, ResidentResourceManager residentResources,
7273
ResourceManagerService resourceManager, PenumbraIpcProviders ipc, CollectionResolver collectionResolver,
7374
DrawObjectState drawObjectState, PathState pathState, SubfileHelper subfileHelper, IdentifiedCollectionCache identifiedCollectionCache,
7475
CutsceneService cutsceneService, ModImportManager modImporter, ImportPopup importPopup, FrameworkManager framework,
75-
TextureManager textureManager, SkinFixer skinFixer, IdentifierService identifier)
76+
TextureManager textureManager, SkinFixer skinFixer, IdentifierService identifier, RedrawService redraws)
7677
: base("Penumbra Debug Window", ImGuiWindowFlags.NoCollapse)
7778
{
7879
IsOpen = true;
@@ -107,6 +108,7 @@ public DebugTab(StartTracker timer, PerformanceTracker performance, Configuratio
107108
_textureManager = textureManager;
108109
_skinFixer = skinFixer;
109110
_identifier = identifier;
111+
_redraws = redraws;
110112
}
111113

112114
public ReadOnlySpan<byte> Label
@@ -317,6 +319,48 @@ private void DrawDebugTabGeneral()
317319
}
318320
}
319321
}
322+
323+
using (var tree = TreeNode("Redraw Service"))
324+
{
325+
if (tree)
326+
{
327+
using var table = Table("##redraws", 3, ImGuiTableFlags.RowBg);
328+
if (table)
329+
{
330+
ImGuiUtil.DrawTableColumn("In GPose");
331+
ImGuiUtil.DrawTableColumn(_redraws.InGPose.ToString());
332+
ImGui.TableNextColumn();
333+
334+
ImGuiUtil.DrawTableColumn("Target");
335+
ImGuiUtil.DrawTableColumn(_redraws.Target.ToString());
336+
ImGui.TableNextColumn();
337+
338+
foreach (var (objectIdx, idx) in _redraws.Queue.WithIndex())
339+
{
340+
var (actualIdx, state) = objectIdx < 0 ? (~objectIdx, "Queued") : (objectIdx, "Invisible");
341+
ImGuiUtil.DrawTableColumn($"Redraw Queue #{idx}");
342+
ImGuiUtil.DrawTableColumn(actualIdx.ToString());
343+
ImGuiUtil.DrawTableColumn(state);
344+
}
345+
346+
foreach (var (objectIdx, idx) in _redraws.AfterGPoseQueue.WithIndex())
347+
{
348+
var (actualIdx, state) = objectIdx < 0 ? (~objectIdx, "Queued") : (objectIdx, "Invisible");
349+
ImGuiUtil.DrawTableColumn($"GPose Queue #{idx}");
350+
ImGuiUtil.DrawTableColumn(actualIdx.ToString());
351+
ImGuiUtil.DrawTableColumn(state);
352+
}
353+
354+
foreach (var (name, idx) in _redraws.GPoseNames.OfType<string>().WithIndex())
355+
{
356+
ImGuiUtil.DrawTableColumn($"GPose Name #{idx}");
357+
ImGuiUtil.DrawTableColumn(name);
358+
ImGui.TableNextColumn();
359+
}
360+
361+
}
362+
}
363+
}
320364
}
321365

322366
private void DrawPerformanceTab()

0 commit comments

Comments
 (0)