From 537978eb0a6158ee5762d84b054e530d6f0649b7 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Tue, 13 Sep 2022 18:07:49 -0400 Subject: [PATCH 1/3] [libgdx] Fixed Skeleton Viewer not closing in some cases. --- .../src/com/esotericsoftware/spine/SkeletonViewer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java b/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java index fd0c13f5e..da939e090 100644 --- a/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java +++ b/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java @@ -352,6 +352,11 @@ public class SkeletonViewer extends ApplicationAdapter { if (!ui.minimizeButton.isChecked()) ui.window.setHeight(height / uiScale + 8); } + public void dispose () { + super.dispose(); + Runtime.getRuntime().exit(0); + } + static public void main (String[] args) throws Exception { try { // Try to turn off illegal access log messages. Class loggerClass = Class.forName("jdk.internal.module.IllegalAccessLogger"); From d6adbe96d8af8ad19aaf9203434fb0e78d35e88a Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Tue, 13 Sep 2022 18:12:31 -0400 Subject: [PATCH 2/3] [libgdx] Allow calling RegionAttachment#updateRegion when region is null. Mesh already allows this. SkeletonJson/Binary call `updateRegion` when the sequence is null, which fails before this commit if the attachment loader doesn't set a region. That is a valid usecase, eg to set regions later. This also orders setting the UVs array indices to 0-7. --- .../spine/attachments/RegionAttachment.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 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 8bfa883d1..5b439df7d 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,6 +81,18 @@ 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] = 1; + uvs[ULY] = 1; + uvs[URX] = 1; + uvs[URY] = 1; + uvs[BRX] = 1; + uvs[BRY] = 0; + return; + } + float width = getWidth(); float height = getHeight(); float localX2 = width / 2; @@ -132,23 +144,23 @@ public class RegionAttachment extends Attachment implements HasTextureRegion { float[] uvs = this.uvs; if (rotated) { - uvs[URX] = region.getU(); - uvs[URY] = region.getV2(); - uvs[BRX] = region.getU(); - uvs[BRY] = region.getV(); uvs[BLX] = region.getU2(); uvs[BLY] = region.getV(); uvs[ULX] = region.getU2(); uvs[ULY] = region.getV2(); + uvs[URX] = region.getU(); + uvs[URY] = region.getV2(); + uvs[BRX] = region.getU(); + uvs[BRY] = region.getV(); } else { + uvs[BLX] = region.getU2(); + uvs[BLY] = region.getV2(); uvs[ULX] = region.getU(); uvs[ULY] = region.getV2(); uvs[URX] = region.getU(); uvs[URY] = region.getV(); uvs[BRX] = region.getU2(); uvs[BRY] = region.getV(); - uvs[BLX] = region.getU2(); - uvs[BLY] = region.getV2(); } } From 926612b1047ab1d795e2fd62b4265d64377912ad Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 14 Sep 2022 10:51:41 +0200 Subject: [PATCH 3/3] [c] Fix compiler warning/error on MSVC 2019 v16.11.18 --- spine-c/spine-c/src/spine/SkeletonBinary.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spine-c/spine-c/src/spine/SkeletonBinary.c b/spine-c/spine-c/src/spine/SkeletonBinary.c index 50c7f3690..406c7f389 100644 --- a/spine-c/spine-c/src/spine/SkeletonBinary.c +++ b/spine-c/spine-c/src/spine/SkeletonBinary.c @@ -128,7 +128,8 @@ static int readVarint(_dataInput *input, int /*bool*/ optimizePositive) { } } } - if (!optimizePositive) value = (((unsigned int) value >> 1) ^ -(value & 1)); + if (!optimizePositive) + value = ((unsigned int) value >> 1) ^ (~(value & 1)); return (int) value; }