Extensions & Frame Restructuring
Implemented Custom Extensions for SpriteMaps (*.smap), Animations (*.anim) and AnimationSets (*.animset). Also restructured Frame to be a container for SpriteMapRegions rather than an extension of them. This will enable easier access to updating them when loading SpriteMaps in the Editor.
This commit is contained in:
@@ -39,14 +39,20 @@
|
||||
<HintPath>..\packages\MonoGame.Forms.DX.2.1.0.2\lib\net451\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MonoGame.Forms.DX.2.1.0.2\lib\net451\SharpDX.dll</HintPath>
|
||||
<HintPath>..\packages\SharpDX.4.0.1\lib\net45\SharpDX.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX.Direct3D11, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MonoGame.Forms.DX.2.1.0.2\lib\net451\SharpDX.Direct3D11.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX.Direct3D9, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpDX.Direct3D9.4.0.1\lib\net45\SharpDX.Direct3D9.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX.DXGI, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MonoGame.Forms.DX.2.1.0.2\lib\net451\SharpDX.DXGI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX.Mathematics, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpDX.Mathematics.4.0.1\lib\net45\SharpDX.Mathematics.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
||||
Generated
+10
-6
@@ -88,9 +88,9 @@
|
||||
//
|
||||
// loadSpriteMapDialog
|
||||
//
|
||||
this.loadSpriteMapDialog.DefaultExt = "xml";
|
||||
this.loadSpriteMapDialog.DefaultExt = "smap";
|
||||
this.loadSpriteMapDialog.FileName = "openFileDialog1";
|
||||
this.loadSpriteMapDialog.Filter = "Xml Files|*.xml";
|
||||
this.loadSpriteMapDialog.Filter = "QUROGames SpriteMap|*smap";
|
||||
//
|
||||
// spriteListBox
|
||||
//
|
||||
@@ -321,17 +321,19 @@
|
||||
//
|
||||
// saveAnimationDialog
|
||||
//
|
||||
this.saveAnimationDialog.DefaultExt = "xml";
|
||||
this.saveAnimationDialog.Filter = "Xml Files|*.xml";
|
||||
this.saveAnimationDialog.DefaultExt = "anim";
|
||||
this.saveAnimationDialog.Filter = "QUROGames Animation|*.anim";
|
||||
//
|
||||
// saveAnimationSetDialog
|
||||
//
|
||||
this.saveAnimationSetDialog.DefaultExt = "xml";
|
||||
this.saveAnimationSetDialog.Filter = "Xml files|*.xml";
|
||||
this.saveAnimationSetDialog.DefaultExt = "animset";
|
||||
this.saveAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
|
||||
//
|
||||
// loadAnimationDialog
|
||||
//
|
||||
this.loadAnimationDialog.DefaultExt = "anim";
|
||||
this.loadAnimationDialog.FileName = "openFileDialog1";
|
||||
this.loadAnimationDialog.Filter = "QUROGames Animation|*.anim";
|
||||
//
|
||||
// addAnimationButton
|
||||
//
|
||||
@@ -497,7 +499,9 @@
|
||||
//
|
||||
// loadAnimationSetDialog
|
||||
//
|
||||
this.loadAnimationSetDialog.DefaultExt = "animset";
|
||||
this.loadAnimationSetDialog.FileName = "openFileDialog1";
|
||||
this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
|
||||
@@ -85,9 +85,12 @@ namespace AnimationEditor
|
||||
animationPreview.Enabled = true;
|
||||
}
|
||||
|
||||
private void InitiateAnimationList()
|
||||
private void InitiateAnimationList(bool newAnimation = true)
|
||||
{
|
||||
Animations = new BindingList<Animation>();
|
||||
if (newAnimation)
|
||||
Animations = new BindingList<Animation>() { new Animation() };
|
||||
else
|
||||
Animations = new BindingList<Animation>();
|
||||
animationBox.DataSource = Animations;
|
||||
animationBox.DisplayMember = "Name";
|
||||
}
|
||||
@@ -210,6 +213,7 @@ namespace AnimationEditor
|
||||
FileStream fileStream = new FileStream(loadSpriteSheetDialog.FileName, FileMode.Open);
|
||||
SpriteSheet = Texture2D.FromStream(animationPreview.Editor.graphics, fileStream);
|
||||
EnableMapAndAnimationLoadingControls();
|
||||
fileStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,6 +242,7 @@ namespace AnimationEditor
|
||||
Frames = new BindingList<Frame>();
|
||||
frameListBox.DataSource = Frames;
|
||||
frameListBox.DisplayMember = "Name";
|
||||
InitiateAnimationList();
|
||||
}
|
||||
|
||||
EnableSpriteMapControls();
|
||||
@@ -420,10 +425,10 @@ namespace AnimationEditor
|
||||
|
||||
private void saveAnimationSetToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var animSet = new Dictionary<string, Animation>();
|
||||
var animSet = new AnimationSet();
|
||||
foreach(Animation anim in Animations)
|
||||
{
|
||||
if (animSet.ContainsKey(anim.Name))
|
||||
if (animSet.Anims.ContainsKey(anim.Name))
|
||||
{
|
||||
string errorMessage = "Duplicate names found! Please ensure all animations have unique names.";
|
||||
string caption = "Save Aborted";
|
||||
@@ -434,7 +439,7 @@ namespace AnimationEditor
|
||||
}
|
||||
else
|
||||
{
|
||||
animSet.Add(anim.Name, anim);
|
||||
animSet.Add(anim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,19 +456,19 @@ namespace AnimationEditor
|
||||
{
|
||||
if (loadAnimationSetDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Dictionary<string, Animation> loadedAnimSet;
|
||||
AnimationSet loadedAnimSet;
|
||||
|
||||
using (XmlReader xmlRead = XmlReader.Create(loadAnimationSetDialog.FileName))
|
||||
{
|
||||
loadedAnimSet = IntermediateSerializer.Deserialize<Dictionary<string, Animation>>(xmlRead, null);
|
||||
loadedAnimSet = IntermediateSerializer.Deserialize<AnimationSet>(xmlRead, null);
|
||||
}
|
||||
|
||||
if (animationBox.Enabled == false)
|
||||
{
|
||||
EnableAnimationEditingControls();
|
||||
}
|
||||
InitiateAnimationList();
|
||||
foreach(KeyValuePair<string,Animation> currentEntry in loadedAnimSet)
|
||||
InitiateAnimationList(newAnimation: false);
|
||||
foreach(KeyValuePair<string,Animation> currentEntry in loadedAnimSet.Anims)
|
||||
{
|
||||
Animations.Add(currentEntry.Value);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MonoGame.Forms.DX" version="2.1.0.2" targetFramework="net451" />
|
||||
<package id="SharpDX" version="4.0.1" targetFramework="net451" />
|
||||
<package id="SharpDX.Direct3D9" version="4.0.1" targetFramework="net451" />
|
||||
<package id="SharpDX.Mathematics" version="4.0.1" targetFramework="net451" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user