From c3ea9fd9316cc954b06b5dbae6a1e13ce871ab7f Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Wed, 27 Aug 2025 16:59:56 -0600 Subject: [PATCH] [ts][pixi-v8] Prevent rendering of attachments with alpha 0. See #2912. --- spine-ts/spine-pixi-v8/src/Spine.ts | 37 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/spine-ts/spine-pixi-v8/src/Spine.ts b/spine-ts/spine-pixi-v8/src/Spine.ts index 897340a06..421fc4178 100644 --- a/spine-ts/spine-pixi-v8/src/Spine.ts +++ b/spine-ts/spine-pixi-v8/src/Spine.ts @@ -658,32 +658,37 @@ export class Spine extends ViewContainer { const skeleton = slot.bone.skeleton; const skeletonColor = skeleton.color; const slotColor = slot.color; - const attachmentColor = attachment.color; + const alpha = skeletonColor.a * slotColor.a * attachmentColor.a; cacheData.color.set( skeletonColor.r * slotColor.r * attachmentColor.r, skeletonColor.g * slotColor.g * attachmentColor.g, skeletonColor.b * slotColor.b * attachmentColor.b, - skeletonColor.a * slotColor.a * attachmentColor.a, + alpha, ); - if (slot.darkColor) { - cacheData.darkColor.setFromColor(slot.darkColor); + if (this.alpha === 0 || alpha === 0) { + cacheData.skipRender = true; + } else { + if (slot.darkColor) { + cacheData.darkColor.setFromColor(slot.darkColor); + } + + cacheData.skipRender = cacheData.clipped = false; + + const texture = attachment.region?.texture.texture || Texture.EMPTY; + + if (cacheData.texture !== texture) { + cacheData.texture = texture; + this.spineTexturesDirty = true; + } + + if (clipper.isClipping()) { + this.updateClippingData(cacheData); + } } - cacheData.skipRender = cacheData.clipped = false; - - const texture = attachment.region?.texture.texture || Texture.EMPTY; - - if (cacheData.texture !== texture) { - cacheData.texture = texture; - this.spineTexturesDirty = true; - } - - if (clipper.isClipping()) { - this.updateClippingData(cacheData); - } } else if (attachment instanceof ClippingAttachment) { clipper.clipStart(slot, attachment);