Vixen
dd8b0a81
csharp
public static class SelectionCage

The corner brackets drawn round a selected object, in the object's own axes.

Read the guide page for this →

Remarks

What says "this one is selected" in a pane the editor does not shade itself. The viewport has two other answers and both are the tool renderer's: an amber tint on the surface — SelectedColour — and, before that, an inverted hull expanded in the editor's own instanced mesh shader. Neither is in a frame a GraphicsCompositor drew, so a composed pane showed a selected object exactly like an unselected one while the gizmo sitting on it said otherwise. This is lines, and lines survive that frame: SceneLines emits them and FramePresenter's Tools pass records them over the composition.

⚠ An overlay rather than a change to the surface, and in a composed pane that is not a compromise — it is the only correct answer. A composed pane exists to show the frame a game would draw. Painting the selected object amber is precisely the one edit that destroys what the pane is for: the material you selected the object to look at is the thing you can no longer see. The tint is right in the tool pane, which is a diagram; a picture wants its annotation drawn over it.

⚠ Brackets, not a box, because Bounds is already a box. That flag draws twelve continuous edges round every shaped entity — grey, and amber for a selected one — as a diagnostic about extent. A selection cage drawn the same way would be a second drawing indistinguishable from the first, which is the failure a box round the selection walks into. Eight corners of three short segments is a broken box: it reads as a bracket at each corner rather than as an edge, at a glance and at any distance.

⚠ And it stands off the extent by a width in pixels. A cage exactly on the box is coplanar with the bounds box when both are on and coincident with the silhouette when neither is — either way it z-fights the thing it is annotating. A standoff in world units would be invisible on a building and swallow a bolt, so this is the hull outline's own rule kept: EditorCamera.WorldPerPixel at the object, so the gap is the width it was asked for at every distance and in both projections.

⚠ Nothing here knows what a selection is. It is handed a box, a matrix and a colour, which is what makes it usable from a contributed gizmo and testable without a scene. Which entities get one, and what each one's extent is, is SceneLines's.

Fields and properties (2)

  • public const float Corner

    How much of each edge a bracket takes, as a fraction of that edge's whole length.

  • public const float Standoff

    How far outside the extent the cage sits, in render pixels.

Methods (1)

Used by (2)

  • SceneLinesVixen.Editor.SceneView
  • SelectionCageTestsVixen.Editor.SceneView.Tests