pixijs / spine-v8

PixiJS v8 port of the official spine runtime
https://pixijs.io/spine-v8/examples/
MIT License
32 stars 5 forks source link

Undefined batcher in SpinePipe.updateRenderable() with empty clipping vertices #17

Closed sta-ger closed 3 months ago

sta-ger commented 3 months ago

When attempting to play one of the animations, I get the following error:

SpinePipe.ts:154 Uncaught
TypeError: Cannot read properties of undefined (reading 'updateElement')
    at SpinePipe.updateRenderable (SpinePipe.ts:154:44)
    at Xu.updateRenderable (RenderGroup.ts:187:65)
    at iE (RenderGroupSystem.ts:143:25)
    at Sl.render (RenderGroupSystem.ts:94:17)
    at Qo.emit (SystemRunner.ts:70:26)
    at L_.render (AbstractRenderer.ts:303:29)
    at lu.render (Application.ts:154:23)
    at li.emit (TickerListener.ts:64:26)
    at Pt.update (Ticker.ts:461:37)
    at Pt._tick (Ticker.ts:163:22)

The problem is that batchableSpineSlot.batcher is undefined during the execution of updateRenderable() at SpinePipe.

image

After some investigation, I've determined that in the addRenderable() method, the batchableSpineSlot for one of the attachments is marked as clipped but has an empty clippedData.vertices, which prevents this batchableSpineSlot from being added to the batch. image

Adding one more condition that allows a slot with empty vertices to pass solves the problem. image (1)

Is it intentional that slots with empty clipping vertices are not allowed to be added to the batch?