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

Merge pull request #20966 from peppy/avoid-unnecessary-path-updates

Avoid unnecessarily refreshing `SliderBodyPiece`'s path
This commit is contained in:
Bartłomiej Dach 2022-10-27 20:42:14 +02:00 committed by GitHub
commit 7479be3719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,16 +40,23 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
body.BorderColour = colours.Yellow;
}
private int? lastVersion;
public override void UpdateFrom(Slider hitObject)
{
base.UpdateFrom(hitObject);
body.PathRadius = hitObject.Scale * OsuHitObject.OBJECT_RADIUS;
var vertices = new List<Vector2>();
hitObject.Path.GetPathToProgress(vertices, 0, 1);
if (lastVersion != hitObject.Path.Version.Value)
{
lastVersion = hitObject.Path.Version.Value;
body.SetVertices(vertices);
var vertices = new List<Vector2>();
hitObject.Path.GetPathToProgress(vertices, 0, 1);
body.SetVertices(vertices);
}
Size = body.Size;
OriginPosition = body.PathOffset;