[ts] Port to 4.3 (WIP)

This commit is contained in:
Davide Tantillo 2025-06-10 17:11:22 +02:00
parent 4225089764
commit 2f23421112
7 changed files with 16 additions and 18 deletions

View File

@ -167,10 +167,10 @@ export class BonePose extends BoneLocal implements Update {
const zd = Math.sin(this.rotation) * s;
this.shearX *= MathUtils.degRad;
this.shearY = (90 + shearY) * MathUtils.degRad;
const la = Math.cos(shearX) * scaleX;
const lb = Math.cos(shearY) * scaleY;
const lc = Math.sin(shearX) * scaleX;
const ld = Math.sin(shearY) * scaleY;
const la = Math.cos(this.shearX) * scaleX;
const lb = Math.cos(this.shearY) * scaleY;
const lc = Math.sin(this.shearX) * scaleX;
const ld = Math.sin(this.shearY) * scaleY;
this.a = za * la + zb * lc;
this.b = za * lb + zb * ld;
this.c = zc * la + zd * lc;

View File

@ -71,7 +71,7 @@ export class PathConstraint extends Constraint<PathConstraint, PathConstraintDat
for (const boneData of this.data.bones)
this.bones.push(skeleton.bones[boneData.index].constrained);
this.slot = skeleton.slots[data.slot.index];;
this.slot = skeleton.slots[data.slot.index];
}
public copy (skeleton: Skeleton) {

View File

@ -127,7 +127,7 @@ export class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
return;
case Physics.reset:
this.reset(skeleton);
// Fall through.
// Fall through.
case Physics.update:
const delta = Math.max(skeleton.time - this.lastTime, 0), aa = this.remaining;
this.remaining += delta;
@ -209,7 +209,6 @@ export class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
let r = l * bone.getWorldScaleX() - this.scaleLag * Math.max(0, 1 - aa / t);
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
}
a = this.remaining;
if (a >= t) {
if (d == -1) {
d = Math.pow(p.damping, 60 * t);

View File

@ -232,7 +232,7 @@ export class Skeleton {
sortReset (bones: Array<Bone>) {
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
if (!bone.active) {
if (bone.active) {
if (bone.sorted) this.sortReset(bone.children);
bone.sorted = false;
}

View File

@ -254,8 +254,6 @@ export class SkeletonBinary {
}
case CONSTRAINT_PATH: {
let data = new PathConstraintData(name);
data.skinRequired = input.readBoolean();
nn = input.readInt(true);
for (let ii = 0; ii < nn; ii++)
data.bones.push(bones[input.readInt(true)]);
data.slot = skeletonData.slots[input.readInt(true)];
@ -307,7 +305,7 @@ export class SkeletonBinary {
constraints.push(data);
break;
}
case CONSTRAINT_PHYSICS: {
case CONSTRAINT_SLIDER: {
const data = new SliderData(name);
data.skinRequired = (nn & 1) != 0;
data.loop = (nn & 2) != 0;

View File

@ -202,34 +202,34 @@ export class SkeletonJson {
let to: ToProperty;
switch (name) {
case "rotate": {
rotate = true
rotate = true;
to = new ToRotate();
break;
}
case "x": {
x = true
x = true;
to = new ToX();
toScale = scale;
break;
}
case "y": {
y = true
y = true;
to = new ToY();
toScale = scale;
break;
}
case "scaleX": {
scaleX = true
scaleX = true;
to = new ToScaleX();
break;
}
case "scaleY": {
scaleY = true
scaleY = true;
to = new ToScaleY();
break;
}
case "shearY": {
shearY = true
shearY = true;
to = new ToShearY();
break;
}

View File

@ -632,7 +632,7 @@ export class Spine extends ViewContainer {
this.updateAndSetPixiMask(slot, i === currentDrawOrder.length - 1);
const pose = slot.pose;
const attachment = pose;
const attachment = pose.attachment;
if (attachment) {
if (attachment instanceof MeshAttachment || attachment instanceof RegionAttachment) {
@ -691,6 +691,7 @@ export class Spine extends ViewContainer {
}
}
else if (attachment instanceof ClippingAttachment) {
clipper.clipEnd(slot);
clipper.clipStart(skeleton, slot, attachment);
continue;
}