diff --git a/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.Designer.cs b/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.Designer.cs
index 664d19b9..3c8a510f 100644
--- a/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.Designer.cs
+++ b/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.Designer.cs
@@ -29,147 +29,148 @@ namespace PckStudio.Forms.Additional_Popups.Animation
///
private void InitializeComponent()
{
- this.SaveBtn = new System.Windows.Forms.Button();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.CancelBtn = new System.Windows.Forms.Button();
- this.FrameIndexUpDown = new System.Windows.Forms.NumericUpDown();
- this.FrameTimeUpDown = new System.Windows.Forms.NumericUpDown();
- ((System.ComponentModel.ISupportInitialize)(this.FrameIndexUpDown)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.FrameTimeUpDown)).BeginInit();
- this.SuspendLayout();
- //
- // SaveBtn
- //
- this.SaveBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.SaveBtn.ForeColor = System.Drawing.Color.White;
- this.SaveBtn.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.SaveBtn.Location = new System.Drawing.Point(55, 111);
- this.SaveBtn.Name = "SaveBtn";
- this.SaveBtn.Size = new System.Drawing.Size(75, 23);
- this.SaveBtn.TabIndex = 7;
- this.SaveBtn.Text = "Save";
- this.SaveBtn.UseVisualStyleBackColor = true;
- this.SaveBtn.Click += new System.EventHandler(this.SaveBtn_Click);
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.ForeColor = System.Drawing.Color.White;
- this.label2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.label2.Location = new System.Drawing.Point(9, 54);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(65, 13);
- this.label2.TabIndex = 6;
- this.label2.Text = "Frame Index";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.ForeColor = System.Drawing.Color.White;
- this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.label1.Location = new System.Drawing.Point(9, 83);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(62, 13);
- this.label1.TabIndex = 10;
- this.label1.Text = "Frame Time";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.ForeColor = System.Drawing.Color.White;
- this.label3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.label3.Location = new System.Drawing.Point(47, 13);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(109, 13);
- this.label3.TabIndex = 12;
- this.label3.Text = "may/matt was here :3";
- //
- // CancelBtn
- //
- this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.CancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.CancelBtn.ForeColor = System.Drawing.Color.White;
- this.CancelBtn.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.CancelBtn.Location = new System.Drawing.Point(135, 111);
- this.CancelBtn.Name = "CancelBtn";
- this.CancelBtn.Size = new System.Drawing.Size(75, 23);
- this.CancelBtn.TabIndex = 13;
- this.CancelBtn.Text = "Cancel";
- this.CancelBtn.UseVisualStyleBackColor = true;
- this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
- //
- // FrameIndexUpDown
- //
- this.FrameIndexUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
- this.FrameIndexUpDown.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.FrameIndexUpDown.ForeColor = System.Drawing.SystemColors.Window;
- this.FrameIndexUpDown.Location = new System.Drawing.Point(77, 54);
- this.FrameIndexUpDown.Maximum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.FrameIndexUpDown.Name = "FrameIndexUpDown";
- this.FrameIndexUpDown.Size = new System.Drawing.Size(179, 20);
- this.FrameIndexUpDown.TabIndex = 14;
- this.FrameIndexUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
- // FrameTimeUpDown
- //
- this.FrameTimeUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
- this.FrameTimeUpDown.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.FrameTimeUpDown.ForeColor = System.Drawing.SystemColors.Window;
- this.FrameTimeUpDown.Location = new System.Drawing.Point(77, 81);
- this.FrameTimeUpDown.Maximum = new decimal(new int[] {
+ this.components = new System.ComponentModel.Container();
+ this.SaveBtn = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.CancelBtn = new System.Windows.Forms.Button();
+ this.FrameTimeUpDown = new System.Windows.Forms.NumericUpDown();
+ this.FrameList = new System.Windows.Forms.TreeView();
+ this.TextureIcons = new System.Windows.Forms.ImageList(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.FrameTimeUpDown)).BeginInit();
+ this.SuspendLayout();
+ //
+ // SaveBtn
+ //
+ this.SaveBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.SaveBtn.ForeColor = System.Drawing.Color.White;
+ this.SaveBtn.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.SaveBtn.Location = new System.Drawing.Point(12, 228);
+ this.SaveBtn.Name = "SaveBtn";
+ this.SaveBtn.Size = new System.Drawing.Size(75, 23);
+ this.SaveBtn.TabIndex = 7;
+ this.SaveBtn.Text = "Save";
+ this.SaveBtn.UseVisualStyleBackColor = true;
+ this.SaveBtn.Click += new System.EventHandler(this.SaveBtn_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.ForeColor = System.Drawing.Color.White;
+ this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.label1.Location = new System.Drawing.Point(19, 204);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(62, 13);
+ this.label1.TabIndex = 10;
+ this.label1.Text = "Frame Time";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.ForeColor = System.Drawing.Color.White;
+ this.label3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.label3.Location = new System.Drawing.Point(14, 13);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(109, 13);
+ this.label3.TabIndex = 12;
+ this.label3.Text = "may/matt was here :3";
+ //
+ // CancelBtn
+ //
+ this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.CancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.CancelBtn.ForeColor = System.Drawing.Color.White;
+ this.CancelBtn.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.CancelBtn.Location = new System.Drawing.Point(92, 228);
+ this.CancelBtn.Name = "CancelBtn";
+ this.CancelBtn.Size = new System.Drawing.Size(75, 23);
+ this.CancelBtn.TabIndex = 13;
+ this.CancelBtn.Text = "Cancel";
+ this.CancelBtn.UseVisualStyleBackColor = true;
+ this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
+ //
+ // FrameTimeUpDown
+ //
+ this.FrameTimeUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
+ this.FrameTimeUpDown.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.FrameTimeUpDown.ForeColor = System.Drawing.SystemColors.Window;
+ this.FrameTimeUpDown.Location = new System.Drawing.Point(87, 202);
+ this.FrameTimeUpDown.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
- this.FrameTimeUpDown.Name = "FrameTimeUpDown";
- this.FrameTimeUpDown.Size = new System.Drawing.Size(179, 20);
- this.FrameTimeUpDown.TabIndex = 15;
- this.FrameTimeUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
- // FrameEditor
- //
- this.AcceptButton = this.SaveBtn;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.CancelButton = this.CancelBtn;
- this.ClientSize = new System.Drawing.Size(264, 140);
- this.ControlBox = false;
- this.Controls.Add(this.FrameTimeUpDown);
- this.Controls.Add(this.FrameIndexUpDown);
- this.Controls.Add(this.CancelBtn);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.SaveBtn);
- this.Controls.Add(this.label2);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.MinimumSize = new System.Drawing.Size(266, 142);
- this.Name = "FrameEditor";
- this.Resizable = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Style = MetroFramework.MetroColorStyle.Silver;
- this.Theme = MetroFramework.MetroThemeStyle.Dark;
- ((System.ComponentModel.ISupportInitialize)(this.FrameIndexUpDown)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.FrameTimeUpDown)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
+ this.FrameTimeUpDown.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.FrameTimeUpDown.Name = "FrameTimeUpDown";
+ this.FrameTimeUpDown.Size = new System.Drawing.Size(73, 20);
+ this.FrameTimeUpDown.TabIndex = 15;
+ this.FrameTimeUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.FrameTimeUpDown.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ //
+ // FrameList
+ //
+ this.FrameList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.FrameList.ForeColor = System.Drawing.SystemColors.Window;
+ this.FrameList.HideSelection = false;
+ this.FrameList.ImageIndex = 0;
+ this.FrameList.ImageList = this.TextureIcons;
+ this.FrameList.Location = new System.Drawing.Point(12, 37);
+ this.FrameList.Name = "FrameList";
+ this.FrameList.SelectedImageIndex = 0;
+ this.FrameList.ShowLines = false;
+ this.FrameList.ShowRootLines = false;
+ this.FrameList.Size = new System.Drawing.Size(155, 159);
+ this.FrameList.TabIndex = 1;
+ //
+ // 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;
+ //
+ // FrameEditor
+ //
+ this.AcceptButton = this.SaveBtn;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.CancelBtn;
+ this.ClientSize = new System.Drawing.Size(178, 264);
+ this.ControlBox = false;
+ this.Controls.Add(this.FrameList);
+ this.Controls.Add(this.FrameTimeUpDown);
+ this.Controls.Add(this.CancelBtn);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.SaveBtn);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "FrameEditor";
+ this.Resizable = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Style = MetroFramework.MetroColorStyle.Silver;
+ this.Theme = MetroFramework.MetroThemeStyle.Dark;
+ ((System.ComponentModel.ISupportInitialize)(this.FrameTimeUpDown)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
}
#endregion
- private System.Windows.Forms.Button SaveBtn;
- private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button CancelBtn;
- private System.Windows.Forms.NumericUpDown FrameIndexUpDown;
private System.Windows.Forms.NumericUpDown FrameTimeUpDown;
- }
+ private System.Windows.Forms.TreeView FrameList;
+ public System.Windows.Forms.ImageList TextureIcons;
+ public System.Windows.Forms.Button SaveBtn;
+ }
}
\ No newline at end of file
diff --git a/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.cs b/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.cs
index c820c4c3..b994bad1 100644
--- a/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.cs
+++ b/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.cs
@@ -15,20 +15,30 @@ namespace PckStudio.Forms.Additional_Popups.Animation
{
public partial class FrameEditor : MetroForm
{
- public int FrameTextureIndex => (int)FrameIndexUpDown.Value;
+ public int FrameTextureIndex => FrameList.SelectedNode.Index;
public int FrameTime => (int)FrameTimeUpDown.Value;
- public FrameEditor(int indexLimit)
+ public FrameEditor(ImageList texList)
{
InitializeComponent();
- label3.Text = "Frame must be within 0 and " + indexLimit + ".";
- FrameIndexUpDown.Maximum = indexLimit;
- FrameTimeUpDown.Minimum = 1;
+ label3.Text = "Select a frame and frame time:";
+ FrameList.ImageList = texList;
+
+ int index = 0;
+ foreach (Image frameTex in texList.Images)
+ {
+ TreeNode frame = new TreeNode($"Frame {index}", index, index);
+ FrameList.Nodes.Add(frame);
+ Console.WriteLine(index);
+ index++;
+ }
}
- public FrameEditor(int frameTime, int frameTextureIndex, int indexLimit) : this(indexLimit)
+
+ public FrameEditor(int frameTime, int frameTextureIndex, ImageList texList) : this(texList)
{
- FrameIndexUpDown.Value = frameTextureIndex;
- FrameTimeUpDown.Value = frameTime;
+ FrameList.SelectedNode = FrameList.Nodes[frameTextureIndex];
+ FrameList.SelectedNode.EnsureVisible();
+ FrameTimeUpDown.Value = frameTime;
}
private void SaveBtn_Click(object sender, EventArgs e)
diff --git a/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.resx b/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.resx
index 1af7de15..4d46b116 100644
--- a/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.resx
+++ b/PCK-Studio/Forms/Additional-Popups/Animation/FrameEditor.resx
@@ -117,4 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.cs b/PCK-Studio/Forms/Editor/AnimationEditor.cs
index bea1b251..095947d7 100644
--- a/PCK-Studio/Forms/Editor/AnimationEditor.cs
+++ b/PCK-Studio/Forms/Editor/AnimationEditor.cs
@@ -143,6 +143,11 @@ namespace PckStudio.Forms.Editor
return frames;
}
+ public List GetFrameTextures()
+ {
+ return frameTextures;
+ }
+
public int GetFrameIndex(Image frameTexture)
{
_ = frameTexture ?? throw new ArgumentNullException(nameof(frameTexture));
@@ -276,7 +281,7 @@ namespace PckStudio.Forms.Editor
frameTreeView.Nodes.Clear();
// $"Frame: {i}, Frame Time: {Animation.MinimumFrameTime}"
TextureIcons.Images.Clear();
- TextureIcons.Images.AddRange(currentAnimation.GetFrames().Select(f => f.Texture).ToArray());
+ TextureIcons.Images.AddRange(currentAnimation.GetFrameTextures().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);
}
@@ -422,8 +427,8 @@ namespace PckStudio.Forms.Editor
private void treeView1_doubleClick(object sender, EventArgs e)
{
var frame = currentAnimation.GetFrame(frameTreeView.SelectedNode.Index);
- using FrameEditor diag = new FrameEditor(frame.Ticks, currentAnimation.GetFrameIndex(frame.Texture), currentAnimation.FrameTextureCount-1);
- if (diag.ShowDialog(this) == DialogResult.OK)
+ using FrameEditor diag = new FrameEditor(frame.Ticks, currentAnimation.GetFrameIndex(frame.Texture), TextureIcons);
+ if (diag.ShowDialog(this) == DialogResult.OK)
{
/* Found a bug here. When passing the frame variable, it would replace the first instance of that frame and time
* rather than the actual frame that was clicked. I've just switched to passing the index to fix this for now. -Matt
@@ -436,7 +441,8 @@ namespace PckStudio.Forms.Editor
private void addFrameToolStripMenuItem_Click(object sender, EventArgs e)
{
- using FrameEditor diag = new FrameEditor(currentAnimation.FrameTextureCount-1);
+ using FrameEditor diag = new FrameEditor(TextureIcons);
+ diag.SaveBtn.Text = "Add";
if (diag.ShowDialog(this) == DialogResult.OK)
{
currentAnimation.AddFrame(diag.FrameTextureIndex, diag.FrameTime);