Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to hide breaks from timeline #30505

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading