@esotericsoftware/spine-core 4.2.28 → 4.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3268,7 +3268,7 @@ var spine = (() => {
3268
3268
  }
3269
3269
  };
3270
3270
  var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
3271
- constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3271
+ constructor(frameCount, bezierCount, physicsConstraintIndex) {
3272
3272
  super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintInertia);
3273
3273
  }
3274
3274
  setup(constraint) {
@@ -3285,7 +3285,7 @@ var spine = (() => {
3285
3285
  }
3286
3286
  };
3287
3287
  var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
3288
- constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3288
+ constructor(frameCount, bezierCount, physicsConstraintIndex) {
3289
3289
  super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintStrength);
3290
3290
  }
3291
3291
  setup(constraint) {
@@ -3302,7 +3302,7 @@ var spine = (() => {
3302
3302
  }
3303
3303
  };
3304
3304
  var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
3305
- constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3305
+ constructor(frameCount, bezierCount, physicsConstraintIndex) {
3306
3306
  super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintDamping);
3307
3307
  }
3308
3308
  setup(constraint) {
@@ -3319,7 +3319,7 @@ var spine = (() => {
3319
3319
  }
3320
3320
  };
3321
3321
  var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
3322
- constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3322
+ constructor(frameCount, bezierCount, physicsConstraintIndex) {
3323
3323
  super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMass);
3324
3324
  }
3325
3325
  setup(constraint) {
@@ -3336,7 +3336,7 @@ var spine = (() => {
3336
3336
  }
3337
3337
  };
3338
3338
  var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
3339
- constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3339
+ constructor(frameCount, bezierCount, physicsConstraintIndex) {
3340
3340
  super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintWind);
3341
3341
  }
3342
3342
  setup(constraint) {
@@ -3353,7 +3353,7 @@ var spine = (() => {
3353
3353
  }
3354
3354
  };
3355
3355
  var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
3356
- constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3356
+ constructor(frameCount, bezierCount, physicsConstraintIndex) {
3357
3357
  super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintGravity);
3358
3358
  }
3359
3359
  setup(constraint) {
@@ -3370,7 +3370,7 @@ var spine = (() => {
3370
3370
  }
3371
3371
  };
3372
3372
  var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
3373
- constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3373
+ constructor(frameCount, bezierCount, physicsConstraintIndex) {
3374
3374
  super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMix);
3375
3375
  }
