From 386ad25ebcd76dbb91da7e5f3b6000515551db38 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 22 Jun 2022 14:08:28 +0200 Subject: [PATCH] [ts] Port of 4efd63f89cb995cbe4f30358d268a9d0eaf0c9be, fix VertexAttachment.timlineAttachment typo. --- spine-ts/spine-core/src/Animation.ts | 5 +++-- spine-ts/spine-core/src/SkeletonBinary.ts | 2 +- spine-ts/spine-core/src/SkeletonJson.ts | 2 +- spine-ts/spine-core/src/Slot.ts | 2 +- spine-ts/spine-core/src/attachments/Attachment.ts | 4 ++-- spine-ts/spine-core/src/attachments/MeshAttachment.ts | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/spine-ts/spine-core/src/Animation.ts b/spine-ts/spine-core/src/Animation.ts index a7332c7aa..75d8af09c 100644 --- a/spine-ts/spine-core/src/Animation.ts +++ b/spine-ts/spine-core/src/Animation.ts @@ -1510,7 +1510,7 @@ export class DeformTimeline extends CurveTimeline implements SlotTimeline { if (!slot.bone.active) return; let slotAttachment: Attachment | null = slot.getAttachment(); if (!slotAttachment) return; - if (!(slotAttachment instanceof VertexAttachment) || (slotAttachment).timelineAttahment != this.attachment) return; + if (!(slotAttachment instanceof VertexAttachment) || (slotAttachment).timelineAttachment != this.attachment) return; let deform: Array = slot.deform; if (deform.length == 0) blend = MixBlend.setup; @@ -2195,7 +2195,7 @@ export class SequenceTimeline extends Timeline implements SlotTimeline { let attachment = this.attachment as unknown as Attachment; if (slotAttachment != attachment) { if (!(slotAttachment instanceof VertexAttachment) - || (slotAttachment as VertexAttachment).timelineAttahment != attachment) return; + || (slotAttachment as VertexAttachment).timelineAttachment != attachment) return; } let frames = this.frames; @@ -2209,6 +2209,7 @@ export class SequenceTimeline extends Timeline implements SlotTimeline { let modeAndIndex = frames[i + SequenceTimeline.MODE]; let delay = frames[i + SequenceTimeline.DELAY]; + if (!this.attachment.sequence) return; let index = modeAndIndex >> 4, count = this.attachment.sequence!.regions.length; let mode = SequenceModeValues[modeAndIndex & 0xf]; if (mode != SequenceMode.hold) { diff --git a/spine-ts/spine-core/src/SkeletonBinary.ts b/spine-ts/spine-core/src/SkeletonBinary.ts index 6c73ae20f..75ed1f589 100644 --- a/spine-ts/spine-core/src/SkeletonBinary.ts +++ b/spine-ts/spine-core/src/SkeletonBinary.ts @@ -238,7 +238,7 @@ export class SkeletonBinary { if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null"); let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent); if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`); - linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent as VertexAttachment : linkedMesh.mesh; + linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent as VertexAttachment : linkedMesh.mesh; linkedMesh.mesh.setParentMesh(parent as MeshAttachment); if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion(); } diff --git a/spine-ts/spine-core/src/SkeletonJson.ts b/spine-ts/spine-core/src/SkeletonJson.ts index ef3983617..0a47d3d16 100644 --- a/spine-ts/spine-core/src/SkeletonJson.ts +++ b/spine-ts/spine-core/src/SkeletonJson.ts @@ -297,7 +297,7 @@ export class SkeletonJson { if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`); let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent); if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`); - linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh; + linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh; linkedMesh.mesh.setParentMesh(parent); if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion(); } diff --git a/spine-ts/spine-core/src/Slot.ts b/spine-ts/spine-core/src/Slot.ts index b625fb35a..aea60cf63 100644 --- a/spine-ts/spine-core/src/Slot.ts +++ b/spine-ts/spine-core/src/Slot.ts @@ -91,7 +91,7 @@ export class Slot { setAttachment (attachment: Attachment | null) { if (this.attachment == attachment) return; if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) - || (attachment).timelineAttahment != (this.attachment).timelineAttahment) { + || (attachment).timelineAttachment != (this.attachment).timelineAttachment) { this.deform.length = 0; } this.attachment = attachment; diff --git a/spine-ts/spine-core/src/attachments/Attachment.ts b/spine-ts/spine-core/src/attachments/Attachment.ts index becf5fe8e..c05713416 100644 --- a/spine-ts/spine-core/src/attachments/Attachment.ts +++ b/spine-ts/spine-core/src/attachments/Attachment.ts @@ -66,7 +66,7 @@ export abstract class VertexAttachment extends Attachment { /** Timelines for the timeline attachment are also applied to this attachment. * May be null if no attachment-specific timelines should be applied. */ - timelineAttahment: Attachment = this; + timelineAttachment: Attachment = this; constructor (name: string) { super(name); @@ -155,6 +155,6 @@ export abstract class VertexAttachment extends Attachment { } attachment.worldVerticesLength = this.worldVerticesLength; - attachment.timelineAttahment = this.timelineAttahment; + attachment.timelineAttachment = this.timelineAttachment; } } diff --git a/spine-ts/spine-core/src/attachments/MeshAttachment.ts b/spine-ts/spine-core/src/attachments/MeshAttachment.ts index 0c737f016..e5b84e4c3 100644 --- a/spine-ts/spine-core/src/attachments/MeshAttachment.ts +++ b/spine-ts/spine-core/src/attachments/MeshAttachment.ts @@ -205,7 +205,7 @@ export class MeshAttachment extends VertexAttachment implements HasTextureRegion let copy = new MeshAttachment(this.name, this.path); copy.region = this.region; copy.color.setFromColor(this.color); - copy.timelineAttahment = this.timelineAttahment; + copy.timelineAttachment = this.timelineAttachment; copy.setParentMesh(this.parentMesh ? this.parentMesh : this); if (copy.region != null) copy.updateRegion(); return copy;