From 14a3a0de93cefd560fba805aa155248fda4f4499 Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 4 Jan 2022 22:38:02 +0800 Subject: [PATCH] Fix ClippingAttachment doesn't work Refer to: https://github.com/EsotericSoftware/spine-runtimes/pull/2011 Reported by: @kangleblue Signed-off-by: halx99 --- extensions/spine/SkeletonRenderer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/extensions/spine/SkeletonRenderer.cpp b/extensions/spine/SkeletonRenderer.cpp index bc594ad145..9aecaf5be5 100644 --- a/extensions/spine/SkeletonRenderer.cpp +++ b/extensions/spine/SkeletonRenderer.cpp @@ -915,14 +915,18 @@ namespace { Attachment *attachment = slot.getAttachment(); if (!attachment || slotIsOutRange(slot, startSlotIndex, endSlotIndex) || - !slot.getBone().isActive() || - slot.getColor().a == 0) + !slot.getBone().isActive()) return true; - if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) { + const auto& attachmentRTTI = attachment->getRTTI(); + if (attachmentRTTI.isExactly(ClippingAttachment::rtti)) + return false; + if (slot.getColor().a == 0) + return true; + if (attachmentRTTI.isExactly(RegionAttachment::rtti)) { if (static_cast(attachment)->getColor().a == 0) return true; } - else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { + else if (attachmentRTTI.isExactly(MeshAttachment::rtti)) { if (static_cast(attachment)->getColor().a == 0) return true; }