mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[ts][pixi-v8] Slot objects are rendered only if skipRender is false. See #2919.
This commit is contained in:
parent
12e6e1fa34
commit
34570f3834
@ -27,17 +27,17 @@
|
|||||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import { MeshAttachment, RegionAttachment } from '@esotericsoftware/spine-core';
|
||||||
import {
|
import {
|
||||||
extensions, ExtensionType,
|
|
||||||
InstructionSet,
|
|
||||||
type BLEND_MODES,
|
type BLEND_MODES,
|
||||||
type Container,
|
type Container, ExtensionType,
|
||||||
|
extensions,
|
||||||
|
type InstructionSet,
|
||||||
type Renderer,
|
type Renderer,
|
||||||
type RenderPipe,
|
type RenderPipe,
|
||||||
} from 'pixi.js';
|
} from 'pixi.js';
|
||||||
import { BatchableSpineSlot } from './BatchableSpineSlot.js';
|
import { BatchableSpineSlot } from './BatchableSpineSlot.js';
|
||||||
import { Spine } from './Spine.js';
|
import type { Spine } from './Spine.js';
|
||||||
import { MeshAttachment, RegionAttachment } from '@esotericsoftware/spine-core';
|
|
||||||
|
|
||||||
const spineBlendModeMap: Record<number, BLEND_MODES> = {
|
const spineBlendModeMap: Record<number, BLEND_MODES> = {
|
||||||
0: 'normal',
|
0: 'normal',
|
||||||
@ -123,6 +123,7 @@ export class SpinePipe implements RenderPipe<Spine> {
|
|||||||
const slot = drawOrder[i];
|
const slot = drawOrder[i];
|
||||||
const attachment = slot.getAttachment();
|
const attachment = slot.getAttachment();
|
||||||
const blendMode = spineBlendModeMap[slot.data.blendMode];
|
const blendMode = spineBlendModeMap[slot.data.blendMode];
|
||||||
|
let skipRender = false;
|
||||||
|
|
||||||
if (attachment instanceof RegionAttachment || attachment instanceof MeshAttachment) {
|
if (attachment instanceof RegionAttachment || attachment instanceof MeshAttachment) {
|
||||||
const cacheData = spine._getCachedData(slot, attachment);
|
const cacheData = spine._getCachedData(slot, attachment);
|
||||||
@ -135,7 +136,8 @@ export class SpinePipe implements RenderPipe<Spine> {
|
|||||||
roundPixels
|
roundPixels
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!cacheData.skipRender) {
|
skipRender = cacheData.skipRender;
|
||||||
|
if (!skipRender) {
|
||||||
batcher.addToBatch(batchableSpineSlot, instructionSet);
|
batcher.addToBatch(batchableSpineSlot, instructionSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,9 +147,12 @@ export class SpinePipe implements RenderPipe<Spine> {
|
|||||||
if (containerAttachment) {
|
if (containerAttachment) {
|
||||||
const container = containerAttachment.container;
|
const container = containerAttachment.container;
|
||||||
|
|
||||||
container.includeInBuild = true;
|
if (!skipRender) {
|
||||||
// See https://github.com/pixijs/pixijs/blob/b4c050a791fe65e979e467c9cba2bda0c01a1c35/src/scene/container/utils/collectAllRenderables.ts#L28
|
container.includeInBuild = true;
|
||||||
container.collectRenderables(instructionSet, this.renderer, null!);
|
// See https://github.com/pixijs/pixijs/blob/b4c050a791fe65e979e467c9cba2bda0c01a1c35/src/scene/container/utils/collectAllRenderables.ts#L28
|
||||||
|
container.collectRenderables(instructionSet, this.renderer, null!);
|
||||||
|
}
|
||||||
|
|
||||||
container.includeInBuild = false;
|
container.includeInBuild = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user