public sealed class NodeGraphModelA graph: nodes, the edges between them, and the furniture round them.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
One model for three graphs. Shader, VFX and animation graphs differ in what their nodes mean and in what they compile to, not in what a graph is. Building three of these is three times the work of building one, and doc 11 says so.
It refuses cycles as they are made, not when they are compiled. A graph that cannot contain a cycle is a graph NodeGraphCompiler can walk without a visited set and a graph a view can lay out without one. The alternative — allow it, report it later — means every consumer has to be robust against a structure the model already knows is wrong, and it means an author finds out about a mistake at a different time from making it.
An input takes one edge. Connecting a second replaces the first, because that is what an author dragging a wire onto an occupied port means every time. An output takes any number; a value read twice is read twice.
⚠ Those three rules are not written here. They are GraphInvariants', and Vixen.Ui.Controls.Advanced.NodeGraph — the graph a canvas draws — calls the same three methods and gets the same GraphConnectionError values back. Two graph types is deliberate; two sets of rules was not, and a change to one of them now has nowhere to land but the shared place. What is still different is delivery: see Connect.
Fields and properties (6)
public string NameWhat the graph is called. A sub-graph is referenced by this.
public IReadOnlyCollection<GraphNode> NodesIts nodes, in insertion order of identity.
public IReadOnlyList<GraphEdge> EdgesIts edges.
public List<GraphGroup> GroupsIts group boxes.
public List<GraphComment> CommentsIts sticky notes.
public List<PortDefinition> InterfaceThe ports this graph has when another graph contains it as a node.
Events (1)
public Action<NodeGraphModel>? ChangedRaised after anything structural changes.
Methods (11)
public void Touch()Says the graph changed in a way it had no way to notice.
public GraphNode Add(string type, Vector2 position = default(Vector2))Adds a node.
public GraphNode Add(NodeId id, string type, Vector2 position = default(Vector2))Adds a node under an identity chosen by the caller.
public void Restore(GraphNode node)Adds a node back under the identity it had, for an undo.
public bool TryGet(NodeId id, out GraphNode? node)One node by identity.
public GraphNode? Remove(NodeId id, out GraphEdge[] detached)Removes a node and every edge touching it.
public GraphEdge? Connect(PortRef from, PortRef to)Connects an output to an input.
public bool TryConnect(PortRef from, PortRef to, out GraphEdge? replaced, out GraphConnectionError error)Connects an output to an input, and says why not when it will not.
public GraphEdge? Disconnect(PortRef to)Disconnects whatever arrives at an input.
public PortRef? Source(PortRef to)What arrives at an input, if anything.
public IReadOnlyList<GraphNode> Ordered()The nodes in an order where every node comes after everything feeding it.
Used by (58, showing 40)
- AddCommentCommandVixen.Editor.NodeGraph
- AddGroupCommandVixen.Editor.NodeGraph
- AddNodeCommandVixen.Editor.NodeGraph
- AuthoringTestsVixen.Editor.AssetEditors.Tests
- CommandTestsVixen.Editor.NodeGraph.Tests
- CompositorCompilerTestsVixen.Editor.AssetEditors.Tests
- CompositorDocumentVixen.Editor.AssetEditors
- CompositorDocumentTestsVixen.Editor.AssetEditors.Tests
- CompositorGraphCompilerVixen.Editor.AssetEditors
- CompositorViewVixen.Editor.AssetEditors
- ConnectCommandVixen.Editor.NodeGraph
- DisconnectCommandVixen.Editor.NodeGraph
- ExtractSubGraphCommandVixen.Editor.NodeGraph
- FixedVixen.Editor.NodeGraph.Tests
- FlattenerVixen.Editor.NodeGraph
- GraphPairVixen.Editor.NodeGraph.Tests
- INodePreviewSourceVixen.Editor.NodeGraph
- ISubGraphSourceVixen.Editor.NodeGraph
- LayoutCommandVixen.Editor.NodeGraph
- LayoutTestsVixen.Editor.NodeGraph.Tests
- ListingCompilerVixen.Editor.NodeGraph.Tests
- MoveNodesCommandVixen.Editor.NodeGraph
- NodeGraphClipboardVixen.Editor.NodeGraph
- NodeGraphCommandVixen.Editor.NodeGraph
- NodeGraphCompilerVixen.Editor.NodeGraph
- NodeGraphDocumentVixen.Editor.NodeGraph
- NodeGraphLayoutVixen.Editor.NodeGraph
- NodeGraphModelTestsVixen.Editor.NodeGraph.Tests
- NodeGraphViewVixen.Editor.NodeGraph
- NodeInspectorVixen.Editor.NodeGraph
- NodeTypingTestsVixen.Editor.NodeGraph.Tests
- PasteCommandVixen.Editor.NodeGraph
- PortValueTestsVixen.Editor.NodeGraph.Tests
- RecorderVixen.Editor.NodeGraph.Tests
- RecordingVixen.Editor.NodeGraph.Tests
- RemoveCommentCommandVixen.Editor.NodeGraph
- RemoveGroupCommandVixen.Editor.NodeGraph
- RemoveNodesCommandVixen.Editor.NodeGraph
- RenameGroupCommandVixen.Editor.NodeGraph
- SetCommentCommandVixen.Editor.NodeGraph