Added Sprite Updater to AnimationEditor
This commit is contained in:
Generated
+23
-1
@@ -71,6 +71,8 @@
|
|||||||
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();
|
||||||
|
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit();
|
||||||
@@ -227,7 +229,8 @@
|
|||||||
//
|
//
|
||||||
this.mainMenuStrip.BackColor = System.Drawing.SystemColors.Control;
|
this.mainMenuStrip.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.fileToolStripMenuItem});
|
this.fileToolStripMenuItem,
|
||||||
|
this.editToolStripMenuItem});
|
||||||
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);
|
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
this.mainMenuStrip.Name = "mainMenuStrip";
|
this.mainMenuStrip.Name = "mainMenuStrip";
|
||||||
this.mainMenuStrip.Size = new System.Drawing.Size(763, 24);
|
this.mainMenuStrip.Size = new System.Drawing.Size(763, 24);
|
||||||
@@ -503,6 +506,23 @@
|
|||||||
this.loadAnimationSetDialog.FileName = "openFileDialog1";
|
this.loadAnimationSetDialog.FileName = "openFileDialog1";
|
||||||
this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
|
this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
|
||||||
//
|
//
|
||||||
|
// editToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem});
|
||||||
|
this.editToolStripMenuItem.Enabled = false;
|
||||||
|
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||||
|
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
||||||
|
this.editToolStripMenuItem.Text = "Edit";
|
||||||
|
//
|
||||||
|
// updateAnimationSpritesFromSpriteMapToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Enabled = false;
|
||||||
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Name = "updateAnimationSpritesFromSpriteMapToolStripMenuItem";
|
||||||
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Size = new System.Drawing.Size(304, 22);
|
||||||
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Text = "Update Animation Sprites from SpriteMap...";
|
||||||
|
this.updateAnimationSpritesFromSpriteMapToolStripMenuItem.Click += new System.EventHandler(this.updateAnimationSpritesFromSpriteMapToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -575,6 +595,8 @@
|
|||||||
private System.Windows.Forms.Label animationLabel;
|
private System.Windows.Forms.Label animationLabel;
|
||||||
private System.Windows.Forms.Label animationNameLabel;
|
private System.Windows.Forms.Label animationNameLabel;
|
||||||
private System.Windows.Forms.OpenFileDialog loadAnimationSetDialog;
|
private System.Windows.Forms.OpenFileDialog loadAnimationSetDialog;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem updateAnimationSpritesFromSpriteMapToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ namespace AnimationEditor
|
|||||||
frameTrackBar.Enabled = true;
|
frameTrackBar.Enabled = true;
|
||||||
playAnimationButton.Enabled = true;
|
playAnimationButton.Enabled = true;
|
||||||
animationPreview.Enabled = true;
|
animationPreview.Enabled = true;
|
||||||
|
|
||||||
|
editToolStripMenuItem.Enabled = true;
|
||||||
|
updateAnimationSpritesFromSpriteMapToolStripMenuItem.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitiateAnimationList(bool newAnimation = true)
|
private void InitiateAnimationList(bool newAnimation = true)
|
||||||
@@ -218,6 +221,11 @@ namespace AnimationEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadSpriteMapToolStripMenuItem_Click(object sender, EventArgs e)
|
private void loadSpriteMapToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadSpriteMapFromFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, SpriteMapRegion> LoadSpriteMapFromFile()
|
||||||
{
|
{
|
||||||
if (loadSpriteMapDialog.ShowDialog() == DialogResult.OK)
|
if (loadSpriteMapDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
@@ -247,7 +255,9 @@ namespace AnimationEditor
|
|||||||
|
|
||||||
EnableSpriteMapControls();
|
EnableSpriteMapControls();
|
||||||
EnableAnimationEditingControls();
|
EnableAnimationEditingControls();
|
||||||
|
return loadedSpriteMap;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animationPreview_FrameChanged(object sender, EventArgs e)
|
private void animationPreview_FrameChanged(object sender, EventArgs e)
|
||||||
@@ -478,5 +488,31 @@ namespace AnimationEditor
|
|||||||
UpdateAnimation();
|
UpdateAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateAnimationSpritesFromSpriteMapToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var loadedSpriteMap = LoadSpriteMapFromFile();
|
||||||
|
|
||||||
|
using(XmlReader xmlRead = XmlReader.Create(loadSpriteMapDialog.FileName))
|
||||||
|
{
|
||||||
|
loadedSpriteMap = IntermediateSerializer.Deserialize<Dictionary<string, SpriteMapRegion>>(xmlRead, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
int updateCounter = 0;
|
||||||
|
|
||||||
|
foreach(Animation anim in Animations)
|
||||||
|
{
|
||||||
|
foreach(Frame frame in anim.Frames)
|
||||||
|
{
|
||||||
|
if (loadedSpriteMap.ContainsKey(frame.Name))
|
||||||
|
{
|
||||||
|
frame.Sprite = loadedSpriteMap[frame.Name];
|
||||||
|
updateCounter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Updated " + updateCounter + " sprites!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user