Skip to content

Commit

Permalink
Change default keybinding for seeking to previous/next objects (and c…
Browse files Browse the repository at this point in the history
…lear old conflicting default)

Closes #29803.
  • Loading branch information
bdach committed Sep 13, 2024
1 parent 2ccb4a4 commit 1b6ab8e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
14 changes: 7 additions & 7 deletions osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ public void TestSeekBetweenObjects()
});
AddStep("seek to 0", () => EditorClock.Seek(0));

pressAndCheckTime(Key.Right, 1000, Key.ControlLeft);
pressAndCheckTime(Key.Right, 2250, Key.ControlLeft);
pressAndCheckTime(Key.Right, 3600, Key.ControlLeft);
pressAndCheckTime(Key.Right, 3600, Key.ControlLeft);
pressAndCheckTime(Key.Left, 2250, Key.ControlLeft);
pressAndCheckTime(Key.Left, 1000, Key.ControlLeft);
pressAndCheckTime(Key.Left, 1000, Key.ControlLeft);
pressAndCheckTime(Key.Right, 1000, Key.ControlLeft, Key.AltLeft);
pressAndCheckTime(Key.Right, 2250, Key.ControlLeft, Key.AltLeft);
pressAndCheckTime(Key.Right, 3600, Key.ControlLeft, Key.AltLeft);
pressAndCheckTime(Key.Right, 3600, Key.ControlLeft, Key.AltLeft);
pressAndCheckTime(Key.Left, 2250, Key.ControlLeft, Key.AltLeft);
pressAndCheckTime(Key.Left, 1000, Key.ControlLeft, Key.AltLeft);
pressAndCheckTime(Key.Left, 1000, Key.ControlLeft, Key.AltLeft);
}

private void pressAndCheckTime(Key key, double expectedTime, params Key[] modifiers)
Expand Down
20 changes: 19 additions & 1 deletion osu.Game/Database/RealmAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ public class RealmAccess : IDisposable
/// 40 2023-12-21 Add ScoreInfo.Version to keep track of which build scores were set on.
/// 41 2024-04-17 Add ScoreInfo.TotalScoreWithoutMods for future mod multiplier rebalances.
/// 42 2024-08-07 Update mania key bindings to reflect changes to ManiaAction
/// 43 2024-09-13 Reset default seek to previous/next object key bindings to avoid conflict with selection nudge hotkeys.
/// </summary>
private const int schema_version = 42;
private const int schema_version = 43;

/// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
Expand Down Expand Up @@ -1192,6 +1193,23 @@ void remapKeyBinding(int oldAction, int newAction)
}

break;

case 43:
{
// Clear default bindings for the chat focus toggle,
// as they would conflict with the newly-added leaderboard toggle.
var keyBindings = migration.NewRealm.All<RealmKeyBinding>();

var seekToPreviousBinding = keyBindings.FirstOrDefault(bind => bind.ActionInt == (int)GlobalAction.EditorSeekToPreviousHitObject);
if (seekToPreviousBinding != null && seekToPreviousBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Control, InputKey.Left }))
migration.NewRealm.Remove(seekToPreviousBinding);

var seekToNextBinding = keyBindings.FirstOrDefault(bind => bind.ActionInt == (int)GlobalAction.EditorSeekToNextHitObject);
if (seekToNextBinding != null && seekToNextBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Control, InputKey.Right }))
migration.NewRealm.Remove(seekToNextBinding);

break;
}
}

Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Input/Bindings/GlobalActionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public static IEnumerable<GlobalAction> GetGlobalActionsFor(GlobalActionCategory
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.MouseWheelLeft }, GlobalAction.EditorCycleNextBeatSnapDivisor),
new KeyBinding(new[] { InputKey.Control, InputKey.R }, GlobalAction.EditorToggleRotateControl),
new KeyBinding(new[] { InputKey.Control, InputKey.E }, GlobalAction.EditorToggleScaleControl),
new KeyBinding(new[] { InputKey.Control, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject),
new KeyBinding(new[] { InputKey.Control, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject),
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject),
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject),
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.Left }, GlobalAction.EditorSeekToPreviousSamplePoint),
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.Right }, GlobalAction.EditorSeekToNextSamplePoint),
};
Expand Down

0 comments on commit 1b6ab8e

Please sign in to comment.