1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:57:24 +08:00

Fix editor beatmap potentially not updating hitobjects

This commit is contained in:
smoogipoo 2020-04-10 13:29:46 +09:00
parent cc0bcea6e5
commit ee7e2b0854

View File

@ -63,6 +63,7 @@ namespace osu.Game.Screens.Edit
trackStartTime(obj); trackStartTime(obj);
} }
private readonly HashSet<HitObject> pendingUpdates = new HashSet<HitObject>();
private ScheduledDelegate scheduledUpdate; private ScheduledDelegate scheduledUpdate;
/// <summary> /// <summary>
@ -74,15 +75,27 @@ namespace osu.Game.Screens.Edit
private void updateHitObject([CanBeNull] HitObject hitObject, bool silent) private void updateHitObject([CanBeNull] HitObject hitObject, bool silent)
{ {
scheduledUpdate?.Cancel(); scheduledUpdate?.Cancel();
scheduledUpdate = Scheduler.AddDelayed(() =>
if (hitObject != null)
pendingUpdates.Add(hitObject);
scheduledUpdate = Schedule(() =>
{ {
beatmapProcessor?.PreProcess(); beatmapProcessor?.PreProcess();
hitObject?.ApplyDefaults(ControlPointInfo, BeatmapInfo.BaseDifficulty);
foreach (var obj in pendingUpdates)
obj.ApplyDefaults(ControlPointInfo, BeatmapInfo.BaseDifficulty);
beatmapProcessor?.PostProcess(); beatmapProcessor?.PostProcess();
if (!silent) if (!silent)
HitObjectUpdated?.Invoke(hitObject); {
}, 0); foreach (var obj in pendingUpdates)
HitObjectUpdated?.Invoke(obj);
}
pendingUpdates.Clear();
});
} }
public BeatmapInfo BeatmapInfo public BeatmapInfo BeatmapInfo