Added SubSprite and SubSpritePosition lists to Frame, Added SubSprite-relevant controls to AnimationEditor, made AnimationEditor sizable

This commit is contained in:
quinnvoker
2018-12-05 15:33:59 -08:00
parent 433fadfe59
commit 95c1674b08
3 changed files with 274 additions and 182 deletions
+176 -74
View File
@@ -52,6 +52,8 @@
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.loadAnimationSetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loadAnimationSetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAnimationSetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveAnimationSetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.animationLoopCheckBox = new System.Windows.Forms.CheckBox(); this.animationLoopCheckBox = new System.Windows.Forms.CheckBox();
this.saveAnimationDialog = new System.Windows.Forms.SaveFileDialog(); this.saveAnimationDialog = new System.Windows.Forms.SaveFileDialog();
this.saveAnimationSetDialog = new System.Windows.Forms.SaveFileDialog(); this.saveAnimationSetDialog = new System.Windows.Forms.SaveFileDialog();
@@ -69,10 +71,15 @@
this.animationPanel = new System.Windows.Forms.Panel(); this.animationPanel = new System.Windows.Forms.Panel();
this.animationNameLabel = new System.Windows.Forms.Label(); this.animationNameLabel = new System.Windows.Forms.Label();
this.animationLabel = new System.Windows.Forms.Label(); this.animationLabel = new System.Windows.Forms.Label();
this.animationPreview = new AnimationEditor.AnimationPreview();
this.loadAnimationSetDialog = new System.Windows.Forms.OpenFileDialog(); this.loadAnimationSetDialog = new System.Windows.Forms.OpenFileDialog();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.animationPreview = new AnimationEditor.AnimationPreview();
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.subSpriteListBox = new System.Windows.Forms.ListBox();
this.subSpriteXPosBox = new System.Windows.Forms.NumericUpDown();
this.subSpriteXPosLabel = new System.Windows.Forms.Label();
this.subSpriteListLabel = new System.Windows.Forms.Label();
this.addSpriteToSubSpritesButton = new System.Windows.Forms.Button();
this.subSpriteYPosBox = new System.Windows.Forms.NumericUpDown();
this.subSpriteYPosLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit();
@@ -80,6 +87,8 @@
this.frameEditorPanel.SuspendLayout(); this.frameEditorPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.importDelayBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.importDelayBox)).BeginInit();
this.animationPanel.SuspendLayout(); this.animationPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.subSpriteXPosBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.subSpriteYPosBox)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// loadSpriteSheetDialog // loadSpriteSheetDialog
@@ -96,32 +105,34 @@
// //
// spriteListBox // spriteListBox
// //
this.spriteListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.spriteListBox.BackColor = System.Drawing.SystemColors.Window; this.spriteListBox.BackColor = System.Drawing.SystemColors.Window;
this.spriteListBox.Enabled = false;
this.spriteListBox.FormattingEnabled = true; this.spriteListBox.FormattingEnabled = true;
this.spriteListBox.Location = new System.Drawing.Point(5, 62); this.spriteListBox.Location = new System.Drawing.Point(5, 62);
this.spriteListBox.Name = "spriteListBox"; this.spriteListBox.Name = "spriteListBox";
this.spriteListBox.Size = new System.Drawing.Size(119, 303); this.spriteListBox.Size = new System.Drawing.Size(119, 342);
this.spriteListBox.TabIndex = 3; this.spriteListBox.TabIndex = 3;
this.spriteListBox.SelectedIndexChanged += new System.EventHandler(this.spriteListBox_SelectedIndexChanged); this.spriteListBox.SelectedIndexChanged += new System.EventHandler(this.spriteListBox_SelectedIndexChanged);
// //
// frameListBox // frameListBox
// //
this.frameListBox.AllowDrop = true; this.frameListBox.AllowDrop = true;
this.frameListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.frameListBox.BackColor = System.Drawing.SystemColors.Window; this.frameListBox.BackColor = System.Drawing.SystemColors.Window;
this.frameListBox.Enabled = false;
this.frameListBox.FormattingEnabled = true; this.frameListBox.FormattingEnabled = true;
this.frameListBox.Location = new System.Drawing.Point(163, 62); this.frameListBox.Location = new System.Drawing.Point(163, 48);
this.frameListBox.Name = "frameListBox"; this.frameListBox.Name = "frameListBox";
this.frameListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; this.frameListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.frameListBox.Size = new System.Drawing.Size(120, 303); this.frameListBox.Size = new System.Drawing.Size(120, 238);
this.frameListBox.TabIndex = 4; this.frameListBox.TabIndex = 4;
this.frameListBox.SelectedIndexChanged += new System.EventHandler(this.frameListBox_SelectedIndexChanged); this.frameListBox.SelectedIndexChanged += new System.EventHandler(this.frameListBox_SelectedIndexChanged);
// //
// addSpriteToFrameListButton // addSpriteToFrameListButton
// //
this.addSpriteToFrameListButton.Enabled = false; this.addSpriteToFrameListButton.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.addSpriteToFrameListButton.Location = new System.Drawing.Point(130, 212); this.addSpriteToFrameListButton.Location = new System.Drawing.Point(130, 162);
this.addSpriteToFrameListButton.Name = "addSpriteToFrameListButton"; this.addSpriteToFrameListButton.Name = "addSpriteToFrameListButton";
this.addSpriteToFrameListButton.Size = new System.Drawing.Size(27, 23); this.addSpriteToFrameListButton.Size = new System.Drawing.Size(27, 23);
this.addSpriteToFrameListButton.TabIndex = 5; this.addSpriteToFrameListButton.TabIndex = 5;
@@ -133,7 +144,6 @@
// //
this.spritePreview.BackColor = System.Drawing.SystemColors.ControlDark; this.spritePreview.BackColor = System.Drawing.SystemColors.ControlDark;
this.spritePreview.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.spritePreview.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.spritePreview.Enabled = false;
this.spritePreview.Location = new System.Drawing.Point(5, 19); this.spritePreview.Location = new System.Drawing.Point(5, 19);
this.spritePreview.Name = "spritePreview"; this.spritePreview.Name = "spritePreview";
this.spritePreview.Size = new System.Drawing.Size(119, 43); this.spritePreview.Size = new System.Drawing.Size(119, 43);
@@ -143,17 +153,18 @@
// //
// frameTrackBar // frameTrackBar
// //
this.frameTrackBar.Enabled = false; this.frameTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
this.frameTrackBar.Location = new System.Drawing.Point(3, 359); | System.Windows.Forms.AnchorStyles.Right)));
this.frameTrackBar.Location = new System.Drawing.Point(3, 403);
this.frameTrackBar.Name = "frameTrackBar"; this.frameTrackBar.Name = "frameTrackBar";
this.frameTrackBar.Size = new System.Drawing.Size(466, 45); this.frameTrackBar.Size = new System.Drawing.Size(467, 45);
this.frameTrackBar.TabIndex = 7; this.frameTrackBar.TabIndex = 7;
this.frameTrackBar.Scroll += new System.EventHandler(this.frameTrackBar_Scroll); this.frameTrackBar.Scroll += new System.EventHandler(this.frameTrackBar_Scroll);
// //
// delayInputBox // delayInputBox
// //
this.delayInputBox.Enabled = false; this.delayInputBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.delayInputBox.Location = new System.Drawing.Point(198, 393); this.delayInputBox.Location = new System.Drawing.Point(200, 312);
this.delayInputBox.Name = "delayInputBox"; this.delayInputBox.Name = "delayInputBox";
this.delayInputBox.Size = new System.Drawing.Size(83, 20); this.delayInputBox.Size = new System.Drawing.Size(83, 20);
this.delayInputBox.TabIndex = 8; this.delayInputBox.TabIndex = 8;
@@ -162,9 +173,8 @@
// animationBox // animationBox
// //
this.animationBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.animationBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.animationBox.Enabled = false;
this.animationBox.FormattingEnabled = true; this.animationBox.FormattingEnabled = true;
this.animationBox.Location = new System.Drawing.Point(71, 0); this.animationBox.Location = new System.Drawing.Point(72, 0);
this.animationBox.Name = "animationBox"; this.animationBox.Name = "animationBox";
this.animationBox.Size = new System.Drawing.Size(121, 21); this.animationBox.Size = new System.Drawing.Size(121, 21);
this.animationBox.TabIndex = 9; this.animationBox.TabIndex = 9;
@@ -172,8 +182,7 @@
// //
// animationNameBox // animationNameBox
// //
this.animationNameBox.Enabled = false; this.animationNameBox.Location = new System.Drawing.Point(314, 0);
this.animationNameBox.Location = new System.Drawing.Point(313, 0);
this.animationNameBox.Name = "animationNameBox"; this.animationNameBox.Name = "animationNameBox";
this.animationNameBox.Size = new System.Drawing.Size(100, 20); this.animationNameBox.Size = new System.Drawing.Size(100, 20);
this.animationNameBox.TabIndex = 10; this.animationNameBox.TabIndex = 10;
@@ -181,9 +190,9 @@
// //
// playAnimationButton // playAnimationButton
// //
this.playAnimationButton.Enabled = false; this.playAnimationButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.playAnimationButton.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.playAnimationButton.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.playAnimationButton.Location = new System.Drawing.Point(200, 391); this.playAnimationButton.Location = new System.Drawing.Point(200, 435);
this.playAnimationButton.Name = "playAnimationButton"; this.playAnimationButton.Name = "playAnimationButton";
this.playAnimationButton.Size = new System.Drawing.Size(75, 23); this.playAnimationButton.Size = new System.Drawing.Size(75, 23);
this.playAnimationButton.TabIndex = 11; this.playAnimationButton.TabIndex = 11;
@@ -193,8 +202,7 @@
// //
// removeFrameButton // removeFrameButton
// //
this.removeFrameButton.Enabled = false; this.removeFrameButton.Location = new System.Drawing.Point(256, 19);
this.removeFrameButton.Location = new System.Drawing.Point(256, 26);
this.removeFrameButton.Name = "removeFrameButton"; this.removeFrameButton.Name = "removeFrameButton";
this.removeFrameButton.Size = new System.Drawing.Size(27, 23); this.removeFrameButton.Size = new System.Drawing.Size(27, 23);
this.removeFrameButton.TabIndex = 12; this.removeFrameButton.TabIndex = 12;
@@ -204,9 +212,8 @@
// //
// moveFrameUpButton // moveFrameUpButton
// //
this.moveFrameUpButton.Enabled = false;
this.moveFrameUpButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.moveFrameUpButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.moveFrameUpButton.Location = new System.Drawing.Point(223, 26); this.moveFrameUpButton.Location = new System.Drawing.Point(223, 19);
this.moveFrameUpButton.Name = "moveFrameUpButton"; this.moveFrameUpButton.Name = "moveFrameUpButton";
this.moveFrameUpButton.Size = new System.Drawing.Size(27, 23); this.moveFrameUpButton.Size = new System.Drawing.Size(27, 23);
this.moveFrameUpButton.TabIndex = 13; this.moveFrameUpButton.TabIndex = 13;
@@ -216,8 +223,7 @@
// //
// moveFrameDownButton // moveFrameDownButton
// //
this.moveFrameDownButton.Enabled = false; this.moveFrameDownButton.Location = new System.Drawing.Point(190, 19);
this.moveFrameDownButton.Location = new System.Drawing.Point(190, 26);
this.moveFrameDownButton.Name = "moveFrameDownButton"; this.moveFrameDownButton.Name = "moveFrameDownButton";
this.moveFrameDownButton.Size = new System.Drawing.Size(27, 23); this.moveFrameDownButton.Size = new System.Drawing.Size(27, 23);
this.moveFrameDownButton.TabIndex = 14; this.moveFrameDownButton.TabIndex = 14;
@@ -233,7 +239,7 @@
this.editToolStripMenuItem}); this.editToolStripMenuItem});
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);
this.mainMenuStrip.Name = "mainMenuStrip"; this.mainMenuStrip.Name = "mainMenuStrip";
this.mainMenuStrip.Size = new System.Drawing.Size(763, 24); this.mainMenuStrip.Size = new System.Drawing.Size(764, 24);
this.mainMenuStrip.TabIndex = 15; this.mainMenuStrip.TabIndex = 15;
this.mainMenuStrip.Text = "menuStrip1"; this.mainMenuStrip.Text = "menuStrip1";
// //
@@ -309,12 +315,29 @@
this.saveAnimationSetToolStripMenuItem.Text = "Save Animation Set..."; this.saveAnimationSetToolStripMenuItem.Text = "Save Animation Set...";
this.saveAnimationSetToolStripMenuItem.Click += new System.EventHandler(this.saveAnimationSetToolStripMenuItem_Click); this.saveAnimationSetToolStripMenuItem.Click += new System.EventHandler(this.saveAnimationSetToolStripMenuItem_Click);
// //
// editToolStripMenuItem
//
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem});
this.editToolStripMenuItem.Enabled = false;
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this.editToolStripMenuItem.Text = "Edit";
//
// updateAnimationSpritesFromSpriteMapToolStripMenuItem
//
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Enabled = false;
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Name = "updateAnimationSpritesFromSpriteMapToolStripMenuItem";
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Size = new System.Drawing.Size(304, 22);
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Text = "Update Animation Sprites from SpriteMap...";
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Click += new System.EventHandler(this.updateAnimationSpritesFromSpriteMapToolStripMenuItem_Click);
//
// animationLoopCheckBox // animationLoopCheckBox
// //
this.animationLoopCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.animationLoopCheckBox.AutoSize = true; this.animationLoopCheckBox.AutoSize = true;
this.animationLoopCheckBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.animationLoopCheckBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.animationLoopCheckBox.Enabled = false; this.animationLoopCheckBox.Location = new System.Drawing.Point(420, 2);
this.animationLoopCheckBox.Location = new System.Drawing.Point(419, 2);
this.animationLoopCheckBox.Name = "animationLoopCheckBox"; this.animationLoopCheckBox.Name = "animationLoopCheckBox";
this.animationLoopCheckBox.Size = new System.Drawing.Size(50, 17); this.animationLoopCheckBox.Size = new System.Drawing.Size(50, 17);
this.animationLoopCheckBox.TabIndex = 16; this.animationLoopCheckBox.TabIndex = 16;
@@ -340,9 +363,8 @@
// //
// addAnimationButton // addAnimationButton
// //
this.addAnimationButton.Enabled = false;
this.addAnimationButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.addAnimationButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.addAnimationButton.Location = new System.Drawing.Point(199, -1); this.addAnimationButton.Location = new System.Drawing.Point(200, -1);
this.addAnimationButton.Name = "addAnimationButton"; this.addAnimationButton.Name = "addAnimationButton";
this.addAnimationButton.Size = new System.Drawing.Size(27, 23); this.addAnimationButton.Size = new System.Drawing.Size(27, 23);
this.addAnimationButton.TabIndex = 18; this.addAnimationButton.TabIndex = 18;
@@ -352,8 +374,7 @@
// //
// removeAnimationButton // removeAnimationButton
// //
this.removeAnimationButton.Enabled = false; this.removeAnimationButton.Location = new System.Drawing.Point(233, -1);
this.removeAnimationButton.Location = new System.Drawing.Point(232, -1);
this.removeAnimationButton.Name = "removeAnimationButton"; this.removeAnimationButton.Name = "removeAnimationButton";
this.removeAnimationButton.Size = new System.Drawing.Size(27, 23); this.removeAnimationButton.Size = new System.Drawing.Size(27, 23);
this.removeAnimationButton.TabIndex = 17; this.removeAnimationButton.TabIndex = 17;
@@ -363,30 +384,41 @@
// //
// frameEditorPanel // frameEditorPanel
// //
this.frameEditorPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.frameEditorPanel.Controls.Add(this.subSpriteListBox);
this.frameEditorPanel.Controls.Add(this.importDelayLabel); this.frameEditorPanel.Controls.Add(this.importDelayLabel);
this.frameEditorPanel.Controls.Add(this.importValuesLabel); this.frameEditorPanel.Controls.Add(this.importValuesLabel);
this.frameEditorPanel.Controls.Add(this.importDelayBox); this.frameEditorPanel.Controls.Add(this.importDelayBox);
this.frameEditorPanel.Controls.Add(this.subSpriteYPosLabel);
this.frameEditorPanel.Controls.Add(this.subSpriteXPosLabel);
this.frameEditorPanel.Controls.Add(this.delayLabel); this.frameEditorPanel.Controls.Add(this.delayLabel);
this.frameEditorPanel.Controls.Add(this.frameInfoLabel); this.frameEditorPanel.Controls.Add(this.frameInfoLabel);
this.frameEditorPanel.Controls.Add(this.subSpriteListLabel);
this.frameEditorPanel.Controls.Add(this.frameBoxLabel); this.frameEditorPanel.Controls.Add(this.frameBoxLabel);
this.frameEditorPanel.Controls.Add(this.spriteBoxLabel); this.frameEditorPanel.Controls.Add(this.spriteBoxLabel);
this.frameEditorPanel.Controls.Add(this.frameListBox); this.frameEditorPanel.Controls.Add(this.frameListBox);
this.frameEditorPanel.Controls.Add(this.spriteListBox); this.frameEditorPanel.Controls.Add(this.spriteListBox);
this.frameEditorPanel.Controls.Add(this.addSpriteToSubSpritesButton);
this.frameEditorPanel.Controls.Add(this.addSpriteToFrameListButton); this.frameEditorPanel.Controls.Add(this.addSpriteToFrameListButton);
this.frameEditorPanel.Controls.Add(this.spritePreview); this.frameEditorPanel.Controls.Add(this.spritePreview);
this.frameEditorPanel.Controls.Add(this.moveFrameDownButton); this.frameEditorPanel.Controls.Add(this.moveFrameDownButton);
this.frameEditorPanel.Controls.Add(this.subSpriteYPosBox);
this.frameEditorPanel.Controls.Add(this.subSpriteXPosBox);
this.frameEditorPanel.Controls.Add(this.delayInputBox); this.frameEditorPanel.Controls.Add(this.delayInputBox);
this.frameEditorPanel.Controls.Add(this.moveFrameUpButton); this.frameEditorPanel.Controls.Add(this.moveFrameUpButton);
this.frameEditorPanel.Controls.Add(this.removeFrameButton); this.frameEditorPanel.Controls.Add(this.removeFrameButton);
this.frameEditorPanel.Enabled = false;
this.frameEditorPanel.Location = new System.Drawing.Point(0, 27); this.frameEditorPanel.Location = new System.Drawing.Point(0, 27);
this.frameEditorPanel.Name = "frameEditorPanel"; this.frameEditorPanel.Name = "frameEditorPanel";
this.frameEditorPanel.Size = new System.Drawing.Size(290, 423); this.frameEditorPanel.Size = new System.Drawing.Size(290, 467);
this.frameEditorPanel.TabIndex = 19; this.frameEditorPanel.TabIndex = 19;
// //
// importDelayLabel // importDelayLabel
// //
this.importDelayLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.importDelayLabel.AutoSize = true; this.importDelayLabel.AutoSize = true;
this.importDelayLabel.Location = new System.Drawing.Point(4, 395); this.importDelayLabel.Location = new System.Drawing.Point(3, 437);
this.importDelayLabel.Name = "importDelayLabel"; this.importDelayLabel.Name = "importDelayLabel";
this.importDelayLabel.Size = new System.Drawing.Size(34, 13); this.importDelayLabel.Size = new System.Drawing.Size(34, 13);
this.importDelayLabel.TabIndex = 21; this.importDelayLabel.TabIndex = 21;
@@ -394,9 +426,10 @@
// //
// importValuesLabel // importValuesLabel
// //
this.importValuesLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.importValuesLabel.AutoSize = true; this.importValuesLabel.AutoSize = true;
this.importValuesLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.importValuesLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.importValuesLabel.Location = new System.Drawing.Point(4, 372); this.importValuesLabel.Location = new System.Drawing.Point(3, 414);
this.importValuesLabel.Name = "importValuesLabel"; this.importValuesLabel.Name = "importValuesLabel";
this.importValuesLabel.Size = new System.Drawing.Size(84, 13); this.importValuesLabel.Size = new System.Drawing.Size(84, 13);
this.importValuesLabel.TabIndex = 20; this.importValuesLabel.TabIndex = 20;
@@ -404,8 +437,8 @@
// //
// importDelayBox // importDelayBox
// //
this.importDelayBox.Enabled = false; this.importDelayBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.importDelayBox.Location = new System.Drawing.Point(41, 393); this.importDelayBox.Location = new System.Drawing.Point(40, 435);
this.importDelayBox.Name = "importDelayBox"; this.importDelayBox.Name = "importDelayBox";
this.importDelayBox.Size = new System.Drawing.Size(83, 20); this.importDelayBox.Size = new System.Drawing.Size(83, 20);
this.importDelayBox.TabIndex = 19; this.importDelayBox.TabIndex = 19;
@@ -413,8 +446,9 @@
// //
// delayLabel // delayLabel
// //
this.delayLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.delayLabel.AutoSize = true; this.delayLabel.AutoSize = true;
this.delayLabel.Location = new System.Drawing.Point(160, 395); this.delayLabel.Location = new System.Drawing.Point(162, 314);
this.delayLabel.Name = "delayLabel"; this.delayLabel.Name = "delayLabel";
this.delayLabel.Size = new System.Drawing.Size(34, 13); this.delayLabel.Size = new System.Drawing.Size(34, 13);
this.delayLabel.TabIndex = 18; this.delayLabel.TabIndex = 18;
@@ -422,9 +456,10 @@
// //
// frameInfoLabel // frameInfoLabel
// //
this.frameInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.frameInfoLabel.AutoSize = true; this.frameInfoLabel.AutoSize = true;
this.frameInfoLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.frameInfoLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.frameInfoLabel.Location = new System.Drawing.Point(160, 372); this.frameInfoLabel.Location = new System.Drawing.Point(162, 296);
this.frameInfoLabel.Name = "frameInfoLabel"; this.frameInfoLabel.Name = "frameInfoLabel";
this.frameInfoLabel.Size = new System.Drawing.Size(121, 13); this.frameInfoLabel.Size = new System.Drawing.Size(121, 13);
this.frameInfoLabel.TabIndex = 17; this.frameInfoLabel.TabIndex = 17;
@@ -452,6 +487,9 @@
// //
// animationPanel // animationPanel
// //
this.animationPanel.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.animationPanel.Controls.Add(this.animationNameLabel); this.animationPanel.Controls.Add(this.animationNameLabel);
this.animationPanel.Controls.Add(this.animationLabel); this.animationPanel.Controls.Add(this.animationLabel);
this.animationPanel.Controls.Add(this.playAnimationButton); this.animationPanel.Controls.Add(this.playAnimationButton);
@@ -462,15 +500,16 @@
this.animationPanel.Controls.Add(this.removeAnimationButton); this.animationPanel.Controls.Add(this.removeAnimationButton);
this.animationPanel.Controls.Add(this.animationNameBox); this.animationPanel.Controls.Add(this.animationNameBox);
this.animationPanel.Controls.Add(this.animationLoopCheckBox); this.animationPanel.Controls.Add(this.animationLoopCheckBox);
this.animationPanel.Enabled = false;
this.animationPanel.Location = new System.Drawing.Point(289, 27); this.animationPanel.Location = new System.Drawing.Point(289, 27);
this.animationPanel.Name = "animationPanel"; this.animationPanel.Name = "animationPanel";
this.animationPanel.Size = new System.Drawing.Size(474, 423); this.animationPanel.Size = new System.Drawing.Size(475, 467);
this.animationPanel.TabIndex = 20; this.animationPanel.TabIndex = 20;
// //
// animationNameLabel // animationNameLabel
// //
this.animationNameLabel.AutoSize = true; this.animationNameLabel.AutoSize = true;
this.animationNameLabel.Location = new System.Drawing.Point(272, 3); this.animationNameLabel.Location = new System.Drawing.Point(273, 3);
this.animationNameLabel.Name = "animationNameLabel"; this.animationNameLabel.Name = "animationNameLabel";
this.animationNameLabel.Size = new System.Drawing.Size(35, 13); this.animationNameLabel.Size = new System.Drawing.Size(35, 13);
this.animationNameLabel.TabIndex = 23; this.animationNameLabel.TabIndex = 23;
@@ -480,59 +519,113 @@
// //
this.animationLabel.AutoSize = true; this.animationLabel.AutoSize = true;
this.animationLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.animationLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.animationLabel.Location = new System.Drawing.Point(3, 3); this.animationLabel.Location = new System.Drawing.Point(4, 3);
this.animationLabel.Name = "animationLabel"; this.animationLabel.Name = "animationLabel";
this.animationLabel.Size = new System.Drawing.Size(62, 13); this.animationLabel.Size = new System.Drawing.Size(62, 13);
this.animationLabel.TabIndex = 22; this.animationLabel.TabIndex = 22;
this.animationLabel.Text = "Animation"; this.animationLabel.Text = "Animation";
// //
// animationPreview
//
this.animationPreview.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.animationPreview.Enabled = false;
this.animationPreview.Location = new System.Drawing.Point(3, 26);
this.animationPreview.Name = "animationPreview";
this.animationPreview.Playing = false;
this.animationPreview.PreviewSprite = null;
this.animationPreview.Size = new System.Drawing.Size(466, 326);
this.animationPreview.TabIndex = 0;
this.animationPreview.Text = "animationPreview1";
this.animationPreview.ZoomLevel = 0F;
this.animationPreview.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.animationPreview_MouseWheel);
//
// loadAnimationSetDialog // loadAnimationSetDialog
// //
this.loadAnimationSetDialog.DefaultExt = "animset"; this.loadAnimationSetDialog.DefaultExt = "animset";
this.loadAnimationSetDialog.FileName = "openFileDialog1"; this.loadAnimationSetDialog.FileName = "openFileDialog1";
this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet"; this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
// //
// editToolStripMenuItem // animationPreview
// //
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.animationPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem}); | System.Windows.Forms.AnchorStyles.Left)
this.editToolStripMenuItem.Enabled = false; | System.Windows.Forms.AnchorStyles.Right)));
this.editToolStripMenuItem.Name = "editToolStripMenuItem"; this.animationPreview.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); this.animationPreview.Location = new System.Drawing.Point(3, 26);
this.editToolStripMenuItem.Text = "Edit"; this.animationPreview.Name = "animationPreview";
this.animationPreview.Playing = false;
this.animationPreview.PreviewSprite = null;
this.animationPreview.Size = new System.Drawing.Size(467, 370);
this.animationPreview.TabIndex = 0;
this.animationPreview.Text = "animationPreview1";
this.animationPreview.ZoomLevel = 0F;
this.animationPreview.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.animationPreview_MouseWheel);
// //
// updateAnimationSpritesFromSpriteMapToolStripMenuItem // subSpriteListBox
// //
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Enabled = false; this.subSpriteListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Name = "updateAnimationSpritesFromSpriteMapToolStripMenuItem"; this.subSpriteListBox.FormattingEnabled = true;
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Size = new System.Drawing.Size(304, 22); this.subSpriteListBox.Location = new System.Drawing.Point(163, 362);
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Text = "Update Animation Sprites from SpriteMap..."; this.subSpriteListBox.Name = "subSpriteListBox";
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Click += new System.EventHandler(this.updateAnimationSpritesFromSpriteMapToolStripMenuItem_Click); this.subSpriteListBox.Size = new System.Drawing.Size(120, 56);
this.subSpriteListBox.TabIndex = 22;
//
// subSpriteXPosBox
//
this.subSpriteXPosBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.subSpriteXPosBox.Location = new System.Drawing.Point(177, 435);
this.subSpriteXPosBox.Name = "subSpriteXPosBox";
this.subSpriteXPosBox.Size = new System.Drawing.Size(43, 20);
this.subSpriteXPosBox.TabIndex = 8;
this.subSpriteXPosBox.ValueChanged += new System.EventHandler(this.delayInputBox_ValueChanged);
//
// subSpriteXPosLabel
//
this.subSpriteXPosLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.subSpriteXPosLabel.AutoSize = true;
this.subSpriteXPosLabel.Location = new System.Drawing.Point(162, 437);
this.subSpriteXPosLabel.Name = "subSpriteXPosLabel";
this.subSpriteXPosLabel.Size = new System.Drawing.Size(14, 13);
this.subSpriteXPosLabel.TabIndex = 18;
this.subSpriteXPosLabel.Text = "X";
//
// subSpriteListLabel
//
this.subSpriteListLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.subSpriteListLabel.AutoSize = true;
this.subSpriteListLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.subSpriteListLabel.Location = new System.Drawing.Point(162, 346);
this.subSpriteListLabel.Name = "subSpriteListLabel";
this.subSpriteListLabel.Size = new System.Drawing.Size(72, 13);
this.subSpriteListLabel.TabIndex = 16;
this.subSpriteListLabel.Text = "Sub-Sprites";
//
// addSpriteToSubSpritesButton
//
this.addSpriteToSubSpritesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.addSpriteToSubSpritesButton.Location = new System.Drawing.Point(130, 371);
this.addSpriteToSubSpritesButton.Name = "addSpriteToSubSpritesButton";
this.addSpriteToSubSpritesButton.Size = new System.Drawing.Size(27, 23);
this.addSpriteToSubSpritesButton.TabIndex = 5;
this.addSpriteToSubSpritesButton.Text = "→";
this.addSpriteToSubSpritesButton.UseVisualStyleBackColor = true;
this.addSpriteToSubSpritesButton.Click += new System.EventHandler(this.addSpriteToFrameListButton_Click);
//
// subSpriteYPosBox
//
this.subSpriteYPosBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.subSpriteYPosBox.Location = new System.Drawing.Point(238, 435);
this.subSpriteYPosBox.Name = "subSpriteYPosBox";
this.subSpriteYPosBox.Size = new System.Drawing.Size(43, 20);
this.subSpriteYPosBox.TabIndex = 8;
this.subSpriteYPosBox.ValueChanged += new System.EventHandler(this.delayInputBox_ValueChanged);
//
// subSpriteYPosLabel
//
this.subSpriteYPosLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.subSpriteYPosLabel.AutoSize = true;
this.subSpriteYPosLabel.Location = new System.Drawing.Point(223, 437);
this.subSpriteYPosLabel.Name = "subSpriteYPosLabel";
this.subSpriteYPosLabel.Size = new System.Drawing.Size(14, 13);
this.subSpriteYPosLabel.TabIndex = 18;
this.subSpriteYPosLabel.Text = "Y";
// //
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control; this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(763, 450); this.ClientSize = new System.Drawing.Size(764, 494);
this.Controls.Add(this.animationPanel); this.Controls.Add(this.animationPanel);
this.Controls.Add(this.frameEditorPanel); this.Controls.Add(this.frameEditorPanel);
this.Controls.Add(this.mainMenuStrip); this.Controls.Add(this.mainMenuStrip);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MinimumSize = new System.Drawing.Size(780, 345);
this.Name = "Form1"; this.Name = "Form1";
this.Text = "QUROGames Animation Studio"; this.Text = "QUROGames Animation Studio";
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.spritePreview)).EndInit();
@@ -545,6 +638,8 @@
((System.ComponentModel.ISupportInitialize)(this.importDelayBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.importDelayBox)).EndInit();
this.animationPanel.ResumeLayout(false); this.animationPanel.ResumeLayout(false);
this.animationPanel.PerformLayout(); this.animationPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.subSpriteXPosBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.subSpriteYPosBox)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -597,6 +692,13 @@
private System.Windows.Forms.OpenFileDialog loadAnimationSetDialog; private System.Windows.Forms.OpenFileDialog loadAnimationSetDialog;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem updateAnimationSpritesFromSpriteMapToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem updateAnimationSpritesFromSpriteMapToolStripMenuItem;
private System.Windows.Forms.ListBox subSpriteListBox;
private System.Windows.Forms.Label subSpriteYPosLabel;
private System.Windows.Forms.Label subSpriteXPosLabel;
private System.Windows.Forms.Label subSpriteListLabel;
private System.Windows.Forms.Button addSpriteToSubSpritesButton;
private System.Windows.Forms.NumericUpDown subSpriteYPosBox;
private System.Windows.Forms.NumericUpDown subSpriteXPosBox;
} }
} }
+85 -106
View File
@@ -20,15 +20,15 @@ namespace AnimationEditor
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
public Texture2D SpriteSheet { get; set; } private Texture2D spriteSheet;
public int FrameRate { get; set; } private int frameRate;
public BindingList<SpriteMapRegion> Sprites { get; set; } private BindingList<SpriteMapRegion> sprites;
public BindingList<Frame> Frames { get; set; } private BindingList<Frame> frames;
public BindingList<Animation> Animations { get; set; } private BindingList<Animation> animations;
public Animation CurrentAnimation { get; set; } private Animation currentAnimation;
public Frame CurrentFrame { get; set; } private Frame currentFrame;
private bool reading = false; private bool reading = false;
private float importDelay = 0; private float importDelay = 0;
@@ -36,7 +36,7 @@ namespace AnimationEditor
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
FrameRate = 60; frameRate = 60;
importDelayBox.Value = 0; importDelayBox.Value = 0;
animationPreview.FrameChanged += animationPreview_FrameChanged; animationPreview.FrameChanged += animationPreview_FrameChanged;
animationPreview.AnimationEnded += animationPreview_AnimationEnded; animationPreview.AnimationEnded += animationPreview_AnimationEnded;
@@ -55,46 +55,25 @@ namespace AnimationEditor
loadAnimationSetToolStripMenuItem.Enabled = true; loadAnimationSetToolStripMenuItem.Enabled = true;
} }
private void EnableSpriteMapControls()
{
spriteListBox.Enabled = true;
addSpriteToFrameListButton.Enabled = true;
spritePreview.Enabled = true;
importDelayBox.Enabled = true;
}
private void EnableAnimationEditingControls() private void EnableAnimationEditingControls()
{ {
saveAnimationToolStripMenuItem.Enabled = true; saveAnimationToolStripMenuItem.Enabled = true;
saveAnimationSetToolStripMenuItem.Enabled = true; saveAnimationSetToolStripMenuItem.Enabled = true;
frameListBox.Enabled = true;
moveFrameDownButton.Enabled = true;
moveFrameUpButton.Enabled = true;
removeFrameButton.Enabled = true;
delayInputBox.Enabled = true;
animationBox.Enabled = true;
addAnimationButton.Enabled = true;
removeAnimationButton.Enabled = true;
removeFrameButton.Enabled = true;
animationNameBox.Enabled = true;
animationLoopCheckBox.Enabled = true;
frameTrackBar.Enabled = true;
playAnimationButton.Enabled = true;
animationPreview.Enabled = true;
editToolStripMenuItem.Enabled = true; editToolStripMenuItem.Enabled = true;
updateAnimationSpritesFromSpriteMapToolStripMenuItem.Enabled = true; updateAnimationSpritesFromSpriteMapToolStripMenuItem.Enabled = true;
frameEditorPanel.Enabled = true;
animationPanel.Enabled = true;
} }
private void InitiateAnimationList(bool newAnimation = true) private void InitiateAnimationList(bool newAnimation = true)
{ {
if (newAnimation) if (newAnimation)
Animations = new BindingList<Animation>() { new Animation() }; animations = new BindingList<Animation>() { new Animation() };
else else
Animations = new BindingList<Animation>(); animations = new BindingList<Animation>();
animationBox.DataSource = Animations; animationBox.DataSource = animations;
animationBox.DisplayMember = "Name"; animationBox.DisplayMember = "Name";
} }
@@ -104,20 +83,20 @@ namespace AnimationEditor
{ {
int newSelectedIndex; int newSelectedIndex;
if (Frames.Count == 1 && Frames[0].Bounds == Microsoft.Xna.Framework.Rectangle.Empty) if (frames.Count == 1 && frames[0].Bounds == Microsoft.Xna.Framework.Rectangle.Empty)
{ {
Frames.Clear(); frames.Clear();
} }
if (frameListBox.SelectedItem == null || frameListBox.SelectedIndex == Frames.Count - 1) if (frameListBox.SelectedItem == null || frameListBox.SelectedIndex == frames.Count - 1)
{ {
Frames.Add(new Frame((SpriteMapRegion)spriteListBox.SelectedItem, importDelay)); frames.Add(new Frame((SpriteMapRegion)spriteListBox.SelectedItem, importDelay));
frameTrackBar.Maximum = Frames.Count - 1; frameTrackBar.Maximum = frames.Count - 1;
newSelectedIndex = Frames.Count - 1; newSelectedIndex = frames.Count - 1;
} }
else else
{ {
Frames.Insert(frameListBox.SelectedIndex + 1, new Frame((SpriteMapRegion)spriteListBox.SelectedItem, 0.25f)); frames.Insert(frameListBox.SelectedIndex + 1, new Frame((SpriteMapRegion)spriteListBox.SelectedItem, 0.25f));
newSelectedIndex = frameListBox.SelectedIndex + 1; newSelectedIndex = frameListBox.SelectedIndex + 1;
} }
UpdateAnimation(); UpdateAnimation();
@@ -127,25 +106,25 @@ namespace AnimationEditor
private void UpdateAnimation() private void UpdateAnimation()
{ {
if(Frames?.Count > 0) if(frames?.Count > 0)
{ {
if(CurrentAnimation == null) if(currentAnimation == null)
CurrentAnimation = new Animation("unnamed", Frames.ToArray(), true); currentAnimation = new Animation("unnamed", frames.ToArray(), true);
else else
{ {
CurrentAnimation.Name = animationNameBox.Text; currentAnimation.Name = animationNameBox.Text;
CurrentAnimation.Frames = Frames.ToArray(); currentAnimation.Frames = frames.ToArray();
CurrentAnimation.IsLooping = animationLoopCheckBox.Checked; currentAnimation.IsLooping = animationLoopCheckBox.Checked;
} }
if (animationPreview.PreviewSprite == null) if (animationPreview.PreviewSprite == null)
animationPreview.PreviewSprite = new AnimatedSprite(SpriteSheet, CurrentAnimation); animationPreview.PreviewSprite = new AnimatedSprite(spriteSheet, currentAnimation);
else else
animationPreview.PreviewSprite.CurrentAnimation = CurrentAnimation; animationPreview.PreviewSprite.CurrentAnimation = currentAnimation;
frameTrackBar.Maximum = CurrentAnimation.Frames.Count() - 1; frameTrackBar.Maximum = currentAnimation.Frames.Count() - 1;
if(Animations.Count < 1) if(animations.Count < 1)
{ {
Animations.Add(CurrentAnimation); animations.Add(currentAnimation);
animationBox.DataSource = Animations; animationBox.DataSource = animations;
animationBox.DisplayMember = "Name"; animationBox.DisplayMember = "Name";
} }
} }
@@ -158,12 +137,12 @@ namespace AnimationEditor
private void ReadAnimationInfo() private void ReadAnimationInfo()
{ {
reading = true; reading = true;
frameTrackBar.Maximum = CurrentAnimation.Frames.Count() - 1; frameTrackBar.Maximum = currentAnimation.Frames.Count() - 1;
Frames = new BindingList<Frame>(CurrentAnimation.Frames.ToList()); frames = new BindingList<Frame>(currentAnimation.Frames.ToList());
frameListBox.DataSource = Frames; frameListBox.DataSource = frames;
frameListBox.DisplayMember = "Name"; frameListBox.DisplayMember = "Name";
animationNameBox.Text = CurrentAnimation.Name; animationNameBox.Text = currentAnimation.Name;
animationLoopCheckBox.Checked = CurrentAnimation.IsLooping; animationLoopCheckBox.Checked = currentAnimation.IsLooping;
reading = false; reading = false;
} }
@@ -173,7 +152,7 @@ namespace AnimationEditor
{ {
var currentSprite = (SpriteMapRegion)spriteListBox.SelectedItem; var currentSprite = (SpriteMapRegion)spriteListBox.SelectedItem;
Stream texture2DToImageStream = new MemoryStream(); Stream texture2DToImageStream = new MemoryStream();
Texture2DRegionExtractor.GetTexture2DFromRegion(SpriteSheet, SpriteSheet.GraphicsDevice, currentSprite.Bounds) Texture2DRegionExtractor.GetTexture2DFromRegion(spriteSheet, spriteSheet.GraphicsDevice, currentSprite.Bounds)
.SaveAsPng(texture2DToImageStream, currentSprite.Bounds.Width, currentSprite.Bounds.Height); .SaveAsPng(texture2DToImageStream, currentSprite.Bounds.Width, currentSprite.Bounds.Height);
spritePreview.Image = Image.FromStream(texture2DToImageStream); spritePreview.Image = Image.FromStream(texture2DToImageStream);
texture2DToImageStream.Close(); texture2DToImageStream.Close();
@@ -184,7 +163,7 @@ namespace AnimationEditor
{ {
if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedItem != null) if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedItem != null)
{ {
CurrentFrame = (Frame)frameListBox.SelectedItem; currentFrame = (Frame)frameListBox.SelectedItem;
if (animationPreview.PreviewSprite != null && !animationPreview.Playing) if (animationPreview.PreviewSprite != null && !animationPreview.Playing)
{ {
animationPreview.PreviewSprite.CurrentFrameIndex = frameListBox.SelectedIndex; animationPreview.PreviewSprite.CurrentFrameIndex = frameListBox.SelectedIndex;
@@ -196,15 +175,15 @@ namespace AnimationEditor
private void UpdateFrameInformation() private void UpdateFrameInformation()
{ {
delayInputBox.Value = (int)(CurrentFrame.Delay * FrameRate); delayInputBox.Value = (int)(currentFrame.Delay * frameRate);
} }
private void delayInputBox_ValueChanged(object sender, EventArgs e) private void delayInputBox_ValueChanged(object sender, EventArgs e)
{ {
foreach(int index in frameListBox.SelectedIndices) foreach(int index in frameListBox.SelectedIndices)
{ {
var currentFrame = Frames[index]; var currentFrame = frames[index];
currentFrame.Delay = (float)delayInputBox.Value / FrameRate; currentFrame.Delay = (float)delayInputBox.Value / frameRate;
} }
} }
@@ -214,7 +193,7 @@ namespace AnimationEditor
if (loadSpriteSheetDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) if (loadSpriteSheetDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{ {
FileStream fileStream = new FileStream(loadSpriteSheetDialog.FileName, FileMode.Open); FileStream fileStream = new FileStream(loadSpriteSheetDialog.FileName, FileMode.Open);
SpriteSheet = Texture2D.FromStream(animationPreview.Editor.graphics, fileStream); spriteSheet = Texture2D.FromStream(animationPreview.Editor.graphics, fileStream);
EnableMapAndAnimationLoadingControls(); EnableMapAndAnimationLoadingControls();
fileStream.Close(); fileStream.Close();
} }
@@ -235,25 +214,25 @@ namespace AnimationEditor
loadedSpriteMap = IntermediateSerializer.Deserialize<Dictionary<string, SpriteMapRegion>>(xmlRead, null); loadedSpriteMap = IntermediateSerializer.Deserialize<Dictionary<string, SpriteMapRegion>>(xmlRead, null);
} }
Sprites = new BindingList<SpriteMapRegion>(); sprites = new BindingList<SpriteMapRegion>();
foreach (KeyValuePair<string, SpriteMapRegion> sprite in loadedSpriteMap) foreach (KeyValuePair<string, SpriteMapRegion> sprite in loadedSpriteMap)
{ {
Sprites.Add(sprite.Value); sprites.Add(sprite.Value);
} }
spriteListBox.DataSource = Sprites; spriteListBox.DataSource = sprites;
spriteListBox.DisplayMember = "Name"; spriteListBox.DisplayMember = "Name";
spriteListBox.ValueMember = "Bounds"; spriteListBox.ValueMember = "Bounds";
if (CurrentAnimation == null) if (currentAnimation == null)
{ {
Frames = new BindingList<Frame>(); frames = new BindingList<Frame>();
frameListBox.DataSource = Frames; frameListBox.DataSource = frames;
frameListBox.DisplayMember = "Name"; frameListBox.DisplayMember = "Name";
InitiateAnimationList(); InitiateAnimationList();
} }
EnableSpriteMapControls();
EnableAnimationEditingControls(); EnableAnimationEditingControls();
return loadedSpriteMap; return loadedSpriteMap;
} }
@@ -273,12 +252,12 @@ namespace AnimationEditor
private void animationLoopCheckBox_CheckedChanged(object sender, EventArgs e) private void animationLoopCheckBox_CheckedChanged(object sender, EventArgs e)
{ {
CurrentAnimation.IsLooping = animationLoopCheckBox.Checked; currentAnimation.IsLooping = animationLoopCheckBox.Checked;
} }
private void playAnimationButton_Click(object sender, EventArgs e) private void playAnimationButton_Click(object sender, EventArgs e)
{ {
if (CurrentAnimation.Frames.Count() > 0) if (currentAnimation.Frames.Count() > 0)
{ {
animationPreview.Playing = !animationPreview.Playing; animationPreview.Playing = !animationPreview.Playing;
if (!animationPreview.Playing) if (!animationPreview.Playing)
@@ -287,7 +266,7 @@ namespace AnimationEditor
} }
else else
{ {
animationPreview.PreviewSprite.CurrentAnimation = CurrentAnimation; animationPreview.PreviewSprite.CurrentAnimation = currentAnimation;
frameTrackBar.Enabled = false; frameTrackBar.Enabled = false;
} }
} }
@@ -304,11 +283,11 @@ namespace AnimationEditor
private void moveFrameDownButton_Click(object sender, EventArgs e) private void moveFrameDownButton_Click(object sender, EventArgs e)
{ {
if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex < Frames.Count - 1) if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex < frames.Count - 1)
{ {
var frameBelow = Frames[frameListBox.SelectedIndex + 1]; var frameBelow = frames[frameListBox.SelectedIndex + 1];
Frames[frameListBox.SelectedIndex + 1] = CurrentFrame; frames[frameListBox.SelectedIndex + 1] = currentFrame;
Frames[frameListBox.SelectedIndex] = frameBelow; frames[frameListBox.SelectedIndex] = frameBelow;
UpdateAnimation(); UpdateAnimation();
frameListBox_SetSingleSelection(frameListBox.SelectedIndex + 1); frameListBox_SetSingleSelection(frameListBox.SelectedIndex + 1);
} }
@@ -318,9 +297,9 @@ namespace AnimationEditor
{ {
if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex > 0) if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex > 0)
{ {
var frameAbove = Frames[frameListBox.SelectedIndex - 1]; var frameAbove = frames[frameListBox.SelectedIndex - 1];
Frames[frameListBox.SelectedIndex - 1] = CurrentFrame; frames[frameListBox.SelectedIndex - 1] = currentFrame;
Frames[frameListBox.SelectedIndex] = frameAbove; frames[frameListBox.SelectedIndex] = frameAbove;
UpdateAnimation(); UpdateAnimation();
frameListBox_SetSingleSelection(frameListBox.SelectedIndex - 1); frameListBox_SetSingleSelection(frameListBox.SelectedIndex - 1);
} }
@@ -328,13 +307,13 @@ namespace AnimationEditor
private void removeFrameButton_Click(object sender, EventArgs e) private void removeFrameButton_Click(object sender, EventArgs e)
{ {
if(frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex > -1 && frameListBox.SelectedIndex < Frames.Count) if(frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex > -1 && frameListBox.SelectedIndex < frames.Count)
{ {
Frames.RemoveAt(frameListBox.SelectedIndex); frames.RemoveAt(frameListBox.SelectedIndex);
UpdateAnimation(); UpdateAnimation();
if(Frames.Count > 0 && frameListBox.SelectedIndex > Frames.Count - 1) if(frames.Count > 0 && frameListBox.SelectedIndex > frames.Count - 1)
{ {
frameListBox_SetSingleSelection(Frames.Count - 1); frameListBox_SetSingleSelection(frames.Count - 1);
} }
} }
} }
@@ -343,8 +322,8 @@ namespace AnimationEditor
{ {
if (!reading) if (!reading)
{ {
CurrentAnimation.Name = animationNameBox.Text; currentAnimation.Name = animationNameBox.Text;
Animations.ResetBindings(); animations.ResetBindings();
} }
} }
@@ -354,7 +333,7 @@ namespace AnimationEditor
{ {
using (XmlWriter writer = XmlWriter.Create(saveAnimationDialog.FileName)) using (XmlWriter writer = XmlWriter.Create(saveAnimationDialog.FileName))
{ {
IntermediateSerializer.Serialize(writer, CurrentAnimation, null); IntermediateSerializer.Serialize(writer, currentAnimation, null);
} }
} }
} }
@@ -373,9 +352,9 @@ namespace AnimationEditor
EnableAnimationEditingControls(); EnableAnimationEditingControls();
InitiateAnimationList(); InitiateAnimationList();
} }
Animations.Add(loadedAnimation); animations.Add(loadedAnimation);
animationBox.SelectedIndex = Animations.Count - 1; animationBox.SelectedIndex = animations.Count - 1;
CurrentAnimation = Animations[animationBox.SelectedIndex]; currentAnimation = animations[animationBox.SelectedIndex];
ReadAnimationInfo(); ReadAnimationInfo();
UpdateAnimation(); UpdateAnimation();
} }
@@ -383,32 +362,32 @@ namespace AnimationEditor
private void animationBox_SelectedIndexChanged(object sender, EventArgs e) private void animationBox_SelectedIndexChanged(object sender, EventArgs e)
{ {
CurrentAnimation = Animations[animationBox.SelectedIndex]; currentAnimation = animations[animationBox.SelectedIndex];
ReadAnimationInfo(); ReadAnimationInfo();
UpdateAnimation(); UpdateAnimation();
} }
private void addAnimationButton_Click(object sender, EventArgs e) private void addAnimationButton_Click(object sender, EventArgs e)
{ {
Animations.Add(new Animation()); animations.Add(new Animation());
animationBox.SelectedIndex = Animations.Count - 1; animationBox.SelectedIndex = animations.Count - 1;
} }
private void removeAnimationButton_Click(object sender, EventArgs e) private void removeAnimationButton_Click(object sender, EventArgs e)
{ {
if (animationBox.SelectedIndex > -1 && animationBox.SelectedIndex < Animations.Count - 1) if (animationBox.SelectedIndex > -1 && animationBox.SelectedIndex < animations.Count - 1)
{ {
if (Animations.Count == 1) if (animations.Count == 1)
{ {
CurrentAnimation = new Animation(); currentAnimation = new Animation();
Animations[animationBox.SelectedIndex] = CurrentAnimation; animations[animationBox.SelectedIndex] = currentAnimation;
ReadAnimationInfo(); ReadAnimationInfo();
UpdateAnimation(); UpdateAnimation();
} }
else else
{ {
Animations.RemoveAt(animationBox.SelectedIndex); animations.RemoveAt(animationBox.SelectedIndex);
if(animationBox.SelectedIndex > Animations.Count - 1) if(animationBox.SelectedIndex > animations.Count - 1)
{ {
animationBox.SelectedIndex--; animationBox.SelectedIndex--;
} }
@@ -418,7 +397,7 @@ namespace AnimationEditor
private void importDelayBox_ValueChanged(object sender, EventArgs e) private void importDelayBox_ValueChanged(object sender, EventArgs e)
{ {
importDelay = (float)importDelayBox.Value / FrameRate; importDelay = (float)importDelayBox.Value / frameRate;
} }
private void animationPreview_MouseWheel(object sender, MouseEventArgs e) private void animationPreview_MouseWheel(object sender, MouseEventArgs e)
@@ -436,7 +415,7 @@ namespace AnimationEditor
private void saveAnimationSetToolStripMenuItem_Click(object sender, EventArgs e) private void saveAnimationSetToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var animSet = new AnimationSet(); var animSet = new AnimationSet();
foreach(Animation anim in Animations) foreach(Animation anim in animations)
{ {
if (animSet.Anims.ContainsKey(anim.Name)) if (animSet.Anims.ContainsKey(anim.Name))
{ {
@@ -480,10 +459,10 @@ namespace AnimationEditor
InitiateAnimationList(newAnimation: false); InitiateAnimationList(newAnimation: false);
foreach(KeyValuePair<string,Animation> currentEntry in loadedAnimSet.Anims) foreach(KeyValuePair<string,Animation> currentEntry in loadedAnimSet.Anims)
{ {
Animations.Add(currentEntry.Value); animations.Add(currentEntry.Value);
} }
animationBox.SelectedIndex = 0; animationBox.SelectedIndex = 0;
CurrentAnimation = Animations[animationBox.SelectedIndex]; currentAnimation = animations[animationBox.SelectedIndex];
ReadAnimationInfo(); ReadAnimationInfo();
UpdateAnimation(); UpdateAnimation();
} }
@@ -500,7 +479,7 @@ namespace AnimationEditor
int updateCounter = 0; int updateCounter = 0;
foreach(Animation anim in Animations) foreach(Animation anim in animations)
{ {
foreach(Frame frame in anim.Frames) foreach(Frame frame in anim.Frames)
{ {
+13 -2
View File
@@ -1,4 +1,5 @@
using QURO; using QURO;
using System.Collections.Generic;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
namespace QURO.AnimationLibrary namespace QURO.AnimationLibrary
@@ -6,20 +7,30 @@ namespace QURO.AnimationLibrary
public class Frame public class Frame
{ {
public SpriteMapRegion Sprite { get; set; } public SpriteMapRegion Sprite { get; set; }
public List<SpriteMapRegion> SubSprites { get; set; }
public List<Vector2> SubSpritePositions { get; set; }
public float Delay { get; set; } public float Delay { get; set; }
public string Name { get { return Sprite.Name; } } public string Name { get { return Sprite.Name; } }
public Rectangle Bounds { get { return Sprite.Bounds; } } public Rectangle Bounds { get { return Sprite.Bounds; } }
public Vector2 Origin { get { return Sprite.Origin; } } public Vector2 Origin { get { return Sprite.Origin; } }
public Frame() : this(new SpriteMapRegion(), 0)
public Frame() : this(new SpriteMapRegion(), 0, null, null)
{ {
} }
public Frame(SpriteMapRegion sprite, float delay) public Frame(SpriteMapRegion sprite, float delay) : this(sprite, delay, null, null)
{
}
public Frame(SpriteMapRegion sprite, float delay, List<SpriteMapRegion> subSprites, List<Vector2> subSpritePositons)
{ {
Sprite = sprite; Sprite = sprite;
Delay = delay; Delay = delay;
SubSprites = subSprites;
SubSpritePositions = subSpritePositons;
} }
} }
} }