1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +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 // Only adjust hit object offsets if the group contains a timing control point
if (Beatmap.AdjustNotesOnOffsetBPMChange.Value && cp is TimingControlPoint tp) if (Beatmap.AdjustNotesOnOffsetBPMChange.Value && cp is TimingControlPoint tp)
{
TimingSectionAdjustments.AdjustHitObjectOffset(Beatmap, tp, time - SelectedGroup.Value.Time); TimingSectionAdjustments.AdjustHitObjectOffset(Beatmap, tp, time - SelectedGroup.Value.Time);
Beatmap.UpdateAllHitObjects();
}
Beatmap.ControlPointInfo.Add(time, cp); Beatmap.ControlPointInfo.Add(time, cp);
} }
// the control point might not necessarily exist yet, if currentGroupItems was empty. // the control point might not necessarily exist yet, if currentGroupItems was empty.
SelectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(time, true); SelectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(time, true);
Beatmap.UpdateAllHitObjects();
changeHandler?.EndChange(); changeHandler?.EndChange();
} }
} }

View File

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

View File

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