1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 16:32:55 +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.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -325,19 +326,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
internal void SuppressHitAnimations() internal void SuppressHitAnimations()
{ {
UpdateState(ArmedState.Idle, true); UpdateState(ArmedState.Idle);
UpdateComboColour(); UpdateComboColour();
// This method is called every frame. If we need to, the following can likely be converted // This method is called every frame in editor contexts, thus the lack of need for transforms.
// to code which doesn't use transforms at all.
// 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)) LifetimeEnd = HitStateUpdateTime + 700;
this.TransformBindableTo(AccentColour, Color4.White, Math.Max(0, HitStateUpdateTime - StateUpdateTime));
using (BeginAbsoluteSequence(HitStateUpdateTime))
this.FadeOut(700).Expire();
} }
internal void RestoreHitAnimations() internal void RestoreHitAnimations()

View File

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

View File

@ -3,12 +3,12 @@
#nullable disable #nullable disable
using System;
using System.Diagnostics; using System.Diagnostics;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -132,14 +132,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
internal void SuppressHitAnimations() internal void SuppressHitAnimations()
{ {
UpdateState(ArmedState.Idle, true); UpdateState(ArmedState.Idle);
UpdateComboColour(); UpdateComboColour();
using (BeginAbsoluteSequence(StateUpdateTime - 5)) // This method is called every frame in editor contexts, thus the lack of need for transforms.
this.TransformBindableTo(AccentColour, Color4.White, Math.Max(0, HitStateUpdateTime - StateUpdateTime));
using (BeginAbsoluteSequence(HitStateUpdateTime)) if (Time.Current >= HitStateUpdateTime)
this.FadeOut(700).Expire(); {
// 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() internal void RestoreHitAnimations()