public abstract class NodeGraphCommandThe half of an undoable graph edit that every one of them shares.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A command holds the model, not the document. A graph is edited the same way whether it is an open asset, a sub-graph being previewed, or a fixture in a test with no project behind it — so the document is optional and its only job is to be marked dirty. That is also what makes every command here testable without a command stack.
⚠ Undo depends on identities never being reused. Restore puts a node back under the identity it had, which is what lets the edges a deletion took with it be restored by name rather than rewritten. Every command below relies on it, and a model that renumbered on undo would break all of them at once.
Fields and properties (3)
protected NodeGraphModel GraphThe graph being edited.
protected EditorDocument? DocumentThe document it belongs to, if it belongs to one.
public abstract string NameWhat this is called in the undo history, as a person would say it.
Methods (6)
protected NodeGraphCommand(NodeGraphModel graph, EditorDocument? document)Starts a command against a graph.
public void Do(EditorContext context)Applies the change.
public void Undo(EditorContext context)Puts back exactly what Do changed.
public virtual bool TryMergeWith(IEditorCommand previous, out IEditorCommand? merged)protected abstract void Apply()Makes the change. Called once on execute and again on every redo.
protected abstract void Revert()Puts back exactly what Apply changed.
Used by (15)
- AddCommentCommandVixen.Editor.NodeGraph
- AddGroupCommandVixen.Editor.NodeGraph
- AddNodeCommandVixen.Editor.NodeGraph
- ConnectCommandVixen.Editor.NodeGraph
- DisconnectCommandVixen.Editor.NodeGraph
- ExtractSubGraphCommandVixen.Editor.NodeGraph
- MoveNodesCommandVixen.Editor.NodeGraph
- PasteCommandVixen.Editor.NodeGraph
- RemoveCommentCommandVixen.Editor.NodeGraph
- RemoveGroupCommandVixen.Editor.NodeGraph
- RemoveNodesCommandVixen.Editor.NodeGraph
- RenameGroupCommandVixen.Editor.NodeGraph
- SetCommentCommandVixen.Editor.NodeGraph
- SetPortTextCommandVixen.Editor.NodeGraph
- SetPortValueCommandVixen.Editor.NodeGraph