1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 15:27:30 +08:00

Make application of offset/BPM object adjustments more sane

This commit is contained in:
Bartłomiej Dach 2024-09-02 10:40:55 +02:00
parent db608159cf
commit 3eaffbb70a
No known key found for this signature in database
3 changed files with 20 additions and 5 deletions

View File

@ -113,15 +113,17 @@ namespace osu.Game.Screens.Edit.Timing
{
// Only adjust hit object offsets if the group contains a timing control point
if (Beatmap.AdjustNotesOnOffsetBPMChange.Value && cp is TimingControlPoint tp)
{
TimingSectionAdjustments.AdjustHitObjectOffset(Beatmap, tp, time - SelectedGroup.Value.Time);
Beatmap.UpdateAllHitObjects();
}
Beatmap.ControlPointInfo.Add(time, cp);
}
// the control point might not necessarily exist yet, if currentGroupItems was empty.
SelectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(time, true);
Beatmap.UpdateAllHitObjects();
changeHandler?.EndChange();
}
}

View File

@ -202,6 +202,7 @@ namespace osu.Game.Screens.Edit.Timing
// VERY TEMPORARY
var currentGroupItems = selectedGroup.Value.ControlPoints.ToArray();
beatmap.BeginChange();
beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value);
double newOffset = selectedGroup.Value.Time + adjust;
@ -209,17 +210,20 @@ namespace osu.Game.Screens.Edit.Timing
foreach (var cp in currentGroupItems)
{
if (beatmap.AdjustNotesOnOffsetBPMChange.Value && cp is TimingControlPoint tp)
{
TimingSectionAdjustments.AdjustHitObjectOffset(beatmap, tp, adjust);
beatmap.UpdateAllHitObjects();
}
beatmap.ControlPointInfo.Add(newOffset, cp);
}
// the control point might not necessarily exist yet, if currentGroupItems was empty.
selectedGroup.Value = beatmap.ControlPointInfo.GroupAt(newOffset, true);
beatmap.EndChange();
if (!editorClock.IsRunning && wasAtStart)
editorClock.Seek(newOffset);
beatmap.UpdateAllHitObjects();
}
private void adjustBpm(double adjust)
@ -229,9 +233,16 @@ namespace osu.Game.Screens.Edit.Timing
if (timing == null)
return;
double oldBeatLength = timing.BeatLength;
timing.BeatLength = 60000 / (timing.BPM + adjust);
beatmap.UpdateAllHitObjects();
if (beatmap.AdjustNotesOnOffsetBPMChange.Value)
{
beatmap.BeginChange();
TimingSectionAdjustments.SetHitObjectBPM(beatmap, timing, oldBeatLength);
beatmap.UpdateAllHitObjects();
beatmap.EndChange();
}
}
private partial class InlineButton : OsuButton

View File

@ -48,8 +48,10 @@ namespace osu.Game.Screens.Edit.Timing
if (!Beatmap.AdjustNotesOnOffsetBPMChange.Value || ControlPoint.Value == null)
return;
Beatmap.BeginChange();
TimingSectionAdjustments.SetHitObjectBPM(Beatmap, ControlPoint.Value, val.OldValue);
Beatmap.UpdateAllHitObjects();
Beatmap.EndChange();
});
}