Vixen
c7401864
csharp
public static class BehaviorTreeLayout

Lays a tree out top-down, parents centred over their children.

Read the guide page for this →

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)

Used by (2)

  • BehaviorTreeDocumentVixen.Editor.AssetEditors
  • BehaviorTreeModelTestsVixen.Editor.Ai.Tests