From 8940c6eaa25983d21ebfb1354924042574c2c3be Mon Sep 17 00:00:00 2001 From: Christopher Whitley Date: Sat, 30 Mar 2024 12:18:19 -0400 Subject: [PATCH 1/5] Added AsepriteDotNet --- .../FlatRedBall.FNA/FlatRedBall.FNA.csproj | 4 ++ .../Aseprite/AsepriteFile.Extensions.cs | 55 +++++++++++++++++++ .../ContentLoaders/AsepriteFileLoader.cs | 30 ++++++++++ .../FlatRedBall/Content/ContentManager.cs | 7 +++ .../FlatRedBall/FlatRedBallShared.projitems | 2 + .../FlatRedBallAndroid.csproj | 1 + .../FlatRedBallDesktopGLNet6.csproj | 2 +- .../FlatRedBalliOS/FlatRedBalliOS.csproj | 1 + 8 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 Engines/FlatRedBallXNA/FlatRedBall/Content/Aseprite/AsepriteFile.Extensions.cs create mode 100644 Engines/FlatRedBallXNA/FlatRedBall/Content/ContentLoaders/AsepriteFileLoader.cs diff --git a/Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj b/Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj index 8b01aa0b5..ffc8e3289 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj @@ -12,6 +12,10 @@ net7.0 + + + + diff --git a/Engines/FlatRedBallXNA/FlatRedBall/Content/Aseprite/AsepriteFile.Extensions.cs b/Engines/FlatRedBallXNA/FlatRedBall/Content/Aseprite/AsepriteFile.Extensions.cs new file mode 100644 index 000000000..a666cdd6b --- /dev/null +++ b/Engines/FlatRedBallXNA/FlatRedBall/Content/Aseprite/AsepriteFile.Extensions.cs @@ -0,0 +1,55 @@ +using AsepriteDotNet.Aseprite; +using AsepriteDotNet.Processors; +using FlatRedBall.Graphics.Animation; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Text; +using AseSpriteSheet = AsepriteDotNet.SpriteSheet; +using AseTexture = AsepriteDotNet.Texture; +using AseTag = AsepriteDotNet.AnimationTag; +using AseAnimationFrame = AsepriteDotNet.AnimationFrame; +using AseRect = AsepriteDotNet.Common.Rectangle; + +namespace FlatRedBall.Content.Aseprite +{ + public static class AsepriteFileExtensions + { + public static AnimationChainList ToAnimationChainList(this AsepriteFile file) + { + + // Generate the Aseprite Spritesheet + AseSpriteSheet spriteSheet = SpriteSheetProcessor.Process(file); + AseTexture aseTexture = spriteSheet.TextureAtlas.Texture; + + // Create the MonoGame Texture2D from the Aseprite Spritesheet + Texture2D texture = new Texture2D(FlatRedBallServices.GraphicsDevice, aseTexture.Size.Width, aseTexture.Size.Height); + texture.SetData(aseTexture.Pixels.ToArray()); + + // Create an AnimationChainList based on the Aseprite spritesheet + AnimationChainList list = new AnimationChainList(spriteSheet.Tags.Length); + for (int i = 0; i < spriteSheet.Tags.Length; i++) + { + AseTag tag = spriteSheet.Tags[i]; + Graphics.Animation.AnimationChain chain = new Graphics.Animation.AnimationChain(tag.Frames.Length); + for (int j = 0; j < tag.Frames.Length; j++) + { + AseAnimationFrame aseFrame = tag.Frames[j]; + AnimationFrame frame = new AnimationFrame(texture, (float)aseFrame.Duration.TotalSeconds); + + AseRect bounds = spriteSheet.TextureAtlas.Regions[aseFrame.FrameIndex].Bounds; + frame.TopCoordinate = bounds.Location.Y / (float)texture.Height; + frame.LeftCoordinate = bounds.Location.X / (float)texture.Width; + frame.BottomCoordinate = frame.TopCoordinate + (bounds.Size.Height / (float)texture.Height); + frame.RightCoordinate = frame.LeftCoordinate + (bounds.Size.Width / (float)texture.Width); + + chain.Add(frame); + } + chain.Name = tag.Name; + list.Add(chain); + } + + return list; + } + } +} diff --git a/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentLoaders/AsepriteFileLoader.cs b/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentLoaders/AsepriteFileLoader.cs new file mode 100644 index 000000000..fe7da5d85 --- /dev/null +++ b/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentLoaders/AsepriteFileLoader.cs @@ -0,0 +1,30 @@ + +using AsepriteDotNet.Aseprite; +using AsepriteDotNet.IO; +using AsepriteDotNet.Processors; +using FlatRedBall.Graphics.Animation; +using FlatRedBall.IO; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace FlatRedBall.Content.ContentLoaders +{ + public static class AsepriteFileLoader + { + public static AsepriteFile Load(string absoluteFileName) + { + // Load the aseprite file + AsepriteFile aseFile; + using (Stream titleStream = FileManager.GetStreamForFile(absoluteFileName)) + { + string name = Path.GetFileNameWithoutExtension(absoluteFileName); + aseFile = AsepriteDotNet.IO.AsepriteFileLoader.FromStream(name, titleStream); + } + + return aseFile; + } + } +} diff --git a/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentManager.cs b/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentManager.cs index 3a9d7e64d..3272606c3 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentManager.cs +++ b/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentManager.cs @@ -50,6 +50,7 @@ using FlatRedBall.Content.ContentLoaders; using FlatRedBall.Performance.Measurement; using FlatRedBall.IO; +using FlatRedBall.Content.Aseprite; namespace FlatRedBall.Content { @@ -670,6 +671,12 @@ public T LoadFromFile(string assetName) //acl[0].ParentGifFileName = assetName; //loadedAsset = acl; } +#if NET6_0_OR_GREATER + else if(assetName.EndsWith("aseprite")) + { + loadedAsset = AsepriteFileLoader.Load(assetName).ToAnimationChainList(); + } +#endif else { loadedAsset = diff --git a/Engines/FlatRedBallXNA/FlatRedBall/FlatRedBallShared.projitems b/Engines/FlatRedBallXNA/FlatRedBall/FlatRedBallShared.projitems index 2663262d9..2a4b4b8bf 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall/FlatRedBallShared.projitems +++ b/Engines/FlatRedBallXNA/FlatRedBall/FlatRedBallShared.projitems @@ -36,6 +36,8 @@ + + diff --git a/Engines/FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj b/Engines/FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj index ab12051ea..aeb358b64 100644 --- a/Engines/FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj @@ -25,6 +25,7 @@ + diff --git a/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj b/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj index 38a4488d5..669603342 100644 --- a/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj @@ -12,7 +12,7 @@ + - diff --git a/Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj b/Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj index ee4410344..2f4669f30 100644 --- a/Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj @@ -19,6 +19,7 @@ + From 5fe9709bebd343b833570283a50813a5340053da Mon Sep 17 00:00:00 2001 From: Victor Chelaru Date: Sat, 30 Mar 2024 11:56:49 -0600 Subject: [PATCH 2/5] Fixed some compile errors on non-.NET 6 platforms. Added .aseprite support in the FRB editor --- .../Aseprite/AsepriteFile.Extensions.cs | 42 +++++++++++++- .../ContentLoaders/AsepriteFileLoader.cs | 4 +- .../FlatRedBall/Content/ContentManager.cs | 9 ++- .../Aseprite/AsepriteAnimationChainLoader.cs | 57 +++++++++++++++++++ FRBDK/Glue/Glue/EditorData.cs | 3 +- ...AvailableAnimationChainsStringConverter.cs | 29 ++++++++-- FRBDK/Glue/Glue/GlueFormsCore.csproj | 1 + .../Errors/AnimationChainErrorReporter.cs | 18 ++++-- .../MainAnimationChainPlugin.cs | 16 +++++- .../Managers/AssetTypeInfoManager.cs | 42 ++++++++++++++ .../OfficialPluginsCore.csproj | 1 + 11 files changed, 205 insertions(+), 17 deletions(-) create mode 100644 FRBDK/Glue/Glue/Content/Aseprite/AsepriteAnimationChainLoader.cs create mode 100644 FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/Managers/AssetTypeInfoManager.cs diff --git a/Engines/FlatRedBallXNA/FlatRedBall/Content/Aseprite/AsepriteFile.Extensions.cs b/Engines/FlatRedBallXNA/FlatRedBall/Content/Aseprite/AsepriteFile.Extensions.cs index a666cdd6b..bee54aab9 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall/Content/Aseprite/AsepriteFile.Extensions.cs +++ b/Engines/FlatRedBallXNA/FlatRedBall/Content/Aseprite/AsepriteFile.Extensions.cs @@ -1,4 +1,5 @@ -using AsepriteDotNet.Aseprite; +#if NET6_0_OR_GREATER +using AsepriteDotNet.Aseprite; using AsepriteDotNet.Processors; using FlatRedBall.Graphics.Animation; using Microsoft.Xna.Framework.Graphics; @@ -10,6 +11,8 @@ using AseTag = AsepriteDotNet.AnimationTag; using AseAnimationFrame = AsepriteDotNet.AnimationFrame; using AseRect = AsepriteDotNet.Common.Rectangle; +using FlatRedBall.Content.AnimationChain; +using AsepriteDotNet; namespace FlatRedBall.Content.Aseprite { @@ -35,7 +38,7 @@ public static AnimationChainList ToAnimationChainList(this AsepriteFile file) for (int j = 0; j < tag.Frames.Length; j++) { AseAnimationFrame aseFrame = tag.Frames[j]; - AnimationFrame frame = new AnimationFrame(texture, (float)aseFrame.Duration.TotalSeconds); + var frame = new Graphics.Animation.AnimationFrame(texture, (float)aseFrame.Duration.TotalSeconds); AseRect bounds = spriteSheet.TextureAtlas.Regions[aseFrame.FrameIndex].Bounds; frame.TopCoordinate = bounds.Location.Y / (float)texture.Height; @@ -51,5 +54,40 @@ public static AnimationChainList ToAnimationChainList(this AsepriteFile file) return list; } + + public static AnimationChainListSave ToAnimationChainListSave(this AsepriteFile file) + { + AseSpriteSheet spriteSheet = SpriteSheetProcessor.Process(file); + + AnimationChainListSave list = new AnimationChainListSave(); + AseTexture aseTexture = spriteSheet.TextureAtlas.Texture; + var width = aseTexture.Size.Width; + var height = aseTexture.Size.Height; + for (int i = 0; i < spriteSheet.Tags.Length; i++) + { + AseTag tag = spriteSheet.Tags[i]; + + var chain = new AnimationChainSave(); + + for (int j = 0; j < tag.Frames.Length; j++) + { + AseAnimationFrame aseFrame = tag.Frames[j]; + AnimationFrameSave animationFrameSave = new AnimationFrameSave(); + + + AseRect bounds = spriteSheet.TextureAtlas.Regions[aseFrame.FrameIndex].Bounds; + animationFrameSave.TopCoordinate = bounds.Location.Y / (float)width; + animationFrameSave.LeftCoordinate = bounds.Location.X / (float)width; + animationFrameSave.BottomCoordinate = animationFrameSave.TopCoordinate + (bounds.Size.Height / (float)height); + animationFrameSave.RightCoordinate = animationFrameSave.LeftCoordinate + (bounds.Size.Width / (float)height); + } + + chain.Name = tag.Name; + list.AnimationChains.Add(chain); + } + return list; + } + } } +#endif \ No newline at end of file diff --git a/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentLoaders/AsepriteFileLoader.cs b/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentLoaders/AsepriteFileLoader.cs index fe7da5d85..8c67382e2 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentLoaders/AsepriteFileLoader.cs +++ b/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentLoaders/AsepriteFileLoader.cs @@ -1,4 +1,5 @@ - +#if NET6_0_OR_GREATER + using AsepriteDotNet.Aseprite; using AsepriteDotNet.IO; using AsepriteDotNet.Processors; @@ -28,3 +29,4 @@ public static AsepriteFile Load(string absoluteFileName) } } } +#endif \ No newline at end of file diff --git a/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentManager.cs b/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentManager.cs index 3272606c3..458755fec 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentManager.cs +++ b/Engines/FlatRedBallXNA/FlatRedBall/Content/ContentManager.cs @@ -50,7 +50,10 @@ using FlatRedBall.Content.ContentLoaders; using FlatRedBall.Performance.Measurement; using FlatRedBall.IO; + +#if NET6_0_OR_GREATER using FlatRedBall.Content.Aseprite; +#endif namespace FlatRedBall.Content { @@ -672,13 +675,13 @@ public T LoadFromFile(string assetName) //loadedAsset = acl; } #if NET6_0_OR_GREATER - else if(assetName.EndsWith("aseprite")) + else if(assetName.EndsWith("aseprite") || assetName.EndsWith("ase")) { loadedAsset = AsepriteFileLoader.Load(assetName).ToAnimationChainList(); } #endif - else - { + else + { loadedAsset = AnimationChainListSave.FromFile(assetName).ToAnimationChainList(mName); diff --git a/FRBDK/Glue/Glue/Content/Aseprite/AsepriteAnimationChainLoader.cs b/FRBDK/Glue/Glue/Content/Aseprite/AsepriteAnimationChainLoader.cs new file mode 100644 index 000000000..1e9c0b65a --- /dev/null +++ b/FRBDK/Glue/Glue/Content/Aseprite/AsepriteAnimationChainLoader.cs @@ -0,0 +1,57 @@ +using AsepriteDotNet.Aseprite; +using AsepriteDotNet.IO; +using AsepriteDotNet.Processors; +using FlatRedBall.Content.AnimationChain; +using FlatRedBall.IO; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlatRedBall.Glue.Content.Aseprite +{ + public class AsepriteAnimationChainLoader + { + public static AnimationChainListSave ToAnimationChainListSave(FilePath filePath) + { + var asepriteFile = AsepriteFileLoader.FromFile(filePath.FullPath); + return ToAnimationChainListSave(asepriteFile); + } + private static AnimationChainListSave ToAnimationChainListSave(AsepriteFile file) + { + var spriteSheet = SpriteSheetProcessor.Process(file); + + AnimationChainListSave list = new AnimationChainListSave(); + var aseTexture = spriteSheet.TextureAtlas.Texture; + var width = aseTexture.Size.Width; + var height = aseTexture.Size.Height; + for (int i = 0; i < spriteSheet.Tags.Length; i++) + { + var tag = spriteSheet.Tags[i]; + + var chain = new AnimationChainSave(); + + for (int j = 0; j < tag.Frames.Length; j++) + { + var aseFrame = tag.Frames[j]; + AnimationFrameSave animationFrameSave = new AnimationFrameSave(); + + + var bounds = spriteSheet.TextureAtlas.Regions[aseFrame.FrameIndex].Bounds; + animationFrameSave.TopCoordinate = bounds.Location.Y / (float)width; + animationFrameSave.LeftCoordinate = bounds.Location.X / (float)width; + animationFrameSave.BottomCoordinate = animationFrameSave.TopCoordinate + (bounds.Size.Height / (float)height); + animationFrameSave.RightCoordinate = animationFrameSave.LeftCoordinate + (bounds.Size.Width / (float)height); + } + + chain.Name = tag.Name; + list.AnimationChains.Add(chain); + } + return list; + } + + + + } +} diff --git a/FRBDK/Glue/Glue/EditorData.cs b/FRBDK/Glue/Glue/EditorData.cs index fef77a044..91b9f4e77 100644 --- a/FRBDK/Glue/Glue/EditorData.cs +++ b/FRBDK/Glue/Glue/EditorData.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/FRBDK/Glue/Glue/FormHelpers/StringConverters/AvailableAnimationChainsStringConverter.cs b/FRBDK/Glue/Glue/FormHelpers/StringConverters/AvailableAnimationChainsStringConverter.cs index 39a2a9160..1e31acc27 100644 --- a/FRBDK/Glue/Glue/FormHelpers/StringConverters/AvailableAnimationChainsStringConverter.cs +++ b/FRBDK/Glue/Glue/FormHelpers/StringConverters/AvailableAnimationChainsStringConverter.cs @@ -11,6 +11,12 @@ using FlatRedBall.Content.SpriteFrame; using GluePropertyGridClasses.StringConverters; using FlatRedBall.Glue.Plugins.ExportedImplementations; +using AsepriteDotNet.Aseprite; +using AsepriteDotNet.Processors; +using System.Formats.Asn1; +using FlatRedBall.IO; +using AsepriteDotNet.IO; +using FlatRedBall.Glue.Content.Aseprite; namespace FlatRedBall.Glue.GuiDisplay { @@ -216,12 +222,19 @@ private static AnimationChainListSave LoadAnimationChainListSave(IElement elemen if (rfs != null) { - string fullFileName = GlueState.Self.ContentDirectory + rfs.Name; + FilePath filePath = GlueState.Self.ContentDirectory + rfs.Name; - if (System.IO.File.Exists(fullFileName)) + if (filePath.Exists()) { - acls = AnimationChainListSave.FromFile( - fullFileName); + var extension = filePath.Extension; + if(extension == "aseprite") + { + acls = AsepriteAnimationChainLoader.ToAnimationChainListSave(filePath); + } + else + { + acls = AnimationChainListSave.FromFile(filePath.FullPath); + } } } return acls; @@ -279,6 +292,12 @@ public override StandardValuesCollection StandardValuesCollection svc = new StandardValuesCollection(mAvailableChains); return svc; - } + } + + + + + + } } diff --git a/FRBDK/Glue/Glue/GlueFormsCore.csproj b/FRBDK/Glue/Glue/GlueFormsCore.csproj index 3cd8ac591..8d550d5f3 100644 --- a/FRBDK/Glue/Glue/GlueFormsCore.csproj +++ b/FRBDK/Glue/Glue/GlueFormsCore.csproj @@ -164,6 +164,7 @@ + diff --git a/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/Errors/AnimationChainErrorReporter.cs b/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/Errors/AnimationChainErrorReporter.cs index 91ebb8bb5..79cb67ef6 100644 --- a/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/Errors/AnimationChainErrorReporter.cs +++ b/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/Errors/AnimationChainErrorReporter.cs @@ -1,4 +1,5 @@ using FlatRedBall.Content.AnimationChain; +using FlatRedBall.Glue.Content.Aseprite; using FlatRedBall.Glue.Errors; using FlatRedBall.Glue.Plugins.ExportedImplementations; using FlatRedBall.Glue.SaveClasses; @@ -41,16 +42,25 @@ void AddBadReferencesFrom(GlueElement glueElement) if(rfs != null) { - var fullFile = GlueCommands.Self.GetAbsoluteFileName(rfs); + var filePath = GlueCommands.Self.GetAbsoluteFilePath(rfs); - if(System.IO.File.Exists( fullFile)) + if(filePath.Exists()) { - AnimationChainListSave achSave = AnimationChainListSave.FromFile(fullFile); + AnimationChainListSave achSave = null; + + if(filePath.Extension == "aseprite") + { + achSave = AsepriteAnimationChainLoader.ToAnimationChainListSave(filePath); + } + else + { + achSave = AnimationChainListSave.FromFile(filePath.FullPath); + } if(achSave.AnimationChains.Any(item => item.Name == animationChainName) == false) { var error = new AnimationReferenceErrorViewModel( - fullFile, namedObject, animationChainName); + filePath.FullPath, namedObject, animationChainName); errors.Add(error); } diff --git a/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/MainAnimationChainPlugin.cs b/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/MainAnimationChainPlugin.cs index 8670dac70..57c57db87 100644 --- a/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/MainAnimationChainPlugin.cs +++ b/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/MainAnimationChainPlugin.cs @@ -46,7 +46,6 @@ public override void StartUp() this.AddErrorReporter(new AnimationChainErrorReporter()); AchxManager.Initialize(this); - } private void AssignEvents() @@ -56,7 +55,22 @@ private void AssignEvents() this.ReactToNamedObjectChangedValue += NamedObjectVariableChangeLogic.HandleNamedObjectChangedValue; this.TryHandleTreeNodeDoubleClicked += TryHandleDoubleClick; this.ReactToItemSelectHandler += HandleTreeViewItemSelected; + this.ReactToLoadedGluxEarly += HandleLoadedGluxEarly; + this.ReactToUnloadedGlux += HandleUnloadedGlux; + } + + private void HandleLoadedGluxEarly() + { + var ati = AssetTypeInfoManager.Self.TryGetAsepriteAti(); + if(ati != null) + { + base.AddAssetTypeInfo(ati); + } + } + private void HandleUnloadedGlux() + { + base.UnregisterAssetTypeInfos(); } private bool TryHandleDoubleClick(ITreeNode tree) diff --git a/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/Managers/AssetTypeInfoManager.cs b/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/Managers/AssetTypeInfoManager.cs new file mode 100644 index 000000000..4ad015e75 --- /dev/null +++ b/FRBDK/Glue/OfficialPlugins/AnimationChainPlugin/Managers/AssetTypeInfoManager.cs @@ -0,0 +1,42 @@ +using FlatRedBall.Glue.Elements; +using FlatRedBall.Glue.Managers; +using FlatRedBall.Glue.Plugins.ExportedImplementations; +using FlatRedBall.IO; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OfficialPlugins.AnimationChainPlugin.Managers +{ + internal class AssetTypeInfoManager : Singleton + { + /// + /// Returns an AssetTypeInfo for the Aseprite + /// file extension if the project is using .NET 6 or greater. + /// + /// The AssetTypeInfo if created, otherwise null. + internal AssetTypeInfo TryGetAsepriteAti() + { + var project = GlueState.Self.CurrentMainProject; + var netVersion = project.DotNetVersion; + if (netVersion.Major >= 6) + { + var achxAti = AvailableAssetTypes.Self.GetAssetTypeFromExtension("achx"); + + var clone = FileManager.CloneObject(achxAti); + + clone.FriendlyName = "Aseprite Animation Chain"; + clone.Extension = "aseprite"; + return clone; + } + else + { + return null; + } + + + } + } +} diff --git a/FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj b/FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj index 1bae4c5cb..c1f35d586 100644 --- a/FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj +++ b/FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj @@ -95,6 +95,7 @@ + From 215b490193d466c18b879a48822ece77755cf4fe Mon Sep 17 00:00:00 2001 From: Victor Chelaru Date: Sat, 30 Mar 2024 12:12:06 -0600 Subject: [PATCH 3/5] Removed PrivateAssets All --- .../FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj b/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj index 669603342..3180f75a9 100644 --- a/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj @@ -12,7 +12,7 @@ - + From ca31cb5a348b2d4f5c25b4697786b5cc51a24856 Mon Sep 17 00:00:00 2001 From: Victor Date: Sat, 6 Apr 2024 11:16:24 -0600 Subject: [PATCH 4/5] Added docs about MDB GetQuadIndex --- .../FlatRedBall.TileGraphics/MapDrawableBatch.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Engines/FlatRedBallAddOns/FlatRedBall.TileGraphics/FlatRedBall.TileGraphics/MapDrawableBatch.cs b/Engines/FlatRedBallAddOns/FlatRedBall.TileGraphics/FlatRedBall.TileGraphics/MapDrawableBatch.cs index 2d23a775a..2f4df89ea 100644 --- a/Engines/FlatRedBallAddOns/FlatRedBall.TileGraphics/FlatRedBall.TileGraphics/MapDrawableBatch.cs +++ b/Engines/FlatRedBallAddOns/FlatRedBall.TileGraphics/FlatRedBall.TileGraphics/MapDrawableBatch.cs @@ -969,6 +969,7 @@ public void GetBottomLeftWorldCoordinateForOrderedTile(int orderedTileIndex, out /// /// Returns the quad index at the argument worldX and worldY. Returns null if no quad is found at this index. + /// If the map has a SortAxis of X or Y, then this funcion uses the sorting to find the quad more quickly. /// /// The absolute world X position. /// The absolute world Y position. From 2efaf36579bd3663def553a5cefe400276a6126a Mon Sep 17 00:00:00 2001 From: Victor Chelaru Date: Sat, 6 Apr 2024 18:27:37 -0600 Subject: [PATCH 5/5] Upped asepritedotnet to 1.7.4 --- Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj | 2 +- .../FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj | 2 +- .../FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj | 2 +- Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj | 2 +- FRBDK/Glue/Glue/GlueFormsCore.csproj | 2 +- FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj b/Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj index 1c57de1a8..d7a954fd6 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj @@ -15,7 +15,7 @@ - + diff --git a/Engines/FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj b/Engines/FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj index 6aeaf1ecc..1ea62accd 100644 --- a/Engines/FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBallAndroid/FlatRedBallAndroid.csproj @@ -34,7 +34,7 @@ - + diff --git a/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj b/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj index fcfb88f16..9e0e828f5 100644 --- a/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj @@ -14,7 +14,7 @@ - + diff --git a/Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj b/Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj index 77f3cd992..84a95c249 100644 --- a/Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj +++ b/Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj @@ -25,7 +25,7 @@ - + diff --git a/FRBDK/Glue/Glue/GlueFormsCore.csproj b/FRBDK/Glue/Glue/GlueFormsCore.csproj index 8d550d5f3..eefbef537 100644 --- a/FRBDK/Glue/Glue/GlueFormsCore.csproj +++ b/FRBDK/Glue/Glue/GlueFormsCore.csproj @@ -164,7 +164,7 @@ - + diff --git a/FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj b/FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj index c1f35d586..37439793e 100644 --- a/FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj +++ b/FRBDK/Glue/OfficialPlugins/OfficialPluginsCore.csproj @@ -95,7 +95,7 @@ - +