From 4695a764d2a4d5fdf46100aa74bd1d3c40dcb686 Mon Sep 17 00:00:00 2001 From: MattNL Date: Sat, 1 Oct 2022 19:39:53 -0400 Subject: [PATCH] AnimationEditor now displays frames in the tree --- PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs | 13 ++++++++++++- PCK-Studio/Forms/Editor/AnimationEditor.cs | 4 +++- PCK-Studio/Forms/Editor/AnimationEditor.resx | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs b/PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs index 56997dfd..230981c1 100644 --- a/PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs @@ -52,6 +52,7 @@ this.AnimationStopBtn = new MetroFramework.Controls.MetroButton(); this.tileLabel = new MetroFramework.Controls.MetroLabel(); this.pictureBoxWithInterpolationMode1 = new PckStudio.PictureBoxWithInterpolationMode(); + this.TextureIcons = new System.Windows.Forms.ImageList(this.components); this.contextMenuStrip1.SuspendLayout(); this.menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWithInterpolationMode1)).BeginInit(); @@ -65,9 +66,12 @@ this.frameTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.frameTreeView.ContextMenuStrip = this.contextMenuStrip1; this.frameTreeView.ForeColor = System.Drawing.Color.White; + this.frameTreeView.ImageIndex = 0; + this.frameTreeView.ImageList = this.TextureIcons; this.frameTreeView.Location = new System.Drawing.Point(20, 88); this.frameTreeView.Margin = new System.Windows.Forms.Padding(0); this.frameTreeView.Name = "frameTreeView"; + this.frameTreeView.SelectedImageIndex = 0; this.frameTreeView.Size = new System.Drawing.Size(165, 223); this.frameTreeView.TabIndex = 15; this.frameTreeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.frameTreeView_ItemDrag); @@ -255,7 +259,7 @@ this.tileLabel.Location = new System.Drawing.Point(20, 312); this.tileLabel.MinimumSize = new System.Drawing.Size(170, 19); this.tileLabel.Name = "tileLabel"; - this.tileLabel.Size = new System.Drawing.Size(170, 19); + this.tileLabel.Size = new System.Drawing.Size(57, 19); this.tileLabel.TabIndex = 20; this.tileLabel.Text = "tileLabel"; this.tileLabel.Theme = MetroFramework.MetroThemeStyle.Dark; @@ -273,6 +277,12 @@ this.pictureBoxWithInterpolationMode1.TabIndex = 16; this.pictureBoxWithInterpolationMode1.TabStop = false; // + // TextureIcons + // + this.TextureIcons.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; + this.TextureIcons.ImageSize = new System.Drawing.Size(32, 32); + this.TextureIcons.TransparentColor = System.Drawing.Color.Transparent; + // // AnimationEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -324,5 +334,6 @@ private System.Windows.Forms.ToolStripMenuItem editorControlsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem setBulkSpedToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem javaAnimationSupportToolStripMenuItem; + private System.Windows.Forms.ImageList TextureIcons; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.cs b/PCK-Studio/Forms/Editor/AnimationEditor.cs index bc9272f9..bea1b251 100644 --- a/PCK-Studio/Forms/Editor/AnimationEditor.cs +++ b/PCK-Studio/Forms/Editor/AnimationEditor.cs @@ -275,7 +275,9 @@ namespace PckStudio.Forms.Editor InterpolationCheckbox.Checked = currentAnimation.Interpolate; frameTreeView.Nodes.Clear(); // $"Frame: {i}, Frame Time: {Animation.MinimumFrameTime}" - currentAnimation.GetFrames().ForEach(f => frameTreeView.Nodes.Add($"Frame: {currentAnimation.GetFrameIndex(f.Texture)}, Frame Time: {f.Ticks}")); + TextureIcons.Images.Clear(); + TextureIcons.Images.AddRange(currentAnimation.GetFrames().Select(f => f.Texture).ToArray()); + currentAnimation.GetFrames().ForEach(f => frameTreeView.Nodes.Add("", $"for {f.Ticks} frame" + (f.Ticks > 1 ? "s" : "" ), currentAnimation.GetFrameIndex(f.Texture), currentAnimation.GetFrameIndex(f.Texture))); player.SelectFrame(currentAnimation, 0); } diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.resx b/PCK-Studio/Forms/Editor/AnimationEditor.resx index 31e8ec68..c3546ac8 100644 --- a/PCK-Studio/Forms/Editor/AnimationEditor.resx +++ b/PCK-Studio/Forms/Editor/AnimationEditor.resx @@ -120,6 +120,9 @@ 125, 17 + + 280, 17 + 17, 17