Added mods: ChangeFrameDelay, MoveSprite(NC), RenameAnimation, RenameFrame, ReorderSprite, ReplaceFrame, SetSpritePosition(NC); Changed: Removed opening conditionals from several mods
This commit is contained in:
@@ -68,6 +68,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Modifications\AddAnimation.cs" />
|
<Compile Include="Modifications\AddAnimation.cs" />
|
||||||
<Compile Include="Modifications\AddSprite.cs" />
|
<Compile Include="Modifications\AddSprite.cs" />
|
||||||
|
<Compile Include="Modifications\SetSpritePosition.cs" />
|
||||||
|
<Compile Include="Modifications\MoveSprite.cs" />
|
||||||
|
<Compile Include="Modifications\ChangeFrameDelay.cs" />
|
||||||
|
<Compile Include="Modifications\RenameFrame.cs" />
|
||||||
|
<Compile Include="Modifications\RenameAnimation.cs" />
|
||||||
|
<Compile Include="Modifications\ReplaceSprite.cs" />
|
||||||
|
<Compile Include="Modifications\ReorderSprite.cs" />
|
||||||
<Compile Include="Modifications\ReorderFrame.cs" />
|
<Compile Include="Modifications\ReorderFrame.cs" />
|
||||||
<Compile Include="Modifications\RemoveAnimation.cs" />
|
<Compile Include="Modifications\RemoveAnimation.cs" />
|
||||||
<Compile Include="Modifications\RemoveSprite.cs" />
|
<Compile Include="Modifications\RemoveSprite.cs" />
|
||||||
|
|||||||
Generated
+54
-48
@@ -71,6 +71,8 @@
|
|||||||
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();
|
||||||
@@ -83,16 +85,14 @@
|
|||||||
this.frameInfoLabel = new System.Windows.Forms.Label();
|
this.frameInfoLabel = new System.Windows.Forms.Label();
|
||||||
this.frameBoxLabel = new System.Windows.Forms.Label();
|
this.frameBoxLabel = new System.Windows.Forms.Label();
|
||||||
this.spriteBoxLabel = new System.Windows.Forms.Label();
|
this.spriteBoxLabel = new System.Windows.Forms.Label();
|
||||||
|
this.spritePreview = new System.Windows.Forms.PictureBox();
|
||||||
this.duplicateFrameButton = new System.Windows.Forms.Button();
|
this.duplicateFrameButton = new System.Windows.Forms.Button();
|
||||||
this.addEmptyFrameButton = new System.Windows.Forms.Button();
|
this.addEmptyFrameButton = new System.Windows.Forms.Button();
|
||||||
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.moveSpriteUpButton = new System.Windows.Forms.Button();
|
this.animationPreview = new AnimationEditor.AnimationPreview();
|
||||||
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,8 +102,8 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)(this.spriteYPosBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.spriteYPosBox)).BeginInit();
|
||||||
((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();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit();
|
||||||
|
this.animationPanel.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// loadSpriteSheetDialog
|
// loadSpriteSheetDialog
|
||||||
@@ -147,6 +147,7 @@
|
|||||||
// addSpriteToFrameListButton
|
// addSpriteToFrameListButton
|
||||||
//
|
//
|
||||||
this.addSpriteToFrameListButton.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
this.addSpriteToFrameListButton.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||||
|
this.addSpriteToFrameListButton.Enabled = false;
|
||||||
this.addSpriteToFrameListButton.Location = new System.Drawing.Point(130, 130);
|
this.addSpriteToFrameListButton.Location = new System.Drawing.Point(130, 130);
|
||||||
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);
|
||||||
@@ -190,7 +191,8 @@
|
|||||||
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;
|
||||||
this.animationNameBox.TextChanged += new System.EventHandler(this.animationNameBox_TextChanged);
|
this.animationNameBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.animationNameBox_KeyPress);
|
||||||
|
this.animationNameBox.Leave += new System.EventHandler(this.animationNameBox_Leave);
|
||||||
//
|
//
|
||||||
// playAnimationButton
|
// playAnimationButton
|
||||||
//
|
//
|
||||||
@@ -440,6 +442,8 @@
|
|||||||
this.frameNameBox.Size = new System.Drawing.Size(83, 20);
|
this.frameNameBox.Size = new System.Drawing.Size(83, 20);
|
||||||
this.frameNameBox.TabIndex = 25;
|
this.frameNameBox.TabIndex = 25;
|
||||||
this.frameNameBox.TextChanged += new System.EventHandler(this.frameNameBox_TextChanged);
|
this.frameNameBox.TextChanged += new System.EventHandler(this.frameNameBox_TextChanged);
|
||||||
|
this.frameNameBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.frameNameBox_KeyPress);
|
||||||
|
this.frameNameBox.Leave += new System.EventHandler(this.frameNameBox_Leave);
|
||||||
//
|
//
|
||||||
// frameSpritePanel
|
// frameSpritePanel
|
||||||
//
|
//
|
||||||
@@ -550,6 +554,30 @@
|
|||||||
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)));
|
||||||
@@ -575,6 +603,7 @@
|
|||||||
// replaceSpriteButton
|
// replaceSpriteButton
|
||||||
//
|
//
|
||||||
this.replaceSpriteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.replaceSpriteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.replaceSpriteButton.Enabled = false;
|
||||||
this.replaceSpriteButton.Location = new System.Drawing.Point(1, 56);
|
this.replaceSpriteButton.Location = new System.Drawing.Point(1, 56);
|
||||||
this.replaceSpriteButton.Name = "replaceSpriteButton";
|
this.replaceSpriteButton.Name = "replaceSpriteButton";
|
||||||
this.replaceSpriteButton.Size = new System.Drawing.Size(27, 23);
|
this.replaceSpriteButton.Size = new System.Drawing.Size(27, 23);
|
||||||
@@ -587,6 +616,7 @@
|
|||||||
// addSpriteToFrameSpritesButton
|
// addSpriteToFrameSpritesButton
|
||||||
//
|
//
|
||||||
this.addSpriteToFrameSpritesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.addSpriteToFrameSpritesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.addSpriteToFrameSpritesButton.Enabled = false;
|
||||||
this.addSpriteToFrameSpritesButton.Location = new System.Drawing.Point(1, 36);
|
this.addSpriteToFrameSpritesButton.Location = new System.Drawing.Point(1, 36);
|
||||||
this.addSpriteToFrameSpritesButton.Name = "addSpriteToFrameSpritesButton";
|
this.addSpriteToFrameSpritesButton.Name = "addSpriteToFrameSpritesButton";
|
||||||
this.addSpriteToFrameSpritesButton.Size = new System.Drawing.Size(27, 23);
|
this.addSpriteToFrameSpritesButton.Size = new System.Drawing.Size(27, 23);
|
||||||
@@ -676,6 +706,17 @@
|
|||||||
this.spriteBoxLabel.TabIndex = 15;
|
this.spriteBoxLabel.TabIndex = 15;
|
||||||
this.spriteBoxLabel.Text = "Sprite Selection";
|
this.spriteBoxLabel.Text = "Sprite Selection";
|
||||||
//
|
//
|
||||||
|
// 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;
|
||||||
|
//
|
||||||
// duplicateFrameButton
|
// duplicateFrameButton
|
||||||
//
|
//
|
||||||
this.duplicateFrameButton.Location = new System.Drawing.Point(130, 18);
|
this.duplicateFrameButton.Location = new System.Drawing.Point(130, 18);
|
||||||
@@ -736,6 +777,12 @@
|
|||||||
this.animationLabel.TabIndex = 22;
|
this.animationLabel.TabIndex = 22;
|
||||||
this.animationLabel.Text = "Animation";
|
this.animationLabel.Text = "Animation";
|
||||||
//
|
//
|
||||||
|
// loadAnimationSetDialog
|
||||||
|
//
|
||||||
|
this.loadAnimationSetDialog.DefaultExt = "animset";
|
||||||
|
this.loadAnimationSetDialog.FileName = "openFileDialog1";
|
||||||
|
this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
|
||||||
|
//
|
||||||
// animationPreview
|
// animationPreview
|
||||||
//
|
//
|
||||||
this.animationPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.animationPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
@@ -756,47 +803,6 @@
|
|||||||
this.animationPreview.ZoomLevel = 0F;
|
this.animationPreview.ZoomLevel = 0F;
|
||||||
this.animationPreview.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.animationPreview_MouseWheel);
|
this.animationPreview.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.animationPreview_MouseWheel);
|
||||||
//
|
//
|
||||||
// loadAnimationSetDialog
|
|
||||||
//
|
|
||||||
this.loadAnimationSetDialog.DefaultExt = "animset";
|
|
||||||
this.loadAnimationSetDialog.FileName = "openFileDialog1";
|
|
||||||
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);
|
||||||
@@ -822,9 +828,9 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)(this.spriteYPosBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.spriteYPosBox)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.spriteXPosBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.spriteXPosBox)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.importDelayBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.importDelayBox)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).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();
|
||||||
|
|
||||||
|
|||||||
+99
-75
@@ -44,6 +44,7 @@ namespace AnimationEditor
|
|||||||
private Animation currentAnimation;
|
private Animation currentAnimation;
|
||||||
private Frame currentFrame;
|
private Frame currentFrame;
|
||||||
|
|
||||||
|
private bool frameNameBoxEdited;
|
||||||
private bool tracking;
|
private bool tracking;
|
||||||
private bool reading;
|
private bool reading;
|
||||||
private float importDelay = 0;
|
private float importDelay = 0;
|
||||||
@@ -128,7 +129,8 @@ namespace AnimationEditor
|
|||||||
else
|
else
|
||||||
animationPreview.PreviewSprite.CurrentAnimation = currentAnimation;
|
animationPreview.PreviewSprite.CurrentAnimation = currentAnimation;
|
||||||
frameTrackBar.Maximum = currentAnimation.Frames.Count() - 1;
|
frameTrackBar.Maximum = currentAnimation.Frames.Count() - 1;
|
||||||
frameListBox_SetSingleSelection(frameTrackBar.Value);
|
if(frameListBox.SelectedIndices.Count < 2 && frameListBox.SelectedIndex != frameTrackBar.Value)
|
||||||
|
frameListBox_SetSingleSelection(frameTrackBar.Value);
|
||||||
if(animations.Count < 1)
|
if(animations.Count < 1)
|
||||||
{
|
{
|
||||||
animations.Add(currentAnimation);
|
animations.Add(currentAnimation);
|
||||||
@@ -156,7 +158,7 @@ namespace AnimationEditor
|
|||||||
|
|
||||||
//update per-sprite controls
|
//update per-sprite controls
|
||||||
spritePosPanel.Enabled = singleSpriteSelected;
|
spritePosPanel.Enabled = singleSpriteSelected;
|
||||||
replaceSpriteButton.Enabled = singleSpriteSelected;
|
replaceSpriteButton.Enabled = singleSpriteSelected && spriteSet != null;
|
||||||
moveSpriteDownButton.Enabled = singleSpriteSelected;
|
moveSpriteDownButton.Enabled = singleSpriteSelected;
|
||||||
moveSpriteUpButton.Enabled = singleSpriteSelected;
|
moveSpriteUpButton.Enabled = singleSpriteSelected;
|
||||||
removeSpriteButton.Enabled = singleSpriteSelected;
|
removeSpriteButton.Enabled = singleSpriteSelected;
|
||||||
@@ -241,6 +243,10 @@ namespace AnimationEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ensure at least one sprite is selected
|
||||||
|
if (frameSprites.Count > 0 && frameSpriteListBox.SelectedIndices.Count < 1)
|
||||||
|
frameSpriteListBox.SelectedIndex = 0;
|
||||||
|
|
||||||
//update forms fields to match selected frame's informations
|
//update forms fields to match selected frame's informations
|
||||||
UpdateFrameInformation();
|
UpdateFrameInformation();
|
||||||
}
|
}
|
||||||
@@ -262,11 +268,11 @@ namespace AnimationEditor
|
|||||||
|
|
||||||
private void delayInputBox_ValueChanged(object sender, EventArgs e)
|
private void delayInputBox_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
foreach(int index in frameListBox.SelectedIndices)
|
if (reading || tracking)
|
||||||
{
|
return;
|
||||||
var currentFrame = frames[index];
|
var mod = new ChangeFrameDelay(frames, frameListBox, (float)delayInputBox.Value / frameRate);
|
||||||
currentFrame.Delay = (float)delayInputBox.Value / frameRate;
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
}
|
undoHistory.Add(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSpriteSheetToolStripMenuItem_Click(object sender, EventArgs e)
|
private void loadSpriteSheetToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
@@ -305,6 +311,11 @@ namespace AnimationEditor
|
|||||||
spriteListBox.DisplayMember = "Name";
|
spriteListBox.DisplayMember = "Name";
|
||||||
spriteListBox.ValueMember = "Bounds";
|
spriteListBox.ValueMember = "Bounds";
|
||||||
|
|
||||||
|
//enable spriteMap-required controls
|
||||||
|
addSpriteToFrameListButton.Enabled = true;
|
||||||
|
addSpriteToFrameSpritesButton.Enabled = true;
|
||||||
|
replaceSpriteButton.Enabled = true;
|
||||||
|
|
||||||
if (currentAnimation == null)
|
if (currentAnimation == null)
|
||||||
{
|
{
|
||||||
frames = new BindingList<Frame>();
|
frames = new BindingList<Frame>();
|
||||||
@@ -370,14 +381,7 @@ namespace AnimationEditor
|
|||||||
{
|
{
|
||||||
if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex < frames.Count - 1)
|
if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex < frames.Count - 1)
|
||||||
{
|
{
|
||||||
MoveListItem(frames, frameListBox, 1);
|
MoveFrame(frames, frameListBox, 1);
|
||||||
/*
|
|
||||||
var frameBelow = frames[frameListBox.SelectedIndex + 1];
|
|
||||||
frames[frameListBox.SelectedIndex + 1] = currentFrame;
|
|
||||||
frames[frameListBox.SelectedIndex] = frameBelow;
|
|
||||||
UpdateAnimation();
|
|
||||||
frameListBox_SetSingleSelection(frameListBox.SelectedIndex + 1);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,18 +389,11 @@ namespace AnimationEditor
|
|||||||
{
|
{
|
||||||
if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex > 0)
|
if (frameListBox.SelectedIndices.Count == 1 && frameListBox.SelectedIndex > 0)
|
||||||
{
|
{
|
||||||
MoveListItem(frames, frameListBox, -1);
|
MoveFrame(frames, frameListBox, -1);
|
||||||
/*
|
|
||||||
var frameAbove = frames[frameListBox.SelectedIndex - 1];
|
|
||||||
frames[frameListBox.SelectedIndex - 1] = currentFrame;
|
|
||||||
frames[frameListBox.SelectedIndex] = frameAbove;
|
|
||||||
UpdateAnimation();
|
|
||||||
frameListBox_SetSingleSelection(frameListBox.SelectedIndex - 1);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveListItem(BindingList<Frame> frameList, ListBox frameBox, int dir)
|
private void MoveFrame(BindingList<Frame> frameList, ListBox frameBox, int dir)
|
||||||
{
|
{
|
||||||
var mod = new ReorderFrame(frameList, frameBox, dir);
|
var mod = new ReorderFrame(frameList, frameBox, dir);
|
||||||
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
@@ -415,15 +412,6 @@ namespace AnimationEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animationNameBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (reading || currentAnimation.Name == animationNameBox.Text)
|
|
||||||
return;
|
|
||||||
|
|
||||||
currentAnimation.Name = animationNameBox.Text;
|
|
||||||
animations.ResetBindings();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveAnimationToolStripMenuItem_Click(object sender, EventArgs e)
|
private void saveAnimationToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (saveAnimationDialog.ShowDialog() == DialogResult.OK)
|
if (saveAnimationDialog.ShowDialog() == DialogResult.OK)
|
||||||
@@ -633,9 +621,13 @@ namespace AnimationEditor
|
|||||||
if (reading || frameSpriteListBox.SelectedIndex >= currentFrame.Sprites.Count)
|
if (reading || frameSpriteListBox.SelectedIndex >= currentFrame.Sprites.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SetSpritePosition();
|
||||||
|
currentFrame.Sprites = frameSprites.ToList();
|
||||||
|
/*
|
||||||
var newPos = currentFrame.Sprites[frameSpriteListBox.SelectedIndex].Offset;
|
var newPos = currentFrame.Sprites[frameSpriteListBox.SelectedIndex].Offset;
|
||||||
newPos.X = (float)spriteXPosBox.Value;
|
newPos.X = (float)spriteXPosBox.Value;
|
||||||
currentFrame.Sprites[frameSpriteListBox.SelectedIndex].Offset = newPos;
|
currentFrame.Sprites[frameSpriteListBox.SelectedIndex].Offset = newPos;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//update Y offset of selected sprite with position entered into spriteYPosBox
|
//update Y offset of selected sprite with position entered into spriteYPosBox
|
||||||
@@ -644,9 +636,20 @@ namespace AnimationEditor
|
|||||||
if (reading || frameSpriteListBox.SelectedIndex >= currentFrame.Sprites.Count)
|
if (reading || frameSpriteListBox.SelectedIndex >= currentFrame.Sprites.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SetSpritePosition();
|
||||||
|
currentFrame.Sprites = frameSprites.ToList();
|
||||||
|
/*
|
||||||
var newPos = currentFrame.Sprites[frameSpriteListBox.SelectedIndex].Offset;
|
var newPos = currentFrame.Sprites[frameSpriteListBox.SelectedIndex].Offset;
|
||||||
newPos.Y = (float)spriteYPosBox.Value;
|
newPos.Y = (float)spriteYPosBox.Value;
|
||||||
currentFrame.Sprites[frameSpriteListBox.SelectedIndex].Offset = newPos;
|
currentFrame.Sprites[frameSpriteListBox.SelectedIndex].Offset = newPos;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetSpritePosition()
|
||||||
|
{
|
||||||
|
var mod = new SetSpritePosition(frameSprites, frameSpriteListBox, new Vector2((float)spriteXPosBox.Value, (float)spriteYPosBox.Value));
|
||||||
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
|
undoHistory.Add(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSpriteToFrameSpritesButton_Click(object sender, EventArgs e)
|
private void addSpriteToFrameSpritesButton_Click(object sender, EventArgs e)
|
||||||
@@ -663,39 +666,24 @@ namespace AnimationEditor
|
|||||||
AddFrame(new Frame());
|
AddFrame(new Frame());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frameNameBox_TextChanged(object sender, EventArgs e)
|
private void RenameFrames()
|
||||||
{
|
{
|
||||||
if (reading)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
foreach(int index in frameListBox.SelectedIndices)
|
foreach(int index in frameListBox.SelectedIndices)
|
||||||
{
|
{
|
||||||
if (frames[index].Name != frameNameBox.Text)
|
if (frames[index].Name != frameNameBox.Text)
|
||||||
{
|
{
|
||||||
frames[index].Name = frameNameBox.Text;
|
|
||||||
changed = true;
|
changed = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
//store current frame selection data
|
var mod = new RenameFrame(frames, frameListBox, frameNameBox.Text);
|
||||||
List<int> selection = new List<int>();
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
foreach (int index in frameListBox.SelectedIndices)
|
undoHistory.Add(mod);
|
||||||
{
|
|
||||||
selection.Add(index);
|
|
||||||
}
|
|
||||||
//refresh list so name changes are reflected in form
|
|
||||||
frames.ResetBindings();
|
|
||||||
//restore selection
|
|
||||||
reading = true;
|
|
||||||
foreach(int index in selection)
|
|
||||||
{
|
|
||||||
frameListBox.SelectedIndex = index;
|
|
||||||
}
|
|
||||||
reading = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,14 +691,7 @@ namespace AnimationEditor
|
|||||||
{
|
{
|
||||||
if (frameSpriteListBox.SelectedIndex < currentFrame.Sprites.Count - 1)
|
if (frameSpriteListBox.SelectedIndex < currentFrame.Sprites.Count - 1)
|
||||||
{
|
{
|
||||||
var index = frameSpriteListBox.SelectedIndex;
|
MoveSprite(frameSprites, frameSpriteListBox, 1);
|
||||||
|
|
||||||
var currentSprite = frameSprites[index];
|
|
||||||
var spriteBelow = frameSprites[index + 1];
|
|
||||||
frameSprites[index + 1] = currentSprite;
|
|
||||||
frameSprites[index] = spriteBelow;
|
|
||||||
UpdateAnimation();
|
|
||||||
frameSpriteListBox.SelectedIndex = index + 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -718,17 +699,18 @@ namespace AnimationEditor
|
|||||||
{
|
{
|
||||||
if (frameSpriteListBox.SelectedIndex > 0)
|
if (frameSpriteListBox.SelectedIndex > 0)
|
||||||
{
|
{
|
||||||
var index = frameSpriteListBox.SelectedIndex;
|
MoveSprite(frameSprites, frameSpriteListBox, -1);
|
||||||
|
|
||||||
var currentSprite = frameSprites[index];
|
|
||||||
var spriteAbove = frameSprites[index - 1];
|
|
||||||
frameSprites[index - 1] = currentSprite;
|
|
||||||
frameSprites[index] = spriteAbove;
|
|
||||||
UpdateAnimation();
|
|
||||||
frameSpriteListBox.SelectedIndex = index - 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MoveSprite(BindingList<Sprite> spriteList, ListBox spriteBox, int dir)
|
||||||
|
{
|
||||||
|
var mod = new ReorderSprite(spriteList, spriteBox, dir);
|
||||||
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
|
undoHistory.Add(mod);
|
||||||
|
UpdateAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
private void removeSpriteButton_Click(object sender, EventArgs e)
|
private void removeSpriteButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (frameSpriteListBox.SelectedIndex > -1 && frameSpriteListBox.SelectedIndex < frameSprites.Count)
|
if (frameSpriteListBox.SelectedIndex > -1 && frameSpriteListBox.SelectedIndex < frameSprites.Count)
|
||||||
@@ -753,12 +735,9 @@ namespace AnimationEditor
|
|||||||
|
|
||||||
private void replaceSpriteButton_Click(object sender, EventArgs e)
|
private void replaceSpriteButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var spr = frameSprites[frameSpriteListBox.SelectedIndex];
|
var mod = new ReplaceSprite(frameSprites, frameSpriteListBox.SelectedIndex, spriteSet[spriteListBox.SelectedIndex]);
|
||||||
var replacement = spriteSet[spriteListBox.SelectedIndex];
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
|
undoHistory.Add(mod);
|
||||||
spr.Bounds = replacement.Bounds;
|
|
||||||
spr.Origin = replacement.Origin;
|
|
||||||
spr.Name = replacement.Name;
|
|
||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -773,5 +752,50 @@ namespace AnimationEditor
|
|||||||
undoHistory.Redo(animationBox, frameListBox, frameSpriteListBox);
|
undoHistory.Redo(animationBox, frameListBox, frameSpriteListBox);
|
||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateAnimationName()
|
||||||
|
{
|
||||||
|
var mod = new RenameAnimation(animations, animationBox.SelectedIndex, animationNameBox.Text);
|
||||||
|
ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
|
||||||
|
undoHistory.Add(mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void animationNameBox_Leave(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (animations[animationBox.SelectedIndex].Name != animationNameBox.Text)
|
||||||
|
{
|
||||||
|
UpdateAnimationName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void animationNameBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyChar == (char)Keys.Return && animations[animationBox.SelectedIndex].Name != animationNameBox.Text)
|
||||||
|
{
|
||||||
|
UpdateAnimationName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frameNameBox_Leave(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (frameNameBoxEdited)
|
||||||
|
RenameFrames();
|
||||||
|
frameNameBoxEdited = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frameNameBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyChar == (char)Keys.Return && frameNameBoxEdited)
|
||||||
|
RenameFrames();
|
||||||
|
frameNameBoxEdited = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frameNameBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(!reading && !tracking)
|
||||||
|
{
|
||||||
|
frameNameBoxEdited = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace AnimationEditor.Modifications
|
|||||||
private BindingList<Frame> frames;
|
private BindingList<Frame> frames;
|
||||||
private ListBox frameListBox;
|
private ListBox frameListBox;
|
||||||
private Frame frameToAdd;
|
private Frame frameToAdd;
|
||||||
|
private int index;
|
||||||
|
|
||||||
public AddFrame(BindingList<Frame> frameList, ListBox frameBox, Frame frame = null)
|
public AddFrame(BindingList<Frame> frameList, ListBox frameBox, Frame frame = null)
|
||||||
{
|
{
|
||||||
@@ -27,6 +28,7 @@ namespace AnimationEditor.Modifications
|
|||||||
if (frame != null)
|
if (frame != null)
|
||||||
frameToAdd = frame;
|
frameToAdd = frame;
|
||||||
else frameToAdd = new Frame();
|
else frameToAdd = new Frame();
|
||||||
|
index = frameListBox.SelectedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Do()
|
public void Do()
|
||||||
@@ -42,15 +44,15 @@ namespace AnimationEditor.Modifications
|
|||||||
frames.Clear();
|
frames.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frameListBox.SelectedItem == null || frameListBox.SelectedIndex == frames.Count - 1)
|
if (frameListBox.SelectedItem == null || index == frames.Count - 1)
|
||||||
{
|
{
|
||||||
frames.Add(frameToAdd);
|
frames.Add(frameToAdd);
|
||||||
newSelectedIndex = frames.Count - 1;
|
newSelectedIndex = frames.Count - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frames.Insert(frameListBox.SelectedIndex + 1, frameToAdd);
|
frames.Insert(index + 1, frameToAdd);
|
||||||
newSelectedIndex = frameListBox.SelectedIndex + 1;
|
newSelectedIndex = index + 1;
|
||||||
}
|
}
|
||||||
ModHelper.SetSingleSelection(frameListBox, newSelectedIndex);
|
ModHelper.SetSingleSelection(frameListBox, newSelectedIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class ChangeFrameDelay : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Frame> frames;
|
||||||
|
private ListBox listBox;
|
||||||
|
private List<int> indices;
|
||||||
|
private Dictionary<int, float> originalDelays;
|
||||||
|
private float newDelay;
|
||||||
|
|
||||||
|
public ChangeFrameDelay(BindingList<Frame> frameList, ListBox frameListBox, float delay)
|
||||||
|
{
|
||||||
|
frames = frameList;
|
||||||
|
listBox = frameListBox;
|
||||||
|
indices = new List<int>();
|
||||||
|
originalDelays = new Dictionary<int, float>();
|
||||||
|
foreach (int i in frameListBox.SelectedIndices)
|
||||||
|
{
|
||||||
|
indices.Add(i);
|
||||||
|
originalDelays.Add(i, frames[i].Delay);
|
||||||
|
}
|
||||||
|
newDelay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
frames[index].Delay = newDelay;
|
||||||
|
}
|
||||||
|
frames.ResetBindings();
|
||||||
|
listBox.SelectedIndices.Clear();
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
listBox.SelectedIndices.Add(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
frames[index].Delay = originalDelays[index];
|
||||||
|
}
|
||||||
|
frames.ResetBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
if (indices.Count == 1)
|
||||||
|
return "Change Frame Delay";
|
||||||
|
else
|
||||||
|
return "Change Frame Delays";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -40,13 +40,13 @@ namespace AnimationEditor.Modifications
|
|||||||
frameBox.SelectedIndices.Clear();
|
frameBox.SelectedIndices.Clear();
|
||||||
foreach(int index in selection.SelectedFrames)
|
foreach(int index in selection.SelectedFrames)
|
||||||
{
|
{
|
||||||
frameBox.SelectedIndex = index;
|
frameBox.SelectedIndices.Add(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
frameSpriteBox.SelectedIndices.Clear();
|
frameSpriteBox.SelectedIndices.Clear();
|
||||||
foreach(int index in selection.SelectedFrameSprites)
|
foreach(int index in selection.SelectedFrameSprites)
|
||||||
{
|
{
|
||||||
frameSpriteBox.SelectedIndex = index;
|
frameSpriteBox.SelectedIndices.Add(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class MoveSprite : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Sprite> sprites;
|
||||||
|
private ListBox listBox;
|
||||||
|
private List<int> indices;
|
||||||
|
private Dictionary<int, Vector2> originalPositions;
|
||||||
|
private Vector2 dist;
|
||||||
|
|
||||||
|
public MoveSprite(BindingList<Sprite> spriteList, ListBox spriteListBox, Vector2 distance)
|
||||||
|
{
|
||||||
|
sprites = spriteList;
|
||||||
|
listBox = spriteListBox;
|
||||||
|
indices = new List<int>();
|
||||||
|
originalPositions = new Dictionary<int, Vector2>();
|
||||||
|
foreach (int i in spriteListBox.SelectedIndices)
|
||||||
|
{
|
||||||
|
indices.Add(i);
|
||||||
|
originalPositions.Add(i, sprites[i].Offset);
|
||||||
|
}
|
||||||
|
dist = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
sprites[index].Offset += dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
sprites[index].Offset = originalPositions[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
if (indices.Count == 1)
|
||||||
|
return "Move Sprite";
|
||||||
|
else
|
||||||
|
return "Move Sprites";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -31,20 +31,17 @@ namespace AnimationEditor.Modifications
|
|||||||
|
|
||||||
public void Do()
|
public void Do()
|
||||||
{
|
{
|
||||||
if (removeIndex > -1 && removeIndex < animations.Count)
|
removedAnim = animations[removeIndex];
|
||||||
|
if (animations.Count == 1)
|
||||||
{
|
{
|
||||||
removedAnim = animations[removeIndex];
|
animations[removeIndex] = new Animation();
|
||||||
if (animations.Count == 1)
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
animations.RemoveAt(removeIndex);
|
||||||
|
if (animationBox.SelectedIndex > animations.Count - 1)
|
||||||
{
|
{
|
||||||
animations[removeIndex] = new Animation();
|
animationBox.SelectedIndex--;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
animations.RemoveAt(removeIndex);
|
|
||||||
if (animationBox.SelectedIndex > animations.Count - 1)
|
|
||||||
{
|
|
||||||
animationBox.SelectedIndex--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,22 +31,19 @@ namespace AnimationEditor.Modifications
|
|||||||
|
|
||||||
public void Do()
|
public void Do()
|
||||||
{
|
{
|
||||||
if(removeIndex > -1 && removeIndex < frames.Count)
|
removedFrame = frames[removeIndex];
|
||||||
|
|
||||||
|
if(frames.Count == 1)
|
||||||
{
|
{
|
||||||
removedFrame = frames[removeIndex];
|
frames.Clear();
|
||||||
|
frames.Add(new Frame());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
frames.RemoveAt(removeIndex);
|
||||||
|
|
||||||
if(frames.Count == 1)
|
if (frames.Count > -1 && frameListBox.SelectedIndex > frames.Count - 1)
|
||||||
{
|
{
|
||||||
frames.Clear();
|
ModHelper.SetSingleSelection(frameListBox, frames.Count - 1);
|
||||||
frames.Add(new Frame());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
frames.RemoveAt(removeIndex);
|
|
||||||
|
|
||||||
if (frames.Count > -1 && frameListBox.SelectedIndex > frames.Count - 1)
|
|
||||||
{
|
|
||||||
ModHelper.SetSingleSelection(frameListBox, frames.Count - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,21 +30,18 @@ namespace AnimationEditor.Modifications
|
|||||||
|
|
||||||
public void Do()
|
public void Do()
|
||||||
{
|
{
|
||||||
if(removeIndex > -1 && removeIndex < sprites.Count)
|
removedSprite = sprites[removeIndex];
|
||||||
|
|
||||||
|
if(sprites.Count == 1)
|
||||||
{
|
{
|
||||||
removedSprite = sprites[removeIndex];
|
sprites.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprites.RemoveAt(removeIndex);
|
||||||
|
|
||||||
if(sprites.Count == 1)
|
if (sprites.Count > -1 && spriteListBox.SelectedIndex > sprites.Count - 1)
|
||||||
{
|
{
|
||||||
sprites.Clear();
|
ModHelper.SetSingleSelection(spriteListBox, sprites.Count - 1);
|
||||||
}
|
|
||||||
else
|
|
||||||
sprites.RemoveAt(removeIndex);
|
|
||||||
|
|
||||||
if (sprites.Count > -1 && spriteListBox.SelectedIndex > sprites.Count - 1)
|
|
||||||
{
|
|
||||||
ModHelper.SetSingleSelection(spriteListBox, sprites.Count - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +73,7 @@ namespace AnimationEditor.Modifications
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "Remove Frame";
|
return "Remove Sprite";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class RenameAnimation : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Animation> anims;
|
||||||
|
private int index;
|
||||||
|
private string originalName;
|
||||||
|
private string newName;
|
||||||
|
|
||||||
|
public RenameAnimation(BindingList<Animation> animList, int index, string name)
|
||||||
|
{
|
||||||
|
anims = animList;
|
||||||
|
this.index = index;
|
||||||
|
originalName = anims[index].Name;
|
||||||
|
newName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
anims[index].Name = newName;
|
||||||
|
anims.ResetBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
anims[index].Name = originalName;
|
||||||
|
anims.ResetBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 "Rename Animation";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class RenameFrame : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Frame> frames;
|
||||||
|
private ListBox listBox;
|
||||||
|
private List<int> indices;
|
||||||
|
private Dictionary<int, string> originalNames;
|
||||||
|
private string newName;
|
||||||
|
|
||||||
|
public RenameFrame(BindingList<Frame> frameList, ListBox frameListBox, string name)
|
||||||
|
{
|
||||||
|
frames = frameList;
|
||||||
|
listBox = frameListBox;
|
||||||
|
indices = new List<int>();
|
||||||
|
originalNames = new Dictionary<int, string>();
|
||||||
|
foreach(int i in frameListBox.SelectedIndices)
|
||||||
|
{
|
||||||
|
indices.Add(i);
|
||||||
|
originalNames.Add(i, frames[i].Name);
|
||||||
|
}
|
||||||
|
newName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
frames[index].Name = newName;
|
||||||
|
}
|
||||||
|
frames.ResetBindings();
|
||||||
|
listBox.SelectedIndices.Clear();
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
listBox.SelectedIndices.Add(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
frames[index].Name = originalNames[index];
|
||||||
|
}
|
||||||
|
frames.ResetBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
if (indices.Count == 1)
|
||||||
|
return "Rename Frame";
|
||||||
|
else
|
||||||
|
return "Rename Frames";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -16,10 +16,10 @@ namespace AnimationEditor.Modifications
|
|||||||
private SelectionState preChangeSelection;
|
private SelectionState preChangeSelection;
|
||||||
private SelectionState postChangeSelection;
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
private BindingList<Frame> frames;
|
private readonly BindingList<Frame> frames;
|
||||||
private ListBox listBox;
|
private readonly ListBox listBox;
|
||||||
private int index;
|
private readonly int index;
|
||||||
private int dir;
|
private readonly int dir;
|
||||||
|
|
||||||
public ReorderFrame(BindingList<Frame> frameList, ListBox frameListBox, int direction)
|
public ReorderFrame(BindingList<Frame> frameList, ListBox frameListBox, int direction)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class ReorderSprite : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Sprite> sprites;
|
||||||
|
private ListBox listBox;
|
||||||
|
private int index;
|
||||||
|
private int dir;
|
||||||
|
|
||||||
|
public ReorderSprite(BindingList<Sprite> spriteList, ListBox spriteListBox, int direction)
|
||||||
|
{
|
||||||
|
sprites = spriteList;
|
||||||
|
listBox = spriteListBox;
|
||||||
|
index = spriteListBox.SelectedIndex;
|
||||||
|
dir = Math.Sign(direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
var movingFrame = sprites[index];
|
||||||
|
sprites[index] = sprites[index + dir];
|
||||||
|
sprites[index + dir] = movingFrame;
|
||||||
|
ModHelper.SetSingleSelection(listBox, index + dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
var movingFrame = sprites[index + dir];
|
||||||
|
sprites[index + dir] = sprites[index];
|
||||||
|
sprites[index] = movingFrame;
|
||||||
|
ModHelper.SetSingleSelection(listBox, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 "Move Sprite";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class ReplaceSprite : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Sprite> sprites;
|
||||||
|
private int index;
|
||||||
|
private Sprite original;
|
||||||
|
private Sprite replacement;
|
||||||
|
|
||||||
|
public ReplaceSprite(BindingList<Sprite> spriteList, int origIndex, Sprite newSprite)
|
||||||
|
{
|
||||||
|
sprites = spriteList;
|
||||||
|
index = origIndex;
|
||||||
|
original = sprites[index].Clone();
|
||||||
|
replacement = newSprite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
sprites[index].Name = replacement.Name;
|
||||||
|
sprites[index].Bounds = replacement.Bounds;
|
||||||
|
sprites[index].Origin = replacement.Origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
sprites[index].Name = original.Name;
|
||||||
|
sprites[index].Bounds = original.Bounds;
|
||||||
|
sprites[index].Origin = original.Origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 "Replace Sprite";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
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;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace AnimationEditor.Modifications
|
||||||
|
{
|
||||||
|
class SetSpritePosition : IModification
|
||||||
|
{
|
||||||
|
private SelectionState preChangeSelection;
|
||||||
|
private SelectionState postChangeSelection;
|
||||||
|
|
||||||
|
private BindingList<Sprite> sprites;
|
||||||
|
private ListBox listBox;
|
||||||
|
private int index;
|
||||||
|
private Vector2 originalPosition;
|
||||||
|
private Vector2 newPosition;
|
||||||
|
|
||||||
|
public SetSpritePosition(BindingList<Sprite> spriteList, ListBox spriteListBox, Vector2 newPos)
|
||||||
|
{
|
||||||
|
sprites = spriteList;
|
||||||
|
listBox = spriteListBox;
|
||||||
|
index = spriteListBox.SelectedIndex;
|
||||||
|
originalPosition = sprites[index].Offset;
|
||||||
|
newPosition = newPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
sprites[index].Offset = newPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
sprites[index].Offset = originalPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 "Set Sprite Position";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user