[ts] Port to 4.3 (WIP) - Format.

This commit is contained in:
Davide Tantillo 2025-06-10 17:42:39 +02:00
parent d7212370f6
commit 59d138124d
9 changed files with 35 additions and 35 deletions

View File

@ -283,7 +283,7 @@ export interface SlotTimeline {
slotIndex: number; slotIndex: number;
} }
export function isSlotTimeline(obj: any): obj is SlotTimeline { export function isSlotTimeline (obj: any): obj is SlotTimeline {
return typeof obj === 'object' && obj !== null && typeof obj.slotIndex === 'number'; return typeof obj === 'object' && obj !== null && typeof obj.slotIndex === 'number';
} }
@ -436,7 +436,7 @@ export abstract class CurveTimeline1 extends CurveTimeline {
} }
} }
getAbsoluteValue(time: number, alpha: number, blend: MixBlend, current: number, setup: number, value?: number) { getAbsoluteValue (time: number, alpha: number, blend: MixBlend, current: number, setup: number, value?: number) {
if (value === undefined) if (value === undefined)
return this.getAbsoluteValue1(time, alpha, blend, current, setup); return this.getAbsoluteValue1(time, alpha, blend, current, setup);
else else
@ -543,7 +543,7 @@ export abstract class BoneTimeline2 extends CurveTimeline implements BoneTimelin
if (bone.active) this.apply1(appliedPose ? bone.applied : bone.pose, bone.data.setup, time, alpha, blend, direction); if (bone.active) this.apply1(appliedPose ? bone.applied : bone.pose, bone.data.setup, time, alpha, blend, direction);
} }
protected abstract apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend, protected abstract apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend,
direction: MixDirection): void; direction: MixDirection): void;
} }
@ -552,7 +552,7 @@ export interface BoneTimeline {
boneIndex: number; boneIndex: number;
} }
export function isBoneTimeline(obj: any): obj is BoneTimeline { export function isBoneTimeline (obj: any): obj is BoneTimeline {
return typeof obj === 'object' && obj !== null && typeof obj.boneIndex === 'number'; return typeof obj === 'object' && obj !== null && typeof obj.boneIndex === 'number';
} }
@ -571,7 +571,7 @@ export abstract class BoneTimeline1 extends CurveTimeline1 implements BoneTimeli
if (bone.active) this.apply1(appliedPose ? bone.applied : bone.pose, bone.data.setup, time, alpha, blend, direction); if (bone.active) this.apply1(appliedPose ? bone.applied : bone.pose, bone.data.setup, time, alpha, blend, direction);
} }
protected abstract apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend, protected abstract apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend,
direction: MixDirection): void; direction: MixDirection): void;
} }
@ -581,7 +581,7 @@ export class RotateTimeline extends BoneTimeline1 {
super(frameCount, bezierCount, boneIndex, Property.rotate); super(frameCount, bezierCount, boneIndex, Property.rotate);
} }
apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend, direction: MixDirection) { apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
pose.rotation = this.getRelativeValue(time, alpha, blend, pose.rotation, setup.rotation); pose.rotation = this.getRelativeValue(time, alpha, blend, pose.rotation, setup.rotation);
} }
} }
@ -592,7 +592,7 @@ export class TranslateTimeline extends BoneTimeline2 {
super(frameCount, bezierCount, boneIndex, Property.x, Property.y); super(frameCount, bezierCount, boneIndex, Property.x, Property.y);
} }
apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend,direction: MixDirection) { apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
let frames = this.frames; let frames = this.frames;
if (time < frames[0]) { if (time < frames[0]) {
switch (blend) { switch (blend) {
@ -651,7 +651,7 @@ export class TranslateXTimeline extends BoneTimeline1 {
super(frameCount, bezierCount, boneIndex, Property.x); super(frameCount, bezierCount, boneIndex, Property.x);
} }
protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend,direction: MixDirection) { protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
pose.x = this.getRelativeValue(time, alpha, blend, pose.x, setup.x); pose.x = this.getRelativeValue(time, alpha, blend, pose.x, setup.x);
} }
} }
@ -662,7 +662,7 @@ export class TranslateYTimeline extends BoneTimeline1 {
super(frameCount, bezierCount, boneIndex, Property.y); super(frameCount, bezierCount, boneIndex, Property.y);
} }
protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend,direction: MixDirection) { protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
pose.y = this.getRelativeValue(time, alpha, blend, pose.y, setup.y); pose.y = this.getRelativeValue(time, alpha, blend, pose.y, setup.y);
} }
} }
@ -673,7 +673,7 @@ export class ScaleTimeline extends BoneTimeline2 {
super(frameCount, bezierCount, boneIndex, Property.scaleX, Property.scaleY); super(frameCount, bezierCount, boneIndex, Property.scaleX, Property.scaleY);
} }
protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend, direction: MixDirection) { protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
let frames = this.frames; let frames = this.frames;
if (time < frames[0]) { if (time < frames[0]) {
switch (blend) { switch (blend) {
@ -770,7 +770,7 @@ export class ScaleXTimeline extends BoneTimeline1 {
super(frameCount, bezierCount, boneIndex, Property.scaleX); super(frameCount, bezierCount, boneIndex, Property.scaleX);
} }
protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend,direction: MixDirection) { protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
pose.scaleX = this.getScaleValue(time, alpha, blend, direction, pose.scaleX, setup.scaleX); pose.scaleX = this.getScaleValue(time, alpha, blend, direction, pose.scaleX, setup.scaleX);
} }
} }
@ -781,7 +781,7 @@ export class ScaleYTimeline extends BoneTimeline1 {
super(frameCount, bezierCount, boneIndex, Property.scaleY); super(frameCount, bezierCount, boneIndex, Property.scaleY);
} }
protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend,direction: MixDirection) { protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
pose.scaleY = this.getScaleValue(time, alpha, blend, direction, pose.scaleY, setup.scaleY); pose.scaleY = this.getScaleValue(time, alpha, blend, direction, pose.scaleY, setup.scaleY);
} }
} }
@ -792,7 +792,7 @@ export class ShearTimeline extends BoneTimeline2 {
super(frameCount, bezierCount, boneIndex, Property.shearX, Property.shearY); super(frameCount, bezierCount, boneIndex, Property.shearX, Property.shearY);
} }
protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend,direction: MixDirection) { protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
let frames = this.frames; let frames = this.frames;
if (time < frames[0]) { if (time < frames[0]) {
switch (blend) { switch (blend) {
@ -851,7 +851,7 @@ export class ShearXTimeline extends BoneTimeline1 {
super(frameCount, bezierCount, boneIndex, Property.shearX); super(frameCount, bezierCount, boneIndex, Property.shearX);
} }
protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend,direction: MixDirection) { protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
pose.shearX = this.getRelativeValue(time, alpha, blend, pose.shearX, setup.shearX); pose.shearX = this.getRelativeValue(time, alpha, blend, pose.shearX, setup.shearX);
} }
} }
@ -862,7 +862,7 @@ export class ShearYTimeline extends BoneTimeline1 {
super(frameCount, bezierCount, boneIndex, Property.shearY); super(frameCount, bezierCount, boneIndex, Property.shearY);
} }
protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha:number, blend: MixBlend,direction: MixDirection) { protected apply1 (pose: BoneLocal, setup: BoneLocal, time: number, alpha: number, blend: MixBlend, direction: MixDirection) {
pose.shearY = this.getRelativeValue(time, alpha, blend, pose.shearY, setup.shearY); pose.shearY = this.getRelativeValue(time, alpha, blend, pose.shearY, setup.shearY);
} }
} }
@ -1826,7 +1826,7 @@ export interface ConstraintTimeline {
readonly constraintIndex: number; readonly constraintIndex: number;
} }
export function isConstraintTimeline(obj: any): obj is ConstraintTimeline { export function isConstraintTimeline (obj: any): obj is ConstraintTimeline {
return typeof obj === 'object' && obj !== null && typeof obj.constraintIndex === 'number'; return typeof obj === 'object' && obj !== null && typeof obj.constraintIndex === 'number';
} }

View File

@ -73,9 +73,9 @@ export class BoneLocal implements Pose<BoneLocal> {
this.y = y; this.y = y;
} }
setScale(scaleX: number, scaleY: number): void; setScale (scaleX: number, scaleY: number): void;
setScale(scale: number): void; setScale (scale: number): void;
setScale(scaleOrX: number, scaleY?: number): void { setScale (scaleOrX: number, scaleY?: number): void {
this.scaleX = scaleOrX; this.scaleX = scaleOrX;
this.scaleY = scaleY === undefined ? scaleOrX : scaleY; this.scaleY = scaleY === undefined ? scaleOrX : scaleY;
} }

View File

@ -243,7 +243,7 @@ export class Skeleton {
* <p> * <p>
* See <a href="https://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine * See <a href="https://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
* Runtimes Guide. */ * Runtimes Guide. */
updateWorldTransform(physics: Physics): void { updateWorldTransform (physics: Physics): void {
this._update++; this._update++;
const resetCache = this.resetCache; const resetCache = this.resetCache;