From dae00a2b1b56c7baa69ce89827d88d39480f10bd Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 15 Jul 2025 18:45:51 +0200 Subject: [PATCH] [csharp] Port of commit a012479: Still compute RegionAttachment offsets when the region is null. Closes #2887. --- .../src/Attachments/RegionAttachment.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/spine-csharp/src/Attachments/RegionAttachment.cs b/spine-csharp/src/Attachments/RegionAttachment.cs index 125f992ab..b46dda9a4 100644 --- a/spine-csharp/src/Attachments/RegionAttachment.cs +++ b/spine-csharp/src/Attachments/RegionAttachment.cs @@ -109,19 +109,6 @@ namespace Spine { /// Calculates the and using the region and the attachment's transform. Must be called if the /// region, the region's properties, or the transform are changed. public void UpdateRegion () { - float[] uvs = this.uvs; - if (region == null) { - uvs[BLX] = 0; - uvs[BLY] = 0; - uvs[ULX] = 0; - uvs[ULY] = 1; - uvs[URX] = 1; - uvs[URY] = 1; - uvs[BRX] = 1; - uvs[BRY] = 0; - return; - } - float width = Width, height = Height; float localX2 = width / 2; float localY2 = height / 2; @@ -166,7 +153,17 @@ namespace Spine { offset[BRX] = localX2Cos - localYSin; offset[BRY] = localYCos + localX2Sin; - if (rotated) { + float[] uvs = this.uvs; + if (region == null) { + uvs[BLX] = 0; + uvs[BLY] = 0; + uvs[ULX] = 0; + uvs[ULY] = 1; + uvs[URX] = 1; + uvs[URY] = 1; + uvs[BRX] = 1; + uvs[BRY] = 0; + } else if (rotated) { uvs[BLX] = region.u2; uvs[BLY] = region.v; uvs[ULX] = region.u2;