mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts][pixi-v8] Prevent crash when slot object parents are not visible. See #3044.
This commit is contained in:
parent
fa48d53948
commit
48d5f3653e
@ -812,7 +812,10 @@ export class Spine extends ViewContainer {
|
|||||||
const { slot, container } = slotAttachment;
|
const { slot, container } = slotAttachment;
|
||||||
|
|
||||||
const followAttachmentValue = slotAttachment.followAttachmentTimeline ? Boolean(slot.attachment) : true;
|
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) {
|
if (container.visible) {
|
||||||
let bone = slot.bone;
|
let bone = slot.bone;
|
||||||
@ -826,7 +829,7 @@ export class Spine extends ViewContainer {
|
|||||||
matrix.ty = bone.worldY;
|
matrix.ty = bone.worldY;
|
||||||
container.setFromMatrix(matrix);
|
container.setFromMatrix(matrix);
|
||||||
|
|
||||||
container.alpha = this.skeleton.color.a * slot.color.a;
|
container.alpha = slotAlpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,8 @@ export class SpinePipe implements RenderPipe<Spine> {
|
|||||||
const drawOrder = spine.skeleton.drawOrder;
|
const drawOrder = spine.skeleton.drawOrder;
|
||||||
const gpuSpine = this.gpuSpineData[spine.uid];
|
const gpuSpine = this.gpuSpineData[spine.uid];
|
||||||
|
|
||||||
|
if (!gpuSpine) return false;
|
||||||
|
|
||||||
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
||||||
const slot = drawOrder[i];
|
const slot = drawOrder[i];
|
||||||
const attachment = slot.getAttachment();
|
const attachment = slot.getAttachment();
|
||||||
@ -185,11 +187,9 @@ export class SpinePipe implements RenderPipe<Spine> {
|
|||||||
if (containerAttachment) {
|
if (containerAttachment) {
|
||||||
const container = containerAttachment.container;
|
const container = containerAttachment.container;
|
||||||
|
|
||||||
if (!skipRender) {
|
container.includeInBuild = true;
|
||||||
container.includeInBuild = true;
|
// See https://github.com/pixijs/pixijs/blob/b4c050a791fe65e979e467c9cba2bda0c01a1c35/src/scene/container/utils/collectAllRenderables.ts#L28
|
||||||
// See https://github.com/pixijs/pixijs/blob/b4c050a791fe65e979e467c9cba2bda0c01a1c35/src/scene/container/utils/collectAllRenderables.ts#L28
|
container.collectRenderables(instructionSet, this.renderer, null!);
|
||||||
container.collectRenderables(instructionSet, this.renderer, null!);
|
|
||||||
}
|
|
||||||
|
|
||||||
container.includeInBuild = false;
|
container.includeInBuild = false;
|
||||||
}
|
}
|
||||||
@ -199,6 +199,8 @@ export class SpinePipe implements RenderPipe<Spine> {
|
|||||||
updateRenderable (spine: Spine) {
|
updateRenderable (spine: Spine) {
|
||||||
const gpuSpine = this.gpuSpineData[spine.uid];
|
const gpuSpine = this.gpuSpineData[spine.uid];
|
||||||
|
|
||||||
|
if (!gpuSpine) return;
|
||||||
|
|
||||||
spine._validateAndTransformAttachments();
|
spine._validateAndTransformAttachments();
|
||||||
|
|
||||||
spine.spineAttachmentsDirty = false;
|
spine.spineAttachmentsDirty = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user