From 9482f60ccfa3c867f0fef1333a6fc03a18031919 Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Fri, 20 Jun 2025 12:00:04 +0200 Subject: [PATCH] [ts] 4.3 porting WIP. --- spine-ts/spine-canvas/src/SkeletonRenderer.ts | 8 ++++---- spine-ts/spine-canvaskit/src/index.ts | 2 +- spine-ts/spine-core/src/SkeletonBounds.ts | 2 +- spine-ts/spine-pixi-v7/src/Spine.ts | 6 +++--- spine-ts/spine-pixi-v7/src/SpineDebugRenderer.ts | 8 ++++---- spine-ts/spine-pixi-v8/src/Spine.ts | 14 +++++++------- spine-ts/spine-pixi-v8/src/SpineDebugRenderer.ts | 8 ++++---- spine-ts/spine-pixi-v8/src/SpinePipe.ts | 6 +++--- spine-ts/spine-threejs/src/SkeletonMesh.ts | 2 +- .../src/SpineWebComponentOverlay.ts | 2 +- .../src/SpineWebComponentSkeleton.ts | 4 ++-- spine-ts/spine-webgl/src/SkeletonDebugRenderer.ts | 8 ++++---- spine-ts/spine-webgl/src/SkeletonRenderer.ts | 2 +- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/spine-ts/spine-canvas/src/SkeletonRenderer.ts b/spine-ts/spine-canvas/src/SkeletonRenderer.ts index af5a2dc85..8d384c4b7 100644 --- a/spine-ts/spine-canvas/src/SkeletonRenderer.ts +++ b/spine-ts/spine-canvas/src/SkeletonRenderer.ts @@ -65,7 +65,7 @@ export class SkeletonRenderer { let bone = slot.bone; if (!bone.active) continue; - let pose = slot.pose; + let pose = slot.applied; let attachment = pose.attachment; if (!(attachment instanceof RegionAttachment)) continue; attachment.computeWorldVertices(slot, worldVertices, 0, 2); @@ -119,7 +119,7 @@ export class SkeletonRenderer { for (let i = 0, n = drawOrder.length; i < n; i++) { const slot = drawOrder[i]; - let pose = slot.pose; + let pose = slot.applied; let attachment = pose.attachment; let texture: HTMLImageElement; @@ -228,7 +228,7 @@ export class SkeletonRenderer { private computeRegionVertices (slot: Slot, region: RegionAttachment, pma: boolean) { let skeletonColor = slot.skeleton.color; - let slotColor = slot.pose.color; + let slotColor = slot.applied.color; let regionColor = region.color; let alpha = skeletonColor.a * slotColor.a * regionColor.a; let multiplier = pma ? alpha : 1; @@ -277,7 +277,7 @@ export class SkeletonRenderer { private computeMeshVertices (slot: Slot, mesh: MeshAttachment, pma: boolean) { let skeleton = slot.skeleton; let skeletonColor = skeleton.color; - let slotColor = slot.pose.color; + let slotColor = slot.applied.color; let regionColor = mesh.color; let alpha = skeletonColor.a * slotColor.a * regionColor.a; let multiplier = pma ? alpha : 1; diff --git a/spine-ts/spine-canvaskit/src/index.ts b/spine-ts/spine-canvaskit/src/index.ts index abe581a1d..3f7682faa 100644 --- a/spine-ts/spine-canvaskit/src/index.ts +++ b/spine-ts/spine-canvaskit/src/index.ts @@ -235,7 +235,7 @@ export class SkeletonRenderer { continue; } - let pose = slot.pose; + let pose = slot.applied; let attachment = pose.attachment; let positions = this.scratchPositions; let colors = this.scratchColors; diff --git a/spine-ts/spine-core/src/SkeletonBounds.ts b/spine-ts/spine-core/src/SkeletonBounds.ts index 68cbc2b24..3a6352890 100644 --- a/spine-ts/spine-core/src/SkeletonBounds.ts +++ b/spine-ts/spine-core/src/SkeletonBounds.ts @@ -76,7 +76,7 @@ export class SkeletonBounds { for (let i = 0; i < slotCount; i++) { let slot = slots[i]; if (!slot.bone.active) continue; - let attachment = slot.pose.attachment; + let attachment = slot.applied.attachment; if (attachment instanceof BoundingBoxAttachment) { boundingBoxes.push(attachment); diff --git a/spine-ts/spine-pixi-v7/src/Spine.ts b/spine-ts/spine-pixi-v7/src/Spine.ts index 5b5672746..e349d145a 100644 --- a/spine-ts/spine-pixi-v7/src/Spine.ts +++ b/spine-ts/spine-pixi-v7/src/Spine.ts @@ -587,7 +587,7 @@ export class Spine extends Container { private updateSlotObject (element: { container: Container, followAttachmentTimeline: boolean }, slot: Slot, zIndex: number) { const { container: slotObject, followAttachmentTimeline } = element - const pose = slot.pose; + const pose = slot.applied; const followAttachmentValue = followAttachmentTimeline ? Boolean(pose.attachment) : true; slotObject.visible = this.skeleton.drawOrder.includes(slot) && followAttachmentValue; @@ -627,7 +627,7 @@ export class Spine extends Container { } if (!pixiMaskSource.computed) { pixiMaskSource.computed = true; - const clippingAttachment = pixiMaskSource.slot.pose.attachment as ClippingAttachment; + const clippingAttachment = pixiMaskSource.slot.applied.attachment as ClippingAttachment; const worldVerticesLength = clippingAttachment.worldVerticesLength; if (this.clippingVertAux.length < worldVerticesLength) this.clippingVertAux = new Float32Array(worldVerticesLength); clippingAttachment.computeWorldVertices(this.skeleton, pixiMaskSource.slot, 0, worldVerticesLength, this.clippingVertAux, 0, 2); @@ -675,7 +675,7 @@ export class Spine extends Container { this.updateAndSetPixiMask(pixiMaskSource, pixiObject.container); } - const pose = slot.pose; + const pose = slot.applied; const useDarkColor = !!pose.darkColor; const vertexSize = useDarkColor ? Spine.DARK_VERTEX_SIZE : Spine.VERTEX_SIZE; if (!slot.bone.active) { diff --git a/spine-ts/spine-pixi-v7/src/SpineDebugRenderer.ts b/spine-ts/spine-pixi-v7/src/SpineDebugRenderer.ts index 3bba21989..cb69ab497 100644 --- a/spine-ts/spine-pixi-v7/src/SpineDebugRenderer.ts +++ b/spine-ts/spine-pixi-v7/src/SpineDebugRenderer.ts @@ -338,7 +338,7 @@ export class SpineDebugRenderer implements ISpineDebugRenderer { for (let i = 0, len = slots.length; i < len; i++) { const slot = slots[i]; - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment == null || !(attachment instanceof RegionAttachment)) { continue; @@ -366,7 +366,7 @@ export class SpineDebugRenderer implements ISpineDebugRenderer { if (!slot.bone.active) { continue; } - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment == null || !(attachment instanceof MeshAttachment)) { continue; @@ -422,7 +422,7 @@ export class SpineDebugRenderer implements ISpineDebugRenderer { if (!slot.bone.active) { continue; } - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment == null || !(attachment instanceof ClippingAttachment)) { continue; @@ -497,7 +497,7 @@ export class SpineDebugRenderer implements ISpineDebugRenderer { if (!slot.bone.active) { continue; } - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment == null || !(attachment instanceof PathAttachment)) { continue; diff --git a/spine-ts/spine-pixi-v8/src/Spine.ts b/spine-ts/spine-pixi-v8/src/Spine.ts index 8d5b5c02f..ab40198aa 100644 --- a/spine-ts/spine-pixi-v8/src/Spine.ts +++ b/spine-ts/spine-pixi-v8/src/Spine.ts @@ -542,7 +542,7 @@ export class Spine extends ViewContainer { for (let i = 0; i < currentDrawOrder.length; i++) { const slot = currentDrawOrder[i]; - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment) { if (attachment !== lastAttachments[index]) { @@ -565,7 +565,7 @@ export class Spine extends ViewContainer { private currentClippingSlot: SlotsToClipping | undefined; private updateAndSetPixiMask (slot: Slot, last: boolean) { // assign/create the currentClippingSlot - const pose = slot.pose; + const pose = slot.applied; const attachment = pose.attachment; if (attachment && attachment instanceof ClippingAttachment) { const clip = (this.clippingSlotToPixiMasks[slot.data.name] ||= { slot, vertices: new Array() }); @@ -604,7 +604,7 @@ export class Spine extends ViewContainer { } // if current slot is the ending one of the currentClippingSlot mask, set currentClippingSlot to undefined - if (currentClippingSlot && (currentClippingSlot.slot.pose.attachment as ClippingAttachment).endSlot == slot.data) { + if (currentClippingSlot && (currentClippingSlot.slot.applied.attachment as ClippingAttachment).endSlot == slot.data) { this.currentClippingSlot = undefined; } @@ -612,7 +612,7 @@ export class Spine extends ViewContainer { if (last) { for (const key in this.clippingSlotToPixiMasks) { const clippingSlotToPixiMask = this.clippingSlotToPixiMasks[key]; - if ((!(clippingSlotToPixiMask.slot.pose.attachment instanceof ClippingAttachment) || !clippingSlotToPixiMask.maskComputed) && clippingSlotToPixiMask.mask) { + if ((!(clippingSlotToPixiMask.slot.applied.attachment instanceof ClippingAttachment) || !clippingSlotToPixiMask.maskComputed) && clippingSlotToPixiMask.mask) { this.removeChild(clippingSlotToPixiMask.mask); maskPool.free(clippingSlotToPixiMask.mask); clippingSlotToPixiMask.mask = undefined; @@ -631,7 +631,7 @@ export class Spine extends ViewContainer { this.updateAndSetPixiMask(slot, i === currentDrawOrder.length - 1); - const pose = slot.pose; + const pose = slot.applied; const attachment = pose.attachment; if (attachment) { @@ -787,7 +787,7 @@ export class Spine extends ViewContainer { private updateSlotObject (slotAttachment: { slot: Slot, container: Container, followAttachmentTimeline: boolean }) { const { slot, container } = slotAttachment; - const pose = slot.pose; + const pose = slot.applied; const followAttachmentValue = slotAttachment.followAttachmentTimeline ? Boolean(pose.attachment) : true; container.visible = this.skeleton.drawOrder.includes(slot) && followAttachmentValue; @@ -1006,7 +1006,7 @@ export class Spine extends ViewContainer { for (let i = 0; i < drawOrder.length; i++) { const slot = drawOrder[i]; - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment && (attachment instanceof RegionAttachment || attachment instanceof MeshAttachment)) { const cacheData = this._getCachedData(slot, attachment); diff --git a/spine-ts/spine-pixi-v8/src/SpineDebugRenderer.ts b/spine-ts/spine-pixi-v8/src/SpineDebugRenderer.ts index d8e2c1717..547430e89 100644 --- a/spine-ts/spine-pixi-v8/src/SpineDebugRenderer.ts +++ b/spine-ts/spine-pixi-v8/src/SpineDebugRenderer.ts @@ -360,7 +360,7 @@ export class SpineDebugRenderer implements ISpineDebugRenderer { for (let i = 0, len = slots.length; i < len; i++) { const slot = slots[i]; - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment === null || !(attachment instanceof RegionAttachment)) { continue; @@ -391,7 +391,7 @@ export class SpineDebugRenderer implements ISpineDebugRenderer { if (!slot.bone.active) { continue; } - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment === null || !(attachment instanceof MeshAttachment)) { continue; @@ -451,7 +451,7 @@ export class SpineDebugRenderer implements ISpineDebugRenderer { if (!slot.bone.active) { continue; } - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment === null || !(attachment instanceof ClippingAttachment)) { continue; @@ -536,7 +536,7 @@ export class SpineDebugRenderer implements ISpineDebugRenderer { if (!slot.bone.active) { continue; } - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment === null || !(attachment instanceof PathAttachment)) { continue; diff --git a/spine-ts/spine-pixi-v8/src/SpinePipe.ts b/spine-ts/spine-pixi-v8/src/SpinePipe.ts index 67538cd7c..f46b33dc9 100644 --- a/spine-ts/spine-pixi-v8/src/SpinePipe.ts +++ b/spine-ts/spine-pixi-v8/src/SpinePipe.ts @@ -86,7 +86,7 @@ export class SpinePipe implements RenderPipe { for (let i = 0, n = drawOrder.length; i < n; i++) { const slot = drawOrder[i]; - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment instanceof RegionAttachment || attachment instanceof MeshAttachment) { const cacheData = spine._getCachedData(slot, attachment); @@ -122,7 +122,7 @@ export class SpinePipe implements RenderPipe { for (let i = 0, n = drawOrder.length; i < n; i++) { const slot = drawOrder[i]; - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; const blendMode = spineBlendModeMap[slot.data.blendMode]; if (attachment instanceof RegionAttachment || attachment instanceof MeshAttachment) { @@ -165,7 +165,7 @@ export class SpinePipe implements RenderPipe { for (let i = 0, n = drawOrder.length; i < n; i++) { const slot = drawOrder[i]; - const attachment = slot.pose.attachment; + const attachment = slot.applied.attachment; if (attachment instanceof RegionAttachment || attachment instanceof MeshAttachment) { const cacheData = spine._getCachedData(slot, attachment); diff --git a/spine-ts/spine-threejs/src/SkeletonMesh.ts b/spine-ts/spine-threejs/src/SkeletonMesh.ts index 2bd9796bb..bf70a5dcb 100644 --- a/spine-ts/spine-threejs/src/SkeletonMesh.ts +++ b/spine-ts/spine-threejs/src/SkeletonMesh.ts @@ -237,7 +237,7 @@ export class SkeletonMesh extends THREE.Object3D { clipper.clipEnd(slot); continue; } - let pose = slot.pose; + let pose = slot.applied; let attachment = pose.attachment; let attachmentColor: Color | null; let texture: ThreeJsTexture | null; diff --git a/spine-ts/spine-webcomponents/src/SpineWebComponentOverlay.ts b/spine-ts/spine-webcomponents/src/SpineWebComponentOverlay.ts index 5ecc73bbf..45d51d389 100644 --- a/spine-ts/spine-webcomponents/src/SpineWebComponentOverlay.ts +++ b/spine-ts/spine-webcomponents/src/SpineWebComponentOverlay.ts @@ -685,7 +685,7 @@ export class SpineWebComponentOverlay extends HTMLElement implements OverlayAttr element.style.display = "" - const pose = slot.pose; + const pose = slot.applied; if (followVisibility && !pose.attachment) { element.style.opacity = "0"; } else if (followOpacity) { diff --git a/spine-ts/spine-webcomponents/src/SpineWebComponentSkeleton.ts b/spine-ts/spine-webcomponents/src/SpineWebComponentSkeleton.ts index ad09de4ea..0248c189e 100644 --- a/spine-ts/spine-webcomponents/src/SpineWebComponentSkeleton.ts +++ b/spine-ts/spine-webcomponents/src/SpineWebComponentSkeleton.ts @@ -1156,7 +1156,7 @@ export class SpineWebComponentSkeleton extends HTMLElement implements Disposable private checkSlotInteraction (type: PointerEventTypesInput, originalEvent?: UIEvent) { for (let [slot, interactionState] of this.pointerSlotEventCallbacks) { if (!slot.bone.active) continue; - let attachment = slot.pose.attachment; + let attachment = slot.applied.attachment; if (!(attachment instanceof RegionAttachment || attachment instanceof MeshAttachment)) continue; @@ -1245,7 +1245,7 @@ export class SpineWebComponentSkeleton extends HTMLElement implements Disposable if (!slot) return; if (hideAttachment) { - slot.pose.setAttachment(null); + slot.applied.setAttachment(null); } element.style.position = 'absolute'; diff --git a/spine-ts/spine-webgl/src/SkeletonDebugRenderer.ts b/spine-ts/spine-webgl/src/SkeletonDebugRenderer.ts index 6b8478274..fdf844073 100644 --- a/spine-ts/spine-webgl/src/SkeletonDebugRenderer.ts +++ b/spine-ts/spine-webgl/src/SkeletonDebugRenderer.ts @@ -90,7 +90,7 @@ export class SkeletonDebugRenderer implements Disposable { for (let i = 0, n = slots.length; i < n; i++) { let slot = slots[i]; if (!slot.bone.active) continue; - let attachment = slot.pose.attachment; + let attachment = slot.applied.attachment; if (attachment instanceof RegionAttachment) { let vertices = this.vertices; attachment.computeWorldVertices(slot, vertices, 0, 2); @@ -107,7 +107,7 @@ export class SkeletonDebugRenderer implements Disposable { for (let i = 0, n = slots.length; i < n; i++) { let slot = slots[i]; if (!slot.bone.active) continue; - let attachment = slot.pose.attachment; + let attachment = slot.applied.attachment; if (!(attachment instanceof MeshAttachment)) continue; let vertices = this.vertices; attachment.computeWorldVertices(skeleton, slot, 0, attachment.worldVerticesLength, vertices, 0, 2); @@ -156,7 +156,7 @@ export class SkeletonDebugRenderer implements Disposable { for (let i = 0, n = slots.length; i < n; i++) { let slot = slots[i]; if (!slot.bone.active) continue; - let attachment = slot.pose.attachment; + let attachment = slot.applied.attachment; if (!(attachment instanceof PathAttachment)) continue; let nn = attachment.worldVerticesLength; let world = this.temp = Utils.setArraySize(this.temp, nn, 0); @@ -205,7 +205,7 @@ export class SkeletonDebugRenderer implements Disposable { for (let i = 0, n = slots.length; i < n; i++) { let slot = slots[i]; if (!slot.bone.active) continue; - let attachment = slot.pose.attachment; + let attachment = slot.applied.attachment; if (!(attachment instanceof ClippingAttachment)) continue; let nn = attachment.worldVerticesLength; let world = this.temp = Utils.setArraySize(this.temp, nn, 0); diff --git a/spine-ts/spine-webgl/src/SkeletonRenderer.ts b/spine-ts/spine-webgl/src/SkeletonRenderer.ts index 72622d144..d46d2d17d 100644 --- a/spine-ts/spine-webgl/src/SkeletonRenderer.ts +++ b/spine-ts/spine-webgl/src/SkeletonRenderer.ts @@ -97,7 +97,7 @@ export class SkeletonRenderer { inRange = false; } - const pose = slot.pose; + const pose = slot.applied; const attachment = pose.attachment; let texture: GLTexture; if (attachment instanceof RegionAttachment) {