Vixen
02b45cc4
csharp
public sealed class SetComponentCommand

Adding, removing and setting a component, undoably.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ One command for the whole component rather than one per field. A component is read as a box, edited, and written back whole — so recording each field would put a step on the stack that undoes a change to a copy nobody can see, and the visible change would belong to a different step.

⚠ Removing records what was there, so undo puts the values back and not just the column. An undo that restored a zeroed component would be worse than none: the hierarchy would look right and the light would be black.

Fields and properties (1)

  • public string Name

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

Methods (3)

  • public SetComponentCommand(SceneDocument document, IComponentBridge bridge, Entity entity, object? before, object? after, string name)

    Records a change to one component on one entity.

  • public void Do(EditorContext context)

    Applies the change.

  • public void Undo(EditorContext context)

    Puts back exactly what Do changed.

Used by (1)

  • ComponentsViewVixen.Editor.App