From 0efa12a86a5b3f19251e90b65f80f523a9ded5bc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Mar 2024 21:52:56 +0300 Subject: [PATCH] Fix parameter commands applying initial value before start time --- osu.Game/Storyboards/Commands/IStoryboardCommand.cs | 3 +++ .../Commands/StoryboardBlendingParametersCommand.cs | 6 +++++- osu.Game/Storyboards/Commands/StoryboardFlipHCommand.cs | 6 +++++- osu.Game/Storyboards/Commands/StoryboardFlipVCommand.cs | 6 +++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/osu.Game/Storyboards/Commands/IStoryboardCommand.cs b/osu.Game/Storyboards/Commands/IStoryboardCommand.cs index 6efb19afe4..ea14f5fa40 100644 --- a/osu.Game/Storyboards/Commands/IStoryboardCommand.cs +++ b/osu.Game/Storyboards/Commands/IStoryboardCommand.cs @@ -28,6 +28,9 @@ namespace osu.Game.Storyboards.Commands /// /// Sets the value of the corresponding property in to the start value of this command. /// + /// + /// Parameter commands (e.g. / / ) only apply the start value if they have zero duration, i.e. take "permanent" effect regardless of time. + /// /// The target drawable. void ApplyInitialValue(TDrawable d) where TDrawable : Drawable, IFlippable, IVectorScalable; diff --git a/osu.Game/Storyboards/Commands/StoryboardBlendingParametersCommand.cs b/osu.Game/Storyboards/Commands/StoryboardBlendingParametersCommand.cs index 9ac6613708..cf9cadf1a7 100644 --- a/osu.Game/Storyboards/Commands/StoryboardBlendingParametersCommand.cs +++ b/osu.Game/Storyboards/Commands/StoryboardBlendingParametersCommand.cs @@ -15,7 +15,11 @@ namespace osu.Game.Storyboards.Commands public override string PropertyName => nameof(Drawable.Blending); - public override void ApplyInitialValue(TDrawable d) => d.Blending = StartValue; + public override void ApplyInitialValue(TDrawable d) + { + if (StartTime == EndTime) + d.Blending = StartValue; + } public override TransformSequence ApplyTransforms(TDrawable d) => d.TransformTo(nameof(d.Blending), StartValue).Delay(Duration) diff --git a/osu.Game/Storyboards/Commands/StoryboardFlipHCommand.cs b/osu.Game/Storyboards/Commands/StoryboardFlipHCommand.cs index fa07ff6645..fbf7295f15 100644 --- a/osu.Game/Storyboards/Commands/StoryboardFlipHCommand.cs +++ b/osu.Game/Storyboards/Commands/StoryboardFlipHCommand.cs @@ -16,7 +16,11 @@ namespace osu.Game.Storyboards.Commands public override string PropertyName => nameof(IFlippable.FlipH); - public override void ApplyInitialValue(TDrawable d) => d.FlipH = StartValue; + public override void ApplyInitialValue(TDrawable d) + { + if (StartTime == EndTime) + d.FlipH = StartValue; + } public override TransformSequence ApplyTransforms(TDrawable d) => d.TransformTo(nameof(IFlippable.FlipH), StartValue).Delay(Duration) diff --git a/osu.Game/Storyboards/Commands/StoryboardFlipVCommand.cs b/osu.Game/Storyboards/Commands/StoryboardFlipVCommand.cs index fa6a170c25..136bd52f1f 100644 --- a/osu.Game/Storyboards/Commands/StoryboardFlipVCommand.cs +++ b/osu.Game/Storyboards/Commands/StoryboardFlipVCommand.cs @@ -16,7 +16,11 @@ namespace osu.Game.Storyboards.Commands public override string PropertyName => nameof(IFlippable.FlipV); - public override void ApplyInitialValue(TDrawable d) => d.FlipV = StartValue; + public override void ApplyInitialValue(TDrawable d) + { + if (StartTime == EndTime) + d.FlipV = StartValue; + } public override TransformSequence ApplyTransforms(TDrawable d) => d.TransformTo(nameof(IFlippable.FlipV), StartValue).Delay(Duration)