Skip to content

Commit

Permalink
Merge pull request #30505 from peppy/editor-hide-breaks
Browse files Browse the repository at this point in the history
Add ability to hide breaks from timeline
  • Loading branch information
bdach authored Nov 6, 2024
2 parents 8aed578 + 9d65d39 commit 2699ebb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion osu.Game/Configuration/OsuConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ protected override void InitialiseDefaults()
SetDefault<UserStatus?>(OsuSetting.UserOnlineStatus, null);

SetDefault(OsuSetting.EditorTimelineShowTimingChanges, true);
SetDefault(OsuSetting.EditorTimelineShowBreaks, true);
SetDefault(OsuSetting.EditorTimelineShowTicks, true);

SetDefault(OsuSetting.EditorContractSidebars, false);
Expand Down Expand Up @@ -439,6 +440,7 @@ public enum OsuSetting
AlwaysShowHoldForMenuButton,
EditorContractSidebars,
EditorScaleOrigin,
EditorRotationOrigin
EditorRotationOrigin,
EditorTimelineShowBreaks,
}
}
5 changes: 5 additions & 0 deletions osu.Game/Localisation/EditorStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ public static class EditorStrings
/// </summary>
public static LocalisableString TimelineShowTimingChanges => new TranslatableString(getKey(@"timeline_show_timing_changes"), @"Show timing changes");

/// <summary>
/// "Show breaks"
/// </summary>
public static LocalisableString TimelineShowBreaks => new TranslatableString(getKey(@"timeline_show_breaks"), @"Show breaks");

/// <summary>
/// "Show ticks"
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using osu.Framework.Bindables;
using osu.Framework.Caching;
using osu.Game.Beatmaps.Timing;
using osu.Game.Configuration;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;

namespace osu.Game.Screens.Edit.Compose.Components.Timeline
Expand All @@ -27,6 +28,15 @@ public partial class TimelineBreakDisplay : TimelinePart<TimelineBreak>

private readonly BindableList<BreakPeriod> breaks = new BindableList<BreakPeriod>();

private readonly BindableBool showBreaks = new BindableBool(true);

[BackgroundDependencyLoader]
private void load(OsuConfigManager configManager)
{
configManager.BindWith(OsuSetting.EditorTimelineShowBreaks, showBreaks);
showBreaks.BindValueChanged(_ => breakCache.Invalidate());
}

protected override void LoadBeatmap(EditorBeatmap beatmap)
{
base.LoadBeatmap(beatmap);
Expand Down Expand Up @@ -67,6 +77,9 @@ private void recreateBreaks()
{
Clear();

if (!showBreaks.Value)
return;

for (int i = 0; i < breaks.Count; i++)
{
var breakPeriod = breaks[i];
Expand Down
6 changes: 6 additions & 0 deletions osu.Game/Screens/Edit/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
private Bindable<bool> editorAutoSeekOnPlacement;
private Bindable<bool> editorLimitedDistanceSnap;
private Bindable<bool> editorTimelineShowTimingChanges;
private Bindable<bool> editorTimelineShowBreaks;
private Bindable<bool> editorTimelineShowTicks;
private Bindable<bool> editorContractSidebars;

Expand Down Expand Up @@ -323,6 +324,7 @@ private void load(OsuConfigManager config)
editorAutoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement);
editorLimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap);
editorTimelineShowTimingChanges = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
editorTimelineShowBreaks = config.GetBindable<bool>(OsuSetting.EditorTimelineShowBreaks);
editorTimelineShowTicks = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
editorContractSidebars = config.GetBindable<bool>(OsuSetting.EditorContractSidebars);

Expand Down Expand Up @@ -390,6 +392,10 @@ private void load(OsuConfigManager config)
{
State = { BindTarget = editorTimelineShowTicks }
},
new ToggleMenuItem(EditorStrings.TimelineShowBreaks)
{
State = { BindTarget = editorTimelineShowBreaks }
},
]
},
new BackgroundDimMenuItem(editorBackgroundDim),
Expand Down

0 comments on commit 2699ebb

Please sign in to comment.