1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:52:55 +08:00

Fix editor arrow seek snapping not updating after control point changes

The editor clock, which is responsible for performing the seek, was not
aware of changes in control points due to reading from the wrong
beatmap. `loadableBeatmap` is not actually changed by any of the editor
components; `playableBeatmap` and `editorBeatmap` are.

For now this is changed to use `playableBeatmap`. A better follow-up
would be to use `editorBeatmap`, but it would probably be best to move
the beat snap bindable into `EditorBeatmap` first.
This commit is contained in:
Bartłomiej Dach 2021-04-03 11:43:47 +02:00
parent b66ba43bc5
commit 4df7ff21c7
3 changed files with 21 additions and 21 deletions

View File

@ -122,22 +122,6 @@ namespace osu.Game.Screens.Edit
return;
}
beatDivisor.Value = loadableBeatmap.BeatmapInfo.BeatDivisor;
beatDivisor.BindValueChanged(divisor => loadableBeatmap.BeatmapInfo.BeatDivisor = divisor.NewValue);
// Todo: should probably be done at a DrawableRuleset level to share logic with Player.
clock = new EditorClock(loadableBeatmap, beatDivisor) { IsCoupled = false };
UpdateClockSource();
dependencies.CacheAs(clock);
AddInternal(clock);
clock.SeekingOrStopped.BindValueChanged(_ => updateSampleDisabledState());
// todo: remove caching of this and consume via editorBeatmap?
dependencies.Cache(beatDivisor);
try
{
playableBeatmap = loadableBeatmap.GetPlayableBeatmap(loadableBeatmap.BeatmapInfo.Ruleset);
@ -154,6 +138,22 @@ namespace osu.Game.Screens.Edit
return;
}
beatDivisor.Value = playableBeatmap.BeatmapInfo.BeatDivisor;
beatDivisor.BindValueChanged(divisor => playableBeatmap.BeatmapInfo.BeatDivisor = divisor.NewValue);
// Todo: should probably be done at a DrawableRuleset level to share logic with Player.
clock = new EditorClock(playableBeatmap, beatDivisor) { IsCoupled = false };
UpdateClockSource();
dependencies.CacheAs(clock);
AddInternal(clock);
clock.SeekingOrStopped.BindValueChanged(_ => updateSampleDisabledState());
// todo: remove caching of this and consume via editorBeatmap?
dependencies.Cache(beatDivisor);
AddInternal(editorBeatmap = new EditorBeatmap(playableBeatmap, loadableBeatmap.Skin));
dependencies.CacheAs(editorBeatmap);
changeHandler = new EditorChangeHandler(editorBeatmap);

View File

@ -42,12 +42,12 @@ namespace osu.Game.Screens.Edit
/// </summary>
public bool IsSeeking { get; private set; }
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
: this(beatmap.Beatmap.ControlPointInfo, beatmap.Track.Length, beatDivisor)
public EditorClock(IBeatmap beatmap, BindableBeatDivisor beatDivisor)
: this(beatmap.ControlPointInfo, beatDivisor)
{
}
public EditorClock(ControlPointInfo controlPointInfo, double trackLength, BindableBeatDivisor beatDivisor)
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor)
{
this.beatDivisor = beatDivisor;
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Edit
}
public EditorClock()
: this(new ControlPointInfo(), 1000, new BindableBeatDivisor())
: this(new ControlPointInfo(), new BindableBeatDivisor())
{
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual
protected EditorClockTestScene()
{
Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false };
Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false };
}
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)