diff --git a/OpenUtau.Core/Editing/ResetBatchEdits.cs b/OpenUtau.Core/Editing/ResetBatchEdits.cs index 7b0fc9dd8..92c04bb70 100644 --- a/OpenUtau.Core/Editing/ResetBatchEdits.cs +++ b/OpenUtau.Core/Editing/ResetBatchEdits.cs @@ -193,4 +193,49 @@ public void Run(UProject project, UVoicePart part, List selectedNotes, Do docManager.EndUndoGroup(); } } + + public class ResetAll : BatchEdit { + public virtual string Name => name; + + private string name; + + public ResetAll() { + name = "pianoroll.menu.notes.reset.all"; + } + + public void Run(UProject project, UVoicePart part, List selectedNotes, DocManager docManager) { + var notes = selectedNotes.Count > 0 ? selectedNotes : part.notes.ToList(); + docManager.StartUndoGroup(true); + foreach (var note in notes) { + // pitch points + docManager.ExecuteCmd(new ResetPitchPointsCommand(part, note)); + // expressions + if (note.phonemeExpressions.Count > 0) { + docManager.ExecuteCmd(new ResetExpressionsCommand(part, note)); + } + // vibrato + if (note.vibrato.length > 0) { + docManager.ExecuteCmd(new VibratoLengthCommand(part, note, 0)); + } + // timings + bool shouldClear = false; + foreach (var o in note.phonemeOverrides) { + if (o.offset != null || o.preutterDelta != null || o.overlapDelta != null) { + shouldClear = true; + break; + } + } + if (shouldClear) { + docManager.ExecuteCmd(new ClearPhonemeTimingCommand(part, note)); + } + // aliases + foreach (var o in note.phonemeOverrides) { + if (o.phoneme != null) { + docManager.ExecuteCmd(new ChangePhonemeAliasCommand(part, note, o.index, null)); + } + } + } + docManager.EndUndoGroup(); + } + } } diff --git a/OpenUtau/Strings/Strings.axaml b/OpenUtau/Strings/Strings.axaml index c9c068c28..87a06cf53 100644 --- a/OpenUtau/Strings/Strings.axaml +++ b/OpenUtau/Strings/Strings.axaml @@ -298,6 +298,7 @@ Warning: this option removes custom presets. Remove tail "-" Remove tail "R" Reset phoneme aliases + Reset notes to default Reset all parameters Reset all expressions Reset phoneme timings diff --git a/OpenUtau/Views/PianoRollWindow.axaml.cs b/OpenUtau/Views/PianoRollWindow.axaml.cs index 2c1b9ec0f..3e760ff2c 100644 --- a/OpenUtau/Views/PianoRollWindow.axaml.cs +++ b/OpenUtau/Views/PianoRollWindow.axaml.cs @@ -130,6 +130,7 @@ await MessageBox.ShowProcessing(this, $"{name} - ? / ?", new ResetVibratos(), new ClearTimings(), new ResetAliases(), + new ResetAll(), }.Select(edit => new MenuItemViewModel() { Header = ThemeManager.GetString(edit.Name), Command = noteBatchEditCommand,