[ts] Port of 4efd63f89cb995cbe4f30358d268a9d0eaf0c9be, fix VertexAttachment.timlineAttachment typo.

This commit is contained in:
Mario Zechner 2022-06-22 14:08:28 +02:00
parent 838b9dd4c3
commit 386ad25ebc
6 changed files with 9 additions and 8 deletions

View File

@ -1510,7 +1510,7 @@ export class DeformTimeline extends CurveTimeline implements SlotTimeline {
if (!slot.bone.active) return; if (!slot.bone.active) return;
let slotAttachment: Attachment | null = slot.getAttachment(); let slotAttachment: Attachment | null = slot.getAttachment();
if (!slotAttachment) return; if (!slotAttachment) return;
if (!(slotAttachment instanceof VertexAttachment) || (<VertexAttachment>slotAttachment).timelineAttahment != this.attachment) return; if (!(slotAttachment instanceof VertexAttachment) || (<VertexAttachment>slotAttachment).timelineAttachment != this.attachment) return;
let deform: Array<number> = slot.deform; let deform: Array<number> = slot.deform;
if (deform.length == 0) blend = MixBlend.setup; 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; let attachment = this.attachment as unknown as Attachment;
if (slotAttachment != attachment) { if (slotAttachment != attachment) {
if (!(slotAttachment instanceof VertexAttachment) if (!(slotAttachment instanceof VertexAttachment)
|| (slotAttachment as VertexAttachment).timelineAttahment != attachment) return; || (slotAttachment as VertexAttachment).timelineAttachment != attachment) return;
} }
let frames = this.frames; let frames = this.frames;
@ -2209,6 +2209,7 @@ export class SequenceTimeline extends Timeline implements SlotTimeline {
let modeAndIndex = frames[i + SequenceTimeline.MODE]; let modeAndIndex = frames[i + SequenceTimeline.MODE];
let delay = frames[i + SequenceTimeline.DELAY]; let delay = frames[i + SequenceTimeline.DELAY];
if (!this.attachment.sequence) return;
let index = modeAndIndex >> 4, count = this.attachment.sequence!.regions.length; let index = modeAndIndex >> 4, count = this.attachment.sequence!.regions.length;
let mode = SequenceModeValues[modeAndIndex & 0xf]; let mode = SequenceModeValues[modeAndIndex & 0xf];
if (mode != SequenceMode.hold) { if (mode != SequenceMode.hold) {

View File

@ -238,7 +238,7 @@ export class SkeletonBinary {
if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null"); if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null");
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent); let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
if (!parent) throw new Error(`Parent mesh not found: ${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); linkedMesh.mesh.setParentMesh(parent as MeshAttachment);
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion(); if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
} }

View File

@ -297,7 +297,7 @@ export class SkeletonJson {
if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`); if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`);
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent); let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`); if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? <VertexAttachment>parent : <VertexAttachment>linkedMesh.mesh; linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? <VertexAttachment>parent : <VertexAttachment>linkedMesh.mesh;
linkedMesh.mesh.setParentMesh(<MeshAttachment>parent); linkedMesh.mesh.setParentMesh(<MeshAttachment>parent);
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion(); if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
} }

View File

@ -91,7 +91,7 @@ export class Slot {
setAttachment (attachment: Attachment | null) { setAttachment (attachment: Attachment | null) {
if (this.attachment == attachment) return; if (this.attachment == attachment) return;
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment)
|| (<VertexAttachment>attachment).timelineAttahment != (<VertexAttachment>this.attachment).timelineAttahment) { || (<VertexAttachment>attachment).timelineAttachment != (<VertexAttachment>this.attachment).timelineAttachment) {
this.deform.length = 0; this.deform.length = 0;
} }
this.attachment = attachment; this.attachment = attachment;

View File

@ -66,7 +66,7 @@ export abstract class VertexAttachment extends Attachment {
/** Timelines for the timeline attachment are also applied to this attachment. /** Timelines for the timeline attachment are also applied to this attachment.
* May be null if no attachment-specific timelines should be applied. */ * May be null if no attachment-specific timelines should be applied. */
timelineAttahment: Attachment = this; timelineAttachment: Attachment = this;
constructor (name: string) { constructor (name: string) {
super(name); super(name);
@ -155,6 +155,6 @@ export abstract class VertexAttachment extends Attachment {
} }
attachment.worldVerticesLength = this.worldVerticesLength; attachment.worldVerticesLength = this.worldVerticesLength;
attachment.timelineAttahment = this.timelineAttahment; attachment.timelineAttachment = this.timelineAttachment;
} }
} }

View File

@ -205,7 +205,7 @@ export class MeshAttachment extends VertexAttachment implements HasTextureRegion
let copy = new MeshAttachment(this.name, this.path); let copy = new MeshAttachment(this.name, this.path);
copy.region = this.region; copy.region = this.region;
copy.color.setFromColor(this.color); copy.color.setFromColor(this.color);
copy.timelineAttahment = this.timelineAttahment; copy.timelineAttachment = this.timelineAttachment;
copy.setParentMesh(this.parentMesh ? this.parentMesh : this); copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
if (copy.region != null) copy.updateRegion(); if (copy.region != null) copy.updateRegion();
return copy; return copy;