diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e451f8..e48fcbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,9 @@ Improvements - **Use a binary tree algorithm for RuntimeTexturePacker to vastly increase packing speed** - Made fields and methods in StaticJsonConverter protected to allow extending it +Fixes +- Fixed DataTextureAtlas creating unnamed entries if there are empty lines at the start or end of the atlas file + ## 7.1.1 ### MLEM diff --git a/MLEM.Data/DataTextureAtlas.cs b/MLEM.Data/DataTextureAtlas.cs index c1bd120..d5da786 100644 --- a/MLEM.Data/DataTextureAtlas.cs +++ b/MLEM.Data/DataTextureAtlas.cs @@ -104,7 +104,7 @@ namespace MLEM.Data { throw new ContentLoadException($"Couldn't load data texture atlas data from {info}", e); } var atlas = new DataTextureAtlas(texture); - var words = Regex.Split(text, @"\s+"); + var words = Regex.Split(text.Trim(), @"\s+"); var namesOffsets = new List<(string, Vector2)>(); var customData = new Dictionary(); diff --git a/Tests/Content/Texture.atlas b/Tests/Content/Texture.atlas index a3c47f2..f1bea33 100644 --- a/Tests/Content/Texture.atlas +++ b/Tests/Content/Texture.atlas @@ -1,3 +1,6 @@ + + + SimpleDeskUp loc 0 0 48 32 piv 16 16 @@ -13,6 +16,10 @@ TestRegionNegativePivot loc 0 32 +16 16 piv -32 +46 + + + + DataTest loc 0 0 16 16 dat DataPoint1 ThisIsSomeData @@ -27,6 +34,7 @@ cpy Copy2 32 4 Copy3 from LongTableUp off 2 4 + LongTableRight LongTableDown LongTableLeft location 32 30 64 48 piv 80 46