public sealed class ShapeCommandOne undoable change to a parametric shape: its numbers, or the loss of them.
Remarks
Doc 24's D6 on the undo stack, and it records no geometry at all. A parametric entity's mesh is a function of its parameters, so putting the parameters back is what puts the mesh back — exactly, and for four numbers rather than for a copy of the mesh. That is the one place this differs from EditMeshCommand, which has to record whole meshes because a topology change has no inverse.
⚠ Demoting records nothing either, and leaves the geometry exactly where it is. The mesh a shape generated is already in the document; taking the parameters away changes nothing about it. An undo puts them back and regenerates — which produces the same mesh, because nothing has edited it yet: the first edit is its own entry on the stack and is undone first.
⚠ Two parameter edits of one shape merge and two of different shapes do not. Dragging a corridor's width field is one decision made over forty frames, and forty entries for it is the shape of every "undo did not undo what I did" report — the same argument EditMeshCommand makes about a gizmo drag. A demotion never merges with anything, because it is a different kind of act and one people are entitled to step back over on its own.
Fields and properties (3)
public string NameWhat this is called in the undo history, as a person would say it.
public bool IsDemotionWhether this is the one-way door rather than a change of numbers.
public Entity EntityWhich entity's shape it changes.
Methods (5)
public static ShapeCommand Set(SceneDocument document, Entity entity, ShapeParameters parameters, string name = "Shape")Records giving an entity a shape, or changing the one it has.
public static ShapeCommand Demote(SceneDocument document, Entity entity, string name = "Make Editable")Records the demotion: the parameters go and the geometry stays.
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)Absorbs the entry below this one, so that the two become one undo step.
Used by (5)
- BlockoutBooleanVixen.Editor.Blockout
- BlockoutCreateVixen.Editor.Blockout
- BlockoutHandoffVixen.Editor.Blockout
- MeshEditVixen.Editor.SceneView
- SceneCloneVixen.Editor.SceneView