mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 07:43:00 +08:00
Merge pull request #24570 from OliBomby/fix-export-slider
Fix last slider control point type being included in legacy export
This commit is contained in:
commit
8561d809b0
@ -70,7 +70,22 @@ namespace osu.Game.Database
|
||||
|
||||
hitObject.StartTime = Math.Floor(hitObject.StartTime);
|
||||
|
||||
if (hitObject is not IHasPath hasPath || BezierConverter.CountSegments(hasPath.Path.ControlPoints) <= 1) continue;
|
||||
if (hitObject is not IHasPath hasPath) continue;
|
||||
|
||||
// stable's hit object parsing expects the entire slider to use only one type of curve,
|
||||
// and happens to use the last non-empty curve type read for the entire slider.
|
||||
// this clear of the last control point type handles an edge case
|
||||
// wherein the last control point of an otherwise-single-segment slider path has a different type than previous,
|
||||
// which would lead to sliders being mangled when exported back to stable.
|
||||
// normally, that would be handled by the `BezierConverter.ConvertToModernBezier()` call below,
|
||||
// which outputs a slider path containing only Bezier control points,
|
||||
// but a non-inherited last control point is (rightly) not considered to be starting a new segment,
|
||||
// therefore it would fail to clear the `CountSegments() <= 1` check.
|
||||
// by clearing explicitly we both fix the issue and avoid unnecessary conversions to Bezier.
|
||||
if (hasPath.Path.ControlPoints.Count > 1)
|
||||
hasPath.Path.ControlPoints[^1].Type = null;
|
||||
|
||||
if (BezierConverter.CountSegments(hasPath.Path.ControlPoints) <= 1) continue;
|
||||
|
||||
var newControlPoints = BezierConverter.ConvertToModernBezier(hasPath.Path.ControlPoints);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user