From 1aa112fe40f8ca6b793ce0ef3f2474068fee0770 Mon Sep 17 00:00:00 2001 From: deal Date: Wed, 19 Jan 2022 22:35:54 +0800 Subject: [PATCH] [cocos2dx] Fix ClippingAttachment doesn't work (#2011) --- spine-cocos2dx/src/spine/SkeletonRenderer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spine-cocos2dx/src/spine/SkeletonRenderer.cpp b/spine-cocos2dx/src/spine/SkeletonRenderer.cpp index 292a16edc..7fba02ca1 100644 --- a/spine-cocos2dx/src/spine/SkeletonRenderer.cpp +++ b/spine-cocos2dx/src/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; }