Exemple #1
0
 /// <summary>
 /// Finishes the previous undo group, if there was one, and begin a new undo group.
 /// The name of the group is taken from the command argument.
 /// </summary>
 /// <remarks>
 /// The undo group is automatically incremented based on events
 /// eg. mouse down events, executing a menu item increments the current
 /// group. But sometimes it is necessary to manually start a new group of undo operations.
 /// </remarks>
 /// <param name="command">The command that causes the new undo group to be started.
 /// Pass null if the undo group should not be named.</param>
 internal void PushUndoGroup(UndoableCommand command = null)
 {
     Undo.IncrementCurrentGroup();
     if (command != null && !string.IsNullOrEmpty(command.UndoString))
     {
         Undo.SetCurrentGroupName(command.UndoString);
     }
 }
Exemple #2
0
 /// <summary>
 /// Pushes the current state on the undo stack.
 /// </summary>
 /// <param name="command">Use command.UndoString as the name of the undo item.</param>
 public virtual void PushUndo(UndoableCommand command)
 {
     Undo.RegisterCompleteObjectUndo(new Object[] { m_UndoState }, command?.UndoString ?? "");
 }