1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Merge pull request #27249 from EVAST9919/editor-alloc

Reduce osu editor allocations with many objects selected
This commit is contained in:
Dean Herbert 2024-02-20 15:06:25 +08:00 committed by GitHub
commit ef413c08f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 8 deletions

View File

@ -78,9 +78,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
Scale = new Vector2(hitObject.Scale);
if (hitObject is IHasComboInformation combo)
ring.BorderColour = combo.GetComboColour(skin);
double editorTime = editorClock.CurrentTime;
double hitObjectTime = hitObject.StartTime;
bool hasReachedObject = editorTime >= hitObjectTime;
@ -92,6 +89,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
ring.Scale = new Vector2(1 + 0.1f * ringScale);
content.Alpha = 0.9f * (1 - alpha);
// TODO: should only update colour on skin/combo/object change.
if (hitObject is IHasComboInformation combo && content.Alpha > 0)
ring.BorderColour = combo.GetComboColour(skin);
}
else
content.Alpha = 0;

View File

@ -416,8 +416,22 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
DrawableObject.SliderBody?.ToScreenSpace(DrawableObject.SliderBody.PathEndOffset) ?? BodyPiece.ToScreenSpace(BodyPiece.PathEndLocation)
};
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
BodyPiece.ReceivePositionalInputAt(screenSpacePos) || ControlPointVisualiser?.Pieces.Any(p => p.ReceivePositionalInputAt(screenSpacePos)) == true;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
{
if (BodyPiece.ReceivePositionalInputAt(screenSpacePos))
return true;
if (ControlPointVisualiser == null)
return false;
foreach (var p in ControlPointVisualiser.Pieces)
{
if (p.ReceivePositionalInputAt(screenSpacePos))
return true;
}
return false;
}
protected virtual SliderCircleOverlay CreateCircleOverlay(Slider slider, SliderPosition position) => new SliderCircleOverlay(slider, position);
}

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
@ -124,12 +123,34 @@ namespace osu.Game.Rulesets.Edit
private (HitObject before, HitObject after)? getObjectsOnEitherSideOfCurrentTime()
{
HitObject? lastBefore = playfield.HitObjectContainer.AliveObjects.LastOrDefault(h => h.HitObject.StartTime < editorClock.CurrentTime)?.HitObject;
HitObject? lastBefore = null;
foreach (var entry in playfield.HitObjectContainer.AliveEntries)
{
double objTime = entry.Value.HitObject.StartTime;
if (objTime >= editorClock.CurrentTime)
continue;
if (objTime > lastBefore?.StartTime)
lastBefore = entry.Value.HitObject;
}
if (lastBefore == null)
return null;
HitObject? firstAfter = playfield.HitObjectContainer.AliveObjects.FirstOrDefault(h => h.HitObject.StartTime >= editorClock.CurrentTime)?.HitObject;
HitObject? firstAfter = null;
foreach (var entry in playfield.HitObjectContainer.AliveEntries)
{
double objTime = entry.Value.HitObject.StartTime;
if (objTime < editorClock.CurrentTime)
continue;
if (objTime < firstAfter?.StartTime)
firstAfter = entry.Value.HitObject;
}
if (firstAfter == null)
return null;