public sealed class SetMembersCommand<TOwner, TValue> where TOwner : classSetting one member to one value on every selected object.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
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 the history, which is 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". This is the array that makes "apply to all" reversible.
Merging is what makes a slider drag one entry. Two of these merge when they set the same member on the same objects in the same order, and the merged command keeps the earlier one's old values — so one undo goes back to before the drag, not to the value one mouse-move ago. CommandStack.Seal on mouse-up is what ends the run, exactly as EditorProperty does it.
Fields and properties (1)
public string NameWhat this is called in the undo history, as a person would say it.
Methods (4)
public SetMembersCommand(InspectorMember<TOwner, TValue> member, TOwner[] targets, TValue[] oldValues, TValue 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)Absorbs the entry below this one, so that the two become one undo step.
Used by (1)
- InspectorMemberVixen.Editor.Inspector