Vixen
02b45cc4
csharp
public sealed class EditMeshCommand

One undoable edit to one mesh, at whichever of the two granularities it needs.

Read the guide page for this →

Remarks

Doc 24's D3, and it is one command type with two shapes rather than two types. A position change — a gizmo drag on selected vertices — records the before and after positions of the elements it touched, and merges with the drag before it. A topology change — extrude, bevel, boolean, loop cut — records the whole mesh, before and after.

⚠ The second looks wasteful and is the only honest answer. A boolean has no inverse to record; a bevel with three segments touches every table in the structure; and an "undo" implemented as an inverse operation is a second implementation of every tool, which will disagree with the first. A blockout mesh is a few thousand vertices — tens of kilobytes — and CommandStack.Capacity defaults to 256, so the worst case is a few megabytes of history for a mesh nobody has that big.

⚠ State the bound rather than discovering it. A designer who spends an hour on one mesh generates the deep history this is measured against, and Capacity is settable for exactly that. A budget in bytes rather than in entries is the change to make if it is ever hit — recorded here so that it is a decision rather than a surprise.

⚠ The mesh is replaced on undo, not mutated back. The document holds a reference and so does everything drawing it, so putting the recorded object back is what makes a redo of a topology change exact — and it is why the recorded meshes are deep copies rather than the live one. A command that stored a reference where it needed a copy is precisely what Vixen.Editor.Core's randomised do/undo/redo suite exists to catch.

Fields and properties (2)

  • public string Name

    What this is called in the undo history, as a person would say it.

  • public bool IsTopology

    Whether this one records the whole mesh rather than a handful of positions.

Methods (6)

Used by (10)

  • BlockoutBooleanVixen.Editor.Blockout
  • BlockoutCreateVixen.Editor.Blockout
  • BlockoutCubeGridVixen.Editor.Blockout
  • BlockoutGeometryVixen.Editor.Blockout
  • BlockoutHandoffVixen.Editor.Blockout
  • BlockoutSurfacesVixen.Editor.Blockout
  • EditMeshSceneTestsVixen.Editor.SceneView.Tests
  • MeshEditVixen.Editor.SceneView
  • MeshGizmoTargetVixen.Editor.SceneView
  • SceneCloneVixen.Editor.SceneView