@esotericsoftware/spine-core 4.0.12 → 4.1.1
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.
- package/dist/Animation.d.ts +22 -3
- package/dist/Animation.js +87 -6
- package/dist/AnimationState.d.ts +8 -8
- package/dist/AnimationState.js +2 -2
- package/dist/AnimationStateData.d.ts +2 -2
- package/dist/AnimationStateData.js +2 -2
- package/dist/AssetManagerBase.d.ts +2 -2
- package/dist/AssetManagerBase.js +2 -2
- package/dist/AtlasAttachmentLoader.d.ts +6 -4
- package/dist/AtlasAttachmentLoader.js +35 -15
- package/dist/Bone.d.ts +2 -2
- package/dist/Bone.js +2 -2
- package/dist/BoneData.d.ts +2 -2
- package/dist/BoneData.js +2 -2
- package/dist/ConstraintData.d.ts +2 -2
- package/dist/ConstraintData.js +2 -2
- package/dist/Event.d.ts +2 -2
- package/dist/Event.js +2 -2
- package/dist/EventData.d.ts +2 -2
- package/dist/EventData.js +2 -2
- package/dist/IkConstraint.d.ts +2 -2
- package/dist/IkConstraint.js +2 -2
- package/dist/IkConstraintData.d.ts +2 -2
- package/dist/IkConstraintData.js +2 -2
- package/dist/PathConstraint.d.ts +2 -2
- package/dist/PathConstraint.js +2 -2
- package/dist/PathConstraintData.d.ts +2 -2
- package/dist/PathConstraintData.js +2 -2
- package/dist/Skeleton.d.ts +2 -8
- package/dist/Skeleton.js +4 -12
- package/dist/SkeletonBinary.d.ts +3 -2
- package/dist/SkeletonBinary.js +89 -52
- package/dist/SkeletonBounds.d.ts +2 -2
- package/dist/SkeletonBounds.js +2 -2
- package/dist/SkeletonClipping.d.ts +2 -2
- package/dist/SkeletonClipping.js +2 -2
- package/dist/SkeletonData.d.ts +2 -2
- package/dist/SkeletonData.js +2 -2
- package/dist/SkeletonJson.d.ts +4 -2
- package/dist/SkeletonJson.js +96 -59
- package/dist/Skin.d.ts +2 -2
- package/dist/Skin.js +2 -2
- package/dist/Slot.d.ts +8 -11
- package/dist/Slot.js +8 -17
- package/dist/SlotData.d.ts +2 -2
- package/dist/SlotData.js +2 -2
- package/dist/Texture.d.ts +2 -2
- package/dist/Texture.js +2 -2
- package/dist/TextureAtlas.d.ts +2 -2
- package/dist/TextureAtlas.js +2 -2
- package/dist/TransformConstraint.d.ts +2 -2
- package/dist/TransformConstraint.js +2 -2
- package/dist/TransformConstraintData.d.ts +2 -2
- package/dist/TransformConstraintData.js +2 -2
- package/dist/Triangulator.d.ts +2 -2
- package/dist/Triangulator.js +2 -2
- package/dist/Updatable.d.ts +2 -2
- package/dist/Updatable.js +2 -2
- package/dist/Utils.d.ts +2 -2
- package/dist/Utils.js +2 -2
- package/dist/VertexEffect.d.ts +2 -2
- package/dist/VertexEffect.js +2 -2
- package/dist/attachments/Attachment.d.ts +5 -4
- package/dist/attachments/Attachment.js +7 -6
- package/dist/attachments/AttachmentLoader.d.ts +5 -4
- package/dist/attachments/AttachmentLoader.js +2 -2
- package/dist/attachments/BoundingBoxAttachment.d.ts +2 -2
- package/dist/attachments/BoundingBoxAttachment.js +2 -2
- package/dist/attachments/ClippingAttachment.d.ts +2 -2
- package/dist/attachments/ClippingAttachment.js +2 -2
- package/dist/attachments/HasTextureRegion.d.ts +44 -0
- package/dist/attachments/HasTextureRegion.js +30 -0
- package/dist/attachments/MeshAttachment.d.ts +11 -6
- package/dist/attachments/MeshAttachment.js +15 -8
- package/dist/attachments/PathAttachment.d.ts +2 -2
- package/dist/attachments/PathAttachment.js +2 -2
- package/dist/attachments/PointAttachment.d.ts +2 -2
- package/dist/attachments/PointAttachment.js +2 -2
- package/dist/attachments/RegionAttachment.d.ts +17 -14
- package/dist/attachments/RegionAttachment.js +16 -14
- package/dist/attachments/Sequence.d.ts +55 -0
- package/dist/attachments/Sequence.js +91 -0
- package/dist/iife/spine-core.js +366 -143
- package/dist/iife/spine-core.js.map +3 -3
- package/dist/iife/spine-core.min.js +2 -2
- package/dist/polyfills.d.ts +2 -2
- package/dist/polyfills.js +2 -2
- package/dist/vertexeffects/JitterEffect.d.ts +2 -2
- package/dist/vertexeffects/JitterEffect.js +2 -2
- package/dist/vertexeffects/SwirlEffect.d.ts +2 -2
- package/dist/vertexeffects/SwirlEffect.js +2 -2
- package/package.json +2 -2
package/dist/iife/spine-core.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var spine = (() => {
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
4
|
-
var __require = typeof require !== "undefined" ? require : (x) => {
|
|
5
|
-
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
};
|
|
7
4
|
var __export = (target, all) => {
|
|
8
5
|
__markAsModule(target);
|
|
9
6
|
for (var name in all)
|
|
@@ -81,6 +78,7 @@ var spine = (() => {
|
|
|
81
78
|
ScaleTimeline: () => ScaleTimeline,
|
|
82
79
|
ScaleXTimeline: () => ScaleXTimeline,
|
|
83
80
|
ScaleYTimeline: () => ScaleYTimeline,
|
|
81
|
+
SequenceTimeline: () => SequenceTimeline,
|
|
84
82
|
ShearTimeline: () => ShearTimeline,
|
|
85
83
|
ShearXTimeline: () => ShearXTimeline,
|
|
86
84
|
ShearYTimeline: () => ShearYTimeline,
|
|
@@ -513,7 +511,7 @@ var spine = (() => {
|
|
|
513
511
|
super(name);
|
|
514
512
|
this.id = _VertexAttachment.nextID++;
|
|
515
513
|
this.worldVerticesLength = 0;
|
|
516
|
-
this.
|
|
514
|
+
this.timelineAttahment = this;
|
|
517
515
|
}
|
|
518
516
|
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
|
|
519
517
|
count = offset + (count >> 1) * stride;
|
|
@@ -585,12 +583,75 @@ var spine = (() => {
|
|
|
585
583
|
} else
|
|
586
584
|
attachment.vertices = null;
|
|
587
585
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
|
588
|
-
attachment.
|
|
586
|
+
attachment.timelineAttahment = this.timelineAttahment;
|
|
589
587
|
}
|
|
590
588
|
};
|
|
591
589
|
var VertexAttachment = _VertexAttachment;
|
|
592
590
|
VertexAttachment.nextID = 0;
|
|
593
591
|
|
|
592
|
+
// spine-core/src/attachments/Sequence.ts
|
|
593
|
+
var _Sequence = class {
|
|
594
|
+
constructor(count) {
|
|
595
|
+
this.id = _Sequence.nextID();
|
|
596
|
+
this.start = 0;
|
|
597
|
+
this.digits = 0;
|
|
598
|
+
this.setupIndex = 0;
|
|
599
|
+
this.regions = new Array(count);
|
|
600
|
+
}
|
|
601
|
+
copy() {
|
|
602
|
+
let copy = new _Sequence(this.regions.length);
|
|
603
|
+
Utils.arrayCopy(this.regions, 0, copy.regions, 0, this.regions.length);
|
|
604
|
+
copy.start = this.start;
|
|
605
|
+
copy.digits = this.digits;
|
|
606
|
+
copy.setupIndex = this.setupIndex;
|
|
607
|
+
return copy;
|
|
608
|
+
}
|
|
609
|
+
apply(slot, attachment) {
|
|
610
|
+
let index = slot.sequenceIndex;
|
|
611
|
+
if (index == -1)
|
|
612
|
+
index = this.setupIndex;
|
|
613
|
+
if (index >= this.regions.length)
|
|
614
|
+
index = this.regions.length - 1;
|
|
615
|
+
let region = this.regions[index];
|
|
616
|
+
if (attachment.region != region) {
|
|
617
|
+
attachment.region = region;
|
|
618
|
+
attachment.updateRegion();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
getPath(basePath, index) {
|
|
622
|
+
let result = basePath;
|
|
623
|
+
let frame = (this.start + index).toString();
|
|
624
|
+
for (let i = this.digits - frame.length; i > 0; i--)
|
|
625
|
+
result += "0";
|
|
626
|
+
result += frame;
|
|
627
|
+
return result;
|
|
628
|
+
}
|
|
629
|
+
static nextID() {
|
|
630
|
+
return _Sequence._nextID++;
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
var Sequence = _Sequence;
|
|
634
|
+
Sequence._nextID = 0;
|
|
635
|
+
var SequenceMode;
|
|
636
|
+
(function(SequenceMode2) {
|
|
637
|
+
SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
|
|
638
|
+
SequenceMode2[SequenceMode2["once"] = 1] = "once";
|
|
639
|
+
SequenceMode2[SequenceMode2["loop"] = 2] = "loop";
|
|
640
|
+
SequenceMode2[SequenceMode2["pingpong"] = 3] = "pingpong";
|
|
641
|
+
SequenceMode2[SequenceMode2["onceReverse"] = 4] = "onceReverse";
|
|
642
|
+
SequenceMode2[SequenceMode2["loopReverse"] = 5] = "loopReverse";
|
|
643
|
+
SequenceMode2[SequenceMode2["pingpongReverse"] = 6] = "pingpongReverse";
|
|
644
|
+
})(SequenceMode || (SequenceMode = {}));
|
|
645
|
+
var SequenceModeValues = [
|
|
646
|
+
0,
|
|
647
|
+
1,
|
|
648
|
+
2,
|
|
649
|
+
3,
|
|
650
|
+
4,
|
|
651
|
+
5,
|
|
652
|
+
6
|
|
653
|
+
];
|
|
654
|
+
|
|
594
655
|
// spine-core/src/Animation.ts
|
|
595
656
|
var Animation = class {
|
|
596
657
|
constructor(name, timelines, duration) {
|
|
@@ -658,7 +719,8 @@ var spine = (() => {
|
|
|
658
719
|
transformConstraint: 15,
|
|
659
720
|
pathConstraintPosition: 16,
|
|
660
721
|
pathConstraintSpacing: 17,
|
|
661
|
-
pathConstraintMix: 18
|
|
722
|
+
pathConstraintMix: 18,
|
|
723
|
+
sequence: 19
|
|
662
724
|
};
|
|
663
725
|
var Timeline = class {
|
|
664
726
|
constructor(frameCount, propertyIds) {
|
|
@@ -1816,7 +1878,7 @@ var spine = (() => {
|
|
|
1816
1878
|
if (!slot.bone.active)
|
|
1817
1879
|
return;
|
|
1818
1880
|
let slotAttachment = slot.getAttachment();
|
|
1819
|
-
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.
|
|
1881
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttahment != this.attachment)
|
|
1820
1882
|
return;
|
|
1821
1883
|
let deform = slot.deform;
|
|
1822
1884
|
if (deform.length == 0)
|
|
@@ -1825,7 +1887,6 @@ var spine = (() => {
|
|
|
1825
1887
|
let vertexCount = vertices[0].length;
|
|
1826
1888
|
let frames = this.frames;
|
|
1827
1889
|
if (time < frames[0]) {
|
|
1828
|
-
let vertexAttachment = slotAttachment;
|
|
1829
1890
|
switch (blend) {
|
|
1830
1891
|
case 0:
|
|
1831
1892
|
deform.length = 0;
|
|
@@ -1836,6 +1897,7 @@ var spine = (() => {
|
|
|
1836
1897
|
return;
|
|
1837
1898
|
}
|
|
1838
1899
|
deform.length = vertexCount;
|
|
1900
|
+
let vertexAttachment = slotAttachment;
|
|
1839
1901
|
if (!vertexAttachment.bones) {
|
|
1840
1902
|
let setupVertices = vertexAttachment.vertices;
|
|
1841
1903
|
for (var i = 0; i < vertexCount; i++)
|
|
@@ -2360,6 +2422,81 @@ var spine = (() => {
|
|
|
2360
2422
|
}
|
|
2361
2423
|
}
|
|
2362
2424
|
};
|
|
2425
|
+
var _SequenceTimeline = class extends Timeline {
|
|
2426
|
+
constructor(frameCount, slotIndex, attachment) {
|
|
2427
|
+
super(frameCount, [
|
|
2428
|
+
Property.sequence + "|" + slotIndex + "|" + attachment.sequence.id
|
|
2429
|
+
]);
|
|
2430
|
+
this.slotIndex = slotIndex;
|
|
2431
|
+
this.attachment = attachment;
|
|
2432
|
+
}
|
|
2433
|
+
getFrameEntries() {
|
|
2434
|
+
return _SequenceTimeline.ENTRIES;
|
|
2435
|
+
}
|
|
2436
|
+
getSlotIndex() {
|
|
2437
|
+
return this.slotIndex;
|
|
2438
|
+
}
|
|
2439
|
+
getAttachment() {
|
|
2440
|
+
return this.attachment;
|
|
2441
|
+
}
|
|
2442
|
+
setFrame(frame, time, mode, index, delay) {
|
|
2443
|
+
let frames = this.frames;
|
|
2444
|
+
frame *= _SequenceTimeline.ENTRIES;
|
|
2445
|
+
frames[frame] = time;
|
|
2446
|
+
frames[frame + _SequenceTimeline.MODE] = mode | index << 4;
|
|
2447
|
+
frames[frame + _SequenceTimeline.DELAY] = delay;
|
|
2448
|
+
}
|
|
2449
|
+
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
2450
|
+
let slot = skeleton.slots[this.slotIndex];
|
|
2451
|
+
if (!slot.bone.active)
|
|
2452
|
+
return;
|
|
2453
|
+
let slotAttachment = slot.attachment;
|
|
2454
|
+
let attachment = this.attachment;
|
|
2455
|
+
if (slotAttachment != attachment) {
|
|
2456
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttahment != attachment)
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
let frames = this.frames;
|
|
2460
|
+
if (time < frames[0]) {
|
|
2461
|
+
if (blend == 0 || blend == 1)
|
|
2462
|
+
slot.sequenceIndex = -1;
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
let i = Timeline.search(frames, time, _SequenceTimeline.ENTRIES);
|
|
2466
|
+
let before = frames[i];
|
|
2467
|
+
let modeAndIndex = frames[i + _SequenceTimeline.MODE];
|
|
2468
|
+
let delay = frames[i + _SequenceTimeline.DELAY];
|
|
2469
|
+
let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
|
|
2470
|
+
let mode = SequenceModeValues[modeAndIndex & 15];
|
|
2471
|
+
if (mode != SequenceMode.hold) {
|
|
2472
|
+
index += (time - before) / delay + 1e-5 | 0;
|
|
2473
|
+
switch (mode) {
|
|
2474
|
+
case SequenceMode.once:
|
|
2475
|
+
index = Math.min(count - 1, index);
|
|
2476
|
+
break;
|
|
2477
|
+
case SequenceMode.loop:
|
|
2478
|
+
index %= count;
|
|
2479
|
+
break;
|
|
2480
|
+
case SequenceMode.pingpong:
|
|
2481
|
+
let n = (count << 1) - 2;
|
|
2482
|
+
index %= n;
|
|
2483
|
+
if (index >= count)
|
|
2484
|
+
index = n - index;
|
|
2485
|
+
break;
|
|
2486
|
+
case SequenceMode.onceReverse:
|
|
2487
|
+
index = Math.max(count - 1 - index, 0);
|
|
2488
|
+
break;
|
|
2489
|
+
case SequenceMode.loopReverse:
|
|
2490
|
+
index = count - 1 - index % count;
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
slot.sequenceIndex = index;
|
|
2494
|
+
}
|
|
2495
|
+
};
|
|
2496
|
+
var SequenceTimeline = _SequenceTimeline;
|
|
2497
|
+
SequenceTimeline.ENTRIES = 3;
|
|
2498
|
+
SequenceTimeline.MODE = 1;
|
|
2499
|
+
SequenceTimeline.DELAY = 2;
|
|
2363
2500
|
|
|
2364
2501
|
// spine-core/src/AnimationState.ts
|
|
2365
2502
|
var AnimationState = class {
|
|
@@ -3453,7 +3590,7 @@ var spine = (() => {
|
|
|
3453
3590
|
this.color = new Color(1, 1, 1, 1);
|
|
3454
3591
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3455
3592
|
}
|
|
3456
|
-
|
|
3593
|
+
updateRegion() {
|
|
3457
3594
|
let regionUVs = this.regionUVs;
|
|
3458
3595
|
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
3459
3596
|
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
@@ -3541,6 +3678,7 @@ var spine = (() => {
|
|
|
3541
3678
|
copy.triangles = new Array(this.triangles.length);
|
|
3542
3679
|
Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
|
|
3543
3680
|
copy.hullLength = this.hullLength;
|
|
3681
|
+
copy.sequence = this.sequence.copy();
|
|
3544
3682
|
if (this.edges) {
|
|
3545
3683
|
copy.edges = new Array(this.edges.length);
|
|
3546
3684
|
Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
|
@@ -3549,14 +3687,20 @@ var spine = (() => {
|
|
|
3549
3687
|
copy.height = this.height;
|
|
3550
3688
|
return copy;
|
|
3551
3689
|
}
|
|
3690
|
+
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
|
|
3691
|
+
if (this.sequence != null)
|
|
3692
|
+
this.sequence.apply(slot, this);
|
|
3693
|
+
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
3694
|
+
}
|
|
3552
3695
|
newLinkedMesh() {
|
|
3553
3696
|
let copy = new MeshAttachment(this.name);
|
|
3554
3697
|
copy.region = this.region;
|
|
3555
3698
|
copy.path = this.path;
|
|
3556
3699
|
copy.color.setFromColor(this.color);
|
|
3557
|
-
copy.
|
|
3700
|
+
copy.timelineAttahment = this.timelineAttahment;
|
|
3558
3701
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
3559
|
-
copy.
|
|
3702
|
+
if (copy.region != null)
|
|
3703
|
+
copy.updateRegion();
|
|
3560
3704
|
return copy;
|
|
3561
3705
|
}
|
|
3562
3706
|
};
|
|
@@ -3624,7 +3768,7 @@ var spine = (() => {
|
|
|
3624
3768
|
this.uvs = Utils.newFloatArray(8);
|
|
3625
3769
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3626
3770
|
}
|
|
3627
|
-
|
|
3771
|
+
updateRegion() {
|
|
3628
3772
|
let region = this.region;
|
|
3629
3773
|
let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
3630
3774
|
let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
@@ -3653,9 +3797,6 @@ var spine = (() => {
|
|
|
3653
3797
|
offset[5] = localY2Cos + localX2Sin;
|
|
3654
3798
|
offset[6] = localX2Cos - localYSin;
|
|
3655
3799
|
offset[7] = localYCos + localX2Sin;
|
|
3656
|
-
}
|
|
3657
|
-
setRegion(region) {
|
|
3658
|
-
this.region = region;
|
|
3659
3800
|
let uvs = this.uvs;
|
|
3660
3801
|
if (region.degrees == 90) {
|
|
3661
3802
|
uvs[2] = region.u;
|
|
@@ -3677,7 +3818,10 @@ var spine = (() => {
|
|
|
3677
3818
|
uvs[7] = region.v2;
|
|
3678
3819
|
}
|
|
3679
3820
|
}
|
|
3680
|
-
computeWorldVertices(
|
|
3821
|
+
computeWorldVertices(slot, worldVertices, offset, stride) {
|
|
3822
|
+
if (this.sequence != null)
|
|
3823
|
+
this.sequence.apply(slot, this);
|
|
3824
|
+
let bone = slot.bone;
|
|
3681
3825
|
let vertexOffset = this.offset;
|
|
3682
3826
|
let x = bone.worldX, y = bone.worldY;
|
|
3683
3827
|
let a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
@@ -3717,6 +3861,7 @@ var spine = (() => {
|
|
|
3717
3861
|
Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
|
|
3718
3862
|
Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
|
|
3719
3863
|
copy.color.setFromColor(this.color);
|
|
3864
|
+
copy.sequence = this.sequence.copy();
|
|
3720
3865
|
return copy;
|
|
3721
3866
|
}
|
|
3722
3867
|
};
|
|
@@ -3759,22 +3904,40 @@ var spine = (() => {
|
|
|
3759
3904
|
constructor(atlas) {
|
|
3760
3905
|
this.atlas = atlas;
|
|
3761
3906
|
}
|
|
3762
|
-
|
|
3763
|
-
let
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3907
|
+
loadSequence(name, basePath, sequence) {
|
|
3908
|
+
let regions = sequence.regions;
|
|
3909
|
+
for (let i = 0, n = regions.length; i < n; i++) {
|
|
3910
|
+
let path = sequence.getPath(basePath, i);
|
|
3911
|
+
regions[i] = this.atlas.findRegion(path);
|
|
3912
|
+
regions[i].renderObject = regions[i];
|
|
3913
|
+
if (regions[i] == null)
|
|
3914
|
+
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
newRegionAttachment(skin, name, path, sequence) {
|
|
3767
3918
|
let attachment = new RegionAttachment(name);
|
|
3768
|
-
|
|
3919
|
+
if (sequence != null) {
|
|
3920
|
+
this.loadSequence(name, path, sequence);
|
|
3921
|
+
} else {
|
|
3922
|
+
let region = this.atlas.findRegion(path);
|
|
3923
|
+
if (!region)
|
|
3924
|
+
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
3925
|
+
region.renderObject = region;
|
|
3926
|
+
attachment.region = region;
|
|
3927
|
+
}
|
|
3769
3928
|
return attachment;
|
|
3770
3929
|
}
|
|
3771
|
-
newMeshAttachment(skin, name, path) {
|
|
3772
|
-
let region = this.atlas.findRegion(path);
|
|
3773
|
-
if (!region)
|
|
3774
|
-
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
3775
|
-
region.renderObject = region;
|
|
3930
|
+
newMeshAttachment(skin, name, path, sequence) {
|
|
3776
3931
|
let attachment = new MeshAttachment(name);
|
|
3777
|
-
|
|
3932
|
+
if (sequence != null) {
|
|
3933
|
+
this.loadSequence(name, path, sequence);
|
|
3934
|
+
} else {
|
|
3935
|
+
let region = this.atlas.findRegion(path);
|
|
3936
|
+
if (!region)
|
|
3937
|
+
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
3938
|
+
region.renderObject = region;
|
|
3939
|
+
attachment.region = region;
|
|
3940
|
+
}
|
|
3778
3941
|
return attachment;
|
|
3779
3942
|
}
|
|
3780
3943
|
newBoundingBoxAttachment(skin, name) {
|
|
@@ -5081,17 +5244,11 @@ var spine = (() => {
|
|
|
5081
5244
|
setAttachment(attachment) {
|
|
5082
5245
|
if (this.attachment == attachment)
|
|
5083
5246
|
return;
|
|
5084
|
-
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.
|
|
5247
|
+
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttahment != this.attachment.timelineAttahment) {
|
|
5085
5248
|
this.deform.length = 0;
|
|
5086
5249
|
}
|
|
5087
5250
|
this.attachment = attachment;
|
|
5088
|
-
this.
|
|
5089
|
-
}
|
|
5090
|
-
setAttachmentTime(time) {
|
|
5091
|
-
this.attachmentTime = this.bone.skeleton.time - time;
|
|
5092
|
-
}
|
|
5093
|
-
getAttachmentTime() {
|
|
5094
|
-
return this.bone.skeleton.time - this.attachmentTime;
|
|
5251
|
+
this.sequenceIndex = -1;
|
|
5095
5252
|
}
|
|
5096
5253
|
setToSetupPose() {
|
|
5097
5254
|
this.color.setFromColor(this.data.color);
|
|
@@ -5317,7 +5474,6 @@ var spine = (() => {
|
|
|
5317
5474
|
var Skeleton = class {
|
|
5318
5475
|
constructor(data) {
|
|
5319
5476
|
this._updateCache = new Array();
|
|
5320
|
-
this.time = 0;
|
|
5321
5477
|
this.scaleX = 1;
|
|
5322
5478
|
this.scaleY = 1;
|
|
5323
5479
|
this.x = 0;
|
|
@@ -5751,7 +5907,7 @@ var spine = (() => {
|
|
|
5751
5907
|
if (attachment instanceof RegionAttachment) {
|
|
5752
5908
|
verticesLength = 8;
|
|
5753
5909
|
vertices = Utils.setArraySize(temp, verticesLength, 0);
|
|
5754
|
-
attachment.computeWorldVertices(slot
|
|
5910
|
+
attachment.computeWorldVertices(slot, vertices, 0, 2);
|
|
5755
5911
|
} else if (attachment instanceof MeshAttachment) {
|
|
5756
5912
|
let mesh = attachment;
|
|
5757
5913
|
verticesLength = mesh.worldVerticesLength;
|
|
@@ -5771,9 +5927,6 @@ var spine = (() => {
|
|
|
5771
5927
|
offset.set(minX, minY);
|
|
5772
5928
|
size.set(maxX - minX, maxY - minY);
|
|
5773
5929
|
}
|
|
5774
|
-
update(delta) {
|
|
5775
|
-
this.time += delta;
|
|
5776
|
-
}
|
|
5777
5930
|
};
|
|
5778
5931
|
|
|
5779
5932
|
// spine-core/src/SkeletonData.ts
|
|
@@ -6225,9 +6378,10 @@ var spine = (() => {
|
|
|
6225
6378
|
let linkedMesh = this.linkedMeshes[i];
|
|
6226
6379
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
6227
6380
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
6228
|
-
linkedMesh.mesh.
|
|
6381
|
+
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
6229
6382
|
linkedMesh.mesh.setParentMesh(parent);
|
|
6230
|
-
linkedMesh.mesh.
|
|
6383
|
+
if (linkedMesh.mesh.region != null)
|
|
6384
|
+
linkedMesh.mesh.updateRegion();
|
|
6231
6385
|
}
|
|
6232
6386
|
this.linkedMeshes.length = 0;
|
|
6233
6387
|
n = input.readInt(true);
|
|
@@ -6296,9 +6450,10 @@ var spine = (() => {
|
|
|
6296
6450
|
let width = input.readFloat();
|
|
6297
6451
|
let height = input.readFloat();
|
|
6298
6452
|
let color = input.readInt32();
|
|
6453
|
+
let sequence = this.readSequence(input);
|
|
6299
6454
|
if (!path)
|
|
6300
6455
|
path = name;
|
|
6301
|
-
let region = this.attachmentLoader.newRegionAttachment(skin, name, path);
|
|
6456
|
+
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
6302
6457
|
if (!region)
|
|
6303
6458
|
return null;
|
|
6304
6459
|
region.path = path;
|
|
@@ -6310,7 +6465,9 @@ var spine = (() => {
|
|
|
6310
6465
|
region.width = width * scale;
|
|
6311
6466
|
region.height = height * scale;
|
|
6312
6467
|
Color.rgba8888ToColor(region.color, color);
|
|
6313
|
-
region.
|
|
6468
|
+
region.sequence = sequence;
|
|
6469
|
+
if (sequence == null)
|
|
6470
|
+
region.updateRegion();
|
|
6314
6471
|
return region;
|
|
6315
6472
|
}
|
|
6316
6473
|
case AttachmentType.BoundingBox: {
|
|
@@ -6335,6 +6492,7 @@ var spine = (() => {
|
|
|
6335
6492
|
let triangles = this.readShortArray(input);
|
|
6336
6493
|
let vertices = this.readVertices(input, vertexCount);
|
|
6337
6494
|
let hullLength = input.readInt(true);
|
|
6495
|
+
let sequence = this.readSequence(input);
|
|
6338
6496
|
let edges = null;
|
|
6339
6497
|
let width = 0, height = 0;
|
|
6340
6498
|
if (nonessential) {
|
|
@@ -6344,7 +6502,7 @@ var spine = (() => {
|
|
|
6344
6502
|
}
|
|
6345
6503
|
if (!path)
|
|
6346
6504
|
path = name;
|
|
6347
|
-
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);
|
|
6505
|
+
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
6348
6506
|
if (!mesh)
|
|
6349
6507
|
return null;
|
|
6350
6508
|
mesh.path = path;
|
|
@@ -6354,8 +6512,10 @@ var spine = (() => {
|
|
|
6354
6512
|
mesh.worldVerticesLength = vertexCount << 1;
|
|
6355
6513
|
mesh.triangles = triangles;
|
|
6356
6514
|
mesh.regionUVs = uvs;
|
|
6357
|
-
|
|
6515
|
+
if (sequence == null)
|
|
6516
|
+
mesh.updateRegion();
|
|
6358
6517
|
mesh.hullLength = hullLength << 1;
|
|
6518
|
+
mesh.sequence = sequence;
|
|
6359
6519
|
if (nonessential) {
|
|
6360
6520
|
mesh.edges = edges;
|
|
6361
6521
|
mesh.width = width * scale;
|
|
@@ -6368,7 +6528,8 @@ var spine = (() => {
|
|
|
6368
6528
|
let color = input.readInt32();
|
|
6369
6529
|
let skinName = input.readStringRef();
|
|
6370
6530
|
let parent = input.readStringRef();
|
|
6371
|
-
let
|
|
6531
|
+
let inheritTimelines = input.readBoolean();
|
|
6532
|
+
let sequence = this.readSequence(input);
|
|
6372
6533
|
let width = 0, height = 0;
|
|
6373
6534
|
if (nonessential) {
|
|
6374
6535
|
width = input.readFloat();
|
|
@@ -6376,16 +6537,17 @@ var spine = (() => {
|
|
|
6376
6537
|
}
|
|
6377
6538
|
if (!path)
|
|
6378
6539
|
path = name;
|
|
6379
|
-
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);
|
|
6540
|
+
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
6380
6541
|
if (!mesh)
|
|
6381
6542
|
return null;
|
|
6382
6543
|
mesh.path = path;
|
|
6383
6544
|
Color.rgba8888ToColor(mesh.color, color);
|
|
6545
|
+
mesh.sequence = sequence;
|
|
6384
6546
|
if (nonessential) {
|
|
6385
6547
|
mesh.width = width * scale;
|
|
6386
6548
|
mesh.height = height * scale;
|
|
6387
6549
|
}
|
|
6388
|
-
this.linkedMeshes.push(new LinkedMesh(mesh, skinName, slotIndex, parent,
|
|
6550
|
+
this.linkedMeshes.push(new LinkedMesh(mesh, skinName, slotIndex, parent, inheritTimelines));
|
|
6389
6551
|
return mesh;
|
|
6390
6552
|
}
|
|
6391
6553
|
case AttachmentType.Path: {
|
|
@@ -6444,6 +6606,15 @@ var spine = (() => {
|
|
|
6444
6606
|
}
|
|
6445
6607
|
return null;
|
|
6446
6608
|
}
|
|
6609
|
+
readSequence(input) {
|
|
6610
|
+
if (!input.readBoolean())
|
|
6611
|
+
return null;
|
|
6612
|
+
let sequence = new Sequence(input.readInt(true));
|
|
6613
|
+
sequence.start = input.readInt(true);
|
|
6614
|
+
sequence.digits = input.readInt(true);
|
|
6615
|
+
sequence.setupIndex = input.readInt(true);
|
|
6616
|
+
return sequence;
|
|
6617
|
+
}
|
|
6447
6618
|
readVertices(input, vertexCount) {
|
|
6448
6619
|
let scale = this.scale;
|
|
6449
6620
|
let verticesLength = vertexCount << 1;
|
|
@@ -6686,7 +6857,6 @@ var spine = (() => {
|
|
|
6686
6857
|
a = a2;
|
|
6687
6858
|
}
|
|
6688
6859
|
timelines.push(timeline);
|
|
6689
|
-
break;
|
|
6690
6860
|
}
|
|
6691
6861
|
}
|
|
6692
6862
|
}
|
|
@@ -6826,49 +6996,66 @@ var spine = (() => {
|
|
|
6826
6996
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
6827
6997
|
let attachmentName = input.readStringRef();
|
|
6828
6998
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
6829
|
-
let
|
|
6830
|
-
let vertices = attachment.vertices;
|
|
6831
|
-
let deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;
|
|
6999
|
+
let timelineType = input.readByte();
|
|
6832
7000
|
let frameCount = input.readInt(true);
|
|
6833
7001
|
let frameLast = frameCount - 1;
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
7002
|
+
switch (timelineType) {
|
|
7003
|
+
case ATTACHMENT_DEFORM: {
|
|
7004
|
+
let vertexAttachment = attachment;
|
|
7005
|
+
let weighted = vertexAttachment.bones;
|
|
7006
|
+
let vertices = vertexAttachment.vertices;
|
|
7007
|
+
let deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;
|
|
7008
|
+
let bezierCount = input.readInt(true);
|
|
7009
|
+
let timeline = new DeformTimeline(frameCount, bezierCount, slotIndex, vertexAttachment);
|
|
7010
|
+
let time = input.readFloat();
|
|
7011
|
+
for (let frame = 0, bezier = 0; ; frame++) {
|
|
7012
|
+
let deform;
|
|
7013
|
+
let end = input.readInt(true);
|
|
7014
|
+
if (end == 0)
|
|
7015
|
+
deform = weighted ? Utils.newFloatArray(deformLength) : vertices;
|
|
7016
|
+
else {
|
|
7017
|
+
deform = Utils.newFloatArray(deformLength);
|
|
7018
|
+
let start = input.readInt(true);
|
|
7019
|
+
end += start;
|
|
7020
|
+
if (scale == 1) {
|
|
7021
|
+
for (let v = start; v < end; v++)
|
|
7022
|
+
deform[v] = input.readFloat();
|
|
7023
|
+
} else {
|
|
7024
|
+
for (let v = start; v < end; v++)
|
|
7025
|
+
deform[v] = input.readFloat() * scale;
|
|
7026
|
+
}
|
|
7027
|
+
if (!weighted) {
|
|
7028
|
+
for (let v = 0, vn = deform.length; v < vn; v++)
|
|
7029
|
+
deform[v] += vertices[v];
|
|
7030
|
+
}
|
|
7031
|
+
}
|
|
7032
|
+
timeline.setFrame(frame, time, deform);
|
|
7033
|
+
if (frame == frameLast)
|
|
7034
|
+
break;
|
|
7035
|
+
let time2 = input.readFloat();
|
|
7036
|
+
switch (input.readByte()) {
|
|
7037
|
+
case CURVE_STEPPED:
|
|
7038
|
+
timeline.setStepped(frame);
|
|
7039
|
+
break;
|
|
7040
|
+
case CURVE_BEZIER:
|
|
7041
|
+
setBezier(input, timeline, bezier++, frame, 0, time, time2, 0, 1, 1);
|
|
7042
|
+
}
|
|
7043
|
+
time = time2;
|
|
6856
7044
|
}
|
|
7045
|
+
timelines.push(timeline);
|
|
7046
|
+
break;
|
|
6857
7047
|
}
|
|
6858
|
-
|
|
6859
|
-
|
|
7048
|
+
case ATTACHMENT_SEQUENCE: {
|
|
7049
|
+
let timeline = new SequenceTimeline(frameCount, slotIndex, attachment);
|
|
7050
|
+
for (let frame = 0; frame < frameCount; frame++) {
|
|
7051
|
+
let time = input.readFloat();
|
|
7052
|
+
let modeAndIndex = input.readInt32();
|
|
7053
|
+
timeline.setFrame(frame, time, SequenceModeValues[modeAndIndex & 15], modeAndIndex >> 4, input.readFloat());
|
|
7054
|
+
}
|
|
7055
|
+
timelines.push(timeline);
|
|
6860
7056
|
break;
|
|
6861
|
-
let time2 = input.readFloat();
|
|
6862
|
-
switch (input.readByte()) {
|
|
6863
|
-
case CURVE_STEPPED:
|
|
6864
|
-
timeline.setStepped(frame);
|
|
6865
|
-
break;
|
|
6866
|
-
case CURVE_BEZIER:
|
|
6867
|
-
setBezier(input, timeline, bezier++, frame, 0, time, time2, 0, 1, 1);
|
|
6868
7057
|
}
|
|
6869
|
-
time = time2;
|
|
6870
7058
|
}
|
|
6871
|
-
timelines.push(timeline);
|
|
6872
7059
|
}
|
|
6873
7060
|
}
|
|
6874
7061
|
}
|
|
@@ -7015,7 +7202,7 @@ var spine = (() => {
|
|
|
7015
7202
|
this.skin = skin;
|
|
7016
7203
|
this.slotIndex = slotIndex;
|
|
7017
7204
|
this.parent = parent;
|
|
7018
|
-
this.
|
|
7205
|
+
this.inheritTimeline = inheritDeform;
|
|
7019
7206
|
}
|
|
7020
7207
|
};
|
|
7021
7208
|
var Vertices = class {
|
|
@@ -7093,6 +7280,8 @@ var spine = (() => {
|
|
|
7093
7280
|
var SLOT_RGBA2 = 3;
|
|
7094
7281
|
var SLOT_RGB2 = 4;
|
|
7095
7282
|
var SLOT_ALPHA = 5;
|
|
7283
|
+
var ATTACHMENT_DEFORM = 0;
|
|
7284
|
+
var ATTACHMENT_SEQUENCE = 1;
|
|
7096
7285
|
var PATH_POSITION = 0;
|
|
7097
7286
|
var PATH_SPACING = 1;
|
|
7098
7287
|
var PATH_MIX = 2;
|
|
@@ -7928,9 +8117,10 @@ var spine = (() => {
|
|
|
7928
8117
|
let linkedMesh = this.linkedMeshes[i];
|
|
7929
8118
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
7930
8119
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
7931
|
-
linkedMesh.mesh.
|
|
8120
|
+
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
7932
8121
|
linkedMesh.mesh.setParentMesh(parent);
|
|
7933
|
-
linkedMesh.mesh.
|
|
8122
|
+
if (linkedMesh.mesh.region != null)
|
|
8123
|
+
linkedMesh.mesh.updateRegion();
|
|
7934
8124
|
}
|
|
7935
8125
|
this.linkedMeshes.length = 0;
|
|
7936
8126
|
if (root.events) {
|
|
@@ -7962,7 +8152,8 @@ var spine = (() => {
|
|
|
7962
8152
|
switch (getValue(map, "type", "region")) {
|
|
7963
8153
|
case "region": {
|
|
7964
8154
|
let path = getValue(map, "path", name);
|
|
7965
|
-
let
|
|
8155
|
+
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
8156
|
+
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
7966
8157
|
if (!region)
|
|
7967
8158
|
return null;
|
|
7968
8159
|
region.path = path;
|
|
@@ -7973,10 +8164,12 @@ var spine = (() => {
|
|
|
7973
8164
|
region.rotation = getValue(map, "rotation", 0);
|
|
7974
8165
|
region.width = map.width * scale;
|
|
7975
8166
|
region.height = map.height * scale;
|
|
8167
|
+
region.sequence = sequence;
|
|
7976
8168
|
let color = getValue(map, "color", null);
|
|
7977
8169
|
if (color)
|
|
7978
8170
|
region.color.setFromString(color);
|
|
7979
|
-
region.
|
|
8171
|
+
if (region.region != null)
|
|
8172
|
+
region.updateRegion();
|
|
7980
8173
|
return region;
|
|
7981
8174
|
}
|
|
7982
8175
|
case "boundingbox": {
|
|
@@ -7992,7 +8185,8 @@ var spine = (() => {
|
|
|
7992
8185
|
case "mesh":
|
|
7993
8186
|
case "linkedmesh": {
|
|
7994
8187
|
let path = getValue(map, "path", name);
|
|
7995
|
-
let
|
|
8188
|
+
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
8189
|
+
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
7996
8190
|
if (!mesh)
|
|
7997
8191
|
return null;
|
|
7998
8192
|
mesh.path = path;
|
|
@@ -8001,16 +8195,18 @@ var spine = (() => {
|
|
|
8001
8195
|
mesh.color.setFromString(color);
|
|
8002
8196
|
mesh.width = getValue(map, "width", 0) * scale;
|
|
8003
8197
|
mesh.height = getValue(map, "height", 0) * scale;
|
|
8198
|
+
mesh.sequence = sequence;
|
|
8004
8199
|
let parent = getValue(map, "parent", null);
|
|
8005
8200
|
if (parent) {
|
|
8006
|
-
this.linkedMeshes.push(new LinkedMesh2(mesh, getValue(map, "skin", null), slotIndex, parent, getValue(map, "
|
|
8201
|
+
this.linkedMeshes.push(new LinkedMesh2(mesh, getValue(map, "skin", null), slotIndex, parent, getValue(map, "timelines", true)));
|
|
8007
8202
|
return mesh;
|
|
8008
8203
|
}
|
|
8009
8204
|
let uvs = map.uvs;
|
|
8010
8205
|
this.readVertices(map, mesh, uvs.length);
|
|
8011
8206
|
mesh.triangles = map.triangles;
|
|
8012
8207
|
mesh.regionUVs = uvs;
|
|
8013
|
-
mesh.
|
|
8208
|
+
if (mesh.region != null)
|
|
8209
|
+
mesh.updateRegion();
|
|
8014
8210
|
mesh.edges = getValue(map, "edges", null);
|
|
8015
8211
|
mesh.hullLength = getValue(map, "hull", 0) * 2;
|
|
8016
8212
|
return mesh;
|
|
@@ -8061,6 +8257,15 @@ var spine = (() => {
|
|
|
8061
8257
|
}
|
|
8062
8258
|
return null;
|
|
8063
8259
|
}
|
|
8260
|
+
readSequence(map) {
|
|
8261
|
+
if (map == null)
|
|
8262
|
+
return null;
|
|
8263
|
+
let sequence = new Sequence(getValue(map, "count", 0));
|
|
8264
|
+
sequence.start = getValue(map, "start", 1);
|
|
8265
|
+
sequence.digits = getValue(map, "digits", 0);
|
|
8266
|
+
sequence.setupIndex = getValue(map, "setup", 0);
|
|
8267
|
+
return sequence;
|
|
8268
|
+
}
|
|
8064
8269
|
readVertices(map, attachment, verticesLength) {
|
|
8065
8270
|
let scale = this.scale;
|
|
8066
8271
|
attachment.worldVerticesLength = verticesLength;
|
|
@@ -8105,7 +8310,7 @@ var spine = (() => {
|
|
|
8105
8310
|
let timeline = new AttachmentTimeline(frames, slotIndex);
|
|
8106
8311
|
for (let frame = 0; frame < frames; frame++) {
|
|
8107
8312
|
let keyMap = timelineMap[frame];
|
|
8108
|
-
timeline.setFrame(frame, getValue(keyMap, "time", 0), keyMap
|
|
8313
|
+
timeline.setFrame(frame, getValue(keyMap, "time", 0), getValue(keyMap, "name", null));
|
|
8109
8314
|
}
|
|
8110
8315
|
timelines.push(timeline);
|
|
8111
8316
|
} else if (timelineName == "rgba") {
|
|
@@ -8407,56 +8612,74 @@ var spine = (() => {
|
|
|
8407
8612
|
}
|
|
8408
8613
|
}
|
|
8409
8614
|
}
|
|
8410
|
-
if (map.
|
|
8411
|
-
for (let
|
|
8412
|
-
let
|
|
8413
|
-
let skin = skeletonData.findSkin(
|
|
8414
|
-
for (let
|
|
8415
|
-
let slotMap =
|
|
8416
|
-
let slotIndex = skeletonData.findSlot(
|
|
8417
|
-
for (let
|
|
8418
|
-
let
|
|
8419
|
-
let
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
deform
|
|
8615
|
+
if (map.attachments) {
|
|
8616
|
+
for (let attachmentsName in map.attachments) {
|
|
8617
|
+
let attachmentsMap = map.attachments[attachmentsName];
|
|
8618
|
+
let skin = skeletonData.findSkin(attachmentsName);
|
|
8619
|
+
for (let slotMapName in attachmentsMap) {
|
|
8620
|
+
let slotMap = attachmentsMap[slotMapName];
|
|
8621
|
+
let slotIndex = skeletonData.findSlot(slotMapName).index;
|
|
8622
|
+
for (let attachmentMapName in slotMap) {
|
|
8623
|
+
let attachmentMap = slotMap[attachmentMapName];
|
|
8624
|
+
let attachment = skin.getAttachment(slotIndex, attachmentMapName);
|
|
8625
|
+
for (let timelineMapName in attachmentMap) {
|
|
8626
|
+
let timelineMap = attachmentMap[timelineMapName];
|
|
8627
|
+
let keyMap = timelineMap[0];
|
|
8628
|
+
if (!keyMap)
|
|
8629
|
+
continue;
|
|
8630
|
+
if (timelineMapName == "deform") {
|
|
8631
|
+
let weighted = attachment.bones;
|
|
8632
|
+
let vertices = attachment.vertices;
|
|
8633
|
+
let deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;
|
|
8634
|
+
let timeline = new DeformTimeline(timelineMap.length, timelineMap.length, slotIndex, attachment);
|
|
8635
|
+
let time = getValue(keyMap, "time", 0);
|
|
8636
|
+
for (let frame = 0, bezier = 0; ; frame++) {
|
|
8637
|
+
let deform;
|
|
8638
|
+
let verticesValue = getValue(keyMap, "vertices", null);
|
|
8639
|
+
if (!verticesValue)
|
|
8640
|
+
deform = weighted ? Utils.newFloatArray(deformLength) : vertices;
|
|
8641
|
+
else {
|
|
8642
|
+
deform = Utils.newFloatArray(deformLength);
|
|
8643
|
+
let start = getValue(keyMap, "offset", 0);
|
|
8644
|
+
Utils.arrayCopy(verticesValue, 0, deform, start, verticesValue.length);
|
|
8645
|
+
if (scale != 1) {
|
|
8646
|
+
for (let i = start, n = i + verticesValue.length; i < n; i++)
|
|
8647
|
+
deform[i] *= scale;
|
|
8648
|
+
}
|
|
8649
|
+
if (!weighted) {
|
|
8650
|
+
for (let i = 0; i < deformLength; i++)
|
|
8651
|
+
deform[i] += vertices[i];
|
|
8652
|
+
}
|
|
8653
|
+
}
|
|
8654
|
+
timeline.setFrame(frame, time, deform);
|
|
8655
|
+
let nextMap = timelineMap[frame + 1];
|
|
8656
|
+
if (!nextMap) {
|
|
8657
|
+
timeline.shrink(bezier);
|
|
8658
|
+
break;
|
|
8659
|
+
}
|
|
8660
|
+
let time2 = getValue(nextMap, "time", 0);
|
|
8661
|
+
let curve = keyMap.curve;
|
|
8662
|
+
if (curve)
|
|
8663
|
+
bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
|
|
8664
|
+
time = time2;
|
|
8665
|
+
keyMap = nextMap;
|
|
8440
8666
|
}
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8667
|
+
timelines.push(timeline);
|
|
8668
|
+
} else if (timelineMapName == "sequence") {
|
|
8669
|
+
let timeline = new SequenceTimeline(timelineMap.length, slotIndex, attachment);
|
|
8670
|
+
let lastDelay = 0;
|
|
8671
|
+
for (let frame = 0; frame < timelineMap.length; frame++) {
|
|
8672
|
+
let delay = getValue(keyMap, "delay", lastDelay);
|
|
8673
|
+
let time = getValue(keyMap, "time", 0);
|
|
8674
|
+
let mode = SequenceMode[getValue(keyMap, "mode", "hold")];
|
|
8675
|
+
let index = getValue(keyMap, "index", 0);
|
|
8676
|
+
timeline.setFrame(frame, time, mode, index, delay);
|
|
8677
|
+
lastDelay = delay;
|
|
8678
|
+
keyMap = timelineMap[frame + 1];
|
|
8444
8679
|
}
|
|
8680
|
+
timelines.push(timeline);
|
|
8445
8681
|
}
|
|
8446
|
-
timeline.setFrame(frame, time, deform);
|
|
8447
|
-
let nextMap = timelineMap[frame + 1];
|
|
8448
|
-
if (!nextMap) {
|
|
8449
|
-
timeline.shrink(bezier);
|
|
8450
|
-
break;
|
|
8451
|
-
}
|
|
8452
|
-
let time2 = getValue(nextMap, "time", 0);
|
|
8453
|
-
let curve = keyMap.curve;
|
|
8454
|
-
if (curve)
|
|
8455
|
-
bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
|
|
8456
|
-
time = time2;
|
|
8457
|
-
keyMap = nextMap;
|
|
8458
8682
|
}
|
|
8459
|
-
timelines.push(timeline);
|
|
8460
8683
|
}
|
|
8461
8684
|
}
|
|
8462
8685
|
}
|
|
@@ -8520,7 +8743,7 @@ var spine = (() => {
|
|
|
8520
8743
|
this.skin = skin;
|
|
8521
8744
|
this.slotIndex = slotIndex;
|
|
8522
8745
|
this.parent = parent;
|
|
8523
|
-
this.
|
|
8746
|
+
this.inheritTimeline = inheritDeform;
|
|
8524
8747
|
}
|
|
8525
8748
|
};
|
|
8526
8749
|
function readTimeline12(keys, timeline, defaultValue, scale) {
|