-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix stack leniency not applying immediately after change #28441
Fix stack leniency not applying immediately after change #28441
Conversation
@@ -105,7 +105,7 @@ public EditorBeatmap(IBeatmap playableBeatmap, ISkin beatmapSkin = null, Beatmap | |||
BeatmapSkin.BeatmapSkinChanged += SaveState; | |||
} | |||
|
|||
beatmapProcessor = playableBeatmap.BeatmapInfo.Ruleset.CreateInstance().CreateBeatmapProcessor(PlayableBeatmap); | |||
beatmapProcessor = playableBeatmap.BeatmapInfo.Ruleset.CreateInstance().CreateBeatmapProcessor(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the primary fix and it works by addressing the thing mentioned in #20675 (comment), namely reading from the correct BeatmapInfo
instance.
I audited both beatmap processors of ours that actually do stuff (osu! and catch), and all of the properties they touch aside from BeatmapInfo
are proxied in EditorBeatmap
forward to PlayableBeatmap
, so from that angle this seems safe-ish.
@@ -49,6 +49,7 @@ protected override void LoadComplete() | |||
private void updateBeatmap() | |||
{ | |||
Beatmap.BeatmapInfo.StackLeniency = stackLeniency.Current.Value; | |||
Beatmap.UpdateAllHitObjects(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bypasses the following guard:
osu/osu.Game/Screens/Edit/EditorBeatmap.cs
Lines 349 to 350 in a8a2e54
if (batchPendingUpdates.Count == 0 && batchPendingDeletes.Count == 0 && batchPendingInserts.Count == 0) | |
return; |
Compare:
osu/osu.Game/Screens/Edit/Setup/DifficultySection.cs
Lines 119 to 132 in a8a2e54
private void updateValues() | |
{ | |
// for now, update these on commit rather than making BeatmapMetadata bindables. | |
// after switching database engines we can reconsider if switching to bindables is a good direction. | |
Beatmap.Difficulty.CircleSize = CircleSizeSlider.Current.Value; | |
Beatmap.Difficulty.DrainRate = HealthDrainSlider.Current.Value; | |
Beatmap.Difficulty.ApproachRate = ApproachRateSlider.Current.Value; | |
Beatmap.Difficulty.OverallDifficulty = OverallDifficultySlider.Current.Value; | |
Beatmap.Difficulty.SliderMultiplier = BaseVelocitySlider.Current.Value; | |
Beatmap.Difficulty.SliderTickRate = TickRateSlider.Current.Value; | |
Beatmap.UpdateAllHitObjects(); | |
Beatmap.SaveState(); | |
} |
@@ -41,47 +42,47 @@ public override void PostProcess() | |||
{ | |||
base.PostProcess(); | |||
|
|||
var osuBeatmap = (Beatmap<OsuHitObject>)Beatmap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hard cast needs to be gone for the EditorBeatmap
change to have a chance of working, because EditorBeatmap
is not a Beatmap<OsuHitObject>
. The catch processor strangely does not do this sort of casting and does nice proper soft casts instead.
As an "optimisation" (reducing iterator and list allocations) I added the soft-cast of Beatmap.HitObjects
to List<OsuHitObject>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine
RFC. Closes #20675.
I don't love this diff and I'm a bit scared of this change, but the last time this was attempted to be fixed the end result was #25467, so in comparison this looks like it may have a chance of maybe passing review.
Will add some self-review comments in a sec because this is a bit counterintuitive and I wasn't sure how much of this was deserving comments (provided this diff survives the initial eye test even). Can also try and add tests for this if this is deemed a viable route forward.