3376
3376
  setup(constraint) {
@@ -6191,8 +6191,8 @@ var spine = (() => {
6191
6191
  let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
6192
6192
  switch (bone.data.transformMode) {
6193
6193
  case 1 /* OnlyTranslation */:
6194
- tx = targetX - bone.worldX;
6195
- ty = targetY - bone.worldY;
6194
+ tx = (targetX - bone.worldX) * MathUtils.signum(bone.skeleton.scaleX);
6195
+ ty = (targetY - bone.worldY) * MathUtils.signum(bone.skeleton.scaleY);
6196
6196
  break;
6197
6197
  case 2 /* NoRotationOrReflection */:
6198
6198
  let s = Math.abs(pa * pd - pb * pc) / Math.max(1e-4, pa * pa + pc * pc);
@@ -7718,7 +7718,7 @@ var spine = (() => {
7718
7718
  }
7719
7719
  sortPhysicsConstraint(constraint) {
7720
7720
  const bone = constraint.bone;
7721
- constraint.active = bone.active && !constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true);
7721
+ constraint.active = bone.active && (!constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true));
7722
7722
  if (!constraint.active)
7723
7723
  return;
7724
7724
  this.sortBone(bone);
@@ -8036,6 +8036,45 @@ var spine = (() => {
8036
8036
  return Physics2;
8037
8037
  })(Physics || {});
8038
8038
 
8039
+ // spine-core/src/PhysicsConstraintData.ts
8040
+ var PhysicsConstraintData = class extends ConstraintData {
8041
+ _bone = null;
8042
+ /** The bone constrained by this physics constraint. */
8043
+ set bone(boneData) {
8044
+ this._bone = boneData;
8045
+ }
8046
+ get bone() {
8047
+ if (!this._bone)
8048
+ throw new Error("BoneData not set.");
8049
+ else
8050
+ return this._bone;
8051
+ }
8052
+ x = 0;
8053
+ y = 0;
8054
+ rotate = 0;
8055
+ scaleX = 1;
8056
+ shearX = 1;
8057
+ step = 0;
8058
+ inertia = 0;
8059
+ strength = 0;
8060
+ damping = 0;
8061
+ massInverse = 0;
8062
+ wind = 0;
8063
+ gravity = 0;
8064
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */
8065
+ mix = 0;
8066
+ inertiaGlobal = false;
8067
+ strengthGlobal = false;
8068
+ dampingGlobal = false;
8069
+ massGlobal = false;
8070
+ windGlobal = false;
8071
+ gravityGlobal = false;
8072
+ mixGlobal = false;
8073
+ constructor(name) {
8074
+ super(name, 0, false);
8075
+ }
8076
+ };
8077
+
8039
8078
  // spine-core/src/SkeletonData.ts
8040
8079
  var SkeletonData = class {
8041
8080
  /** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
@@ -8519,8 +8558,11 @@ var spine = (() => {
8519
8558
  data.length = input.readFloat() * scale;
8520
8559
  data.transformMode = input.readInt(true);
8521
8560
  data.skinRequired = input.readBoolean();
8522
- if (nonessential)
8561
+ if (nonessential) {
8523
8562
  Color.rgba8888ToColor(data.color, input.readInt32());
8563
+ data.icon = input.readString() ?? void 0;
8564
+ data.visible = input.readBoolean();
8565
+ }
8524
8566
  skeletonData.bones.push(data);
8525
8567
  }
8526
8568
  n = input.readInt(true);
@@ -8536,6 +8578,8 @@ var spine = (() => {
8536
8578
  Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
8537
8579
  data.attachmentName = input.readStringRef();
8538
8580
  data.blendMode = input.readInt(true);
8581
+ if (nonessential)
8582
+ data.visible = input.readBoolean();
8539
8583
  skeletonData.slots.push(data);
8540
8584
  }
8541
8585
  n = input.readInt(true);
@@ -8545,17 +8589,18 @@ var spine = (() => {
8545
8589
  throw new Error("IK constraint data name must not be null.");
8546
8590
  let data = new IkConstraintData(name);
8547
8591
  data.order = input.readInt(true);
8548
- data.skinRequired = input.readBoolean();
8549
8592
  nn = input.readInt(true);
8550
8593
  for (let ii = 0; ii < nn; ii++)
8551
8594
  data.bones.push(skeletonData.bones[input.readInt(true)]);
8552
8595
  data.target = skeletonData.bones[input.readInt(true)];
8553
8596
  data.mix = input.readFloat();
8554
8597
  data.softness = input.readFloat() * scale;
8555
- data.bendDirection = input.readByte();
8556
- data.compress = input.readBoolean();
8557
- data.stretch = input.readBoolean();
8558
- data.uniform = input.readBoolean();
8598
+ let flags = input.readByte();
8599
+ data.skinRequired = (flags & 1) != 0;
8600
+ data.bendDirection = (flags & 2) != 0 ? 1 : -1;
8601
+ data.compress = (flags & 4) != 0;
8602
+ data.stretch = (flags & 8) != 0;
8603
+ data.uniform = (flags & 16) != 0;
8559
8604
  skeletonData.ikConstraints.push(data);
8560
8605
  }
8561
8606
  n = input.readInt(true);
@@ -8565,13 +8610,14 @@ var spine = (() => {
8565
8610
  throw new Error("Transform constraint data name must not be null.");
8566
8611
  let data = new TransformConstraintData(name);
8567
8612
  data.order = input.readInt(true);
8568
- data.skinRequired = input.readBoolean();
8569
8613
  nn = input.readInt(true);
8570
8614
  for (let ii = 0; ii < nn; ii++)
8571
8615
  data.bones.push(skeletonData.bones[input.readInt(true)]);
8572
8616
  data.target = skeletonData.bones[input.readInt(true)];
8573
- data.local = input.readBoolean();
8574
- data.relative = input.readBoolean();
8617
+ const flags = input.readByte();
8618
+ data.skinRequired = (flags & 1) != 0;
8619
+ data.local = (flags & 2) != 0;
8620
+ data.relative = (flags & 4) != 0;
8575
8621
  data.offsetRotation = input.readFloat();
8576
8622
  data.offsetX = input.readFloat() * scale;
8577
8623
  data.offsetY = input.readFloat() * scale;
@@ -8613,6 +8659,51 @@ var spine = (() => {
8613
8659
  data.mixY = input.readFloat();
8614
8660
  skeletonData.pathConstraints.push(data);
8615
8661
  }
8662
+ n = input.readInt(true);
8663
+ for (let i = 0, nn; i < n; i++) {
8664
+ const name = input.readString();
8665
+ if (!name)
8666
+ throw new Error("Physics constraint data name must not be null.");
8667
+ const data = new PhysicsConstraintData(name);
8668
+ data.order = input.readInt(true);
8669
+ data.bone = skeletonData.bones[input.readInt(true)];
8670
+ let flags = input.readByte();
8671
+ data.skinRequired = (flags & 1) != 0;
8672
+ if ((flags & 2) != 0)
8673
+ data.x = input.readFloat();
8674
+ if ((flags & 4) != 0)
8675
+ data.y = input.readFloat();
8676
+ if ((flags & 8) != 0)
8677
+ data.rotate = input.readFloat();
8678
+ if ((flags & 16) != 0)
8679
+ data.scaleX = input.readFloat();
8680
+ if ((flags & 32) != 0)
8681
+ data.shearX = input.readFloat();
8682
+ data.step = 1 / input.readByte();
8683
+ data.inertia = input.readFloat();
8684
+ data.strength = input.readFloat();
8685
+ data.damping = input.readFloat();
8686
+ data.massInverse = input.readFloat();
8687
+ data.wind = input.readFloat();
8688
+ data.gravity = input.readFloat();
8689
+ data.mix = input.readFloat();
8690
+ flags = input.readByte();
8691
+ if ((flags & 1) != 0)
8692
+ data.inertiaGlobal = true;
8693
+ if ((flags & 2) != 0)
8694
+ data.strengthGlobal = true;
8695
+ if ((flags & 4) != 0)
8696
+ data.dampingGlobal = true;
8697
+ if ((flags & 8) != 0)
8698
+ data.massGlobal = true;
8699
+ if ((flags & 16) != 0)
8700
+ data.windGlobal = true;
8701
+ if ((flags & 32) != 0)
8702
+ data.gravityGlobal = true;
8703
+ if ((flags & 64) != 0)
8704
+ data.mixGlobal = true;
8705
+ skeletonData.physicsConstraints.push(data);
8706
+ }
8616
8707
  let defaultSkin = this.readSkin(input, skeletonData, true, nonessential);
8617
8708
  if (defaultSkin) {
8618
8709
  skeletonData.defaultSkin = defaultSkin;
@@ -8631,9 +8722,7 @@ var spine = (() => {
8631
8722
  n = this.linkedMeshes.length;
8632
8723
  for (let i = 0; i < n; i++) {
8633
8724
  let linkedMesh = this.linkedMeshes[i];
8634
- let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
8635
- if (!skin)
8636
- throw new Error("Not skin found for linked mesh.");
8725
+ const skin = skeletonData.skins[linkedMesh.skinIndex];
8637
8726
  if (!linkedMesh.parent)
8638
8727
  throw new Error("Linked mesh parent must not be null");
8639
8728
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
@@ -8647,9 +8736,9 @@ var spine = (() => {
8647
8736
  this.linkedMeshes.length = 0;
8648
8737
  n = input.readInt(true);
8649
8738
  for (let i = 0; i < n; i++) {
8650
- let eventName = input.readStringRef();
8739
+ let eventName = input.readString();
8651
8740
  if (!eventName)
8652
- throw new Error();
8741
+ throw new Error("Event data name must not be null");
8653
8742
  let data = new EventData(eventName);
8654
8743
  data.intValue = input.readInt(false);
8655
8744
  data.floatValue = input.readFloat();
@@ -8679,10 +8768,12 @@ var spine = (() => {
8679
8768
  return null;
8680
8769
  skin = new Skin("default");
8681
8770
  } else {
8682
- let skinName = input.readStringRef();
8771
+ let skinName = input.readString();
8683
8772
  if (!skinName)
8684
8773
  throw new Error("Skin name must not be null.");
8685
8774
  skin = new Skin(skinName);
8775
+ if (nonessential)
8776
+ Color.rgba8888ToColor(skin.color, input.readInt32());
8686
8777
  skin.bones.length = input.readInt(true);
8687
8778
  for (let i = 0, n = skin.bones.length; i < n; i++)
8688
8779
  skin.bones[i] = skeletonData.bones[input.readInt(true)];
@@ -8692,6 +8783,8 @@ var spine = (() => {
8692
8783
  skin.constraints.push(skeletonData.transformConstraints[input.readInt(true)]);
8693
8784
  for (let i = 0, n = input.readInt(true); i < n; i++)
8694
8785
  skin.constraints.push(skeletonData.pathConstraints[input.readInt(true)]);
8786
+ for (let i = 0, n = input.readInt(true); i < n; i++)
8787
+ skin.constraints.push(skeletonData.physicsConstraints[input.readInt(true)]);
8695
8788
  slotCount = input.readInt(true);
8696
8789
  }
8697
8790
  for (let i = 0; i < slotCount; i++) {
@@ -8709,12 +8802,15 @@ var spine = (() => {
8709
8802
  }
8710
8803
  readAttachment(input, skeletonData, skin, slotIndex, attachmentName, nonessential) {
8711
8804
  let scale = this.scale;
8712
- let name = input.readStringRef();
8805
+ let flags = input.readByte();
8806
+ const name = (flags & 8) != 0 ? input.readStringRef() : attachmentName;
8713
8807
  if (!name)
8714
- name = attachmentName;
8715
- switch (input.readByte()) {
8808
+ throw new Error("Attachment name must not be null");
8809
+ switch (flags & 7) {
8716
8810
  case AttachmentType.Region: {
8717
- let path = input.readStringRef();
8811
+ let path = (flags & 16) != 0 ? input.readStringRef() : null;
8812
+ const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
8813
+ const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
8718
8814
  let rotation = input.readFloat();
8719
8815
  let x = input.readFloat();
8720
8816
  let y = input.readFloat();
@@ -8722,8 +8818,6 @@ var spine = (() => {
8722
8818
  let scaleY = input.readFloat();
8723
8819
  let width = input.readFloat();
8724
8820
  let height = input.readFloat();
8725
- let color = input.readInt32();
8726
- let sequence = this.readSequence(input);
8727
8821
  if (!path)
8728
8822
  path = name;
8729
8823
  let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
@@ -8744,13 +8838,12 @@ var spine = (() => {
8744
8838
  return region;
8745
8839
  }
8746
8840
  case AttachmentType.BoundingBox: {
8747
- let vertexCount = input.readInt(true);
8748
- let vertices = this.readVertices(input, vertexCount);
8841
+ let vertices = this.readVertices(input, (flags & 16) != 0);
8749
8842
  let color = nonessential ? input.readInt32() : 0;
8750
8843
  let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
8751
8844
  if (!box)
8752
8845
  return null;
8753
- box.worldVerticesLength = vertexCount << 1;
8846
+ box.worldVerticesLength = vertices.length;
8754
8847
  box.vertices = vertices.vertices;
8755
8848
  box.bones = vertices.bones;
8756
8849
  if (nonessential)
@@ -8758,18 +8851,17 @@ var spine = (() => {
8758
8851
  return box;
8759
8852
  }
8760
8853
  case AttachmentType.Mesh: {
8761
- let path = input.readStringRef();
8762
- let color = input.readInt32();
8763
- let vertexCount = input.readInt(true);
8764
- let uvs = this.readFloatArray(input, vertexCount << 1, 1);
8765
- let triangles = this.readShortArray(input);
8766
- let vertices = this.readVertices(input, vertexCount);
8767
- let hullLength = input.readInt(true);
8768
- let sequence = this.readSequence(input);
8854
+ let path = (flags & 16) != 0 ? input.readStringRef() : name;
8855
+ const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
8856
+ const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
8857
+ const hullLength = input.readInt(true);
8858
+ const vertices = this.readVertices(input, (flags & 128) != 0);
8859
+ const uvs = this.readFloatArray(input, vertices.length, 1);
8860
+ const triangles = this.readShortArray(input, (vertices.length - hullLength - 2) * 3);
8769
8861
  let edges = [];
8770
8862
  let width = 0, height = 0;
8771
8863
  if (nonessential) {
8772
- edges = this.readShortArray(input);
8864
+ edges = this.readShortArray(input, input.readInt(true));
8773
8865
  width = input.readFloat();
8774
8866
  height = input.readFloat();
8775
8867
  }
@@ -8782,7 +8874,7 @@ var spine = (() => {
8782
8874
  Color.rgba8888ToColor(mesh.color, color);
8783
8875
  mesh.bones = vertices.bones;
8784
8876
  mesh.vertices = vertices.vertices;
8785
- mesh.worldVerticesLength = vertexCount << 1;
8877
+ mesh.worldVerticesLength = vertices.length;
8786
8878
  mesh.triangles = triangles;
8787
8879
  mesh.regionUVs = uvs;
8788
8880
  if (sequence == null)
@@ -8797,19 +8889,19 @@ var spine = (() => {
8797
8889
  return mesh;
8798
8890
  }
8799
8891
  case AttachmentType.LinkedMesh: {
8800
- let path = input.readStringRef();
8801
- let color = input.readInt32();
8802
- let skinName = input.readStringRef();
8803
- let parent = input.readStringRef();
8804
- let inheritTimelines = input.readBoolean();
8805
- let sequence = this.readSequence(input);
8892
+ const path = (flags & 16) != 0 ? input.readStringRef() : name;
8893
+ if (path == null)
8894
+ throw new Error("Path of linked mesh must not be null");
8895
+ const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
8896
+ const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
8897
+ const inheritTimelines = (flags & 128) != 0;
8898
+ const skinIndex = input.readInt(true);
8899
+ const parent = input.readStringRef();
8806
8900
  let width = 0, height = 0;
8807
8901
  if (nonessential) {
8808
8902
  width = input.readFloat();
8809
8903
  height = input.readFloat();
8810
8904
  }
8811
- if (!path)
8812
- path = name;
8813
8905
  let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
8814
8906
  if (!mesh)
8815
8907
  return null;
@@ -8820,24 +8912,23 @@ var spine = (() => {
8820
8912
  mesh.width = width * scale;
8821
8913
  mesh.height = height * scale;
8822
8914
  }
8823
- this.linkedMeshes.push(new LinkedMesh(mesh, skinName, slotIndex, parent, inheritTimelines));
8915
+ this.linkedMeshes.push(new LinkedMesh(mesh, skinIndex, slotIndex, parent, inheritTimelines));
8824
8916
  return mesh;
8825
8917
  }
8826
8918
  case AttachmentType.Path: {
8827
- let closed2 = input.readBoolean();
8828
- let constantSpeed = input.readBoolean();
8829
- let vertexCount = input.readInt(true);
8830
- let vertices = this.readVertices(input, vertexCount);
8831
- let lengths = Utils.newArray(vertexCount / 3, 0);
8919
+ const closed2 = (flags & 16) != 0;
8920
+ const constantSpeed = (flags & 32) != 0;
8921
+ const vertices = this.readVertices(input, (flags & 64) != 0);
8922
+ const lengths = Utils.newArray(vertices.length / 6, 0);
8832
8923
  for (let i = 0, n = lengths.length; i < n; i++)
8833
8924
  lengths[i] = input.readFloat() * scale;
8834
- let color = nonessential ? input.readInt32() : 0;
8835
- let path = this.attachmentLoader.newPathAttachment(skin, name);
8925
+ const color = nonessential ? input.readInt32() : 0;
8926
+ const path = this.attachmentLoader.newPathAttachment(skin, name);
8836
8927
  if (!path)
8837
8928
  return null;
8838
8929
  path.closed = closed2;
8839
8930
  path.constantSpeed = constantSpeed;
8840
- path.worldVerticesLength = vertexCount << 1;
8931
+ path.worldVerticesLength = vertices.length;
8841
8932
  path.vertices = vertices.vertices;
8842
8933
  path.bones = vertices.bones;
8843
8934
  path.lengths = lengths;
@@ -8846,11 +8937,11 @@ var spine = (() => {
8846
8937
  return path;
8847
8938
  }
8848
8939
  case AttachmentType.Point: {
8849
- let rotation = input.readFloat();
8850
- let x = input.readFloat();
8851
- let y = input.readFloat();
8852
- let color = nonessential ? input.readInt32() : 0;
8853
- let point = this.attachmentLoader.newPointAttachment(skin, name);
8940
+ const rotation = input.readFloat();
8941
+ const x = input.readFloat();
8942
+ const y = input.readFloat();
8943
+ const color = nonessential ? input.readInt32() : 0;
8944
+ const point = this.attachmentLoader.newPointAttachment(skin, name);
8854
8945
  if (!point)
8855
8946
  return null;
8856
8947
  point.x = x * scale;
@@ -8861,15 +8952,14 @@ var spine = (() => {
8861
8952
  return point;
8862
8953
  }
8863
8954
  case AttachmentType.Clipping: {
8864
- let endSlotIndex = input.readInt(true);
8865
- let vertexCount = input.readInt(true);
8866
- let vertices = this.readVertices(input, vertexCount);
8955
+ const endSlotIndex = input.readInt(true);
8956
+ const vertices = this.readVertices(input, (flags & 16) != 0);
8867
8957
  let color = nonessential ? input.readInt32() : 0;
8868
8958
  let clip = this.attachmentLoader.newClippingAttachment(skin, name);
8869
8959
  if (!clip)
8870
8960
  return null;
8871
8961
  clip.endSlot = skeletonData.slots[endSlotIndex];
8872
- clip.worldVerticesLength = vertexCount << 1;
8962
+ clip.worldVerticesLength = vertices.length;
8873
8963
  clip.vertices = vertices.vertices;
8874
8964
  clip.bones = vertices.bones;
8875
8965
  if (nonessential)
@@ -8888,12 +8978,13 @@ var spine = (() => {
8888
8978
  sequence.setupIndex = input.readInt(true);
8889
8979
  return sequence;
8890
8980
  }
8891
- readVertices(input, vertexCount) {
8892
- let scale = this.scale;
8893
- let verticesLength = vertexCount << 1;
8894
- let vertices = new Vertices();
8895
- if (!input.readBoolean()) {
8896
- vertices.vertices = this.readFloatArray(input, verticesLength, scale);
8981
+ readVertices(input, weighted) {
8982
+ const scale = this.scale;
8983
+ const vertexCount = input.readInt(true);
8984
+ const vertices = new Vertices();
8985
+ vertices.length = vertexCount << 1;
8986
+ if (!weighted) {
8987
+ vertices.vertices = this.readFloatArray(input, vertices.length, scale);
8897
8988
  return vertices;
8898
8989
  }
8899
8990
  let weights = new Array();
@@ -8923,19 +9014,16 @@ var spine = (() => {
8923
9014
  }
8924
9015
  return array;
8925
9016
  }
8926
- readShortArray(input) {
8927
- let n = input.readInt(true);
9017
+ readShortArray(input, n) {
8928
9018
  let array = new Array(n);
8929
9019
  for (let i = 0; i < n; i++)
8930
- array[i] = input.readShort();
9020
+ array[i] = input.readInt(true);
8931
9021
  return array;
8932
9022
  }
8933
9023
  readAnimation(input, name, skeletonData) {
8934
9024
  input.readInt(true);
8935
9025
  let timelines = new Array();
8936
9026
  let scale = this.scale;
8937
- let tempColor1 = new Color();
8938
- let tempColor2 = new Color();
8939
9027
  for (let i = 0, n = input.readInt(true); i < n; i++) {
8940
9028
  let slotIndex = input.readInt(true);
8941
9029
  for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
@@ -9176,7 +9264,8 @@ var spine = (() => {
9176
9264
  let timeline = new IkConstraintTimeline(frameCount, input.readInt(true), index);
9177
9265
  let time = input.readFloat(), mix = input.readFloat(), softness = input.readFloat() * scale;
9178
9266
  for (let frame = 0, bezier = 0; ; frame++) {
9179
- timeline.setFrame(frame, time, mix, softness, input.readByte(), input.readBoolean(), input.readBoolean());
9267
+ const flags = input.readByte();
9268
+ timeline.setFrame(frame, time, mix, softness, input.readByte(), (flags & 1) != 0, (flags & 2) != 0);
9180
9269
  if (frame == frameLast)
9181
9270
  break;
9182
9271
  let time2 = input.readFloat(), mix2 = input.readFloat(), softness2 = input.readFloat() * scale;
@@ -9229,23 +9318,24 @@ var spine = (() => {
9229
9318
  let index = input.readInt(true);
9230
9319
  let data = skeletonData.pathConstraints[index];
9231
9320
  for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
9232
- switch (input.readByte()) {
9321
+ const type = input.readByte(), frameCount = input.readInt(true), bezierCount = input.readInt(true);
9322
+ switch (type) {
9233
9323
  case PATH_POSITION:
9234
9324
  timelines.push(readTimeline1(
9235
9325
  input,
9236
- new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index),
9326
+ new PathConstraintPositionTimeline(frameCount, bezierCount, index),
9237
9327
  data.positionMode == 0 /* Fixed */ ? scale : 1
9238
9328
  ));
9239
9329
  break;
9240
9330
  case PATH_SPACING:
9241
9331
  timelines.push(readTimeline1(
9242
9332
  input,
9243
- new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index),
9333
+ new PathConstraintSpacingTimeline(frameCount, bezierCount, index),
9244
9334
  data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */ ? scale : 1
9245
9335
  ));
9246
9336
  break;
9247
9337
  case PATH_MIX:
9248
- let timeline = new PathConstraintMixTimeline(input.readInt(true), input.readInt(true), index);
9338
+ let timeline = new PathConstraintMixTimeline(frameCount, bezierCount, index);
9249
9339
  let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat();
9250
9340
  for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
9251
9341
  timeline.setFrame(frame, time, mixRotate, mixX, mixY);
@@ -9270,6 +9360,42 @@ var spine = (() => {
9270
9360
  }
9271
9361
  }
9272
9362
  }
9363
+ for (let i = 0, n = input.readInt(true); i < n; i++) {
9364
+ const index = input.readInt(true) - 1;
9365
+ for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
9366
+ const type = input.readByte(), frameCount = input.readInt(true);
9367
+ if (type == PHYSICS_RESET) {
9368
+ const timeline = new PhysicsConstraintResetTimeline(frameCount, index);
9369
+ for (let frame = 0; frame < frameCount; frame++)
9370
+ timeline.setFrame(frame, input.readFloat());
9371
+ timelines.push(timeline);
9372
+ continue;
9373
+ }
9374
+ const bezierCount = input.readInt(true);
9375
+ switch (type) {
9376
+ case PHYSICS_INERTIA:
9377
+ timelines.push(readTimeline1(input, new PhysicsConstraintInertiaTimeline(frameCount, bezierCount, index), 1));
9378
+ break;
9379
+ case PHYSICS_STRENGTH:
9380
+ timelines.push(readTimeline1(input, new PhysicsConstraintStrengthTimeline(frameCount, bezierCount, index), 1));
9381
+ break;
9382
+ case PHYSICS_DAMPING:
9383
+ timelines.push(readTimeline1(input, new PhysicsConstraintDampingTimeline(frameCount, bezierCount, index), 1));
9384
+ break;
9385
+ case PHYSICS_MASS:
9386
+ timelines.push(readTimeline1(input, new PhysicsConstraintMassTimeline(frameCount, bezierCount, index), 1));
9387
+ break;
9388
+ case PHYSICS_WIND:
9389
+ timelines.push(readTimeline1(input, new PhysicsConstraintWindTimeline(frameCount, bezierCount, index), 1));
9390
+ break;
9391
+ case PHYSICS_GRAVITY:
9392
+ timelines.push(readTimeline1(input, new PhysicsConstraintGravityTimeline(frameCount, bezierCount, index), 1));
9393
+ break;
9394
+ case PHYSICS_MIX:
9395
+ timelines.push(readTimeline1(input, new PhysicsConstraintMixTimeline(frameCount, bezierCount, index), 1));
9396
+ }
9397
+ }
9398
+ }
9273
9399
  for (let i = 0, n = input.readInt(true); i < n; i++) {
9274
9400
  let skin = skeletonData.skins[input.readInt(true)];
9275
9401
  for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
@@ -9384,7 +9510,9 @@ var spine = (() => {
9384
9510
  let event = new Event(time, eventData);
9385
9511
  event.intValue = input.readInt(false);
9386
9512
  event.floatValue = input.readFloat();
9387
- event.stringValue = input.readBoolean() ? input.readString() : eventData.stringValue;
9513
+ event.stringValue = input.readString();
9514
+ if (event.stringValue == null)
9515
+ event.stringValue = eventData.stringValue;
9388
9516
  if (event.data.audioPath) {
9389
9517
  event.volume = input.readFloat();
9390
9518
  event.balance = input.readFloat();
@@ -9487,22 +9615,23 @@ var spine = (() => {
9487
9615
  };
9488
9616
  var LinkedMesh = class {
9489
9617
  parent;
9490
- skin;
9618
+ skinIndex;
9491
9619
  slotIndex;
9492
9620
  mesh;
9493
9621
  inheritTimeline;
9494
- constructor(mesh, skin, slotIndex, parent, inheritDeform) {
9622
+ constructor(mesh, skinIndex, slotIndex, parent, inheritDeform) {
9495
9623
  this.mesh = mesh;
9496
- this.skin = skin;
9624
+ this.skinIndex = skinIndex;
9497
9625
  this.slotIndex = slotIndex;
9498
9626
  this.parent = parent;
9499
9627
  this.inheritTimeline = inheritDeform;
9500
9628
  }
9501
9629
  };
9502
9630
  var Vertices = class {
9503
- constructor(bones = null, vertices = null) {
9631
+ constructor(bones = null, vertices = null, length = 0) {
9504
9632
  this.bones = bones;
9505
9633
  this.vertices = vertices;
9634
+ this.length = length;
9506
9635
  }
9507
9636
  };
9508
9637
  var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
@@ -9579,6 +9708,14 @@ var spine = (() => {
9579
9708
  var PATH_POSITION = 0;
9580
9709
  var PATH_SPACING = 1;
9581
9710
  var PATH_MIX = 2;
9711
+ var PHYSICS_INERTIA = 0;
9712
+ var PHYSICS_STRENGTH = 1;
9713
+ var PHYSICS_DAMPING = 2;
9714
+ var PHYSICS_MASS = 4;
9715
+ var PHYSICS_WIND = 5;
9716
+ var PHYSICS_GRAVITY = 6;
9717
+ var PHYSICS_MIX = 7;
9718
+ var PHYSICS_RESET = 8;
9582
9719
  var CURVE_STEPPED = 1;
9583
9720
  var CURVE_BEZIER = 2;
9584
9721