From 72647a2edf4e5ca8f929dbd592ee7e6be9e8704d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 2 Aug 2022 23:02:34 +0200 Subject: [PATCH] Fixed data texture atlases not allowing most characters in their region names --- CHANGELOG.md | 4 ++++ MLEM.Data/DataTextureAtlas.cs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b68c9..0a267aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ Improvements - Allow elements to auto-adjust their size even when their children are aligned oddly - Close other dropdowns when opening a dropdown +### MLEM.Data +Fixes +- Fixed data texture atlases not allowing most characters in their region names + ## 6.0.0 ### MLEM Additions diff --git a/MLEM.Data/DataTextureAtlas.cs b/MLEM.Data/DataTextureAtlas.cs index 1f0efa9..18cbd95 100644 --- a/MLEM.Data/DataTextureAtlas.cs +++ b/MLEM.Data/DataTextureAtlas.cs @@ -86,7 +86,7 @@ namespace MLEM.Data { var atlas = new DataTextureAtlas(texture); // parse each texture region: " loc [piv ] [off ]" - foreach (Match match in Regex.Matches(text, @"(.+)\W+loc\W+([0-9]+)\W+([0-9]+)\W+([0-9]+)\W+([0-9]+)\W*(?:piv\W+([0-9.]+)\W+([0-9.]+))?\W*(?:off\W+([0-9.]+)\W+([0-9.]+))?")) { + foreach (Match match in Regex.Matches(text, @"(.+)\s+loc\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s*(?:piv\s+([0-9.]+)\s+([0-9.]+))?\s*(?:off\s+([0-9.]+)\s+([0-9.]+))?")) { // offset var off = !match.Groups[8].Success ? Vector2.Zero : new Vector2( float.Parse(match.Groups[8].Value, CultureInfo.InvariantCulture), @@ -103,7 +103,7 @@ namespace MLEM.Data { float.Parse(match.Groups[6].Value, CultureInfo.InvariantCulture) - (pivotRelative ? 0 : loc.X), float.Parse(match.Groups[7].Value, CultureInfo.InvariantCulture) - (pivotRelative ? 0 : loc.Y)); - foreach (var name in Regex.Split(match.Groups[1].Value, @"\W")) { + foreach (var name in Regex.Split(match.Groups[1].Value, @"\s")) { var trimmed = name.Trim(); if (trimmed.Length <= 0) continue;