1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 02:52:54 +08:00

Merge pull request #28621 from bdach/fix-hitmarker-performance-again

Fix editor performance regression with hitmarkers active
This commit is contained in:
Dean Herbert 2024-06-27 01:16:17 +09:00 committed by GitHub
commit 1a606ae7e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 17 deletions

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
@ -325,19 +326,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
internal void SuppressHitAnimations()
{
UpdateState(ArmedState.Idle, true);
UpdateState(ArmedState.Idle);
UpdateComboColour();
// This method is called every frame. If we need to, the following can likely be converted
// to code which doesn't use transforms at all.
// This method is called every frame in editor contexts, thus the lack of need for transforms.
// Matches stable (see https://github.com/peppy/osu-stable-reference/blob/bb57924c1552adbed11ee3d96cdcde47cf96f2b6/osu!/GameplayElements/HitObjects/Osu/HitCircleOsu.cs#L336-L338)
if (Time.Current >= HitStateUpdateTime)
{
// More or less matches stable (see https://github.com/peppy/osu-stable-reference/blob/bb57924c1552adbed11ee3d96cdcde47cf96f2b6/osu!/GameplayElements/HitObjects/Osu/HitCircleOsu.cs#L336-L338)
AccentColour.Value = Color4.White;
Alpha = Interpolation.ValueAt(Time.Current, 1f, 0f, HitStateUpdateTime, HitStateUpdateTime + 700);
}
using (BeginAbsoluteSequence(StateUpdateTime - 5))
this.TransformBindableTo(AccentColour, Color4.White, Math.Max(0, HitStateUpdateTime - StateUpdateTime));
using (BeginAbsoluteSequence(HitStateUpdateTime))
this.FadeOut(700).Expire();
LifetimeEnd = HitStateUpdateTime + 700;
}
internal void RestoreHitAnimations()

View File

@ -375,14 +375,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
internal void SuppressHitAnimations()
{
UpdateState(ArmedState.Idle, true);
UpdateState(ArmedState.Idle);
HeadCircle.SuppressHitAnimations();
TailCircle.SuppressHitAnimations();
}
internal void RestoreHitAnimations()
{
UpdateState(ArmedState.Hit, force: true);
UpdateState(ArmedState.Hit);
HeadCircle.RestoreHitAnimations();
TailCircle.RestoreHitAnimations();
}

View File

@ -3,12 +3,12 @@
#nullable disable
using System;
using System.Diagnostics;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Skinning;
@ -132,14 +132,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
internal void SuppressHitAnimations()
{
UpdateState(ArmedState.Idle, true);
UpdateState(ArmedState.Idle);
UpdateComboColour();
using (BeginAbsoluteSequence(StateUpdateTime - 5))
this.TransformBindableTo(AccentColour, Color4.White, Math.Max(0, HitStateUpdateTime - StateUpdateTime));
// This method is called every frame in editor contexts, thus the lack of need for transforms.
using (BeginAbsoluteSequence(HitStateUpdateTime))
this.FadeOut(700).Expire();
if (Time.Current >= HitStateUpdateTime)
{
// More or less matches stable (see https://github.com/peppy/osu-stable-reference/blob/bb57924c1552adbed11ee3d96cdcde47cf96f2b6/osu!/GameplayElements/HitObjects/Osu/HitCircleOsu.cs#L336-L338)
AccentColour.Value = Color4.White;
Alpha = Interpolation.ValueAt(Time.Current, 1f, 0f, HitStateUpdateTime, HitStateUpdateTime + 700);
}
LifetimeEnd = HitStateUpdateTime + 700;
}
internal void RestoreHitAnimations()