From 64460749767d4e3a6b3285aec060d3fc01132e44 Mon Sep 17 00:00:00 2001 From: cadon0 Date: Tue, 10 Nov 2020 01:52:26 +1300 Subject: [PATCH 1/4] Fix paths for storyboard animation sprites --- .../Drawables/DrawableStoryboardAnimation.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 97de239e4a..34120f4848 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -118,8 +118,24 @@ namespace osu.Game.Storyboards.Drawables for (int frame = 0; frame < Animation.FrameCount; frame++) { string framePath = Animation.Path.Replace(".", frame + "."); + Drawable sprite = storyboard.CreateSpriteFromResourcePath(framePath, textureStore); - AddFrame(storyboard.CreateSpriteFromResourcePath(framePath, textureStore), Animation.FrameDelay); + if (sprite != null) + { + AddFrame(sprite, Animation.FrameDelay); + continue; + } + + framePath = Animation.Path.Replace("0.", frame + "."); + sprite = storyboard.CreateSpriteFromResourcePath(framePath, textureStore); + + if (sprite != null) + { + AddFrame(sprite, Animation.FrameDelay); + } + + // todo: handle animation intentionally declared with more frames than sprites to cause a blinking effect + // e.g. beatmap 5381's "spr\play-skip.png" } Animation.ApplyTransforms(this); From 539806e9d6869b95f6b9ca0c3a51f45adc0e139c Mon Sep 17 00:00:00 2001 From: cadon0 Date: Tue, 10 Nov 2020 21:57:29 +1300 Subject: [PATCH 2/4] Rewrite - Add empty drawable whenever sprite not found --- .../Drawables/DrawableStoryboardAnimation.cs | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 34120f4848..a78d0bf4d7 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -118,24 +118,8 @@ namespace osu.Game.Storyboards.Drawables for (int frame = 0; frame < Animation.FrameCount; frame++) { string framePath = Animation.Path.Replace(".", frame + "."); - Drawable sprite = storyboard.CreateSpriteFromResourcePath(framePath, textureStore); - - if (sprite != null) - { - AddFrame(sprite, Animation.FrameDelay); - continue; - } - - framePath = Animation.Path.Replace("0.", frame + "."); - sprite = storyboard.CreateSpriteFromResourcePath(framePath, textureStore); - - if (sprite != null) - { - AddFrame(sprite, Animation.FrameDelay); - } - - // todo: handle animation intentionally declared with more frames than sprites to cause a blinking effect - // e.g. beatmap 5381's "spr\play-skip.png" + Drawable sprite = storyboard.CreateSpriteFromResourcePath(framePath, textureStore) ?? Drawable.Empty(); + AddFrame(sprite, Animation.FrameDelay); } Animation.ApplyTransforms(this); From ce837eaba0d6f6dc261614ddb66183b1bf56f4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 Nov 2020 12:20:26 +0100 Subject: [PATCH 3/4] Rename variables --- .../Storyboards/Drawables/DrawableStoryboardAnimation.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index a78d0bf4d7..644bb28457 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -115,11 +115,11 @@ namespace osu.Game.Storyboards.Drawables [BackgroundDependencyLoader] private void load(TextureStore textureStore, Storyboard storyboard) { - for (int frame = 0; frame < Animation.FrameCount; frame++) + for (int frameIndex = 0; frameIndex < Animation.FrameCount; frameIndex++) { - string framePath = Animation.Path.Replace(".", frame + "."); - Drawable sprite = storyboard.CreateSpriteFromResourcePath(framePath, textureStore) ?? Drawable.Empty(); - AddFrame(sprite, Animation.FrameDelay); + string framePath = Animation.Path.Replace(".", frameIndex + "."); + Drawable frame = storyboard.CreateSpriteFromResourcePath(framePath, textureStore) ?? Drawable.Empty(); + AddFrame(frame, Animation.FrameDelay); } Animation.ApplyTransforms(this); From 61093030ee4b66e8d22c58ed0a6cf4917f2b80eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 Nov 2020 12:20:49 +0100 Subject: [PATCH 4/4] Remove redundant class name qualifier --- osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 644bb28457..7eac994e07 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -118,7 +118,7 @@ namespace osu.Game.Storyboards.Drawables for (int frameIndex = 0; frameIndex < Animation.FrameCount; frameIndex++) { string framePath = Animation.Path.Replace(".", frameIndex + "."); - Drawable frame = storyboard.CreateSpriteFromResourcePath(framePath, textureStore) ?? Drawable.Empty(); + Drawable frame = storyboard.CreateSpriteFromResourcePath(framePath, textureStore) ?? Empty(); AddFrame(frame, Animation.FrameDelay); }