Vixen
feb85697
csharp
public sealed class SceneHierarchyView

A scene's entities as a tree: what is in it, what is selected, and what things are called.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The half of doc 11's scene editor that is not a viewport. A scene editor is "scene view + hierarchy + inspector"; the viewport is Vixen.Editor.SceneView's and the inspector is Vixen.Editor.Inspector's, and this is the third — written once, so that the scene editor and the prefab editor are one tree over two documents.

The panel is SceneHierarchyView.vxml; this file is the accessibility modifier and the reasoning, the same arrangement as CompiledSceneView beside it.

⚠ A control rather than a model over a panel (#1322). It was new SceneHierarchyView(scene, panel) — a plain class that added a TreeView to whatever container it was handed — and the cost of that was a Detach() its own production caller could not call: SceneEditorFactory.CreateView constructed one for its effect and kept no handle. An element is told when its subtree leaves the document; a plain class has nowhere to hear it.

⚠ Rebuilt from StructureChanged, not polled. The document raises it when entities appear, disappear or change parent, and deliberately does not raise it for a transform edit or a rename — a tree rebuilt on every frame of a gizmo drag would lose its expansion state forty times a second. A rename moves one row's text instead.

⚠ Selection travels out of this and not into it. Clicking a row writes SceneDocument.Selection; something else selecting an entity does not move the highlight, because nothing here subscribes to the signal. That is the same gap the application's own hierarchy has, and the fix is the same Effect that needs a reactive scheduler the editor's loop does not flush.

Fields and properties (5)

  • protected override string TagName
  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public TreeView Tree

    The rows.

  • public SceneDocument? Scene

    The scene being shown, or before the first Show.

  • public int RootCount

    How many rows are at the top level.

Methods (4)

  • protected override void OnCreated()
  • protected override void OnRemoved()
  • public void Show(SceneDocument scene)

    Shows a scene, and stops showing whatever was here before.

  • public void Rebuild()

    Rebuilds the rows from the document as it stands.

Used by (3)

  • PrefabViewVixen.Editor.AssetEditors
  • SceneEditorViewVixen.Editor.AssetEditors
  • SceneHierarchyViewTestsVixen.Editor.AssetEditors.Tests