Vixen
02b45cc4
csharp
public sealed class TerrainMode

The viewport mode the sculpt tools live in.

Read the guide page for this →

Remarks

The third mode, and the first whose gestures are the feature — [docs/plan/31 § Two modes, not three, and not one]. Blockout proved the seam by claiming keys that already meant something; this one claims eight of them and then spends the whole of every drag inside Pointer, because a brush is not a verb with a shortcut — it is a pointer that means something else while the mode is active.

⚠ Terrain and Foliage are two modes because they filter different things. Sculpt and paint require a terrain and act on its texels; foliage paints onto any surface and its filter set is the feature. One mode that did both would have to answer "what is the target surface" twice with different answers. Unreal splits them for this reason and it is right.

⚠ Entering the mode with no terrain shows the create panel rather than an empty toolbar. HasTerrain is what the panel reads, and the tool commands are disabled rather than hidden — a mode that does nothing and says nothing is the state every one of these toolsets puts a new user in.

Fields and properties (42)

  • public const string ModeId

    What the mode is called, everywhere an id is wanted.

  • public const string TerrainContext

    The command context the mode claims while it is active.

  • public const string PanelId

    What the panel the mode opens is registered as.

  • public string Id

    What everything refers to it by: select, blockout.

  • public StringId Title

    What the mode bar's button says.

  • public PathBuilder? Icon
  • public IconArt? Art

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

  • public string? Context

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

  • public string? Panel
  • public IReadOnlyList<ToolbarEntry> Toolbar
  • public static IReadOnlyList<TerrainCategory> Categories

    The two halves of the toolset, in the order the strip lists them.

  • public static IReadOnlyList<TerrainPaintTool> PaintTools

    The four paint tools, in the order the strip lists them.

  • public static IReadOnlyList<TerrainTool> Tools

    Every tool, in the order the strip lists them.

  • public TerrainEdit Editing

    The editing state the mode drives.

  • public EditorDocument? Document

    The document a committed stroke goes onto, or null while the mode drives none.

  • public Vector3 Origin

    Where the terrain's sample origin is, in world space.

  • public float Reach

    How far a pointer ray looks for the ground, in metres.

  • public bool HasTerrain

    Whether there is a terrain to sculpt.

  • public TerrainCreateSettings Create

    The form a new terrain is created from, which is the panel's first section.

  • public TerrainCategory Category

    Which half of the toolset the digits and the strip are showing.

  • public TerrainPaintTool PaintTool

    Which paint tool a drag runs, while the category is Paint.

  • public int ToolCount

    How many tools the current category has, which is what the digits address.

  • public TerrainTool Tool

    Which sculpt tool a drag runs.

  • public const int SlotCount

    How many digits the mode claims.

  • public const string AddTargetCommand

    Adds a target layer to paint with.

  • public const string RemoveTargetCommand

    Removes the selected one, giving its coverage back to the rest.

  • public static IReadOnlyList<string> TargetCommands

    Every target-layer verb, in the order the menu lists them.

  • public const string GrowBrushCommand

    Makes the brush bigger.

  • public const string ShrinkBrushCommand

    And smaller.

  • public const string HarderCommand

    Presses harder.

  • public const string SofterCommand

    And softer.

  • public const string CreateCommand

    Creates the terrain the create form describes.

  • public const string AddLayerCommand

    Adds an edit layer on top of the stack.

  • public const string RemoveLayerCommand

    Removes the selected one.

  • public const string DuplicateLayerCommand

    Copies it, deltas and all.

  • public const string ClearLayerCommand

    Empties it without removing it.

  • public const string CollapseLayerCommand

    Adds it into the layer below and drops it.

  • public const string RaiseLayerCommand

    Moves it up the stack.

  • public const string LowerLayerCommand

    And down.

  • public const string ToggleLayerCommand

    Shows or hides it.

  • public static IReadOnlyList<string> BrushCommands

    Every brush verb, in the order the menu lists them.

  • public static IReadOnlyList<string> LayerCommands

    And every layer verb.

Events (5)

  • public Action<IEditorCommand>? Committed

    Raised when a stroke has been committed, with the entry that undoes it.

  • public Action<Terrain>? Created

    Raised when the mode has made a terrain, so the application can put it in a scene.

  • public Action<TerrainCategory>? CategoryChanged

    Raised when Category changes.

  • public Action<TerrainPaintTool>? PaintToolChanged

    Raised when PaintTool changes.

  • public Action<TerrainTool>? ToolChanged

    Raised when Tool changes.

Methods (14)

  • public bool SelectSlot(int slot)

    Selects the th tool of the current category, 0-based.

  • public static string ToolCommand(TerrainTool tool)

    What the command that selects a tool is called.

  • public static string PaintToolCommand(TerrainPaintTool tool)

    What the command that selects a paint tool is called.

  • public static string CategoryCommand(TerrainCategory category)

    What the command that chooses a category is called.

  • public static string SlotCommand(int slot)

    What the command bound to a digit is called.

  • public void Register(EditorShell shell)

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

  • public void Unregister(EditorShell shell)

    Takes them back out.

  • public void Activated()

    The mode has become the active one.

  • public void Deactivated()
  • public bool Pointer(PointerEvent args)
  • public bool Key(KeyEvent args)
  • public bool Pointer(SceneViewport pane, PointerEvent args)
  • public bool Key(SceneViewport pane, KeyEvent args)
  • public IEditorCommand? Commit()

    Ends the stroke and puts it on the document's stack.

Used by (9)

  • EditorModeTestsVixen.Editor.App.Tests
  • FoliageModeTestsVixen.Editor.Terrain.Tests
  • SculptSessionTestsVixen.Editor.Terrain.Tests
  • TerrainModeTestsVixen.Editor.Terrain.Tests
  • TerrainModuleVixen.Editor.Terrain
  • TerrainPaintModeTestsVixen.Editor.Terrain.Tests
  • TerrainPanelTestsVixen.Editor.Terrain.Tests
  • TerrainPanelTestsVixen.Editor.App.Tests
  • TerrainSessionTestsVixen.Editor.App.Tests