[ts][pixi-v8] Slot objects are rendered only if skipRender is false. See #2912.

This commit is contained in:
Davide Tantillo 2025-09-16 12:03:52 +02:00
parent f40ecd9933
commit add2b16062
2 changed files with 27 additions and 19 deletions

View File

@ -1,11 +1,14 @@
{
"formatter": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
"formatter": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noAssignInExpressions": "off"
}
}
}
}

View File

@ -27,17 +27,17 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { MeshAttachment, RegionAttachment } from '@esotericsoftware/spine-core';
import {
extensions, ExtensionType,
InstructionSet,
type BLEND_MODES,
type Container,
type Container, ExtensionType,
extensions,
type InstructionSet,
type Renderer,
type RenderPipe,
} from 'pixi.js';
import { BatchableSpineSlot } from './BatchableSpineSlot.js';
import { Spine } from './Spine.js';
import { MeshAttachment, RegionAttachment } from '@esotericsoftware/spine-core';
import type { Spine } from './Spine.js';
const spineBlendModeMap: Record<number, BLEND_MODES> = {
0: 'normal',
@ -123,6 +123,7 @@ export class SpinePipe implements RenderPipe<Spine> {
const slot = drawOrder[i];
const attachment = slot.applied.attachment;
const blendMode = spineBlendModeMap[slot.data.blendMode];
let skipRender = false;
if (attachment instanceof RegionAttachment || attachment instanceof MeshAttachment) {
const cacheData = spine._getCachedData(slot, attachment);
@ -135,7 +136,8 @@ export class SpinePipe implements RenderPipe<Spine> {
roundPixels
);
if (!cacheData.skipRender) {
skipRender = cacheData.skipRender;
if (!skipRender) {
batcher.addToBatch(batchableSpineSlot, instructionSet);
}
}
@ -145,9 +147,12 @@ export class SpinePipe implements RenderPipe<Spine> {
if (containerAttachment) {
const container = containerAttachment.container;
container.includeInBuild = true;
// See https://github.com/pixijs/pixijs/blob/b4c050a791fe65e979e467c9cba2bda0c01a1c35/src/scene/container/utils/collectAllRenderables.ts#L28
container.collectRenderables(instructionSet, this.renderer, null!);
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 = false;
}
}