[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; const zd = Math.sin(this.rotation) * s;
this.shearX *= MathUtils.degRad; this.shearX *= MathUtils.degRad;
this.shearY = (90 + shearY) * MathUtils.degRad; this.shearY = (90 + shearY) * MathUtils.degRad;
const la = Math.cos(shearX) * scaleX; const la = Math.cos(this.shearX) * scaleX;
const lb = Math.cos(shearY) * scaleY; const lb = Math.cos(this.shearY) * scaleY;
const lc = Math.sin(shearX) * scaleX; const lc = Math.sin(this.shearX) * scaleX;
const ld = Math.sin(shearY) * scaleY; const ld = Math.sin(this.shearY) * scaleY;
this.a = za * la + zb * lc; this.a = za * la + zb * lc;
this.b = za * lb + zb * ld; this.b = za * lb + zb * ld;
this.c = zc * la + zd * lc; 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) for (const boneData of this.data.bones)
this.bones.push(skeleton.bones[boneData.index].constrained); 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) { public copy (skeleton: Skeleton) {

View File

@ -209,7 +209,6 @@ export class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
let r = l * bone.getWorldScaleX() - this.scaleLag * Math.max(0, 1 - aa / t); let r = l * bone.getWorldScaleX() - this.scaleLag * Math.max(0, 1 - aa / t);
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r; if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
} }
a = this.remaining;
if (a >= t) { if (a >= t) {
if (d == -1) { if (d == -1) {
d = Math.pow(p.damping, 60 * t); d = Math.pow(p.damping, 60 * t);

View File

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

View File

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

View File

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

View File

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