From b7d6cf819cffc5eb68db75cc774bce5625342176 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Sat, 16 Apr 2022 14:33:50 -0400 Subject: [PATCH] [gdx] Throw if SkeletonRenderer batch doesn't support clipping. --- .../com/esotericsoftware/spine/SkeletonRenderer.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 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 4f66bef09..bc7ed9984 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java @@ -91,10 +91,7 @@ public class SkeletonRenderer { Object[] drawOrder = skeleton.drawOrder.items; for (int i = 0, n = skeleton.drawOrder.size; i < n; i++) { Slot slot = (Slot)drawOrder[i]; - if (!slot.bone.active) { - clipper.clipEnd(slot); - continue; - } + if (!slot.bone.active) continue; Attachment attachment = slot.attachment; if (attachment instanceof RegionAttachment) { RegionAttachment region = (RegionAttachment)attachment; @@ -129,8 +126,8 @@ public class SkeletonRenderer { batch.draw(region.getRegion().getTexture(), vertices, 0, 20); } else if (attachment instanceof ClippingAttachment) { - clipper.clipStart(slot, (ClippingAttachment)attachment); - continue; + throw new RuntimeException(batch.getClass().getSimpleName() + + " cannot perform clipping, PolygonSpriteBatch or TwoColorPolygonBatch is required."); } else if (attachment instanceof MeshAttachment) { throw new RuntimeException(batch.getClass().getSimpleName() @@ -140,10 +137,7 @@ public class SkeletonRenderer { Skeleton attachmentSkeleton = ((SkeletonAttachment)attachment).getSkeleton(); if (attachmentSkeleton != null) draw(batch, attachmentSkeleton); } - - clipper.clipEnd(slot); } - clipper.clipEnd(); if (vertexEffect != null) vertexEffect.end(); }