public static class BehaviorTreeLayoutLays a tree out top-down, parents centred over their children.
Remarks
⚠ The existing NodeGraphLayout is left-to-right by longest path, which is right for dataflow and wrong for a tree — doc 37 § D19 names this as one of the additions the canvas needed. It landed here rather than in the framework because the layout needs the tree, and the tree is BehaviorTreeContent: a longest-path layout over a projected graph would have to rediscover the parent-child structure it was projected from, and would get the sibling order from the wires rather than from the list that actually holds it.
Reingold–Tilford's shape, in its simple form: lay the leaves out left to right in order, then put every parent at the midpoint of its children. That gives the two properties an author reads a tree by — siblings are in priority order left to right, and a parent sits over the branch it owns — and it is one pass down and one pass up.
⚠ It is a command, not something that happens on open. Positions are authored data (doc 37 § D5): a layout somebody spent an afternoon on is thrown away by an editor that re-runs this every time the file is opened, and — worse, if order were derived from position, which here it is not — it would silently change what the agent does.
Methods (2)
public static void Apply(BehaviorTreeModel model, BehaviorLayoutOptions options = default(BehaviorLayoutOptions))Lays out a whole tree, writing each node's position.
public static float HeightOf(BehaviorNodeContent node, BehaviorLayoutOptions options)How tall a node's box is, which the row spacing has to clear.
Used by (2)
- BehaviorTreeDocumentVixen.Editor.AssetEditors
- BehaviorTreeModelTestsVixen.Editor.Ai.Tests