From 22b495b718d3d5233e718d64d51b7afc8cd059a8 Mon Sep 17 00:00:00 2001 From: MattNL Date: Sun, 28 Aug 2022 04:37:32 -0400 Subject: [PATCH] Added Export Java Animation tool --- .../Forms/Editor/AnimationEditor.Designer.cs | 537 +++++++++--------- PCK-Studio/Forms/Editor/AnimationEditor.cs | 28 + 2 files changed, 302 insertions(+), 263 deletions(-) diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs b/PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs index b12b5916..fd5624bd 100644 --- a/PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/AnimationEditor.Designer.cs @@ -28,293 +28,303 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AnimationEditor)); - this.frameTreeView = new System.Windows.Forms.TreeView(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.addFrameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeFrameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.bulkAnimationSpeedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importJavaAnimationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.changeTileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.InterpolationCheckbox = new MetroFramework.Controls.MetroCheckBox(); - this.AnimationPlayBtn = new MetroFramework.Controls.MetroButton(); - this.AnimationStopBtn = new MetroFramework.Controls.MetroButton(); - this.tileLabel = new MetroFramework.Controls.MetroLabel(); - this.MipMapCheckbox = new MetroFramework.Controls.MetroCheckBox(); - this.MipMapLabel = new MetroFramework.Controls.MetroLabel(); - this.MipMapNumericUpDown = new System.Windows.Forms.NumericUpDown(); - this.pictureBoxWithInterpolationMode1 = new PckStudio.PictureBoxWithInterpolationMode(); - this.contextMenuStrip1.SuspendLayout(); - this.menuStrip.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.MipMapNumericUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWithInterpolationMode1)).BeginInit(); - this.SuspendLayout(); - // - // treeView1 - // - this.frameTreeView.AllowDrop = true; - this.frameTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AnimationEditor)); + this.frameTreeView = new System.Windows.Forms.TreeView(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.addFrameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeFrameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.bulkAnimationSpeedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importJavaAnimationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.changeTileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.InterpolationCheckbox = new MetroFramework.Controls.MetroCheckBox(); + this.AnimationPlayBtn = new MetroFramework.Controls.MetroButton(); + this.AnimationStopBtn = new MetroFramework.Controls.MetroButton(); + this.tileLabel = new MetroFramework.Controls.MetroLabel(); + this.MipMapCheckbox = new MetroFramework.Controls.MetroCheckBox(); + this.MipMapLabel = new MetroFramework.Controls.MetroLabel(); + this.MipMapNumericUpDown = new System.Windows.Forms.NumericUpDown(); + this.pictureBoxWithInterpolationMode1 = new PckStudio.PictureBoxWithInterpolationMode(); + this.exportJavaAnimationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStrip1.SuspendLayout(); + this.menuStrip.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.MipMapNumericUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWithInterpolationMode1)).BeginInit(); + this.SuspendLayout(); + // + // frameTreeView + // + this.frameTreeView.AllowDrop = true; + this.frameTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); - 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.Location = new System.Drawing.Point(20, 88); - this.frameTreeView.Margin = new System.Windows.Forms.Padding(0); - this.frameTreeView.Name = "treeView1"; - this.frameTreeView.Size = new System.Drawing.Size(165, 198); - this.frameTreeView.TabIndex = 15; - this.frameTreeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.frameTreeView_ItemDrag); - this.frameTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.frameTreeView_AfterSelect); - this.frameTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_doubleClick); - this.frameTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.frameTreeView_DragDrop); - this.frameTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.frameTreeView_DragEnter); - this.frameTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.frameTreeView_DragOver); - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + 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.Location = new System.Drawing.Point(20, 88); + this.frameTreeView.Margin = new System.Windows.Forms.Padding(0); + this.frameTreeView.Name = "frameTreeView"; + this.frameTreeView.Size = new System.Drawing.Size(165, 198); + this.frameTreeView.TabIndex = 15; + this.frameTreeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.frameTreeView_ItemDrag); + this.frameTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.frameTreeView_AfterSelect); + this.frameTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_doubleClick); + this.frameTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.frameTreeView_DragDrop); + this.frameTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.frameTreeView_DragEnter); + this.frameTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.frameTreeView_DragOver); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addFrameToolStripMenuItem, this.removeFrameToolStripMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(154, 48); - // - // addFrameToolStripMenuItem - // - this.addFrameToolStripMenuItem.Image = global::PckStudio.Properties.Resources.ExportFile; - this.addFrameToolStripMenuItem.Name = "addFrameToolStripMenuItem"; - this.addFrameToolStripMenuItem.Size = new System.Drawing.Size(153, 22); - this.addFrameToolStripMenuItem.Text = "Add Frame"; - this.addFrameToolStripMenuItem.Click += new System.EventHandler(this.addFrameToolStripMenuItem_Click); - // - // removeFrameToolStripMenuItem - // - this.removeFrameToolStripMenuItem.Image = global::PckStudio.Properties.Resources.Del; - this.removeFrameToolStripMenuItem.Name = "removeFrameToolStripMenuItem"; - this.removeFrameToolStripMenuItem.Size = new System.Drawing.Size(153, 22); - this.removeFrameToolStripMenuItem.Text = "Remove Frame"; - this.removeFrameToolStripMenuItem.Click += new System.EventHandler(this.removeFrameToolStripMenuItem_Click); - // - // menuStrip - // - this.menuStrip.AutoSize = false; - this.menuStrip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(154, 48); + // + // addFrameToolStripMenuItem + // + this.addFrameToolStripMenuItem.Image = global::PckStudio.Properties.Resources.ExportFile; + this.addFrameToolStripMenuItem.Name = "addFrameToolStripMenuItem"; + this.addFrameToolStripMenuItem.Size = new System.Drawing.Size(153, 22); + this.addFrameToolStripMenuItem.Text = "Add Frame"; + this.addFrameToolStripMenuItem.Click += new System.EventHandler(this.addFrameToolStripMenuItem_Click); + // + // removeFrameToolStripMenuItem + // + this.removeFrameToolStripMenuItem.Image = global::PckStudio.Properties.Resources.Del; + this.removeFrameToolStripMenuItem.Name = "removeFrameToolStripMenuItem"; + this.removeFrameToolStripMenuItem.Size = new System.Drawing.Size(153, 22); + this.removeFrameToolStripMenuItem.Text = "Remove Frame"; + this.removeFrameToolStripMenuItem.Click += new System.EventHandler(this.removeFrameToolStripMenuItem_Click); + // + // menuStrip + // + this.menuStrip.AutoSize = false; + this.menuStrip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.editToolStripMenuItem, this.helpToolStripMenuItem}); - this.menuStrip.Location = new System.Drawing.Point(20, 60); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(372, 24); - this.menuStrip.TabIndex = 14; - this.menuStrip.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuStrip.Location = new System.Drawing.Point(20, 60); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(372, 24); + this.menuStrip.TabIndex = 14; + this.menuStrip.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.saveToolStripMenuItem1}); - this.fileToolStripMenuItem.ForeColor = System.Drawing.Color.White; - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); - this.fileToolStripMenuItem.Text = "File"; - // - // saveToolStripMenuItem1 - // - this.saveToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem1.Image"))); - this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1"; - this.saveToolStripMenuItem1.Size = new System.Drawing.Size(98, 22); - this.saveToolStripMenuItem1.Text = "Save"; - this.saveToolStripMenuItem1.Click += new System.EventHandler(this.saveToolStripMenuItem1_Click); - // - // editToolStripMenuItem - // - this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem.ForeColor = System.Drawing.Color.White; + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // saveToolStripMenuItem1 + // + this.saveToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem1.Image"))); + this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1"; + this.saveToolStripMenuItem1.Size = new System.Drawing.Size(98, 22); + this.saveToolStripMenuItem1.Text = "Save"; + this.saveToolStripMenuItem1.Click += new System.EventHandler(this.saveToolStripMenuItem1_Click); + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.bulkAnimationSpeedToolStripMenuItem, this.importJavaAnimationToolStripMenuItem, + this.exportJavaAnimationToolStripMenuItem, this.changeTileToolStripMenuItem}); - this.editToolStripMenuItem.ForeColor = System.Drawing.Color.White; - this.editToolStripMenuItem.Name = "editToolStripMenuItem"; - this.editToolStripMenuItem.Size = new System.Drawing.Size(46, 20); - this.editToolStripMenuItem.Text = "Tools"; - // - // bulkAnimationSpeedToolStripMenuItem - // - this.bulkAnimationSpeedToolStripMenuItem.Image = global::PckStudio.Properties.Resources.clock; - this.bulkAnimationSpeedToolStripMenuItem.Name = "bulkAnimationSpeedToolStripMenuItem"; - this.bulkAnimationSpeedToolStripMenuItem.Size = new System.Drawing.Size(210, 22); - this.bulkAnimationSpeedToolStripMenuItem.Text = "Set Bulk Animation Speed"; - this.bulkAnimationSpeedToolStripMenuItem.Click += new System.EventHandler(this.bulkAnimationSpeedToolStripMenuItem_Click); - // - // importJavaAnimationToolStripMenuItem - // - this.importJavaAnimationToolStripMenuItem.Image = global::PckStudio.Properties.Resources.ExportFile; - this.importJavaAnimationToolStripMenuItem.Name = "importJavaAnimationToolStripMenuItem"; - this.importJavaAnimationToolStripMenuItem.Size = new System.Drawing.Size(210, 22); - this.importJavaAnimationToolStripMenuItem.Text = "Import Java Animation"; - this.importJavaAnimationToolStripMenuItem.Click += new System.EventHandler(this.importJavaAnimationToolStripMenuItem_Click); - // - // changeTileToolStripMenuItem - // - this.changeTileToolStripMenuItem.Image = global::PckStudio.Properties.Resources.changeTile; - this.changeTileToolStripMenuItem.Name = "changeTileToolStripMenuItem"; - this.changeTileToolStripMenuItem.Size = new System.Drawing.Size(210, 22); - this.changeTileToolStripMenuItem.Text = "Change Tile"; - this.changeTileToolStripMenuItem.Click += new System.EventHandler(this.changeTileToolStripMenuItem_Click); - // - // helpToolStripMenuItem - // - this.helpToolStripMenuItem.ForeColor = System.Drawing.Color.White; - this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; - this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); - this.helpToolStripMenuItem.Text = "Help"; - this.helpToolStripMenuItem.Click += new System.EventHandler(this.helpToolStripMenuItem_Click); - // - // InterpolationCheckbox - // - this.InterpolationCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.InterpolationCheckbox.AutoSize = true; - this.InterpolationCheckbox.Location = new System.Drawing.Point(188, 317); - this.InterpolationCheckbox.Name = "InterpolationCheckbox"; - this.InterpolationCheckbox.Size = new System.Drawing.Size(204, 15); - this.InterpolationCheckbox.TabIndex = 17; - this.InterpolationCheckbox.Text = "Interpolates (not simulated above)"; - this.InterpolationCheckbox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.InterpolationCheckbox.UseSelectable = true; - // - // AnimationPlayBtn - // - this.AnimationPlayBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.AnimationPlayBtn.Location = new System.Drawing.Point(188, 291); - this.AnimationPlayBtn.Name = "AnimationPlayBtn"; - this.AnimationPlayBtn.Size = new System.Drawing.Size(99, 24); - this.AnimationPlayBtn.TabIndex = 18; - this.AnimationPlayBtn.Text = "Play Animation"; - this.AnimationPlayBtn.Theme = MetroFramework.MetroThemeStyle.Dark; - this.AnimationPlayBtn.UseSelectable = true; - this.AnimationPlayBtn.Click += new System.EventHandler(this.StartAnimationBtn_Click); - // - // AnimationStopBtn - // - this.AnimationStopBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.AnimationStopBtn.Enabled = false; - this.AnimationStopBtn.Location = new System.Drawing.Point(293, 291); - this.AnimationStopBtn.Name = "AnimationStopBtn"; - this.AnimationStopBtn.Size = new System.Drawing.Size(99, 24); - this.AnimationStopBtn.TabIndex = 19; - this.AnimationStopBtn.Text = "Stop Animation"; - this.AnimationStopBtn.Theme = MetroFramework.MetroThemeStyle.Dark; - this.AnimationStopBtn.UseSelectable = true; - this.AnimationStopBtn.Click += new System.EventHandler(this.StopAnimationBtn_Click); - // - // tileLabel - // - this.tileLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.tileLabel.AutoSize = true; - this.tileLabel.Location = new System.Drawing.Point(20, 290); - this.tileLabel.MinimumSize = new System.Drawing.Size(170, 19); - this.tileLabel.Name = "tileLabel"; - this.tileLabel.Size = new System.Drawing.Size(57, 19); - this.tileLabel.TabIndex = 20; - this.tileLabel.Text = "tileLabel"; - this.tileLabel.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // MipMapCheckbox - // - this.MipMapCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.MipMapCheckbox.AutoSize = true; - this.MipMapCheckbox.Location = new System.Drawing.Point(20, 312); - this.MipMapCheckbox.Name = "MipMapCheckbox"; - this.MipMapCheckbox.Size = new System.Drawing.Size(128, 15); - this.MipMapCheckbox.TabIndex = 21; - this.MipMapCheckbox.Text = "Is Mip Map Texture?"; - this.MipMapCheckbox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.MipMapCheckbox.UseSelectable = true; - this.MipMapCheckbox.CheckedChanged += new System.EventHandler(this.MipMapCheckBox_CheckedChanged); - // - // MipMapLabel - // - this.MipMapLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.MipMapLabel.AutoSize = true; - this.MipMapLabel.Location = new System.Drawing.Point(21, 330); - this.MipMapLabel.Name = "MipMapLabel"; - this.MipMapLabel.Size = new System.Drawing.Size(99, 19); - this.MipMapLabel.TabIndex = 22; - this.MipMapLabel.Text = "Mip Map Level:"; - this.MipMapLabel.Theme = MetroFramework.MetroThemeStyle.Dark; - this.MipMapLabel.Visible = false; - // - // MipMapNumericUpDown - // - this.MipMapNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.MipMapNumericUpDown.BackColor = System.Drawing.Color.Black; - this.MipMapNumericUpDown.ForeColor = System.Drawing.SystemColors.Window; - this.MipMapNumericUpDown.Location = new System.Drawing.Point(127, 330); - this.MipMapNumericUpDown.Maximum = new decimal(new int[] { + this.editToolStripMenuItem.ForeColor = System.Drawing.Color.White; + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(46, 20); + this.editToolStripMenuItem.Text = "Tools"; + // + // bulkAnimationSpeedToolStripMenuItem + // + this.bulkAnimationSpeedToolStripMenuItem.Image = global::PckStudio.Properties.Resources.clock; + this.bulkAnimationSpeedToolStripMenuItem.Name = "bulkAnimationSpeedToolStripMenuItem"; + this.bulkAnimationSpeedToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.bulkAnimationSpeedToolStripMenuItem.Text = "Set Bulk Animation Speed"; + this.bulkAnimationSpeedToolStripMenuItem.Click += new System.EventHandler(this.bulkAnimationSpeedToolStripMenuItem_Click); + // + // importJavaAnimationToolStripMenuItem + // + this.importJavaAnimationToolStripMenuItem.Image = global::PckStudio.Properties.Resources.Replace; + this.importJavaAnimationToolStripMenuItem.Name = "importJavaAnimationToolStripMenuItem"; + this.importJavaAnimationToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.importJavaAnimationToolStripMenuItem.Text = "Import Java Animation"; + this.importJavaAnimationToolStripMenuItem.Click += new System.EventHandler(this.importJavaAnimationToolStripMenuItem_Click); + // + // changeTileToolStripMenuItem + // + this.changeTileToolStripMenuItem.Image = global::PckStudio.Properties.Resources.changeTile; + this.changeTileToolStripMenuItem.Name = "changeTileToolStripMenuItem"; + this.changeTileToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.changeTileToolStripMenuItem.Text = "Change Tile"; + this.changeTileToolStripMenuItem.Click += new System.EventHandler(this.changeTileToolStripMenuItem_Click); + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.ForeColor = System.Drawing.Color.White; + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "Help"; + this.helpToolStripMenuItem.Click += new System.EventHandler(this.helpToolStripMenuItem_Click); + // + // InterpolationCheckbox + // + this.InterpolationCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.InterpolationCheckbox.AutoSize = true; + this.InterpolationCheckbox.Location = new System.Drawing.Point(188, 317); + this.InterpolationCheckbox.Name = "InterpolationCheckbox"; + this.InterpolationCheckbox.Size = new System.Drawing.Size(204, 15); + this.InterpolationCheckbox.TabIndex = 17; + this.InterpolationCheckbox.Text = "Interpolates (not simulated above)"; + this.InterpolationCheckbox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.InterpolationCheckbox.UseSelectable = true; + // + // AnimationPlayBtn + // + this.AnimationPlayBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.AnimationPlayBtn.Location = new System.Drawing.Point(188, 291); + this.AnimationPlayBtn.Name = "AnimationPlayBtn"; + this.AnimationPlayBtn.Size = new System.Drawing.Size(99, 24); + this.AnimationPlayBtn.TabIndex = 18; + this.AnimationPlayBtn.Text = "Play Animation"; + this.AnimationPlayBtn.Theme = MetroFramework.MetroThemeStyle.Dark; + this.AnimationPlayBtn.UseSelectable = true; + this.AnimationPlayBtn.Click += new System.EventHandler(this.StartAnimationBtn_Click); + // + // AnimationStopBtn + // + this.AnimationStopBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.AnimationStopBtn.Enabled = false; + this.AnimationStopBtn.Location = new System.Drawing.Point(293, 291); + this.AnimationStopBtn.Name = "AnimationStopBtn"; + this.AnimationStopBtn.Size = new System.Drawing.Size(99, 24); + this.AnimationStopBtn.TabIndex = 19; + this.AnimationStopBtn.Text = "Stop Animation"; + this.AnimationStopBtn.Theme = MetroFramework.MetroThemeStyle.Dark; + this.AnimationStopBtn.UseSelectable = true; + this.AnimationStopBtn.Click += new System.EventHandler(this.StopAnimationBtn_Click); + // + // tileLabel + // + this.tileLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.tileLabel.AutoSize = true; + this.tileLabel.Location = new System.Drawing.Point(20, 290); + this.tileLabel.MinimumSize = new System.Drawing.Size(170, 19); + this.tileLabel.Name = "tileLabel"; + this.tileLabel.Size = new System.Drawing.Size(57, 19); + this.tileLabel.TabIndex = 20; + this.tileLabel.Text = "tileLabel"; + this.tileLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // MipMapCheckbox + // + this.MipMapCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.MipMapCheckbox.AutoSize = true; + this.MipMapCheckbox.Location = new System.Drawing.Point(20, 312); + this.MipMapCheckbox.Name = "MipMapCheckbox"; + this.MipMapCheckbox.Size = new System.Drawing.Size(128, 15); + this.MipMapCheckbox.TabIndex = 21; + this.MipMapCheckbox.Text = "Is Mip Map Texture?"; + this.MipMapCheckbox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.MipMapCheckbox.UseSelectable = true; + this.MipMapCheckbox.CheckedChanged += new System.EventHandler(this.MipMapCheckBox_CheckedChanged); + // + // MipMapLabel + // + this.MipMapLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.MipMapLabel.AutoSize = true; + this.MipMapLabel.Location = new System.Drawing.Point(21, 330); + this.MipMapLabel.Name = "MipMapLabel"; + this.MipMapLabel.Size = new System.Drawing.Size(99, 19); + this.MipMapLabel.TabIndex = 22; + this.MipMapLabel.Text = "Mip Map Level:"; + this.MipMapLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + this.MipMapLabel.Visible = false; + // + // MipMapNumericUpDown + // + this.MipMapNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.MipMapNumericUpDown.BackColor = System.Drawing.Color.Black; + this.MipMapNumericUpDown.ForeColor = System.Drawing.SystemColors.Window; + this.MipMapNumericUpDown.Location = new System.Drawing.Point(127, 330); + this.MipMapNumericUpDown.Maximum = new decimal(new int[] { 5, 0, 0, 0}); - this.MipMapNumericUpDown.Minimum = new decimal(new int[] { + this.MipMapNumericUpDown.Minimum = new decimal(new int[] { 2, 0, 0, 0}); - this.MipMapNumericUpDown.Name = "MipMapNumericUpDown"; - this.MipMapNumericUpDown.Size = new System.Drawing.Size(44, 20); - this.MipMapNumericUpDown.TabIndex = 23; - this.MipMapNumericUpDown.Value = new decimal(new int[] { + this.MipMapNumericUpDown.Name = "MipMapNumericUpDown"; + this.MipMapNumericUpDown.Size = new System.Drawing.Size(44, 20); + this.MipMapNumericUpDown.TabIndex = 23; + this.MipMapNumericUpDown.Value = new decimal(new int[] { 2, 0, 0, 0}); - this.MipMapNumericUpDown.Visible = false; - // - // pictureBoxWithInterpolationMode1 - // - this.pictureBoxWithInterpolationMode1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.MipMapNumericUpDown.Visible = false; + // + // pictureBoxWithInterpolationMode1 + // + this.pictureBoxWithInterpolationMode1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.pictureBoxWithInterpolationMode1.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; - this.pictureBoxWithInterpolationMode1.Location = new System.Drawing.Point(188, 88); - this.pictureBoxWithInterpolationMode1.Name = "pictureBoxWithInterpolationMode1"; - this.pictureBoxWithInterpolationMode1.Size = new System.Drawing.Size(204, 198); - this.pictureBoxWithInterpolationMode1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxWithInterpolationMode1.TabIndex = 16; - this.pictureBoxWithInterpolationMode1.TabStop = false; - // - // AnimationEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(412, 362); - this.Controls.Add(this.AnimationStopBtn); - this.Controls.Add(this.AnimationPlayBtn); - this.Controls.Add(this.MipMapNumericUpDown); - this.Controls.Add(this.MipMapLabel); - this.Controls.Add(this.MipMapCheckbox); - this.Controls.Add(this.tileLabel); - this.Controls.Add(this.InterpolationCheckbox); - this.Controls.Add(this.pictureBoxWithInterpolationMode1); - this.Controls.Add(this.frameTreeView); - this.Controls.Add(this.menuStrip); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(412, 362); - this.Name = "AnimationEditor"; - this.Style = MetroFramework.MetroColorStyle.Silver; - this.Text = "Animation Editor"; - this.Theme = MetroFramework.MetroThemeStyle.Dark; - this.contextMenuStrip1.ResumeLayout(false); - this.menuStrip.ResumeLayout(false); - this.menuStrip.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.MipMapNumericUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWithInterpolationMode1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + this.pictureBoxWithInterpolationMode1.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; + this.pictureBoxWithInterpolationMode1.Location = new System.Drawing.Point(188, 88); + this.pictureBoxWithInterpolationMode1.Name = "pictureBoxWithInterpolationMode1"; + this.pictureBoxWithInterpolationMode1.Size = new System.Drawing.Size(204, 198); + this.pictureBoxWithInterpolationMode1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBoxWithInterpolationMode1.TabIndex = 16; + this.pictureBoxWithInterpolationMode1.TabStop = false; + // + // exportJavaAnimationToolStripMenuItem + // + this.exportJavaAnimationToolStripMenuItem.Image = global::PckStudio.Properties.Resources.ExportFile; + this.exportJavaAnimationToolStripMenuItem.Name = "exportJavaAnimationToolStripMenuItem"; + this.exportJavaAnimationToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.exportJavaAnimationToolStripMenuItem.Text = "Export Java Animation"; + this.exportJavaAnimationToolStripMenuItem.Click += new System.EventHandler(this.exportJavaAnimationToolStripMenuItem_Click); + // + // AnimationEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(412, 362); + this.Controls.Add(this.AnimationStopBtn); + this.Controls.Add(this.AnimationPlayBtn); + this.Controls.Add(this.MipMapNumericUpDown); + this.Controls.Add(this.MipMapLabel); + this.Controls.Add(this.MipMapCheckbox); + this.Controls.Add(this.tileLabel); + this.Controls.Add(this.InterpolationCheckbox); + this.Controls.Add(this.pictureBoxWithInterpolationMode1); + this.Controls.Add(this.frameTreeView); + this.Controls.Add(this.menuStrip); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MinimumSize = new System.Drawing.Size(412, 362); + this.Name = "AnimationEditor"; + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Text = "Animation Editor"; + this.Theme = MetroFramework.MetroThemeStyle.Dark; + this.contextMenuStrip1.ResumeLayout(false); + this.menuStrip.ResumeLayout(false); + this.menuStrip.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.MipMapNumericUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWithInterpolationMode1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -340,5 +350,6 @@ private MetroFramework.Controls.MetroCheckBox MipMapCheckbox; private MetroFramework.Controls.MetroLabel MipMapLabel; private System.Windows.Forms.NumericUpDown MipMapNumericUpDown; + private System.Windows.Forms.ToolStripMenuItem exportJavaAnimationToolStripMenuItem; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.cs b/PCK-Studio/Forms/Editor/AnimationEditor.cs index 216c79bc..055131bf 100644 --- a/PCK-Studio/Forms/Editor/AnimationEditor.cs +++ b/PCK-Studio/Forms/Editor/AnimationEditor.cs @@ -577,5 +577,33 @@ namespace PckStudio.Forms.Editor { MipMapNumericUpDown.Visible = MipMapLabel.Visible = MipMapCheckbox.Checked; } + + private void exportJavaAnimationToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveFileDialog fileDialog = new SaveFileDialog(); + fileDialog.Title = "Please choose where you want to save your new animation"; + + fileDialog.Filter = "Animation Scripts (*.mcmeta)|*.png.mcmeta"; + fileDialog.CheckPathExists = true; + if (fileDialog.ShowDialog(this) != DialogResult.OK) return; + + JObject mcmeta = new JObject(); + JObject animation = new JObject(); + JArray frames = new JArray(); + currentAnimation.GetFrames().ForEach(f => { + JObject frame = new JObject(); + frame["index"] = currentAnimation.GetFrameIndex(f.Texture); + frame["time"] = f.Ticks; + frames.Add(frame); + }); + animation["interpolation"] = InterpolationCheckbox.Checked; + animation["frames"] = frames; + mcmeta["comment"] = "Animation converted via PCK Studio"; + mcmeta["animation"] = animation; + File.WriteAllText(fileDialog.FileName, JsonConvert.SerializeObject(mcmeta, Formatting.Indented)); + string fn = fileDialog.FileName; + currentAnimation.BuildTexture().Save(fn.Remove(fn.Length - 7)); + MessageBox.Show("Your animation was successfully exported at " + fn, "Successful export"); + } } }