[ts][pixi-v8] Prevent crash when slot object parents are not visible. See #3044.

This commit is contained in:
Davide Tantillo 2026-03-23 11:22:46 +01:00
parent fa48d53948
commit 48d5f3653e
2 changed files with 12 additions and 7 deletions

View File

@ -812,7 +812,10 @@ export class Spine extends ViewContainer {
const { slot, container } = slotAttachment;
const followAttachmentValue = slotAttachment.followAttachmentTimeline ? Boolean(slot.attachment) : true;
container.visible = this.skeleton.drawOrder.includes(slot) && followAttachmentValue;
const slotAlpha = this.skeleton.color.a * slot.color.a;
container.visible = this.skeleton.drawOrder.includes(slot) && followAttachmentValue
&& this.alpha > 0 && slotAlpha > 0;
if (container.visible) {
let bone = slot.bone;
@ -826,7 +829,7 @@ export class Spine extends ViewContainer {
matrix.ty = bone.worldY;
container.setFromMatrix(matrix);
container.alpha = this.skeleton.color.a * slot.color.a;
container.alpha = slotAlpha;
}
}

View File

@ -90,6 +90,8 @@ export class SpinePipe implements RenderPipe<Spine> {
const drawOrder = spine.skeleton.drawOrder;
const gpuSpine = this.gpuSpineData[spine.uid];
if (!gpuSpine) return false;
for (let i = 0, n = drawOrder.length; i < n; i++) {
const slot = drawOrder[i];
const attachment = slot.getAttachment();
@ -185,11 +187,9 @@ export class SpinePipe implements RenderPipe<Spine> {
if (containerAttachment) {
const container = containerAttachment.container;
if (!skipRender) {
container.includeInBuild = true;
// See https://github.com/pixijs/pixijs/blob/b4c050a791fe65e979e467c9cba2bda0c01a1c35/src/scene/container/utils/collectAllRenderables.ts#L28
container.collectRenderables(instructionSet, this.renderer, null!);
}
container.includeInBuild = true;
// See https://github.com/pixijs/pixijs/blob/b4c050a791fe65e979e467c9cba2bda0c01a1c35/src/scene/container/utils/collectAllRenderables.ts#L28
container.collectRenderables(instructionSet, this.renderer, null!);
container.includeInBuild = false;
}
@ -199,6 +199,8 @@ export class SpinePipe implements RenderPipe<Spine> {
updateRenderable (spine: Spine) {
const gpuSpine = this.gpuSpineData[spine.uid];
if (!gpuSpine) return;
spine._validateAndTransformAttachments();
spine.spineAttachmentsDirty = false;