Vixen
dd8b0a81
csharp
public readonly record struct NodePreview

What a node's output looks like, small, under the node.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Two kinds, because the two questions are different. Doc 11 asks for live preview thumbnails, which for a shader graph means compiling one node's expression and running it over a quad; that is Image, and it is drawn exactly the way Viewport draws a scene — a number the renderer was given, handed back in an image command. A swatch is the other kind and is not a placeholder for it: a constant, a colour, a mask and a channel split all reduce to one colour, and rendering a quad to say so would be a render target per node to answer a question a rectangle answers.

⚠ A number the renderer does not know draws nothing at all, which is Viewport.RenderTarget's warning and applies here for the same reason. A preview that went blank is a target that was recreated and not re-registered — so a source that cannot guarantee its handle is live should answer with a colour instead.

⚠ Unavailable is the third kind, and it replaced a Label that nothing could ever have read — #1092. That parameter offered "a few characters over it", every producer passed the default, and the reason no reader was ever written is structural rather than an oversight: NodePreviewLayer draws — deliberately, for NodeMinimap's reason — and DrawContext has no text primitive at all. A DrawCommandKind.Text carries a shaped glyph run on a baseline and only DrawListBuilder, walking a laid-out text block, can produce one. So the honest channel for "this one has no picture and that is not a fault" is a flag the layer can draw, and this is it.

Why the distinction is worth a field. A source answering leaves no swatch, and a missing swatch is indistinguishable from a preview source that has stopped running — which is #1089 one level up, where a plugin was being unloaded and the only symptom was a blank canvas. A node whose picture only a host with an asset database could supply is a different state and now looks different.

Fields and properties (4)

  • public Color4 Color

    The colour to show when there is no image, or the tint when there is one.

  • public ulong Image

    The renderer's handle for a thumbnail rendered into a target, or zero for a flat swatch.

  • public bool FlipVertically

    Whether that target is upside down, as a scene's is.

  • public bool Unavailable

    Whether this node has no picture for a reason, rather than no picture yet.

Methods (1)

  • public NodePreview(Color4 Color, ulong Image = 0, bool FlipVertically = false, bool Unavailable = false)

    What a node's output looks like, small, under the node.

Used by (10)

  • FixedVixen.Editor.NodeGraph.Tests
  • INodePreviewSourceVixen.Editor.NodeGraph
  • NodePreviewLayerVixen.Editor.NodeGraph
  • NodePreviewWiringTestsVixen.Editor.Texturing.Tests
  • RecorderVixen.Editor.NodeGraph.Tests
  • ShaderGraphDocumentVixen.Editor.AssetEditors
  • ShaderGraphPreviewRendererVixen.Editor.ShaderGraph
  • TextureGraphPreviewDeviceTestsVixen.Editor.TextureGraph.Tests
  • TextureGraphPreviewsVixen.Editor.TextureGraph
  • ViewTestsVixen.Editor.NodeGraph.Tests