Fix incorrect legacy conversion when B-splines are used

This commit is contained in:
Bartłomiej Dach 2023-11-20 15:08:58 +09:00
parent 80a3225bb2
commit 6d7d826b8b
No known key found for this signature in database
2 changed files with 8 additions and 3 deletions

View File

@ -85,7 +85,8 @@ namespace osu.Game.Database
if (hasPath.Path.ControlPoints.Count > 1)
hasPath.Path.ControlPoints[^1].Type = null;
if (BezierConverter.CountSegments(hasPath.Path.ControlPoints) <= 1) continue;
if (BezierConverter.CountSegments(hasPath.Path.ControlPoints) <= 1
&& hasPath.Path.ControlPoints[0].Type!.Value.Degree == null) continue;
var newControlPoints = BezierConverter.ConvertToModernBezier(hasPath.Path.ControlPoints);

View File

@ -164,9 +164,13 @@ namespace osu.Game.Rulesets.Objects
break;
case SplineType.BSpline:
for (int j = 0; j < segmentVertices.Length - 1; j++)
var bSplineResult = segmentType.Degree == null
? segmentVertices
: PathApproximator.BSplineToBezier(segmentVertices, segmentType.Degree.Value);
for (int j = 0; j < bSplineResult.Length - 1; j++)
{
result.Add(new PathControlPoint(segmentVertices[j], j == 0 ? segmentType : null));
result.Add(new PathControlPoint(bSplineResult[j], j == 0 ? PathType.BEZIER : null));
}
break;