Added: SelectionState; New Undoable Mods: AddAnimation, RemoveAnimation, AddFrame, RemoveFrame, RemoveSprite
This commit is contained in:
@@ -66,6 +66,13 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Modifications\AddAnimation.cs" />
|
||||||
|
<Compile Include="Modifications\RemoveAnimation.cs" />
|
||||||
|
<Compile Include="Modifications\RemoveSprite.cs" />
|
||||||
|
<Compile Include="Modifications\RemoveFrame.cs" />
|
||||||
|
<Compile Include="Modifications\AddFrame.cs" />
|
||||||
|
<Compile Include="Modifications\History.cs" />
|
||||||
|
<Compile Include="Modifications\IModification.cs" />
|
||||||
<Compile Include="AnimationPreview.cs">
|
<Compile Include="AnimationPreview.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -75,6 +82,8 @@
|
|||||||
<Compile Include="Form1.Designer.cs">
|
<Compile Include="Form1.Designer.cs">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Modifications\ModHelper.cs" />
|
||||||
|
<Compile Include="Modifications\SelectionState.cs" />
|
||||||
<Compile Include="MonoGame.Framework.Content.Pipeline\ContentIdentity.cs" />
|
<Compile Include="MonoGame.Framework.Content.Pipeline\ContentIdentity.cs" />
|
||||||
<Compile Include="MonoGame.Framework.Content.Pipeline\InvalidContentException.cs" />
|
<Compile Include="MonoGame.Framework.Content.Pipeline\InvalidContentException.cs" />
|
||||||
<Compile Include="MonoGame.Framework.Content.Pipeline\NamedValueDictionary.cs" />
|
<Compile Include="MonoGame.Framework.Content.Pipeline\NamedValueDictionary.cs" />
|
||||||
@@ -136,6 +145,7 @@
|
|||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
@@ -157,5 +167,11 @@
|
|||||||
<Name>QURO</Name>
|
<Name>QURO</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\15test.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\13test.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
Generated
+60
-40
@@ -33,7 +33,6 @@
|
|||||||
this.spriteListBox = new System.Windows.Forms.ListBox();
|
this.spriteListBox = new System.Windows.Forms.ListBox();
|
||||||
this.frameListBox = new System.Windows.Forms.ListBox();
|
this.frameListBox = new System.Windows.Forms.ListBox();
|
||||||
this.addSpriteToFrameListButton = new System.Windows.Forms.Button();
|
this.addSpriteToFrameListButton = new System.Windows.Forms.Button();
|
||||||
this.spritePreview = new System.Windows.Forms.PictureBox();
|
|
||||||
this.frameTrackBar = new System.Windows.Forms.TrackBar();
|
this.frameTrackBar = new System.Windows.Forms.TrackBar();
|
||||||
this.delayInputBox = new System.Windows.Forms.NumericUpDown();
|
this.delayInputBox = new System.Windows.Forms.NumericUpDown();
|
||||||
this.animationBox = new System.Windows.Forms.ComboBox();
|
this.animationBox = new System.Windows.Forms.ComboBox();
|
||||||
@@ -53,6 +52,8 @@
|
|||||||
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.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem = 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();
|
||||||
@@ -70,8 +71,6 @@
|
|||||||
this.spriteYPosBox = new System.Windows.Forms.NumericUpDown();
|
this.spriteYPosBox = new System.Windows.Forms.NumericUpDown();
|
||||||
this.spriteXPosBox = new System.Windows.Forms.NumericUpDown();
|
this.spriteXPosBox = new System.Windows.Forms.NumericUpDown();
|
||||||
this.removeSpriteButton = new System.Windows.Forms.Button();
|
this.removeSpriteButton = new System.Windows.Forms.Button();
|
||||||
this.moveSpriteUpButton = new System.Windows.Forms.Button();
|
|
||||||
this.moveSpriteDownButton = new System.Windows.Forms.Button();
|
|
||||||
this.frameSpriteListBox = new System.Windows.Forms.ListBox();
|
this.frameSpriteListBox = new System.Windows.Forms.ListBox();
|
||||||
this.frameSpriteListLabel = new System.Windows.Forms.Label();
|
this.frameSpriteListLabel = new System.Windows.Forms.Label();
|
||||||
this.replaceSpriteButton = new System.Windows.Forms.Button();
|
this.replaceSpriteButton = new System.Windows.Forms.Button();
|
||||||
@@ -91,7 +90,9 @@
|
|||||||
this.animationLabel = new System.Windows.Forms.Label();
|
this.animationLabel = new System.Windows.Forms.Label();
|
||||||
this.animationPreview = new AnimationEditor.AnimationPreview();
|
this.animationPreview = new AnimationEditor.AnimationPreview();
|
||||||
this.loadAnimationSetDialog = new System.Windows.Forms.OpenFileDialog();
|
this.loadAnimationSetDialog = new System.Windows.Forms.OpenFileDialog();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit();
|
this.moveSpriteUpButton = new System.Windows.Forms.Button();
|
||||||
|
this.moveSpriteDownButton = new System.Windows.Forms.Button();
|
||||||
|
this.spritePreview = new System.Windows.Forms.PictureBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit();
|
||||||
this.mainMenuStrip.SuspendLayout();
|
this.mainMenuStrip.SuspendLayout();
|
||||||
@@ -102,6 +103,7 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)(this.spriteXPosBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.spriteXPosBox)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.importDelayBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.importDelayBox)).BeginInit();
|
||||||
this.animationPanel.SuspendLayout();
|
this.animationPanel.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// loadSpriteSheetDialog
|
// loadSpriteSheetDialog
|
||||||
@@ -153,17 +155,6 @@
|
|||||||
this.addSpriteToFrameListButton.UseVisualStyleBackColor = true;
|
this.addSpriteToFrameListButton.UseVisualStyleBackColor = true;
|
||||||
this.addSpriteToFrameListButton.Click += new System.EventHandler(this.addSpriteToFrameListButton_Click);
|
this.addSpriteToFrameListButton.Click += new System.EventHandler(this.addSpriteToFrameListButton_Click);
|
||||||
//
|
//
|
||||||
// spritePreview
|
|
||||||
//
|
|
||||||
this.spritePreview.BackColor = System.Drawing.SystemColors.ControlDark;
|
|
||||||
this.spritePreview.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
|
||||||
this.spritePreview.Location = new System.Drawing.Point(5, 19);
|
|
||||||
this.spritePreview.Name = "spritePreview";
|
|
||||||
this.spritePreview.Size = new System.Drawing.Size(119, 43);
|
|
||||||
this.spritePreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.spritePreview.TabIndex = 6;
|
|
||||||
this.spritePreview.TabStop = false;
|
|
||||||
//
|
|
||||||
// frameTrackBar
|
// frameTrackBar
|
||||||
//
|
//
|
||||||
this.frameTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
this.frameTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
@@ -331,12 +322,28 @@
|
|||||||
// editToolStripMenuItem
|
// editToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.undoToolStripMenuItem,
|
||||||
|
this.redoToolStripMenuItem,
|
||||||
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem});
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem});
|
||||||
this.editToolStripMenuItem.Enabled = false;
|
this.editToolStripMenuItem.Enabled = false;
|
||||||
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
||||||
this.editToolStripMenuItem.Text = "Edit";
|
this.editToolStripMenuItem.Text = "Edit";
|
||||||
//
|
//
|
||||||
|
// undoToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
|
||||||
|
this.undoToolStripMenuItem.Size = new System.Drawing.Size(304, 22);
|
||||||
|
this.undoToolStripMenuItem.Text = "Undo";
|
||||||
|
this.undoToolStripMenuItem.Click += new System.EventHandler(this.undoToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// redoToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";
|
||||||
|
this.redoToolStripMenuItem.Size = new System.Drawing.Size(304, 22);
|
||||||
|
this.redoToolStripMenuItem.Text = "Redo";
|
||||||
|
this.redoToolStripMenuItem.Click += new System.EventHandler(this.redoToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// updateAnimationSpritesFromSpriteMapToolStripMenuItem
|
// updateAnimationSpritesFromSpriteMapToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Enabled = false;
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Enabled = false;
|
||||||
@@ -543,30 +550,6 @@
|
|||||||
this.removeSpriteButton.UseVisualStyleBackColor = true;
|
this.removeSpriteButton.UseVisualStyleBackColor = true;
|
||||||
this.removeSpriteButton.Click += new System.EventHandler(this.removeSpriteButton_Click);
|
this.removeSpriteButton.Click += new System.EventHandler(this.removeSpriteButton_Click);
|
||||||
//
|
//
|
||||||
// moveSpriteUpButton
|
|
||||||
//
|
|
||||||
this.moveSpriteUpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.moveSpriteUpButton.Location = new System.Drawing.Point(109, 0);
|
|
||||||
this.moveSpriteUpButton.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
|
|
||||||
this.moveSpriteUpButton.Name = "moveSpriteUpButton";
|
|
||||||
this.moveSpriteUpButton.Size = new System.Drawing.Size(23, 23);
|
|
||||||
this.moveSpriteUpButton.TabIndex = 26;
|
|
||||||
this.moveSpriteUpButton.Text = "↑";
|
|
||||||
this.moveSpriteUpButton.UseVisualStyleBackColor = true;
|
|
||||||
this.moveSpriteUpButton.Click += new System.EventHandler(this.moveSpriteUpButton_Click);
|
|
||||||
//
|
|
||||||
// moveSpriteDownButton
|
|
||||||
//
|
|
||||||
this.moveSpriteDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.moveSpriteDownButton.Location = new System.Drawing.Point(86, 0);
|
|
||||||
this.moveSpriteDownButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
|
|
||||||
this.moveSpriteDownButton.Name = "moveSpriteDownButton";
|
|
||||||
this.moveSpriteDownButton.Size = new System.Drawing.Size(23, 23);
|
|
||||||
this.moveSpriteDownButton.TabIndex = 26;
|
|
||||||
this.moveSpriteDownButton.Text = "↓";
|
|
||||||
this.moveSpriteDownButton.UseVisualStyleBackColor = true;
|
|
||||||
this.moveSpriteDownButton.Click += new System.EventHandler(this.moveSpriteDownButton_Click);
|
|
||||||
//
|
|
||||||
// frameSpriteListBox
|
// frameSpriteListBox
|
||||||
//
|
//
|
||||||
this.frameSpriteListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.frameSpriteListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
@@ -779,6 +762,41 @@
|
|||||||
this.loadAnimationSetDialog.FileName = "openFileDialog1";
|
this.loadAnimationSetDialog.FileName = "openFileDialog1";
|
||||||
this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
|
this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
|
||||||
//
|
//
|
||||||
|
// moveSpriteUpButton
|
||||||
|
//
|
||||||
|
this.moveSpriteUpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.moveSpriteUpButton.Location = new System.Drawing.Point(109, 0);
|
||||||
|
this.moveSpriteUpButton.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
|
||||||
|
this.moveSpriteUpButton.Name = "moveSpriteUpButton";
|
||||||
|
this.moveSpriteUpButton.Size = new System.Drawing.Size(23, 23);
|
||||||
|
this.moveSpriteUpButton.TabIndex = 26;
|
||||||
|
this.moveSpriteUpButton.Text = "↑";
|
||||||
|
this.moveSpriteUpButton.UseVisualStyleBackColor = true;
|
||||||
|
this.moveSpriteUpButton.Click += new System.EventHandler(this.moveSpriteUpButton_Click);
|
||||||
|
//
|
||||||
|
// moveSpriteDownButton
|
||||||
|
//
|
||||||
|
this.moveSpriteDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.moveSpriteDownButton.Location = new System.Drawing.Point(86, 0);
|
||||||
|
this.moveSpriteDownButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
|
||||||
|
this.moveSpriteDownButton.Name = "moveSpriteDownButton";
|
||||||
|
this.moveSpriteDownButton.Size = new System.Drawing.Size(23, 23);
|
||||||
|
this.moveSpriteDownButton.TabIndex = 26;
|
||||||
|
this.moveSpriteDownButton.Text = "↓";
|
||||||
|
this.moveSpriteDownButton.UseVisualStyleBackColor = true;
|
||||||
|
this.moveSpriteDownButton.Click += new System.EventHandler(this.moveSpriteDownButton_Click);
|
||||||
|
//
|
||||||
|
// spritePreview
|
||||||
|
//
|
||||||
|
this.spritePreview.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||||
|
this.spritePreview.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||||
|
this.spritePreview.Location = new System.Drawing.Point(5, 19);
|
||||||
|
this.spritePreview.Name = "spritePreview";
|
||||||
|
this.spritePreview.Size = new System.Drawing.Size(119, 43);
|
||||||
|
this.spritePreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||||
|
this.spritePreview.TabIndex = 6;
|
||||||
|
this.spritePreview.TabStop = false;
|
||||||
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -791,7 +809,6 @@
|
|||||||
this.MinimumSize = new System.Drawing.Size(780, 345);
|
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.frameTrackBar)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).EndInit();
|
||||||
this.mainMenuStrip.ResumeLayout(false);
|
this.mainMenuStrip.ResumeLayout(false);
|
||||||
@@ -807,6 +824,7 @@
|
|||||||
((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.spritePreview)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -877,6 +895,8 @@
|
|||||||
private System.Windows.Forms.Button duplicateFrameButton;
|
private System.Windows.Forms.Button duplicateFrameButton;
|
||||||
private System.Windows.Forms.Button replaceSpriteButton;
|
private System.Windows.Forms.Button replaceSpriteButton;
|
||||||
private System.Windows.Forms.Panel spritePosPanel;
|
private System.Windows.Forms.Panel spritePosPanel;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-47
@@ -14,12 +14,15 @@ using Microsoft.Xna.Framework.Graphics;
|
|||||||
using QURO.Animation;
|
using QURO.Animation;
|
||||||
using QURO;
|
using QURO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using AnimationEditor.Modifications;
|
||||||
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
|
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
|
||||||
|
|
||||||
namespace AnimationEditor
|
namespace AnimationEditor
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
|
private History undoHistory;
|
||||||
|
|
||||||
private Texture2D _spriteSheet;
|
private Texture2D _spriteSheet;
|
||||||
//property ensures animationPreview holds a copy of whatever spriteSheet the editor is using
|
//property ensures animationPreview holds a copy of whatever spriteSheet the editor is using
|
||||||
private Texture2D spriteSheet
|
private Texture2D spriteSheet
|
||||||
@@ -48,6 +51,7 @@ namespace AnimationEditor
|
|||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
undoHistory = new History();
|
||||||
frameRate = 60;
|
frameRate = 60;
|
||||||
importDelayBox.Value = 0;
|
importDelayBox.Value = 0;
|
||||||
animationPreview.FrameChanged += animationPreview_FrameChanged;
|
animationPreview.FrameChanged += animationPreview_FrameChanged;
|
||||||
@@ -101,30 +105,10 @@ namespace AnimationEditor
|
|||||||
|
|
||||||
private void AddFrame(Frame frameToAdd)
|
private void AddFrame(Frame frameToAdd)
|
||||||
{
|
{
|
||||||
int newSelectedIndex;
|
var modification = new AddFrame(frames, frameListBox, frameToAdd);
|
||||||
|
ModHelper.DoModificationWithSelectionTracking(modification, animationBox, frameListBox, frameSpriteListBox);
|
||||||
//if only frame in animation is uninitiated and input is not empty, clear the list
|
undoHistory.Add(modification);
|
||||||
if (frameToAdd.Name != "empty" &&
|
|
||||||
frames.Count == 1 &&
|
|
||||||
frames[0].Sprites.Count == 1 &&
|
|
||||||
frames[0].Sprites[0].Name == "empty")
|
|
||||||
{
|
|
||||||
frames.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frameListBox.SelectedItem == null || frameListBox.SelectedIndex == frames.Count - 1)
|
|
||||||
{
|
|
||||||
frames.Add(frameToAdd);
|
|
||||||
frameTrackBar.Maximum = frames.Count - 1;
|
|
||||||
newSelectedIndex = frames.Count - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
frames.Insert(frameListBox.SelectedIndex + 1, frameToAdd);
|
|
||||||
newSelectedIndex = frameListBox.SelectedIndex + 1;
|
|
||||||
}
|
|
||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
frameListBox_SetSingleSelection(newSelectedIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAnimation()
|
private void UpdateAnimation()
|
||||||
@@ -235,6 +219,7 @@ namespace AnimationEditor
|
|||||||
if (animationPreview.PreviewSprite != null && !animationPreview.Playing)
|
if (animationPreview.PreviewSprite != null && !animationPreview.Playing)
|
||||||
{
|
{
|
||||||
animationPreview.PreviewSprite.CurrentFrameIndex = frameListBox.SelectedIndex;
|
animationPreview.PreviewSprite.CurrentFrameIndex = frameListBox.SelectedIndex;
|
||||||
|
frameTrackBar.Maximum = frames.Count - 1;
|
||||||
frameTrackBar.Value = frameListBox.SelectedIndex;
|
frameTrackBar.Value = frameListBox.SelectedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,12 +394,10 @@ namespace AnimationEditor
|
|||||||
{
|
{
|
||||||
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);
|
var mod = new RemoveFrame(frames, frameListBox, frameListBox.SelectedIndex);
|
||||||
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, spriteListBox);
|
||||||
|
undoHistory.Add(mod);
|
||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
if(frames.Count > 0 && frameListBox.SelectedIndex > frames.Count - 1)
|
|
||||||
{
|
|
||||||
frameListBox_SetSingleSelection(frames.Count - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,14 +435,20 @@ namespace AnimationEditor
|
|||||||
EnableAnimationEditingControls();
|
EnableAnimationEditingControls();
|
||||||
InitiateAnimationList();
|
InitiateAnimationList();
|
||||||
}
|
}
|
||||||
animations.Add(loadedAnimation);
|
AddAnimation(loadedAnimation);
|
||||||
animationBox.SelectedIndex = animations.Count - 1;
|
|
||||||
currentAnimation = animations[animationBox.SelectedIndex];
|
currentAnimation = animations[animationBox.SelectedIndex];
|
||||||
ReadAnimationInfo();
|
ReadAnimationInfo();
|
||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddAnimation(Animation anim)
|
||||||
|
{
|
||||||
|
var mod = new AddAnimation(animations, animationBox, anim);
|
||||||
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
|
undoHistory.Add(mod);
|
||||||
|
}
|
||||||
|
|
||||||
private void animationBox_SelectedIndexChanged(object sender, EventArgs e)
|
private void animationBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
currentAnimation = animations[animationBox.SelectedIndex];
|
currentAnimation = animations[animationBox.SelectedIndex];
|
||||||
@@ -469,30 +458,19 @@ namespace AnimationEditor
|
|||||||
|
|
||||||
private void addAnimationButton_Click(object sender, EventArgs e)
|
private void addAnimationButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
animations.Add(new Animation());
|
AddAnimation(new Animation());
|
||||||
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)
|
||||||
{
|
{
|
||||||
if (animations.Count == 1)
|
var mod = new RemoveAnimation(animations, animationBox, animationBox.SelectedIndex);
|
||||||
{
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
currentAnimation = new Animation();
|
undoHistory.Add(mod);
|
||||||
animations[animationBox.SelectedIndex] = currentAnimation;
|
|
||||||
ReadAnimationInfo();
|
ReadAnimationInfo();
|
||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
animations.RemoveAt(animationBox.SelectedIndex);
|
|
||||||
if(animationBox.SelectedIndex > animations.Count - 1)
|
|
||||||
{
|
|
||||||
animationBox.SelectedIndex--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void importDelayBox_ValueChanged(object sender, EventArgs e)
|
private void importDelayBox_ValueChanged(object sender, EventArgs e)
|
||||||
@@ -545,6 +523,7 @@ namespace AnimationEditor
|
|||||||
{
|
{
|
||||||
if (loadAnimationSetDialog.ShowDialog() == DialogResult.OK)
|
if (loadAnimationSetDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
undoHistory = new History();
|
||||||
AnimationSet loadedAnimSet;
|
AnimationSet loadedAnimSet;
|
||||||
|
|
||||||
using (XmlReader xmlRead = XmlReader.Create(loadAnimationSetDialog.FileName))
|
using (XmlReader xmlRead = XmlReader.Create(loadAnimationSetDialog.FileName))
|
||||||
@@ -740,7 +719,9 @@ namespace AnimationEditor
|
|||||||
{
|
{
|
||||||
if (frameSpriteListBox.SelectedIndex > -1 && frameSpriteListBox.SelectedIndex < frameSprites.Count)
|
if (frameSpriteListBox.SelectedIndex > -1 && frameSpriteListBox.SelectedIndex < frameSprites.Count)
|
||||||
{
|
{
|
||||||
frameSprites.RemoveAt(frameSpriteListBox.SelectedIndex);
|
var mod = new RemoveSprite(frameSprites, frameSpriteListBox, frameSpriteListBox.SelectedIndex);
|
||||||
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
|
undoHistory.Add(mod);
|
||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -766,5 +747,17 @@ namespace AnimationEditor
|
|||||||
spr.Name = replacement.Name;
|
spr.Name = replacement.Name;
|
||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void undoToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
undoHistory.Undo(animationBox, frameListBox, frameSpriteListBox);
|
||||||
|
UpdateAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void redoToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
undoHistory.Redo(animationBox, frameListBox, frameSpriteListBox);
|
||||||
|
UpdateAnimation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using QURO;
|
||||||
|
using QURO.Animation;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class AddAnimation : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Animation> animations;
|
||||||
|
private ComboBox animationBox;
|
||||||
|
private Animation animationToAdd;
|
||||||
|
|
||||||
|
public AddAnimation(BindingList<Animation> animList, ComboBox animBox, Animation anim = null)
|
||||||
|
{
|
||||||
|
animations = animList;
|
||||||
|
animationBox = animBox;
|
||||||
|
if (anim != null)
|
||||||
|
animationToAdd = anim;
|
||||||
|
else animationToAdd = new Animation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
animations.Add(animationToAdd);
|
||||||
|
animationBox.SelectedIndex = animations.Count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
animations.RemoveAt(animations.Count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionState GetPreChangeSelection()
|
||||||
|
{
|
||||||
|
return preChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPreChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
preChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
public SelectionState GetPostChangeSelection()
|
||||||
|
{
|
||||||
|
return postChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPostChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
postChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "Add Animation";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using QURO;
|
||||||
|
using QURO.Animation;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class AddFrame : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Frame> frames;
|
||||||
|
private ListBox frameListBox;
|
||||||
|
private Frame frameToAdd;
|
||||||
|
|
||||||
|
public AddFrame(BindingList<Frame> frameList, ListBox frameBox, Frame frame = null)
|
||||||
|
{
|
||||||
|
frames = frameList;
|
||||||
|
frameListBox = frameBox;
|
||||||
|
if (frame != null)
|
||||||
|
frameToAdd = frame;
|
||||||
|
else frameToAdd = new Frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
int newSelectedIndex;
|
||||||
|
|
||||||
|
//if only frame in animation is uninitiated and input is not empty, clear the list
|
||||||
|
if (frameToAdd.Name != "empty" &&
|
||||||
|
frames.Count == 1 &&
|
||||||
|
frames[0].Sprites.Count == 1 &&
|
||||||
|
frames[0].Sprites[0].Name == "empty")
|
||||||
|
{
|
||||||
|
frames.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frameListBox.SelectedItem == null || frameListBox.SelectedIndex == frames.Count - 1)
|
||||||
|
{
|
||||||
|
frames.Add(frameToAdd);
|
||||||
|
newSelectedIndex = frames.Count - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frames.Insert(frameListBox.SelectedIndex + 1, frameToAdd);
|
||||||
|
newSelectedIndex = frameListBox.SelectedIndex + 1;
|
||||||
|
}
|
||||||
|
ModHelper.SetSingleSelection(frameListBox, newSelectedIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
if(frames.Count < 2)
|
||||||
|
{
|
||||||
|
frames.Clear();
|
||||||
|
frames.Add(new Frame());
|
||||||
|
}
|
||||||
|
else if(postChangeSelection!= null)
|
||||||
|
{
|
||||||
|
int addedFrameIndex = postChangeSelection.SelectedFrames[0];
|
||||||
|
frames.RemoveAt(addedFrameIndex);
|
||||||
|
if(addedFrameIndex > 0)
|
||||||
|
{
|
||||||
|
ModHelper.SetSingleSelection(frameListBox, addedFrameIndex - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionState GetPreChangeSelection()
|
||||||
|
{
|
||||||
|
return preChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPreChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
preChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
public SelectionState GetPostChangeSelection()
|
||||||
|
{
|
||||||
|
return postChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPostChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
postChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "Add Frame";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class History
|
||||||
|
{
|
||||||
|
private List<IModification> changes;
|
||||||
|
private int position;
|
||||||
|
|
||||||
|
public bool CanUndo
|
||||||
|
{
|
||||||
|
get { return position >= 0 && changes.Count > 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanRedo
|
||||||
|
{
|
||||||
|
get { return position < changes.Count - 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public History()
|
||||||
|
{
|
||||||
|
changes = new List<IModification>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Add(IModification change)
|
||||||
|
{
|
||||||
|
if (position < changes.Count - 1)
|
||||||
|
{
|
||||||
|
changes.RemoveRange(position + 1, changes.Count - 1 - position);
|
||||||
|
}
|
||||||
|
changes.Add(change);
|
||||||
|
position = changes.Count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
if (CanUndo)
|
||||||
|
{
|
||||||
|
changes[position].Undo();
|
||||||
|
position--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo(ComboBox animBox, ListBox frameBox, ListBox spriteBox)
|
||||||
|
{
|
||||||
|
if (CanUndo)
|
||||||
|
{
|
||||||
|
Console.Write("Hist.Pos(" + position + "): ");
|
||||||
|
ModHelper.UndoAndRestoreSelection(changes[position], animBox, frameBox, spriteBox);
|
||||||
|
position--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Redo()
|
||||||
|
{
|
||||||
|
if (CanRedo)
|
||||||
|
{
|
||||||
|
changes[position + 1].Do();
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Redo(ComboBox animBox, ListBox frameBox, ListBox spriteBox)
|
||||||
|
{
|
||||||
|
if (CanRedo)
|
||||||
|
{
|
||||||
|
Console.Write("Hist.Pos(" + position + "): ");
|
||||||
|
ModHelper.RedoAndRestoreSelection(changes[position + 1], animBox, frameBox, spriteBox);
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string NextUndoString()
|
||||||
|
{
|
||||||
|
if (!CanUndo)
|
||||||
|
return "Undo...";
|
||||||
|
else
|
||||||
|
return "Undo " + changes[position];
|
||||||
|
}
|
||||||
|
|
||||||
|
public string NextRedoString()
|
||||||
|
{
|
||||||
|
if (!CanRedo)
|
||||||
|
return "Redo...";
|
||||||
|
else
|
||||||
|
return "Redo " + changes[position + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
public interface IModification
|
||||||
|
{
|
||||||
|
void Do();
|
||||||
|
void Undo();
|
||||||
|
SelectionState GetPreChangeSelection();
|
||||||
|
void SetPreChangeSelection(SelectionState currentSelection);
|
||||||
|
SelectionState GetPostChangeSelection();
|
||||||
|
void SetPostChangeSelection(SelectionState currentSelection);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using QURO;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
public static class ModHelper
|
||||||
|
{
|
||||||
|
public static void DoModificationWithSelectionTracking(IModification mod, ComboBox animBox, ListBox frameBox, ListBox frameSpriteBox)
|
||||||
|
{
|
||||||
|
mod.SetPreChangeSelection(new SelectionState(animBox, frameBox, frameSpriteBox));
|
||||||
|
mod.Do();
|
||||||
|
mod.SetPostChangeSelection(new SelectionState (animBox, frameBox, frameSpriteBox));
|
||||||
|
Console.WriteLine("Perform: " + mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UndoAndRestoreSelection(IModification mod, ComboBox animBox, ListBox frameBox, ListBox frameSpriteBox)
|
||||||
|
{
|
||||||
|
mod.Undo();
|
||||||
|
RestoreSelection(mod.GetPreChangeSelection(), animBox, frameBox, frameSpriteBox);
|
||||||
|
Console.WriteLine("Undo: " + mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RedoAndRestoreSelection(IModification mod, ComboBox animBox, ListBox frameBox, ListBox frameSpriteBox)
|
||||||
|
{
|
||||||
|
mod.Do();
|
||||||
|
RestoreSelection(mod.GetPostChangeSelection(), animBox, frameBox, frameSpriteBox);
|
||||||
|
Console.WriteLine("Redo: " + mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RestoreSelection(SelectionState selection, ComboBox animBox, ListBox frameBox, ListBox frameSpriteBox)
|
||||||
|
{
|
||||||
|
animBox.SelectedIndex = selection.SelectedAnimation;
|
||||||
|
|
||||||
|
frameBox.SelectedIndices.Clear();
|
||||||
|
foreach(int index in selection.SelectedFrames)
|
||||||
|
{
|
||||||
|
frameBox.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
frameSpriteBox.SelectedIndices.Clear();
|
||||||
|
foreach(int index in selection.SelectedFrameSprites)
|
||||||
|
{
|
||||||
|
frameSpriteBox.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetSingleSelection(ListBox lb, int index)
|
||||||
|
{
|
||||||
|
lb.SelectedIndices.Clear();
|
||||||
|
lb.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using QURO;
|
||||||
|
using QURO.Animation;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class RemoveAnimation : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Animation> animations;
|
||||||
|
private ComboBox animationBox;
|
||||||
|
private int removeIndex;
|
||||||
|
|
||||||
|
private Animation removedAnim;
|
||||||
|
|
||||||
|
public RemoveAnimation(BindingList<Animation> anims, ComboBox animBox, int index)
|
||||||
|
{
|
||||||
|
animations = anims;
|
||||||
|
animationBox = animBox;
|
||||||
|
removeIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
if (removeIndex > -1 && removeIndex < animations.Count)
|
||||||
|
{
|
||||||
|
removedAnim = animations[removeIndex];
|
||||||
|
if (animations.Count == 1)
|
||||||
|
{
|
||||||
|
animations[removeIndex] = new Animation();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
animations.RemoveAt(removeIndex);
|
||||||
|
if (animationBox.SelectedIndex > animations.Count - 1)
|
||||||
|
{
|
||||||
|
animationBox.SelectedIndex--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
if(removedAnim != null)
|
||||||
|
{
|
||||||
|
if (animations.Count == 1 && removeIndex == 0 && animations[0].Frames.Length == 1 && animations[0].Frames[0].Sprites[0].Bounds == Rectangle.Empty)
|
||||||
|
{
|
||||||
|
animations[0] = removedAnim;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
animations.Insert(removeIndex, removedAnim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionState GetPreChangeSelection()
|
||||||
|
{
|
||||||
|
return preChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPreChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
preChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
public SelectionState GetPostChangeSelection()
|
||||||
|
{
|
||||||
|
return postChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPostChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
postChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "Remove Animation";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using QURO;
|
||||||
|
using QURO.Animation;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class RemoveFrame : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Frame> frames;
|
||||||
|
private ListBox frameListBox;
|
||||||
|
private int removeIndex;
|
||||||
|
|
||||||
|
private Frame removedFrame;
|
||||||
|
|
||||||
|
public RemoveFrame(BindingList<Frame> frameList, ListBox frameBox, int index)
|
||||||
|
{
|
||||||
|
frames = frameList;
|
||||||
|
frameListBox = frameBox;
|
||||||
|
removeIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
if(removeIndex > -1 && removeIndex < frames.Count)
|
||||||
|
{
|
||||||
|
removedFrame = frames[removeIndex];
|
||||||
|
|
||||||
|
if(frames.Count == 1)
|
||||||
|
{
|
||||||
|
frames.Clear();
|
||||||
|
frames.Add(new Frame());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
frames.RemoveAt(removeIndex);
|
||||||
|
|
||||||
|
if (frames.Count > -1 && frameListBox.SelectedIndex > frames.Count - 1)
|
||||||
|
{
|
||||||
|
ModHelper.SetSingleSelection(frameListBox, frames.Count - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
if(removedFrame != null)
|
||||||
|
{
|
||||||
|
if(frames.Count == 1 && removeIndex == 0)
|
||||||
|
{
|
||||||
|
frames.Clear();
|
||||||
|
frames.Add(removedFrame);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
frames.Insert(removeIndex, removedFrame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionState GetPreChangeSelection()
|
||||||
|
{
|
||||||
|
return preChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPreChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
preChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
public SelectionState GetPostChangeSelection()
|
||||||
|
{
|
||||||
|
return postChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPostChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
postChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "Remove Sprite";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using QURO;
|
||||||
|
using QURO.Animation;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class RemoveSprite : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Sprite> sprites;
|
||||||
|
private ListBox spriteListBox;
|
||||||
|
private int removeIndex;
|
||||||
|
|
||||||
|
private Sprite removedSprite;
|
||||||
|
|
||||||
|
public RemoveSprite(BindingList<Sprite> spriteList, ListBox spriteBox, int index)
|
||||||
|
{
|
||||||
|
sprites = spriteList;
|
||||||
|
spriteListBox = spriteBox;
|
||||||
|
removeIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
if(removeIndex > -1 && removeIndex < sprites.Count)
|
||||||
|
{
|
||||||
|
removedSprite = sprites[removeIndex];
|
||||||
|
|
||||||
|
if(sprites.Count == 1)
|
||||||
|
{
|
||||||
|
sprites.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprites.RemoveAt(removeIndex);
|
||||||
|
|
||||||
|
if (sprites.Count > -1 && spriteListBox.SelectedIndex > sprites.Count - 1)
|
||||||
|
{
|
||||||
|
ModHelper.SetSingleSelection(spriteListBox, sprites.Count - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
if(removedSprite != null)
|
||||||
|
{
|
||||||
|
sprites.Insert(removeIndex, removedSprite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionState GetPreChangeSelection()
|
||||||
|
{
|
||||||
|
return preChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPreChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
preChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
public SelectionState GetPostChangeSelection()
|
||||||
|
{
|
||||||
|
return postChangeSelection;
|
||||||
|
}
|
||||||
|
public void SetPostChangeSelection(SelectionState currentSelection)
|
||||||
|
{
|
||||||
|
postChangeSelection = currentSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "Remove Frame";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
public class SelectionState
|
||||||
|
{
|
||||||
|
public int SelectedAnimation { get; set; }
|
||||||
|
public List<int> SelectedFrames { get; set; }
|
||||||
|
public List<int> SelectedFrameSprites { get; set; }
|
||||||
|
|
||||||
|
public SelectionState(ComboBox animationComboBox, ListBox frameListBox, ListBox frameSpriteListBox)
|
||||||
|
{
|
||||||
|
SelectedAnimation = animationComboBox.SelectedIndex;
|
||||||
|
SelectedFrames = frameListBox.SelectedIndices.Cast<int>().ToList();
|
||||||
|
SelectedFrameSprites = frameSpriteListBox.SelectedIndices.Cast<int>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-19
@@ -8,8 +8,8 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace AnimationEditor.Properties
|
namespace AnimationEditor.Properties {
|
||||||
{
|
using System;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -19,31 +19,26 @@ namespace AnimationEditor.Properties
|
|||||||
// class via a tool like ResGen or Visual Studio.
|
// class via a tool like ResGen or Visual Studio.
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
// with the /str option, or rebuild your VS project.
|
// with the /str option, or rebuild your VS project.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources
|
internal class Resources {
|
||||||
{
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
internal Resources()
|
internal Resources() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the cached ResourceManager instance used by this class.
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
{
|
get {
|
||||||
get
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
{
|
|
||||||
if ((resourceMan == null))
|
|
||||||
{
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AnimationEditor.Properties.Resources", typeof(Resources).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AnimationEditor.Properties.Resources", typeof(Resources).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
@@ -56,14 +51,11 @@ namespace AnimationEditor.Properties
|
|||||||
/// resource lookups using this strongly typed resource class.
|
/// resource lookups using this strongly typed resource class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
internal static global::System.Globalization.CultureInfo Culture
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return resourceCulture;
|
return resourceCulture;
|
||||||
}
|
}
|
||||||
set
|
set {
|
||||||
{
|
|
||||||
resourceCulture = value;
|
resourceCulture = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:choice maxOccurs="unbounded">
|
<xsd:choice maxOccurs="unbounded">
|
||||||
@@ -68,9 +69,10 @@
|
|||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="assembly">
|
<xsd:element name="assembly">
|
||||||
@@ -85,9 +87,10 @@
|
|||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="resheader">
|
<xsd:element name="resheader">
|
||||||
@@ -109,9 +112,9 @@
|
|||||||
<value>2.0</value>
|
<value>2.0</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="reader">
|
<resheader name="reader">
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
</root>
|
</root>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 987 B |
Binary file not shown.
|
After Width: | Height: | Size: 991 B |
Reference in New Issue
Block a user