Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix editor performance regression with hitmarkers active #28621

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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;
Expand Down Expand Up @@ -325,19 +326,19 @@ public ProxyableSkinnableDrawable(ISkinComponentLookup lookup, Func<ISkinCompone

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)

using (BeginAbsoluteSequence(StateUpdateTime - 5))
this.TransformBindableTo(AccentColour, Color4.White, Math.Max(0, HitStateUpdateTime - StateUpdateTime));
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(HitStateUpdateTime))
this.FadeOut(700).Expire();
LifetimeEnd = HitStateUpdateTime + 700;
}

internal void RestoreHitAnimations()
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,14 @@ private partial class DefaultSliderBody : PlaySliderBody

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();
}
Expand Down
17 changes: 11 additions & 6 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -132,14 +132,19 @@ protected override void OnApply()

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()
Expand Down
Loading