From 95a70cf8cd57663abcfda5d08f956eb6f4e150f3 Mon Sep 17 00:00:00 2001 From: MattN-L Date: Sat, 16 Mar 2024 00:03:26 -0400 Subject: [PATCH] Fix for nonuniform tile images being incorrectly set --- PCK-Studio/Forms/Editor/TextureAtlasEditor.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs b/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs index 68f24c98..ef19a899 100644 --- a/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs +++ b/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs @@ -390,11 +390,13 @@ namespace PckStudio.Forms.Editor g.DrawImage(texture, dataTile.Area); } + var _finalTexture = _workingTexture.GetArea(new Rectangle(dataTile.Area.X, dataTile.Area.Y, dataTile.Area.Width, dataTile.Area.Height)); + if(_selectedTile != dataTile) - _tiles[dataTile.Index] = new AtlasTile(dataTile.Index, dataTile.Area, dataTile.Tile, texture); + _tiles[dataTile.Index] = new AtlasTile(dataTile.Index, dataTile.Area, dataTile.Tile, _finalTexture); else - _tiles[_selectedTile.Index] = new AtlasTile(_selectedTile.Index, _selectedTile.Area, _selectedTile.Tile, texture); - selectTilePictureBox.Image = texture; + _tiles[_selectedTile.Index] = new AtlasTile(_selectedTile.Index, _selectedTile.Area, _selectedTile.Tile, _finalTexture); + selectTilePictureBox.Image = _finalTexture; UpdateAtlasDisplay(); }