diff --git a/CHANGELOG.md b/CHANGELOG.md index 474d8af..372aca3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,10 @@ Improvements Fixes - Fixed paragraph links having incorrect hover locations when using special text alignments +### MLEM.Extended +Improvements +- Preserve texture region names when converting between MLEM and MG.Extended + ### MLEM.Data Improvements - Rethrow exceptions when no RawContentManager readers could be constructed diff --git a/MLEM.Extended/Extensions/TextureExtensions.cs b/MLEM.Extended/Extensions/TextureExtensions.cs index 765c8cb..6ad5509 100644 --- a/MLEM.Extended/Extensions/TextureExtensions.cs +++ b/MLEM.Extended/Extensions/TextureExtensions.cs @@ -23,7 +23,7 @@ namespace MLEM.Extended.Extensions { /// The nine patch to convert /// The converted nine patch public static TextureRegion2D ToExtended(this TextureRegion region) { - return new TextureRegion2D(region.Texture, region.U, region.V, region.Width, region.Height); + return new TextureRegion2D(region.Name, region.Texture, region.U, region.V, region.Width, region.Height); } /// @@ -32,7 +32,7 @@ namespace MLEM.Extended.Extensions { /// The nine patch to convert /// The converted nine patch public static NinePatch ToMlem(this NinePatchRegion2D patch) { - return new NinePatch(new TextureRegion(patch.Texture, patch.Bounds), patch.LeftPadding, patch.RightPadding, patch.TopPadding, patch.BottomPadding); + return new NinePatch(((TextureRegion2D) patch).ToMlem(), patch.LeftPadding, patch.RightPadding, patch.TopPadding, patch.BottomPadding); } /// @@ -41,7 +41,7 @@ namespace MLEM.Extended.Extensions { /// The nine patch to convert /// The converted nine patch public static TextureRegion ToMlem(this TextureRegion2D region) { - return new TextureRegion(region.Texture, region.Bounds); + return new TextureRegion(region.Texture, region.Bounds) {Name = region.Name}; } }