public void PerformAndRecordCommand(BaseCommand command, bool discardIfNotMerged = false) { bool discardCommand = discardIfNotMerged; BaseCommand delta = command; ClearRedo(); while (m_OperationStack.Any()) { BaseCommand top = m_OperationStack.Pop(); if (!top.Merge(command)) { m_OperationStack.Push(top); break; } discardCommand = false; command = top; } if (discardCommand) { command.Dispose(); return; } delta.Redo(); m_OperationStack.Push(command); OperationStackChanged(); }
// TODO: deprecate in favor of PerformAndRecordCommand // Used by BrushStrokeCommand and ModifyLightCommmand while in Disco mode public void RecordCommand(BaseCommand command) { ClearRedo(); while (m_OperationStack.Any()) { BaseCommand top = m_OperationStack.Pop(); if (!top.Merge(command)) { m_OperationStack.Push(top); break; } command = top; } m_OperationStack.Push(command); OperationStackChanged(); }