public sealed class FoliageStrokeCommandOne foliage stroke as one entry in the undo history.
Remarks
The third stroke command, and the one whose record is instances rather than a rectangle. A sculpt stroke holds a rect of deltas and a paint stroke holds a rect of weights, because both write a grid; a foliage stroke writes a list, so what it holds is what it added and what it took away.
⚠ Redo re-adds rather than re-scattering, and that is not the same thing. The scatter is deterministic from its seed, so re-running it would produce the same trees — but only if nothing else changed in between, and an undo stack does not promise that. Somebody who erased a clearing, undid it, then undid the stroke before it, has changed what the spacing rejection sees. Holding the instances is the only version that is exact.
⚠ Addresses do not survive the round trip and the command does not pretend they do. Undoing a stroke removes what it added, which shifts every index after it; the re-add produces new addresses. So the command works in instances and the editor re-resolves its selection after any edit.
Fields and properties (3)
public string NameWhat this is called in the undo history, as a person would say it.
public int AddedHow many instances the stroke added.
public int RemovedAnd how many it took away.
Methods (3)
public FoliageStrokeCommand(FoliageVolume volume, IReadOnlyList<FoliageAddress> placed, IReadOnlyList<FoliageInstance> erased, IReadOnlyList<int> erasedTypes, string name, Action<FoliageVolume>? 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.
Used by (2)
- FoliageEditVixen.Editor.Terrain
- FoliageModeVixen.Editor.Terrain