From cc788d35cb093fde5476ed824e22ae4efb06c6cc Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 29 Mar 2023 19:40:53 +0200 Subject: [PATCH] Animation - Removed implicit frame to image operator --- PCK-Studio/Forms/Editor/Animation.cs | 4 +--- PCK-Studio/Forms/Editor/AnimationEditor.cs | 9 ++------- PCK-Studio/Forms/Editor/AnimationPlayer.cs | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/PCK-Studio/Forms/Editor/Animation.cs b/PCK-Studio/Forms/Editor/Animation.cs index 7ef4b203..a80785af 100644 --- a/PCK-Studio/Forms/Editor/Animation.cs +++ b/PCK-Studio/Forms/Editor/Animation.cs @@ -41,8 +41,6 @@ namespace PckStudio.Forms.Editor public readonly Image Texture; public int Ticks; - public static implicit operator Image(Frame f) => f.Texture; - public Frame(Image texture) : this(texture, MinimumFrameTime) { } @@ -131,7 +129,7 @@ namespace PckStudio.Forms.Editor { StringBuilder stringBuilder = new StringBuilder(Interpolate ? "#" : string.Empty); foreach (var frame in frames) - stringBuilder.Append($"{GetTextureIndex(frame)}*{frame.Ticks},"); + stringBuilder.Append($"{GetTextureIndex(frame.Texture)}*{frame.Ticks},"); return stringBuilder.ToString(0, stringBuilder.Length - 1); } diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.cs b/PCK-Studio/Forms/Editor/AnimationEditor.cs index 715e48f0..c8f3c303 100644 --- a/PCK-Studio/Forms/Editor/AnimationEditor.cs +++ b/PCK-Studio/Forms/Editor/AnimationEditor.cs @@ -265,14 +265,9 @@ namespace PckStudio.Forms.Editor private void bulkAnimationSpeedToolStripMenuItem_Click(object sender, EventArgs e) { SetBulkSpeed diag = new SetBulkSpeed(frameTreeView); - if(diag.ShowDialog(this) == DialogResult.OK) + if (diag.ShowDialog(this) == DialogResult.OK) { - var list = currentAnimation.GetFrames(); - for (int i = 0; i < list.Count; i++) - { - Animation.Frame f = list[i]; - currentAnimation.SetFrame(f, currentAnimation.GetTextureIndex(f), diag.time); - } + currentAnimation.GetFrames().ForEach(frame => frame.Ticks = diag.time); LoadAnimationTreeView(); } diag.Dispose(); diff --git a/PCK-Studio/Forms/Editor/AnimationPlayer.cs b/PCK-Studio/Forms/Editor/AnimationPlayer.cs index 4a87299d..bca7ca62 100644 --- a/PCK-Studio/Forms/Editor/AnimationPlayer.cs +++ b/PCK-Studio/Forms/Editor/AnimationPlayer.cs @@ -68,7 +68,7 @@ namespace PckStudio.Forms.Editor { Monitor.Enter(_animation); Animation.Frame frame = _animation[frameIndex]; - display.Image = frame; + display.Image = frame.Texture; Monitor.Exit(_animation); return frame; }