From a012479fc4557ae9383afc17ce10b829abc27358 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Mon, 14 Jul 2025 23:44:21 -0400 Subject: [PATCH] [libgdx] Still compute RegionAttachment offsets when the region is null. This lets computeWorldVertices work even when there is no region, which can be useful. --- .../spine/attachments/RegionAttachment.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionAttachment.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionAttachment.java index d48e37907..261bcb9b0 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionAttachment.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionAttachment.java @@ -81,18 +81,6 @@ public class RegionAttachment extends Attachment implements HasTextureRegion { /** Calculates the {@link #offset} and {@link #uvs} 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 () { - 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 = getWidth(), height = getHeight(); float localX2 = width / 2; float localY2 = height / 2; @@ -137,7 +125,16 @@ public class RegionAttachment extends Attachment implements HasTextureRegion { offset[BRY] = localYCos + localX2Sin; float[] uvs = this.uvs; - if (rotated) { + 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.getU2(); uvs[BLY] = region.getV(); uvs[ULX] = region.getU2();