Vixen
02b45cc4
csharp
public interface IEditorMode

A statement about what the viewport's input means right now.

Read the guide page for this →

Remarks

A mode is not a toolbar of commands. Unreal's Select / Landscape / Foliage / Mesh Paint strip is a claim about what a click in the viewport is, and doc 20's A1 asks for the interface before the second mode exists because retrofitting one is how editors end up with six mutually-exclusive booleans on the viewport.

⚠ What makes the seam necessary rather than nice is Context. Doc 24's B2 is the case: 1/2/3 are vertex, edge and face in every modelling tool ever written, and doc 20's B2 gives 1..9 to view-bookmark recall. Both are right. A mode that owns those keys while it is active and releases them when it is not is the only resolution that does not make one of them worse — and the machinery for it already exists, because Context and CommandFor are how the outliner and the content browser already share Delete.

⚠ Register and Activated are different moments and registering from the second is the mistake this pair exists to prevent. A mode's commands have to be in the registry from the moment the mode is, or they are absent from the keybinding editor, absent from the palette, and their bindings are unsaveable until somebody has entered the mode once. Activation is state, not registration.

⚠ Everything optional is genuinely optional. A mode with no icon draws its title, a mode with no toolbar adds nothing to the mode bar, a mode with no panel opens none, and a mode that refuses no input is a mode that only owns its keys — which is exactly what doc 24's P0 ships Blockout as.

Fields and properties (7)

  • string Id

    What everything refers to it by: select, blockout.

  • StringId Title

    What the mode bar's button says.

  • PathBuilder? Icon

    The glyph on that button, or to draw the title instead.

  • IconArt? Art

    Coloured art for the mode's button, drawn with the title underneath.

  • string? Context

    Which command context the mode claims while it is active, or .

  • string? Panel

    A panel opened while the mode is active, or for none.

  • IReadOnlyList<ToolbarEntry> Toolbar

    What the mode puts on the mode bar beside the mode buttons.

Methods (6)

  • void Register(EditorShell shell)

    Puts the mode's commands, bindings and panels into the shell.

  • void Unregister(EditorShell shell)

    Takes them back out.

  • void Activated()

    The mode has become the active one.

  • void Deactivated()

    It has stopped being it.

  • bool Pointer(PointerEvent args)

    First refusal on a pointer event in the viewport.

  • bool Key(KeyEvent args)

    First refusal on a key event in the viewport.

Used by (18)

  • BlockoutModeVixen.Editor.Blockout
  • BlockoutModeTestsVixen.Editor.Blockout.Tests
  • EditorApplicationVixen.Editor.App
  • EditorModeTestsVixen.Editor.App.Tests
  • EditorModesVixen.Editor.Ui
  • FakeVixen.Editor.Ui.Tests
  • FoliageModeVixen.Editor.Terrain
  • FoliageModeTestsVixen.Editor.Terrain.Tests
  • LoadingTestsVixen.Editor.Plugin.Tests
  • ModeVixen.Editor.App.Tests
  • ModeInputVixen.Editor.App
  • ModeStripTestsVixen.Editor.Ui.Tests
  • PluginContextVixen.Editor.Plugin
  • ProbeVixen.Editor.Ui.Tests
  • SelectModeVixen.Editor.Ui
  • TerrainModeVixen.Editor.Terrain
  • TerrainPanelTestsVixen.Editor.App.Tests
  • TerrainSessionTestsVixen.Editor.App.Tests