public sealed class ShaderGraphDocumentA shader, open for editing as a graph, with the Raven it emits beside it.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Doc 20's B5 has had "shader graph ✅" against .ShaderGraph for a while, and what that ticked was the node library, the typing and the emission. None of it was reachable: there was no document, no factory and no registration, so nothing in the editor could turn a double-click into a graph. This is that half — the same shape VfxDocument and CompositorDocument already have, and for the same reason it is in this assembly rather than in Vixen.Editor.ShaderGraph: that one knows nothing about a project or a panel, which is what lets its tests compile a graph with no editor in the way.
⚠ The file holds the graph, not the shader. A .vxshadergraph is a NodeGraphAsset — nodes, edges, positions, the numbers and names an author typed — and Compile turns it into Raven. Saving the emitted source instead would throw away the layout and make the document unopenable; saving both would be two files that can disagree, with the generated one the tempting thing to hand-edit.
⚠ Compiling runs the graph compiler and Raven's front end. The graph compiler's complaints name a node and a port; Raven's name a line of text the author never wrote. Both are worth having and neither substitutes for the other — a graph that is well-formed can still emit a shader that does not type-check, which is exactly the failure a panel showing only Diagnostics would report as success. Mapping the second kind back to the node that emitted the line needs the emitter to record spans and is SourceDiagnostics's standing debt, written down in doc 11.
⚠ Nothing imports a .vxshadergraph yet, for the reason CompositorDocument gives about a .vxcomp: NativeFormatImporter carries a document forward unchanged, and what a build needs from a graph is the compiled shader. That is an importer that runs Compile and hands the source to Raven, which is doc 08's seam and not a panel's.
⚠ A file this build cannot read opens empty and says why. NodeGraphDocument.Load repairs what it can and refuses a graph from a later version outright; both arrive in LoadDiagnostics rather than as an exception, so the panel that could show the problem is reachable.
Fields and properties (8)
public const string ExtensionWhat a shader graph is written as.
public string AssetPathWhere the file is, absolute.
public NodeGraphModel GraphThe graph.
public NodeTypeRegistry RegistryThe node types this document is edited against.
public IReadOnlyList<NodeDiagnostic> LoadDiagnosticsWhat reading the file had to say — repairs, and a refusal.
public IReadOnlyList<NodeDiagnostic> DiagnosticsWhat the last Compile had to say about the graph.
public IReadOnlyList<CodeDiagnostic> SourceDiagnosticsWhat Raven had to say about the source the last Compile emitted.
public ShaderGraphSource? SourceThe shader the last Compile emitted, or .
Events (1)
public Action<ShaderGraphDocument>? CompiledRaised after Compile has run.
Methods (5)
public ShaderGraphDocument(EditorProject project, AssetId asset, string path, NodeTypeRegistry? registry = null)Opens a shader graph.
public ShaderGraphSource? Compile()Compiles the graph, and puts the emitted source through Raven.
public string ToYaml()The graph as this document would write it, without writing it.
public string? ShaderSource()The Raven the graph emits, for a host that wants the text.
protected override void SaveCore()Writes the document back to wherever it came from.
Used by (5)
- ShaderGraphEditorFactoryVixen.Editor.AssetEditors
- ShaderGraphSurfaceTestsVixen.Editor.App.Tests
- ShaderGraphTestsVixen.Editor.AssetEditors.Tests
- ShaderGraphViewVixen.Editor.AssetEditors
- ShaderGraphViewTestsVixen.Editor.AssetEditors.Tests