public sealed class TerrainStrokeCommandOne brush stroke as one entry in the undo history.
Remarks
[docs/plan/31 § D11], and the record it wraps is the kernel's. TerrainStroke holds the layer, the union of the rectangles the stroke touched, and that rectangle's deltas before and after; this is the thing that puts it on CommandStack and tells the terrain what to recomposite either way.
⚠ Merging is off, deliberately and not by omission. Two strokes are two undos — which is what an artist means by "undo that" and what every paint application does. What does merge is inside the stroke: a drag is one TerrainStroke being extended rather than four hundred commands, so by the time one of these exists the merging has already happened.
⚠ Built at pointer-up, from a stroke that has already been applied. Every command in the editor records this way — see EditMeshCommand.Moved — because a drag applies as it goes and the command is what makes the finished state undoable rather than what performs it. So Do is a redo the first time it is not called, which is why the constructor takes the captured after-image rather than reapplying the brush.
Fields and properties (5)
public string NameWhat this is called in the undo history, as a person would say it.
public TerrainRect RectWhich samples the stroke touched.
public TerrainEditLayer LayerWhich layer it wrote.
public int RecordedSamplesHow many samples the record holds, before and after together.
public long BytesHow many bytes it occupies.
Methods (4)
public TerrainStrokeCommand(Terrain terrain, TerrainStroke stroke, string name, Action<TerrainRect>? changed = null)Records an applied stroke.
public void Do(EditorContext context)Applies the change.
public void Undo(EditorContext context)Puts back exactly what Do changed.
public bool TryMergeWith(IEditorCommand previous, out IEditorCommand? merged)
Used by (1)
- TerrainEditVixen.Editor.Terrain