mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 06:29:02 +08:00
[ts][pixi-v8] Prevent crash when slot object parents are not visible. See #3044.
This commit is contained in:
parent
39fe4692db
commit
21bb8df68f
@ -802,7 +802,10 @@ export class Spine extends ViewContainer {
|
||||
|
||||
const pose = slot.applied;
|
||||
const followAttachmentValue = slotAttachment.followAttachmentTimeline ? Boolean(pose.attachment) : true;
|
||||
container.visible = this.skeleton.drawOrder.includes(slot) && followAttachmentValue;
|
||||
const slotAlpha = this.skeleton.color.a * pose.color.a;
|
||||
|
||||
container.visible = this.skeleton.drawOrder.includes(slot) && followAttachmentValue
|
||||
&& this.alpha > 0 && slotAlpha > 0;
|
||||
|
||||
if (container.visible) {
|
||||
const applied = slot.bone.applied;
|
||||
@ -816,7 +819,7 @@ export class Spine extends ViewContainer {
|
||||
matrix.ty = applied.worldY;
|
||||
container.setFromMatrix(matrix);
|
||||
|
||||
container.alpha = this.skeleton.color.a * pose.color.a;
|
||||
container.alpha = slotAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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.applied.attachment;
|
||||
@ -185,12 +187,10 @@ 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
|
||||
// biome-ignore lint/style/noNonNullAssertion: it was in pixi code
|
||||
container.collectRenderables(instructionSet, this.renderer, null!);
|
||||
}
|
||||
container.includeInBuild = true;
|
||||
// See https://github.com/pixijs/pixijs/blob/b4c050a791fe65e979e467c9cba2bda0c01a1c35/src/scene/container/utils/collectAllRenderables.ts#L28
|
||||
// biome-ignore lint/style/noNonNullAssertion: it was in pixi code
|
||||
container.collectRenderables(instructionSet, this.renderer, null!);
|
||||
|
||||
container.includeInBuild = false;
|
||||
}
|
||||
@ -200,6 +200,8 @@ export class SpinePipe implements RenderPipe<Spine> {
|
||||
updateRenderable (spine: Spine) {
|
||||
const gpuSpine = this.gpuSpineData[spine.uid];
|
||||
|
||||
if (!gpuSpine) return;
|
||||
|
||||
spine._validateAndTransformAttachments();
|
||||
|
||||
spine.spineAttachmentsDirty = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user