Vixen
02b45cc4
csharp
public sealed class TerrainHoleStroke

A hole stroke, recorded so it can be undone.

Read the guide page for this →

Remarks

The parallel of TerrainStroke, and a separate type because a hole is not a delta. The seven sculpt tools write signed offsets into an edit layer, so their record is the layer's values either side; holes are one bit on TerrainHoles, which lives on the terrain rather than on a layer and has no alpha, no stack and no composite. Trying to record one in a TerrainStroke would be recording the wrong container's contents and restoring them onto ground the tool never touched.

⚠ The before image is taken lazily and never re-taken, exactly as Extend does it: a drag crossing the same ground forty times records it once, holding the bit it had before the first crossing. Re-recording would make undo restore the middle of the stroke.

Fields and properties (3)

  • public TerrainRect Rect

    Everything the stroke has touched.

  • public int RecordedSamples

    How many samples the record holds.

  • public bool IsEmpty

    Whether anything has been recorded.

Methods (4)

  • public TerrainHoleStroke(Terrain terrain)

    Begins recording.

  • public TerrainRect Record(in TerrainBrush brush, in BrushStamp stamp)

    Records the bits a stamp is about to change, and says which samples those are.

  • public TerrainRect Undo()

    Puts the mask back the way it was.

  • public IReadOnlyDictionary<long, bool> Capture()

    Captures what the stroke left, so it can be redone.

Used by (2)

  • TerrainEditVixen.Editor.Terrain
  • TerrainHoleCommandVixen.Editor.Terrain