public sealed class BehaviorTreeDocumentA behaviour tree, open for editing.
Remarks
The model and the compiler are Vixen.Editor.Ai's and Vixen.Ai's — neither knows about a project, a document or a panel — and this is the YAML end of it and the undo stack over it.
⚠ Every gesture is one snapshot in, one snapshot out. The node graphs use fine-grained inverses because a shader graph is thousands of nodes; a behaviour tree is tens, and a snapshot is a few kilobytes of strings. What that buys is that a reparent, a reorder and a key rename that rewrote forty references are all undoable by construction, with no chance of an inverse that puts back four of the five things it changed. The entries still merge, so dragging a number is one step rather than forty.
⚠ Compiled when it is asked for, not on every edit. Adding a composite produces a tree with a composite that has no children; adding a decorator produces one whose key is briefly empty. Compiling on every change would fill the panel with complaints about a node somebody is halfway through making — the rule CompositorDocument and AnimationGraphDocument both state.
Fields and properties (6)
public const string ExtensionWhat a behaviour tree is written as.
public string AssetPathWhere the file is, absolute.
public BehaviorTreeModel ModelThe tree, and every operation over it.
public string? LoadErrorWhy the file would not read, or .
public IReadOnlyList<BehaviorTreeDiagnostic> DiagnosticsWhat the last Compile had to say.
public BehaviorTreeTemplate? TemplateWhat the last Compile produced, or .
Events (1)
public Action<BehaviorTreeDocument>? ChangedRaised after anything changes the tree.
Methods (6)
public BehaviorTreeDocument(EditorProject project, AssetId asset, string path)Opens a tree.
public string ToYaml()The tree as it would be written.
public BehaviorTreeTemplate? Compile(BehaviorTreeResolver? resolver = null)Compiles the tree, against whatever a caller can resolve.
public void Edit(string name, Action<BehaviorTreeModel> gesture, string? mergeKey = null)Runs a gesture as one undo entry.
public void Layout()Lays the tree out top-down, as one undo entry.
protected override void SaveCore()Writes the document back to wherever it came from.
Used by (5)
- BehaviorTreeDocumentTestsVixen.Editor.AssetEditors.Tests
- BehaviorTreeEditorFactoryVixen.Editor.AssetEditors
- BehaviorTreeViewVixen.Editor.AssetEditors
- LiveTreeCanvasTestsVixen.Editor.AssetEditors.Tests
- SnapshotCommandVixen.Editor.AssetEditors