1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 03:23:03 +08:00

Fixed certain UI elements not working for HitObject BPM/Offset adjustment

This commit is contained in:
Aurelian 2024-06-09 11:29:25 +02:00
parent ac0c425e29
commit 33d0d4c8f2
3 changed files with 18 additions and 5 deletions

View File

@ -109,11 +109,18 @@ namespace osu.Game.Screens.Edit.Timing
Beatmap.ControlPointInfo.RemoveGroup(SelectedGroup.Value); Beatmap.ControlPointInfo.RemoveGroup(SelectedGroup.Value);
foreach (var cp in currentGroupItems) foreach (var cp in currentGroupItems)
{
// Only adjust hit object offsets if the group contains a timing control point
if (Beatmap.AdjustNotesOnOffsetBPMChange.Value && cp is TimingControlPoint tp)
tp.AdjustHitObjectOffset(Beatmap, time - SelectedGroup.Value.Time);
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

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -10,14 +9,11 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osuTK; using osuTK;
namespace osu.Game.Screens.Edit.Timing namespace osu.Game.Screens.Edit.Timing
@ -226,7 +222,6 @@ namespace osu.Game.Screens.Edit.Timing
beatmap.UpdateAllHitObjects(); beatmap.UpdateAllHitObjects();
} }
private void adjustBpm(double adjust) private void adjustBpm(double adjust)
{ {
var timing = selectedGroup.Value?.ControlPoints.OfType<TimingControlPoint>().FirstOrDefault(); var timing = selectedGroup.Value?.ControlPoints.OfType<TimingControlPoint>().FirstOrDefault();

View File

@ -42,6 +42,17 @@ namespace osu.Game.Screens.Edit.Timing
{ {
if (!isRebinding) ChangeHandler?.SaveState(); if (!isRebinding) ChangeHandler?.SaveState();
} }
bpmTextEntry.Bindable.BindValueChanged(val =>
{
if (ControlPoint.Value == null)
return;
ChangeHandler?.BeginChange();
ControlPoint.Value.SetHitObjectBPM(Beatmap, val.OldValue);
Beatmap.UpdateAllHitObjects();
ChangeHandler?.EndChange();
});
} }
private bool isRebinding; private bool isRebinding;