From b2898a8eae7ccd4394bdd637332ac12fa522dc73 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 3 Aug 2022 10:37:59 +0200 Subject: [PATCH] Made RuntimeTexturePacker restore texture region name and pivot when packing --- CHANGELOG.md | 1 + MLEM.Data/RuntimeTexturePacker.cs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43f519f..b596bb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Improvements ### MLEM.Data Improvements - Allow data texture atlas pivots and offsets to be negative +- Made RuntimeTexturePacker restore texture region name and pivot when packing Fixes - Fixed data texture atlases not allowing most characters in their region names diff --git a/MLEM.Data/RuntimeTexturePacker.cs b/MLEM.Data/RuntimeTexturePacker.cs index ac1e901..9c55c3c 100644 --- a/MLEM.Data/RuntimeTexturePacker.cs +++ b/MLEM.Data/RuntimeTexturePacker.cs @@ -199,7 +199,10 @@ namespace MLEM.Data { // invoke callbacks foreach (var request in this.alreadyPackedTextures) { var packedArea = request.PackedArea.Shrink(new Point(request.Padding, request.Padding)); - request.Result.Invoke(new TextureRegion(this.PackedTexture, packedArea)); + request.Result.Invoke(new TextureRegion(this.PackedTexture, packedArea) { + Pivot = request.Texture.Pivot, + Name = request.Texture.Name + }); if (this.disposeTextures) request.Texture.Texture.Dispose(); }