From d8cf0107f3c2708e65af8e5ba7e0b4df87bdf9e6 Mon Sep 17 00:00:00 2001 From: MattN-L Date: Sat, 16 Mar 2024 13:48:32 -0400 Subject: [PATCH] Fix for .gif import not setting correct category --- PCK-Studio/Forms/Editor/AnimationEditor.cs | 36 ++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.cs b/PCK-Studio/Forms/Editor/AnimationEditor.cs index a39c0ec5..708b492c 100644 --- a/PCK-Studio/Forms/Editor/AnimationEditor.cs +++ b/PCK-Studio/Forms/Editor/AnimationEditor.cs @@ -74,15 +74,20 @@ namespace PckStudio.Forms.Editor animationPictureBox.BlendColor = blendColor; } + private void ValidateToolStrip() + { + bulkAnimationSpeedToolStripMenuItem.Enabled = + importToolStripMenuItem.Enabled = + exportAsToolStripMenuItem.Enabled = + changeTileToolStripMenuItem.Enabled = + InterpolationCheckbox.Visible = !IsSpecialTile(_tileName); + } + private void AnimationEditor_Load(object sender, EventArgs e) { - bulkAnimationSpeedToolStripMenuItem.Enabled = - importToolStripMenuItem.Enabled = - exportAsToolStripMenuItem.Enabled = - changeTileToolStripMenuItem.Enabled = - InterpolationCheckbox.Visible = !IsSpecialTile(_tileName); + ValidateToolStrip(); - SetTileLabel(); + SetTileLabel(); LoadAnimationTreeView(); } @@ -127,12 +132,17 @@ namespace PckStudio.Forms.Editor animationPictureBox.SelectFrame(_animation, frameTreeView.SelectedNode.Index); } + private void StopAnimation() + { + animationPictureBox.Stop(); + AnimationStartStopBtn.Text = "Play Animation"; + } + private void AnimationStartStopBtn_Click(object sender, EventArgs e) { if (animationPictureBox.IsPlaying) { - animationPictureBox.Stop(); - AnimationStartStopBtn.Text = "Play Animation"; + StopAnimation(); return; } if (_animation.FrameCount > 1) @@ -341,6 +351,7 @@ namespace PckStudio.Forms.Editor private void changeTileToolStripMenuItem_Click(object sender, EventArgs e) { + StopAnimation(); using (ChangeTile diag = new ChangeTile()) { if (diag.ShowDialog(this) != DialogResult.OK) @@ -350,10 +361,7 @@ namespace PckStudio.Forms.Editor _animation.Category = diag.Category; _tileName = diag.SelectedTile; - bulkAnimationSpeedToolStripMenuItem.Enabled = - importToolStripMenuItem.Enabled = - exportAsToolStripMenuItem.Enabled = - InterpolationCheckbox.Visible = !IsSpecialTile(_tileName); + ValidateToolStrip(); SetTileLabel(); } @@ -468,7 +476,11 @@ namespace PckStudio.Forms.Editor gif.SelectActiveFrame(dimension, i); textures.Add(new Bitmap(gif)); } + + var animCat = _animation.Category; + _animation = new Animation(textures, string.Empty); + _animation.Category = animCat; LoadAnimationTreeView(); }