Vixen
dd8b0a81
csharp
public sealed class DiagnosticsPanel

A panel that shows what a running document is doing, for whoever is building it.

Read the guide page for this →

Remarks

Doc 13 calls a UI-debug view "the single most valuable tool for anyone building a UI in this framework". UiDiagnostics is the half that reads a document; this is the half that shows it, and the two are separate types because the aggregator is Vixen.Ui's and a control is not.

⚠ A control rather than an IDiagnosticOverlay, and the seam is the whole reason why. The other overlays report a frame the interface knows nothing about, so they live where the frame does. Every number here is about a UiDocument — and the one host whose whole job is drawing one, UiApplication, may not reference Vixen.Engine at all, while the one production holder of a DiagnosticOverlays cannot see Vixen.Ui. An overlay written for this would be registered nowhere, which is this repository's commonest defect wearing a diagnostics badge. A control works in UiApplication, in the editor and in any game that draws a document, and needs no reference in either direction.

⚠ It reports the frame before this one, deliberately, and that is not a rounding error. A panel drawn into the document it describes is part of that document: it has elements, it is styled, it is laid out, and so it moves StylesApplied, LayoutNodes and the settling counters it is reporting. Call Refresh at the top of the frame, before the document restyles, and the numbers shown are the ones the previous pass finished with — a frame old and self-consistent, which is the trade FrameStatsOverlay already documents. Refreshing in the middle of a pass reports a document half way through changing, including this panel's own churn.

⚠ Subject is what makes it usable at all in the honest arrangement. A panel that could only describe its own document has no way to describe one without perturbing it; pointing this at another document — a second UiDocument on its own surface — makes the reading exact rather than merely consistent. The default is the panel's own document, because that is the arrangement somebody debugging reaches for first.

The rows are a KeyValueList, which pools: a panel refreshed sixty times a second rewrites text rather than building and discarding a few dozen elements to say what it said last frame.

Fields and properties (6)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public UiDocument? Subject

    The document this describes. Its own, unless another one is named.

  • public Vector2? Probe

    Where the element description comes from, in the subject's coordinates.

  • public int RowCount

    How many rows the last Refresh wrote.

  • public KeyValueList Rows

    The rows, as they are shown.

Methods (2)

  • public void Refresh()

    Reads the subject and rewrites the rows. Call it at the top of the frame.

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

Used by (5)

  • DiagnosticsPanelTestsVixen.Ui.Controls.Tests
  • UiApplicationVixen.Ui.Desktop
  • EditorApplicationVixen.Editor.App
  • EditorShellVixen.Editor.Ui
  • UiDiagnosticsPanelTestsVixen.Editor.App.Tests