From c5907b67148a09a0e783ae7bd4729e7f67157f46 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Mon, 19 Jun 2017 14:04:19 +0200 Subject: [PATCH] [libgdx] Ignore clipping attachments with too few vertices. Needed for editor, check not necessary for other runtimes. --- .../src/com/esotericsoftware/spine/SkeletonRenderer.java | 6 ++---- .../com/esotericsoftware/spine/utils/SkeletonClipping.java | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java index ca79638a7..24bb16753 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java @@ -305,10 +305,8 @@ public class SkeletonRenderer { float oldScaleY = rootBone.getScaleY(); float oldRotation = rootBone.getRotation(); attachmentSkeleton.setPosition(bone.getWorldX(), bone.getWorldY()); - // rootBone.setScaleX(1 + bone.getWorldScaleX() - - // oldScaleX); - // rootBone.setScaleY(1 + bone.getWorldScaleY() - - // oldScaleY); + // rootBone.setScaleX(1 + bone.getWorldScaleX() - oldScaleX); + // rootBone.setScaleY(1 + bone.getWorldScaleY() - oldScaleY); // Also set shear. rootBone.setRotation(oldRotation + bone.getWorldRotationX()); attachmentSkeleton.updateWorldTransform(); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonClipping.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonClipping.java index ee60dfc42..ebe38e0d6 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonClipping.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonClipping.java @@ -49,9 +49,10 @@ public class SkeletonClipping { public int clipStart (Slot slot, ClippingAttachment clip) { if (clipAttachment != null) return 0; + int n = clip.getWorldVerticesLength(); + if (n < 6) return 0; clipAttachment = clip; - int n = clip.getWorldVerticesLength(); float[] vertices = clippingPolygon.setSize(n); clip.computeWorldVertices(slot, 0, n, vertices, 0, 2); makeClockwise(clippingPolygon);