Skip to content

Commit

Permalink
Fixed DataTextureAtlas creating unnamed entries if there are empty li…
Browse files Browse the repository at this point in the history
…nes at the start or end of the atlas file
  • Loading branch information
Ellpeck committed Nov 16, 2024
1 parent b0bf558 commit 3ab2466
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion MLEM.Data/DataTextureAtlas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static DataTextureAtlas LoadAtlasData(TextureRegion texture, ContentManag
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<string, string>();
Expand Down
8 changes: 8 additions & 0 deletions Tests/Content/Texture.atlas
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@



SimpleDeskUp
loc 0 0 48 32
piv 16 16
Expand All @@ -13,6 +16,10 @@ TestRegionNegativePivot
loc 0 32 +16 16
piv -32 +46





DataTest
loc 0 0 16 16
dat DataPoint1 ThisIsSomeData
Expand All @@ -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
Expand Down

0 comments on commit 3ab2466

Please sign in to comment.