Vixen
02b45cc4
csharp
public sealed class SetValuesCommand

Setting one member to one value on every selected object, through boxed accessors.

Read the guide page for this →

Remarks

What an IEditMember without typed accessors returns from CreateSetCommand. The inspector's generated members build a typed command instead, because they can reach a struct field by reference and this cannot. Everything else about the two is the same, and this is the one a graph port, a settings row or a plugin's own member gets for free rather than writing.

One command for the whole selection, not one per object. Editing a field with twenty things selected is one edit and undoing it is one keystroke. A composite of twenty commands would undo correctly and would report twenty entries in a history nobody can read.

The old values are per object. They have to be: the whole point of a mixed-value edit is that the objects disagreed, and undo has to put each one back to what it held rather than to a shared "before".

Fields and properties (1)

  • public string Name

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

Methods (4)

  • public SetValuesCommand(IEditMember member, IReadOnlyList<object> targets, IReadOnlyList<object?> oldValues, object? newValue, EditorDocument? document = null)

    Describes setting a member across a selection.

  • 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)

  • TestMemberVixen.Editor.Core.Tests