Fix ClippingAttachment doesn't work

Refer to: https://github.com/EsotericSoftware/spine-runtimes/pull/2011

Reported by: @kangleblue

Signed-off-by: halx99 <halx99@live.com>
This commit is contained in:
halx99 2022-01-04 22:38:02 +08:00
parent beb8606e16
commit 14a3a0de93
1 changed files with 8 additions and 4 deletions

View File

@ -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<RegionAttachment*>(attachment)->getColor().a == 0)
return true;
}
else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
else if (attachmentRTTI.isExactly(MeshAttachment::rtti)) {
if (static_cast<MeshAttachment*>(attachment)->getColor().a == 0)
return true;
}