mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 23:15:34 +08:00
Take custom bank name length into account when collapsing sample point indicators
Would close https://github.com/ppy/osu/issues/31312. Not super happy with the performance overhead of this, but this is already a heuristic-based implementation to avoid every-frame `.ChildrenOfType<>()` calls or similar, so not super sure how to do better. The `Array.Contains()` check stands out in profiling, but without it the indicators can collapse *too* eagerly sometimes.
This commit is contained in:
parent
f18114d2fb
commit
693db097ee
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Audio;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -131,7 +132,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
private void updateSamplePointContractedState()
|
private void updateSamplePointContractedState()
|
||||||
{
|
{
|
||||||
const double minimum_gap = 28;
|
const double absolute_minimum_gap = 31; // assumes single letter bank name for default banks
|
||||||
|
double minimumGap = absolute_minimum_gap;
|
||||||
|
|
||||||
if (timeline == null || editorClock == null)
|
if (timeline == null || editorClock == null)
|
||||||
return;
|
return;
|
||||||
@ -153,9 +155,23 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
if (hitObject.GetEndTime() < editorClock.CurrentTime - timeline.VisibleRange / 2)
|
if (hitObject.GetEndTime() < editorClock.CurrentTime - timeline.VisibleRange / 2)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
foreach (var sample in hitObject.Samples)
|
||||||
|
{
|
||||||
|
if (!HitSampleInfo.AllBanks.Contains(sample.Bank))
|
||||||
|
minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
|
||||||
|
}
|
||||||
|
|
||||||
if (hitObject is IHasRepeats hasRepeats)
|
if (hitObject is IHasRepeats hasRepeats)
|
||||||
|
{
|
||||||
smallestTimeGap = Math.Min(smallestTimeGap, hasRepeats.Duration / hasRepeats.SpanCount() / 2);
|
smallestTimeGap = Math.Min(smallestTimeGap, hasRepeats.Duration / hasRepeats.SpanCount() / 2);
|
||||||
|
|
||||||
|
foreach (var sample in hasRepeats.NodeSamples.SelectMany(s => s))
|
||||||
|
{
|
||||||
|
if (!HitSampleInfo.AllBanks.Contains(sample.Bank))
|
||||||
|
minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double gap = lastTime - hitObject.GetEndTime();
|
double gap = lastTime - hitObject.GetEndTime();
|
||||||
|
|
||||||
// If the gap is less than 1ms, we can assume that the objects are stacked on top of each other
|
// If the gap is less than 1ms, we can assume that the objects are stacked on top of each other
|
||||||
@ -167,7 +183,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
|
|
||||||
double smallestAbsoluteGap = ((TimelineSelectionBlueprintContainer)SelectionBlueprints).ContentRelativeToAbsoluteFactor.X * smallestTimeGap;
|
double smallestAbsoluteGap = ((TimelineSelectionBlueprintContainer)SelectionBlueprints).ContentRelativeToAbsoluteFactor.X * smallestTimeGap;
|
||||||
SamplePointContracted.Value = smallestAbsoluteGap < minimum_gap;
|
SamplePointContracted.Value = smallestAbsoluteGap < minimumGap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Stack<HitObject> currentConcurrentObjects = new Stack<HitObject>();
|
private readonly Stack<HitObject> currentConcurrentObjects = new Stack<HitObject>();
|
||||||
|
Loading…
Reference in New Issue
Block a user