@esotericsoftware/spine-core 4.2.1 → 4.2.2
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 +7 -7
- package/dist/Animation.js +8 -16
- package/dist/AnimationState.d.ts +18 -17
- package/dist/AnimationState.js +33 -26
- package/dist/AnimationStateData.js +1 -3
- package/dist/AssetManagerBase.d.ts +1 -0
- package/dist/AssetManagerBase.js +26 -10
- package/dist/AtlasAttachmentLoader.js +7 -7
- package/dist/Bone.d.ts +2 -2
- package/dist/Bone.js +1 -5
- package/dist/BoneData.d.ts +2 -2
- package/dist/BoneData.js +1 -3
- package/dist/Event.d.ts +1 -1
- package/dist/Event.js +1 -2
- package/dist/EventData.d.ts +2 -2
- package/dist/EventData.js +1 -2
- package/dist/IkConstraint.js +15 -10
- package/dist/IkConstraintData.d.ts +3 -1
- package/dist/IkConstraintData.js +9 -2
- package/dist/PathConstraint.js +13 -12
- package/dist/PathConstraintData.d.ts +3 -1
- package/dist/PathConstraintData.js +12 -5
- package/dist/Skeleton.d.ts +17 -9
- package/dist/Skeleton.js +18 -19
- package/dist/SkeletonBinary.d.ts +2 -2
- package/dist/SkeletonBinary.js +55 -15
- package/dist/SkeletonBounds.d.ts +3 -3
- package/dist/SkeletonClipping.js +5 -3
- package/dist/SkeletonData.d.ts +14 -14
- package/dist/SkeletonData.js +1 -1
- package/dist/SkeletonJson.d.ts +2 -2
- package/dist/SkeletonJson.js +96 -23
- package/dist/Skin.d.ts +2 -2
- package/dist/Skin.js +3 -5
- package/dist/Slot.d.ts +4 -4
- package/dist/Slot.js +4 -8
- package/dist/SlotData.d.ts +2 -2
- package/dist/SlotData.js +2 -6
- package/dist/TextureAtlas.d.ts +6 -4
- package/dist/TextureAtlas.js +29 -33
- package/dist/TransformConstraint.js +11 -10
- package/dist/TransformConstraintData.d.ts +3 -1
- package/dist/TransformConstraintData.js +9 -2
- package/dist/Utils.d.ts +2 -2
- package/dist/Utils.js +1 -1
- package/dist/attachments/Attachment.d.ts +1 -1
- package/dist/attachments/Attachment.js +2 -4
- package/dist/attachments/AttachmentLoader.d.ts +2 -2
- package/dist/attachments/ClippingAttachment.d.ts +1 -1
- package/dist/attachments/ClippingAttachment.js +1 -1
- package/dist/attachments/HasTextureRegion.d.ts +2 -2
- package/dist/attachments/MeshAttachment.d.ts +4 -4
- package/dist/attachments/MeshAttachment.js +11 -12
- package/dist/attachments/PathAttachment.js +2 -2
- package/dist/attachments/RegionAttachment.d.ts +3 -3
- package/dist/attachments/RegionAttachment.js +6 -6
- package/dist/iife/spine-core.js +377 -198
- package/dist/iife/spine-core.js.map +2 -2
- package/dist/iife/spine-core.min.js +2 -2
- package/package.json +1 -1
package/dist/iife/spine-core.js
CHANGED
|
@@ -511,7 +511,7 @@ var spine = (() => {
|
|
|
511
511
|
super(name);
|
|
512
512
|
this.id = _VertexAttachment.nextID++;
|
|
513
513
|
this.bones = null;
|
|
514
|
-
this.vertices =
|
|
514
|
+
this.vertices = [];
|
|
515
515
|
this.worldVerticesLength = 0;
|
|
516
516
|
this.timelineAttahment = this;
|
|
517
517
|
}
|
|
@@ -582,8 +582,7 @@ var spine = (() => {
|
|
|
582
582
|
if (this.vertices) {
|
|
583
583
|
attachment.vertices = Utils.newFloatArray(this.vertices.length);
|
|
584
584
|
Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
|
585
|
-
}
|
|
586
|
-
attachment.vertices = null;
|
|
585
|
+
}
|
|
587
586
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
|
588
587
|
attachment.timelineAttahment = this.timelineAttahment;
|
|
589
588
|
}
|
|
@@ -657,8 +656,8 @@ var spine = (() => {
|
|
|
657
656
|
// spine-core/src/Animation.ts
|
|
658
657
|
var Animation = class {
|
|
659
658
|
constructor(name, timelines, duration) {
|
|
660
|
-
this.timelines =
|
|
661
|
-
this.timelineIds =
|
|
659
|
+
this.timelines = [];
|
|
660
|
+
this.timelineIds = new StringSet();
|
|
662
661
|
if (!name)
|
|
663
662
|
throw new Error("name cannot be null.");
|
|
664
663
|
this.name = name;
|
|
@@ -669,7 +668,7 @@ var spine = (() => {
|
|
|
669
668
|
if (!timelines)
|
|
670
669
|
throw new Error("timelines cannot be null.");
|
|
671
670
|
this.timelines = timelines;
|
|
672
|
-
this.timelineIds
|
|
671
|
+
this.timelineIds.clear();
|
|
673
672
|
for (var i = 0; i < timelines.length; i++)
|
|
674
673
|
this.timelineIds.addAll(timelines[i].getPropertyIds());
|
|
675
674
|
}
|
|
@@ -728,8 +727,6 @@ var spine = (() => {
|
|
|
728
727
|
};
|
|
729
728
|
var Timeline = class {
|
|
730
729
|
constructor(frameCount, propertyIds) {
|
|
731
|
-
this.propertyIds = null;
|
|
732
|
-
this.frames = null;
|
|
733
730
|
this.propertyIds = propertyIds;
|
|
734
731
|
this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries());
|
|
735
732
|
}
|
|
@@ -763,7 +760,6 @@ var spine = (() => {
|
|
|
763
760
|
var CurveTimeline = class extends Timeline {
|
|
764
761
|
constructor(frameCount, bezierCount, propertyIds) {
|
|
765
762
|
super(frameCount, propertyIds);
|
|
766
|
-
this.curves = null;
|
|
767
763
|
this.curves = Utils.newFloatArray(frameCount + bezierCount * 18);
|
|
768
764
|
this.curves[frameCount - 1] = 1;
|
|
769
765
|
}
|
|
@@ -1823,8 +1819,6 @@ var spine = (() => {
|
|
|
1823
1819
|
Property.deform + "|" + slotIndex + "|" + attachment.id
|
|
1824
1820
|
]);
|
|
1825
1821
|
this.slotIndex = 0;
|
|
1826
|
-
this.attachment = null;
|
|
1827
|
-
this.vertices = null;
|
|
1828
1822
|
this.slotIndex = slotIndex;
|
|
1829
1823
|
this.attachment = attachment;
|
|
1830
1824
|
this.vertices = new Array(frameCount);
|
|
@@ -1887,6 +1881,8 @@ var spine = (() => {
|
|
|
1887
1881
|
if (!slot.bone.active)
|
|
1888
1882
|
return;
|
|
1889
1883
|
let slotAttachment = slot.getAttachment();
|
|
1884
|
+
if (!slotAttachment)
|
|
1885
|
+
return;
|
|
1890
1886
|
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttahment != this.attachment)
|
|
1891
1887
|
return;
|
|
1892
1888
|
let deform = slot.deform;
|
|
@@ -2041,7 +2037,6 @@ var spine = (() => {
|
|
|
2041
2037
|
var _EventTimeline = class extends Timeline {
|
|
2042
2038
|
constructor(frameCount) {
|
|
2043
2039
|
super(frameCount, _EventTimeline.propertyIds);
|
|
2044
|
-
this.events = null;
|
|
2045
2040
|
this.events = new Array(frameCount);
|
|
2046
2041
|
}
|
|
2047
2042
|
getFrameCount() {
|
|
@@ -2084,7 +2079,6 @@ var spine = (() => {
|
|
|
2084
2079
|
var _DrawOrderTimeline = class extends Timeline {
|
|
2085
2080
|
constructor(frameCount) {
|
|
2086
2081
|
super(frameCount, _DrawOrderTimeline.propertyIds);
|
|
2087
|
-
this.drawOrders = null;
|
|
2088
2082
|
this.drawOrders = new Array(frameCount);
|
|
2089
2083
|
}
|
|
2090
2084
|
getFrameCount() {
|
|
@@ -2105,7 +2099,8 @@ var spine = (() => {
|
|
|
2105
2099
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2106
2100
|
return;
|
|
2107
2101
|
}
|
|
2108
|
-
let
|
|
2102
|
+
let idx = Timeline.search1(this.frames, time);
|
|
2103
|
+
let drawOrderToSetupIndex = this.drawOrders[idx];
|
|
2109
2104
|
if (!drawOrderToSetupIndex)
|
|
2110
2105
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2111
2106
|
else {
|
|
@@ -2521,9 +2516,8 @@ var spine = (() => {
|
|
|
2521
2516
|
SequenceTimeline.DELAY = 2;
|
|
2522
2517
|
|
|
2523
2518
|
// spine-core/src/AnimationState.ts
|
|
2524
|
-
var
|
|
2519
|
+
var _AnimationState = class {
|
|
2525
2520
|
constructor(data) {
|
|
2526
|
-
this.data = null;
|
|
2527
2521
|
this.tracks = new Array();
|
|
2528
2522
|
this.timeScale = 1;
|
|
2529
2523
|
this.unkeyedState = 0;
|
|
@@ -2536,9 +2530,7 @@ var spine = (() => {
|
|
|
2536
2530
|
this.data = data;
|
|
2537
2531
|
}
|
|
2538
2532
|
static emptyAnimation() {
|
|
2539
|
-
|
|
2540
|
-
_emptyAnimation = new Animation("<empty>", [], 0);
|
|
2541
|
-
return _emptyAnimation;
|
|
2533
|
+
return _AnimationState._emptyAnimation;
|
|
2542
2534
|
}
|
|
2543
2535
|
update(delta) {
|
|
2544
2536
|
delta *= this.timeScale;
|
|
@@ -2971,13 +2963,13 @@ var spine = (() => {
|
|
|
2971
2963
|
return entry;
|
|
2972
2964
|
}
|
|
2973
2965
|
setEmptyAnimation(trackIndex, mixDuration = 0) {
|
|
2974
|
-
let entry = this.setAnimationWith(trackIndex,
|
|
2966
|
+
let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
|
|
2975
2967
|
entry.mixDuration = mixDuration;
|
|
2976
2968
|
entry.trackEnd = mixDuration;
|
|
2977
2969
|
return entry;
|
|
2978
2970
|
}
|
|
2979
2971
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
2980
|
-
let entry = this.addAnimationWith(trackIndex,
|
|
2972
|
+
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
2981
2973
|
if (delay <= 0)
|
|
2982
2974
|
entry.delay += entry.mixDuration - mixDuration;
|
|
2983
2975
|
entry.mixDuration = mixDuration;
|
|
@@ -3116,6 +3108,8 @@ var spine = (() => {
|
|
|
3116
3108
|
this.queue.clear();
|
|
3117
3109
|
}
|
|
3118
3110
|
};
|
|
3111
|
+
var AnimationState = _AnimationState;
|
|
3112
|
+
AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
|
|
3119
3113
|
var TrackEntry = class {
|
|
3120
3114
|
constructor() {
|
|
3121
3115
|
this.animation = null;
|
|
@@ -3197,7 +3191,6 @@ var spine = (() => {
|
|
|
3197
3191
|
constructor(animState) {
|
|
3198
3192
|
this.objects = [];
|
|
3199
3193
|
this.drainDisabled = false;
|
|
3200
|
-
this.animState = null;
|
|
3201
3194
|
this.animState = animState;
|
|
3202
3195
|
}
|
|
3203
3196
|
start(entry) {
|
|
@@ -3240,45 +3233,57 @@ var spine = (() => {
|
|
|
3240
3233
|
case EventType.start:
|
|
3241
3234
|
if (entry.listener && entry.listener.start)
|
|
3242
3235
|
entry.listener.start(entry);
|
|
3243
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3244
|
-
|
|
3245
|
-
|
|
3236
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3237
|
+
let listener = listeners[ii];
|
|
3238
|
+
if (listener.start)
|
|
3239
|
+
listener.start(entry);
|
|
3240
|
+
}
|
|
3246
3241
|
break;
|
|
3247
3242
|
case EventType.interrupt:
|
|
3248
3243
|
if (entry.listener && entry.listener.interrupt)
|
|
3249
3244
|
entry.listener.interrupt(entry);
|
|
3250
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3251
|
-
|
|
3252
|
-
|
|
3245
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3246
|
+
let listener = listeners[ii];
|
|
3247
|
+
if (listener.interrupt)
|
|
3248
|
+
listener.interrupt(entry);
|
|
3249
|
+
}
|
|
3253
3250
|
break;
|
|
3254
3251
|
case EventType.end:
|
|
3255
3252
|
if (entry.listener && entry.listener.end)
|
|
3256
3253
|
entry.listener.end(entry);
|
|
3257
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3258
|
-
|
|
3259
|
-
|
|
3254
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3255
|
+
let listener = listeners[ii];
|
|
3256
|
+
if (listener.end)
|
|
3257
|
+
listener.end(entry);
|
|
3258
|
+
}
|
|
3260
3259
|
case EventType.dispose:
|
|
3261
3260
|
if (entry.listener && entry.listener.dispose)
|
|
3262
3261
|
entry.listener.dispose(entry);
|
|
3263
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3264
|
-
|
|
3265
|
-
|
|
3262
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3263
|
+
let listener = listeners[ii];
|
|
3264
|
+
if (listener.dispose)
|
|
3265
|
+
listener.dispose(entry);
|
|
3266
|
+
}
|
|
3266
3267
|
this.animState.trackEntryPool.free(entry);
|
|
3267
3268
|
break;
|
|
3268
3269
|
case EventType.complete:
|
|
3269
3270
|
if (entry.listener && entry.listener.complete)
|
|
3270
3271
|
entry.listener.complete(entry);
|
|
3271
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3272
|
-
|
|
3273
|
-
|
|
3272
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3273
|
+
let listener = listeners[ii];
|
|
3274
|
+
if (listener.complete)
|
|
3275
|
+
listener.complete(entry);
|
|
3276
|
+
}
|
|
3274
3277
|
break;
|
|
3275
3278
|
case EventType.event:
|
|
3276
3279
|
let event = objects[i++ + 2];
|
|
3277
3280
|
if (entry.listener && entry.listener.event)
|
|
3278
3281
|
entry.listener.event(entry, event);
|
|
3279
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3283
|
+
let listener = listeners[ii];
|
|
3284
|
+
if (listener.event)
|
|
3285
|
+
listener.event(entry, event);
|
|
3286
|
+
}
|
|
3282
3287
|
break;
|
|
3283
3288
|
}
|
|
3284
3289
|
}
|
|
@@ -3319,12 +3324,10 @@ var spine = (() => {
|
|
|
3319
3324
|
var HOLD_MIX = 4;
|
|
3320
3325
|
var SETUP = 1;
|
|
3321
3326
|
var CURRENT = 2;
|
|
3322
|
-
var _emptyAnimation = null;
|
|
3323
3327
|
|
|
3324
3328
|
// spine-core/src/AnimationStateData.ts
|
|
3325
3329
|
var AnimationStateData = class {
|
|
3326
3330
|
constructor(skeletonData) {
|
|
3327
|
-
this.skeletonData = null;
|
|
3328
3331
|
this.animationToMixTime = {};
|
|
3329
3332
|
this.defaultMix = 0;
|
|
3330
3333
|
if (!skeletonData)
|
|
@@ -3441,65 +3444,63 @@ var spine = (() => {
|
|
|
3441
3444
|
this.regions = new Array();
|
|
3442
3445
|
let reader = new TextureAtlasReader(atlasText);
|
|
3443
3446
|
let entry = new Array(4);
|
|
3444
|
-
let page = null;
|
|
3445
|
-
let region = null;
|
|
3446
3447
|
let pageFields = {};
|
|
3447
|
-
pageFields["size"] = () => {
|
|
3448
|
-
|
|
3449
|
-
|
|
3448
|
+
pageFields["size"] = (page2) => {
|
|
3449
|
+
page2.width = parseInt(entry[1]);
|
|
3450
|
+
page2.height = parseInt(entry[2]);
|
|
3450
3451
|
};
|
|
3451
3452
|
pageFields["format"] = () => {
|
|
3452
3453
|
};
|
|
3453
|
-
pageFields["filter"] = () => {
|
|
3454
|
-
|
|
3455
|
-
|
|
3454
|
+
pageFields["filter"] = (page2) => {
|
|
3455
|
+
page2.minFilter = Utils.enumValue(TextureFilter, entry[1]);
|
|
3456
|
+
page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
|
|
3456
3457
|
};
|
|
3457
|
-
pageFields["repeat"] = () => {
|
|
3458
|
+
pageFields["repeat"] = (page2) => {
|
|
3458
3459
|
if (entry[1].indexOf("x") != -1)
|
|
3459
|
-
|
|
3460
|
+
page2.uWrap = TextureWrap.Repeat;
|
|
3460
3461
|
if (entry[1].indexOf("y") != -1)
|
|
3461
|
-
|
|
3462
|
+
page2.vWrap = TextureWrap.Repeat;
|
|
3462
3463
|
};
|
|
3463
|
-
pageFields["pma"] = () => {
|
|
3464
|
-
|
|
3464
|
+
pageFields["pma"] = (page2) => {
|
|
3465
|
+
page2.pma = entry[1] == "true";
|
|
3465
3466
|
};
|
|
3466
3467
|
var regionFields = {};
|
|
3467
|
-
regionFields["xy"] = () => {
|
|
3468
|
+
regionFields["xy"] = (region) => {
|
|
3468
3469
|
region.x = parseInt(entry[1]);
|
|
3469
3470
|
region.y = parseInt(entry[2]);
|
|
3470
3471
|
};
|
|
3471
|
-
regionFields["size"] = () => {
|
|
3472
|
+
regionFields["size"] = (region) => {
|
|
3472
3473
|
region.width = parseInt(entry[1]);
|
|
3473
3474
|
region.height = parseInt(entry[2]);
|
|
3474
3475
|
};
|
|
3475
|
-
regionFields["bounds"] = () => {
|
|
3476
|
+
regionFields["bounds"] = (region) => {
|
|
3476
3477
|
region.x = parseInt(entry[1]);
|
|
3477
3478
|
region.y = parseInt(entry[2]);
|
|
3478
3479
|
region.width = parseInt(entry[3]);
|
|
3479
3480
|
region.height = parseInt(entry[4]);
|
|
3480
3481
|
};
|
|
3481
|
-
regionFields["offset"] = () => {
|
|
3482
|
+
regionFields["offset"] = (region) => {
|
|
3482
3483
|
region.offsetX = parseInt(entry[1]);
|
|
3483
3484
|
region.offsetY = parseInt(entry[2]);
|
|
3484
3485
|
};
|
|
3485
|
-
regionFields["orig"] = () => {
|
|
3486
|
+
regionFields["orig"] = (region) => {
|
|
3486
3487
|
region.originalWidth = parseInt(entry[1]);
|
|
3487
3488
|
region.originalHeight = parseInt(entry[2]);
|
|
3488
3489
|
};
|
|
3489
|
-
regionFields["offsets"] = () => {
|
|
3490
|
+
regionFields["offsets"] = (region) => {
|
|
3490
3491
|
region.offsetX = parseInt(entry[1]);
|
|
3491
3492
|
region.offsetY = parseInt(entry[2]);
|
|
3492
3493
|
region.originalWidth = parseInt(entry[3]);
|
|
3493
3494
|
region.originalHeight = parseInt(entry[4]);
|
|
3494
3495
|
};
|
|
3495
|
-
regionFields["rotate"] = () => {
|
|
3496
|
+
regionFields["rotate"] = (region) => {
|
|
3496
3497
|
let value = entry[1];
|
|
3497
3498
|
if (value == "true")
|
|
3498
3499
|
region.degrees = 90;
|
|
3499
3500
|
else if (value != "false")
|
|
3500
3501
|
region.degrees = parseInt(value);
|
|
3501
3502
|
};
|
|
3502
|
-
regionFields["index"] = () => {
|
|
3503
|
+
regionFields["index"] = (region) => {
|
|
3503
3504
|
region.index = parseInt(entry[1]);
|
|
3504
3505
|
};
|
|
3505
3506
|
let line = reader.readLine();
|
|
@@ -3512,6 +3513,7 @@ var spine = (() => {
|
|
|
3512
3513
|
break;
|
|
3513
3514
|
line = reader.readLine();
|
|
3514
3515
|
}
|
|
3516
|
+
let page = null;
|
|
3515
3517
|
let names = null;
|
|
3516
3518
|
let values = null;
|
|
3517
3519
|
while (true) {
|
|
@@ -3521,32 +3523,29 @@ var spine = (() => {
|
|
|
3521
3523
|
page = null;
|
|
3522
3524
|
line = reader.readLine();
|
|
3523
3525
|
} else if (!page) {
|
|
3524
|
-
page = new TextureAtlasPage();
|
|
3525
|
-
page.name = line.trim();
|
|
3526
|
+
page = new TextureAtlasPage(line.trim());
|
|
3526
3527
|
while (true) {
|
|
3527
3528
|
if (reader.readEntry(entry, line = reader.readLine()) == 0)
|
|
3528
3529
|
break;
|
|
3529
3530
|
let field = pageFields[entry[0]];
|
|
3530
3531
|
if (field)
|
|
3531
|
-
field();
|
|
3532
|
+
field(page);
|
|
3532
3533
|
}
|
|
3533
3534
|
this.pages.push(page);
|
|
3534
3535
|
} else {
|
|
3535
|
-
region = new TextureAtlasRegion();
|
|
3536
|
-
region.page = page;
|
|
3537
|
-
region.name = line;
|
|
3536
|
+
let region = new TextureAtlasRegion(page, line);
|
|
3538
3537
|
while (true) {
|
|
3539
3538
|
let count = reader.readEntry(entry, line = reader.readLine());
|
|
3540
3539
|
if (count == 0)
|
|
3541
3540
|
break;
|
|
3542
3541
|
let field = regionFields[entry[0]];
|
|
3543
3542
|
if (field)
|
|
3544
|
-
field();
|
|
3543
|
+
field(region);
|
|
3545
3544
|
else {
|
|
3546
|
-
if (!names)
|
|
3545
|
+
if (!names)
|
|
3547
3546
|
names = [];
|
|
3547
|
+
if (!values)
|
|
3548
3548
|
values = [];
|
|
3549
|
-
}
|
|
3550
3549
|
names.push(entry[0]);
|
|
3551
3550
|
let entryValues = [];
|
|
3552
3551
|
for (let i = 0; i < count; i++)
|
|
@@ -3558,7 +3557,7 @@ var spine = (() => {
|
|
|
3558
3557
|
region.originalWidth = region.width;
|
|
3559
3558
|
region.originalHeight = region.height;
|
|
3560
3559
|
}
|
|
3561
|
-
if (names && names.length > 0) {
|
|
3560
|
+
if (names && names.length > 0 && values && values.length > 0) {
|
|
3562
3561
|
region.names = names;
|
|
3563
3562
|
region.values = values;
|
|
3564
3563
|
names = null;
|
|
@@ -3590,14 +3589,14 @@ var spine = (() => {
|
|
|
3590
3589
|
page.setTexture(assetManager.get(pathPrefix + page.name));
|
|
3591
3590
|
}
|
|
3592
3591
|
dispose() {
|
|
3592
|
+
var _a;
|
|
3593
3593
|
for (let i = 0; i < this.pages.length; i++) {
|
|
3594
|
-
this.pages[i].texture.dispose();
|
|
3594
|
+
(_a = this.pages[i].texture) == null ? void 0 : _a.dispose();
|
|
3595
3595
|
}
|
|
3596
3596
|
}
|
|
3597
3597
|
};
|
|
3598
3598
|
var TextureAtlasReader = class {
|
|
3599
3599
|
constructor(text) {
|
|
3600
|
-
this.lines = null;
|
|
3601
3600
|
this.index = 0;
|
|
3602
3601
|
this.lines = text.split(/\r\n|\r|\n/);
|
|
3603
3602
|
}
|
|
@@ -3630,8 +3629,7 @@ var spine = (() => {
|
|
|
3630
3629
|
}
|
|
3631
3630
|
};
|
|
3632
3631
|
var TextureAtlasPage = class {
|
|
3633
|
-
constructor() {
|
|
3634
|
-
this.name = null;
|
|
3632
|
+
constructor(name) {
|
|
3635
3633
|
this.minFilter = TextureFilter.Nearest;
|
|
3636
3634
|
this.magFilter = TextureFilter.Nearest;
|
|
3637
3635
|
this.uWrap = TextureWrap.ClampToEdge;
|
|
@@ -3640,6 +3638,7 @@ var spine = (() => {
|
|
|
3640
3638
|
this.width = 0;
|
|
3641
3639
|
this.height = 0;
|
|
3642
3640
|
this.pma = false;
|
|
3641
|
+
this.name = name;
|
|
3643
3642
|
}
|
|
3644
3643
|
setTexture(texture) {
|
|
3645
3644
|
this.texture = texture;
|
|
@@ -3648,10 +3647,8 @@ var spine = (() => {
|
|
|
3648
3647
|
}
|
|
3649
3648
|
};
|
|
3650
3649
|
var TextureAtlasRegion = class extends TextureRegion {
|
|
3651
|
-
constructor() {
|
|
3652
|
-
super(
|
|
3653
|
-
this.page = null;
|
|
3654
|
-
this.name = null;
|
|
3650
|
+
constructor(page, name) {
|
|
3651
|
+
super();
|
|
3655
3652
|
this.x = 0;
|
|
3656
3653
|
this.y = 0;
|
|
3657
3654
|
this.offsetX = 0;
|
|
@@ -3662,28 +3659,32 @@ var spine = (() => {
|
|
|
3662
3659
|
this.degrees = 0;
|
|
3663
3660
|
this.names = null;
|
|
3664
3661
|
this.values = null;
|
|
3662
|
+
this.page = page;
|
|
3663
|
+
this.name = name;
|
|
3665
3664
|
}
|
|
3666
3665
|
};
|
|
3667
3666
|
|
|
3668
3667
|
// spine-core/src/attachments/MeshAttachment.ts
|
|
3669
3668
|
var MeshAttachment = class extends VertexAttachment {
|
|
3670
|
-
constructor(name) {
|
|
3669
|
+
constructor(name, path) {
|
|
3671
3670
|
super(name);
|
|
3672
3671
|
this.region = null;
|
|
3673
|
-
this.
|
|
3674
|
-
this.
|
|
3675
|
-
this.
|
|
3676
|
-
this.triangles = null;
|
|
3672
|
+
this.regionUVs = [];
|
|
3673
|
+
this.uvs = [];
|
|
3674
|
+
this.triangles = [];
|
|
3677
3675
|
this.color = new Color(1, 1, 1, 1);
|
|
3678
3676
|
this.width = 0;
|
|
3679
3677
|
this.height = 0;
|
|
3680
3678
|
this.hullLength = 0;
|
|
3681
|
-
this.edges =
|
|
3679
|
+
this.edges = [];
|
|
3682
3680
|
this.parentMesh = null;
|
|
3683
3681
|
this.sequence = null;
|
|
3684
3682
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3683
|
+
this.path = path;
|
|
3685
3684
|
}
|
|
3686
3685
|
updateRegion() {
|
|
3686
|
+
if (!this.region)
|
|
3687
|
+
throw new Error("Region not set.");
|
|
3687
3688
|
let regionUVs = this.regionUVs;
|
|
3688
3689
|
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
3689
3690
|
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
@@ -3759,9 +3760,8 @@ var spine = (() => {
|
|
|
3759
3760
|
copy() {
|
|
3760
3761
|
if (this.parentMesh)
|
|
3761
3762
|
return this.newLinkedMesh();
|
|
3762
|
-
let copy = new MeshAttachment(this.name);
|
|
3763
|
+
let copy = new MeshAttachment(this.name, this.path);
|
|
3763
3764
|
copy.region = this.region;
|
|
3764
|
-
copy.path = this.path;
|
|
3765
3765
|
copy.color.setFromColor(this.color);
|
|
3766
3766
|
this.copyTo(copy);
|
|
3767
3767
|
copy.regionUVs = new Array(this.regionUVs.length);
|
|
@@ -3786,9 +3786,8 @@ var spine = (() => {
|
|
|
3786
3786
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
3787
3787
|
}
|
|
3788
3788
|
newLinkedMesh() {
|
|
3789
|
-
let copy = new MeshAttachment(this.name);
|
|
3789
|
+
let copy = new MeshAttachment(this.name, this.path);
|
|
3790
3790
|
copy.region = this.region;
|
|
3791
|
-
copy.path = this.path;
|
|
3792
3791
|
copy.color.setFromColor(this.color);
|
|
3793
3792
|
copy.timelineAttahment = this.timelineAttahment;
|
|
3794
3793
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
@@ -3802,7 +3801,7 @@ var spine = (() => {
|
|
|
3802
3801
|
var PathAttachment = class extends VertexAttachment {
|
|
3803
3802
|
constructor(name) {
|
|
3804
3803
|
super(name);
|
|
3805
|
-
this.lengths =
|
|
3804
|
+
this.lengths = [];
|
|
3806
3805
|
this.closed = false;
|
|
3807
3806
|
this.constantSpeed = false;
|
|
3808
3807
|
this.color = new Color(1, 1, 1, 1);
|
|
@@ -3851,7 +3850,7 @@ var spine = (() => {
|
|
|
3851
3850
|
|
|
3852
3851
|
// spine-core/src/attachments/RegionAttachment.ts
|
|
3853
3852
|
var _RegionAttachment = class extends Attachment {
|
|
3854
|
-
constructor(name) {
|
|
3853
|
+
constructor(name, path) {
|
|
3855
3854
|
super(name);
|
|
3856
3855
|
this.x = 0;
|
|
3857
3856
|
this.y = 0;
|
|
@@ -3861,15 +3860,17 @@ var spine = (() => {
|
|
|
3861
3860
|
this.width = 0;
|
|
3862
3861
|
this.height = 0;
|
|
3863
3862
|
this.color = new Color(1, 1, 1, 1);
|
|
3864
|
-
this.path = null;
|
|
3865
3863
|
this.rendererObject = null;
|
|
3866
3864
|
this.region = null;
|
|
3867
3865
|
this.sequence = null;
|
|
3868
3866
|
this.offset = Utils.newFloatArray(8);
|
|
3869
3867
|
this.uvs = Utils.newFloatArray(8);
|
|
3870
3868
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3869
|
+
this.path = path;
|
|
3871
3870
|
}
|
|
3872
3871
|
updateRegion() {
|
|
3872
|
+
if (!this.region)
|
|
3873
|
+
throw new Error("Region not set.");
|
|
3873
3874
|
let region = this.region;
|
|
3874
3875
|
let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
3875
3876
|
let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
@@ -3948,10 +3949,9 @@ var spine = (() => {
|
|
|
3948
3949
|
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
|
3949
3950
|
}
|
|
3950
3951
|
copy() {
|
|
3951
|
-
let copy = new _RegionAttachment(this.name);
|
|
3952
|
+
let copy = new _RegionAttachment(this.name, this.path);
|
|
3952
3953
|
copy.region = this.region;
|
|
3953
3954
|
copy.rendererObject = this.rendererObject;
|
|
3954
|
-
copy.path = this.path;
|
|
3955
3955
|
copy.x = this.x;
|
|
3956
3956
|
copy.y = this.y;
|
|
3957
3957
|
copy.scaleX = this.scaleX;
|
|
@@ -4003,21 +4003,21 @@ var spine = (() => {
|
|
|
4003
4003
|
// spine-core/src/AtlasAttachmentLoader.ts
|
|
4004
4004
|
var AtlasAttachmentLoader = class {
|
|
4005
4005
|
constructor(atlas) {
|
|
4006
|
-
this.atlas = null;
|
|
4007
4006
|
this.atlas = atlas;
|
|
4008
4007
|
}
|
|
4009
4008
|
loadSequence(name, basePath, sequence) {
|
|
4010
4009
|
let regions = sequence.regions;
|
|
4011
4010
|
for (let i = 0, n = regions.length; i < n; i++) {
|
|
4012
4011
|
let path = sequence.getPath(basePath, i);
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
if (regions[i] == null)
|
|
4012
|
+
let region = this.atlas.findRegion(path);
|
|
4013
|
+
if (region == null)
|
|
4016
4014
|
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
4015
|
+
regions[i] = region;
|
|
4016
|
+
regions[i].renderObject = regions[i];
|
|
4017
4017
|
}
|
|
4018
4018
|
}
|
|
4019
4019
|
newRegionAttachment(skin, name, path, sequence) {
|
|
4020
|
-
let attachment = new RegionAttachment(name);
|
|
4020
|
+
let attachment = new RegionAttachment(name, path);
|
|
4021
4021
|
if (sequence != null) {
|
|
4022
4022
|
this.loadSequence(name, path, sequence);
|
|
4023
4023
|
} else {
|
|
@@ -4030,7 +4030,7 @@ var spine = (() => {
|
|
|
4030
4030
|
return attachment;
|
|
4031
4031
|
}
|
|
4032
4032
|
newMeshAttachment(skin, name, path, sequence) {
|
|
4033
|
-
let attachment = new MeshAttachment(name);
|
|
4033
|
+
let attachment = new MeshAttachment(name, path);
|
|
4034
4034
|
if (sequence != null) {
|
|
4035
4035
|
this.loadSequence(name, path, sequence);
|
|
4036
4036
|
} else {
|
|
@@ -4060,7 +4060,6 @@ var spine = (() => {
|
|
|
4060
4060
|
var BoneData = class {
|
|
4061
4061
|
constructor(index, name, parent) {
|
|
4062
4062
|
this.index = 0;
|
|
4063
|
-
this.name = null;
|
|
4064
4063
|
this.parent = null;
|
|
4065
4064
|
this.length = 0;
|
|
4066
4065
|
this.x = 0;
|
|
@@ -4094,8 +4093,6 @@ var spine = (() => {
|
|
|
4094
4093
|
// spine-core/src/Bone.ts
|
|
4095
4094
|
var Bone = class {
|
|
4096
4095
|
constructor(data, skeleton, parent) {
|
|
4097
|
-
this.data = null;
|
|
4098
|
-
this.skeleton = null;
|
|
4099
4096
|
this.parent = null;
|
|
4100
4097
|
this.children = new Array();
|
|
4101
4098
|
this.x = 0;
|
|
@@ -4348,15 +4345,15 @@ var spine = (() => {
|
|
|
4348
4345
|
|
|
4349
4346
|
// spine-core/src/AssetManagerBase.ts
|
|
4350
4347
|
var AssetManagerBase = class {
|
|
4351
|
-
constructor(textureLoader, pathPrefix = "", downloader =
|
|
4352
|
-
this.pathPrefix =
|
|
4348
|
+
constructor(textureLoader, pathPrefix = "", downloader = new Downloader()) {
|
|
4349
|
+
this.pathPrefix = "";
|
|
4353
4350
|
this.assets = {};
|
|
4354
4351
|
this.errors = {};
|
|
4355
4352
|
this.toLoad = 0;
|
|
4356
4353
|
this.loaded = 0;
|
|
4357
4354
|
this.textureLoader = textureLoader;
|
|
4358
4355
|
this.pathPrefix = pathPrefix;
|
|
4359
|
-
this.downloader = downloader
|
|
4356
|
+
this.downloader = downloader;
|
|
4360
4357
|
}
|
|
4361
4358
|
start(path) {
|
|
4362
4359
|
this.toLoad++;
|
|
@@ -4376,10 +4373,28 @@ var spine = (() => {
|
|
|
4376
4373
|
if (callback)
|
|
4377
4374
|
callback(path, message);
|
|
4378
4375
|
}
|
|
4376
|
+
loadAll() {
|
|
4377
|
+
let promise = new Promise((resolve, reject) => {
|
|
4378
|
+
let check = () => {
|
|
4379
|
+
if (this.isLoadingComplete()) {
|
|
4380
|
+
if (this.hasErrors())
|
|
4381
|
+
reject(this.errors);
|
|
4382
|
+
else
|
|
4383
|
+
resolve(this);
|
|
4384
|
+
return;
|
|
4385
|
+
}
|
|
4386
|
+
requestAnimationFrame(check);
|
|
4387
|
+
};
|
|
4388
|
+
requestAnimationFrame(check);
|
|
4389
|
+
});
|
|
4390
|
+
return promise;
|
|
4391
|
+
}
|
|
4379
4392
|
setRawDataURI(path, data) {
|
|
4380
4393
|
this.downloader.rawDataUris[this.pathPrefix + path] = data;
|
|
4381
4394
|
}
|
|
4382
|
-
loadBinary(path, success =
|
|
4395
|
+
loadBinary(path, success = () => {
|
|
4396
|
+
}, error = () => {
|
|
4397
|
+
}) {
|
|
4383
4398
|
path = this.start(path);
|
|
4384
4399
|
this.downloader.downloadBinary(path, (data) => {
|
|
4385
4400
|
this.success(success, path, data);
|
|
@@ -4387,7 +4402,9 @@ var spine = (() => {
|
|
|
4387
4402
|
this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
|
|
4388
4403
|
});
|
|
4389
4404
|
}
|
|
4390
|
-
loadText(path, success =
|
|
4405
|
+
loadText(path, success = () => {
|
|
4406
|
+
}, error = () => {
|
|
4407
|
+
}) {
|
|
4391
4408
|
path = this.start(path);
|
|
4392
4409
|
this.downloader.downloadText(path, (data) => {
|
|
4393
4410
|
this.success(success, path, data);
|
|
@@ -4395,7 +4412,9 @@ var spine = (() => {
|
|
|
4395
4412
|
this.error(error, path, `Couldn't load text ${path}: status ${status}, ${responseText}`);
|
|
4396
4413
|
});
|
|
4397
4414
|
}
|
|
4398
|
-
loadJson(path, success =
|
|
4415
|
+
loadJson(path, success = () => {
|
|
4416
|
+
}, error = () => {
|
|
4417
|
+
}) {
|
|
4399
4418
|
path = this.start(path);
|
|
4400
4419
|
this.downloader.downloadJson(path, (data) => {
|
|
4401
4420
|
this.success(success, path, data);
|
|
@@ -4403,7 +4422,9 @@ var spine = (() => {
|
|
|
4403
4422
|
this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
|
|
4404
4423
|
});
|
|
4405
4424
|
}
|
|
4406
|
-
loadTexture(path, success =
|
|
4425
|
+
loadTexture(path, success = () => {
|
|
4426
|
+
}, error = () => {
|
|
4427
|
+
}) {
|
|
4407
4428
|
path = this.start(path);
|
|
4408
4429
|
let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
|
|
4409
4430
|
let isWebWorker = !isBrowser;
|
|
@@ -4433,7 +4454,9 @@ var spine = (() => {
|
|
|
4433
4454
|
image.src = path;
|
|
4434
4455
|
}
|
|
4435
4456
|
}
|
|
4436
|
-
loadTextureAtlas(path, success =
|
|
4457
|
+
loadTextureAtlas(path, success = () => {
|
|
4458
|
+
}, error = () => {
|
|
4459
|
+
}, fileAlias) {
|
|
4437
4460
|
let index = path.lastIndexOf("/");
|
|
4438
4461
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
4439
4462
|
path = this.start(path);
|
|
@@ -4442,7 +4465,7 @@ var spine = (() => {
|
|
|
4442
4465
|
let atlas = new TextureAtlas(atlasText);
|
|
4443
4466
|
let toLoad = atlas.pages.length, abort = false;
|
|
4444
4467
|
for (let page of atlas.pages) {
|
|
4445
|
-
this.loadTexture(fileAlias
|
|
4468
|
+
this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
|
|
4446
4469
|
if (!abort) {
|
|
4447
4470
|
page.setTexture(texture);
|
|
4448
4471
|
if (--toLoad == 0)
|
|
@@ -4619,7 +4642,6 @@ var spine = (() => {
|
|
|
4619
4642
|
// spine-core/src/Event.ts
|
|
4620
4643
|
var Event = class {
|
|
4621
4644
|
constructor(time, data) {
|
|
4622
|
-
this.data = null;
|
|
4623
4645
|
this.intValue = 0;
|
|
4624
4646
|
this.floatValue = 0;
|
|
4625
4647
|
this.stringValue = null;
|
|
@@ -4636,7 +4658,6 @@ var spine = (() => {
|
|
|
4636
4658
|
// spine-core/src/EventData.ts
|
|
4637
4659
|
var EventData = class {
|
|
4638
4660
|
constructor(name) {
|
|
4639
|
-
this.name = null;
|
|
4640
4661
|
this.intValue = 0;
|
|
4641
4662
|
this.floatValue = 0;
|
|
4642
4663
|
this.stringValue = null;
|
|
@@ -4650,9 +4671,6 @@ var spine = (() => {
|
|
|
4650
4671
|
// spine-core/src/IkConstraint.ts
|
|
4651
4672
|
var IkConstraint = class {
|
|
4652
4673
|
constructor(data, skeleton) {
|
|
4653
|
-
this.data = null;
|
|
4654
|
-
this.bones = null;
|
|
4655
|
-
this.target = null;
|
|
4656
4674
|
this.bendDirection = 0;
|
|
4657
4675
|
this.compress = false;
|
|
4658
4676
|
this.stretch = false;
|
|
@@ -4670,9 +4688,16 @@ var spine = (() => {
|
|
|
4670
4688
|
this.compress = data.compress;
|
|
4671
4689
|
this.stretch = data.stretch;
|
|
4672
4690
|
this.bones = new Array();
|
|
4673
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
4674
|
-
|
|
4675
|
-
|
|
4691
|
+
for (let i = 0; i < data.bones.length; i++) {
|
|
4692
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
4693
|
+
if (!bone)
|
|
4694
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
4695
|
+
this.bones.push(bone);
|
|
4696
|
+
}
|
|
4697
|
+
let target = skeleton.findBone(data.target.name);
|
|
4698
|
+
if (!target)
|
|
4699
|
+
throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
4700
|
+
this.target = target;
|
|
4676
4701
|
}
|
|
4677
4702
|
isActive() {
|
|
4678
4703
|
return this.active;
|
|
@@ -4693,6 +4718,8 @@ var spine = (() => {
|
|
|
4693
4718
|
}
|
|
4694
4719
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4695
4720
|
let p = bone.parent;
|
|
4721
|
+
if (!p)
|
|
4722
|
+
throw new Error("IK bone must have parent.");
|
|
4696
4723
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4697
4724
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4698
4725
|
switch (bone.data.transformMode) {
|
|
@@ -4770,6 +4797,8 @@ var spine = (() => {
|
|
|
4770
4797
|
cwy = c * cx + d * cy + parent.worldY;
|
|
4771
4798
|
}
|
|
4772
4799
|
let pp = parent.parent;
|
|
4800
|
+
if (!pp)
|
|
4801
|
+
throw new Error("IK parent must itself have a parent.");
|
|
4773
4802
|
a = pp.a;
|
|
4774
4803
|
b = pp.b;
|
|
4775
4804
|
c = pp.c;
|
|
@@ -4891,7 +4920,7 @@ var spine = (() => {
|
|
|
4891
4920
|
constructor(name) {
|
|
4892
4921
|
super(name, 0, false);
|
|
4893
4922
|
this.bones = new Array();
|
|
4894
|
-
this.
|
|
4923
|
+
this._target = null;
|
|
4895
4924
|
this.bendDirection = 1;
|
|
4896
4925
|
this.compress = false;
|
|
4897
4926
|
this.stretch = false;
|
|
@@ -4899,6 +4928,15 @@ var spine = (() => {
|
|
|
4899
4928
|
this.mix = 1;
|
|
4900
4929
|
this.softness = 0;
|
|
4901
4930
|
}
|
|
4931
|
+
set target(boneData) {
|
|
4932
|
+
this._target = boneData;
|
|
4933
|
+
}
|
|
4934
|
+
get target() {
|
|
4935
|
+
if (!this._target)
|
|
4936
|
+
throw new Error("BoneData not set.");
|
|
4937
|
+
else
|
|
4938
|
+
return this._target;
|
|
4939
|
+
}
|
|
4902
4940
|
};
|
|
4903
4941
|
|
|
4904
4942
|
// spine-core/src/PathConstraintData.ts
|
|
@@ -4906,10 +4944,10 @@ var spine = (() => {
|
|
|
4906
4944
|
constructor(name) {
|
|
4907
4945
|
super(name, 0, false);
|
|
4908
4946
|
this.bones = new Array();
|
|
4909
|
-
this.
|
|
4910
|
-
this.positionMode =
|
|
4911
|
-
this.spacingMode =
|
|
4912
|
-
this.rotateMode =
|
|
4947
|
+
this._target = null;
|
|
4948
|
+
this.positionMode = PositionMode.Fixed;
|
|
4949
|
+
this.spacingMode = SpacingMode.Fixed;
|
|
4950
|
+
this.rotateMode = RotateMode.Chain;
|
|
4913
4951
|
this.offsetRotation = 0;
|
|
4914
4952
|
this.position = 0;
|
|
4915
4953
|
this.spacing = 0;
|
|
@@ -4917,6 +4955,15 @@ var spine = (() => {
|
|
|
4917
4955
|
this.mixX = 0;
|
|
4918
4956
|
this.mixY = 0;
|
|
4919
4957
|
}
|
|
4958
|
+
set target(slotData) {
|
|
4959
|
+
this._target = slotData;
|
|
4960
|
+
}
|
|
4961
|
+
get target() {
|
|
4962
|
+
if (!this._target)
|
|
4963
|
+
throw new Error("SlotData not set.");
|
|
4964
|
+
else
|
|
4965
|
+
return this._target;
|
|
4966
|
+
}
|
|
4920
4967
|
};
|
|
4921
4968
|
var PositionMode;
|
|
4922
4969
|
(function(PositionMode2) {
|
|
@@ -4940,9 +4987,6 @@ var spine = (() => {
|
|
|
4940
4987
|
// spine-core/src/PathConstraint.ts
|
|
4941
4988
|
var _PathConstraint = class {
|
|
4942
4989
|
constructor(data, skeleton) {
|
|
4943
|
-
this.data = null;
|
|
4944
|
-
this.bones = null;
|
|
4945
|
-
this.target = null;
|
|
4946
4990
|
this.position = 0;
|
|
4947
4991
|
this.spacing = 0;
|
|
4948
4992
|
this.mixRotate = 0;
|
|
@@ -4961,9 +5005,16 @@ var spine = (() => {
|
|
|
4961
5005
|
throw new Error("skeleton cannot be null.");
|
|
4962
5006
|
this.data = data;
|
|
4963
5007
|
this.bones = new Array();
|
|
4964
|
-
for (let i = 0, n = data.bones.length; i < n; i++)
|
|
4965
|
-
|
|
4966
|
-
|
|
5008
|
+
for (let i = 0, n = data.bones.length; i < n; i++) {
|
|
5009
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
5010
|
+
if (!bone)
|
|
5011
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
5012
|
+
this.bones.push(bone);
|
|
5013
|
+
}
|
|
5014
|
+
let target = skeleton.findSlot(data.target.name);
|
|
5015
|
+
if (!target)
|
|
5016
|
+
throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
5017
|
+
this.target = target;
|
|
4967
5018
|
this.position = data.position;
|
|
4968
5019
|
this.spacing = data.spacing;
|
|
4969
5020
|
this.mixRotate = data.mixRotate;
|
|
@@ -4984,7 +5035,7 @@ var spine = (() => {
|
|
|
4984
5035
|
let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
|
|
4985
5036
|
let bones = this.bones;
|
|
4986
5037
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
4987
|
-
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) :
|
|
5038
|
+
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
|
|
4988
5039
|
let spacing = this.spacing;
|
|
4989
5040
|
switch (data.spacingMode) {
|
|
4990
5041
|
case SpacingMode.Percent:
|
|
@@ -5105,7 +5156,7 @@ var spine = (() => {
|
|
|
5105
5156
|
computeWorldPositions(path, spacesCount, tangents) {
|
|
5106
5157
|
let target = this.target;
|
|
5107
5158
|
let position = this.position;
|
|
5108
|
-
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world =
|
|
5159
|
+
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = this.world;
|
|
5109
5160
|
let closed2 = path.closed;
|
|
5110
5161
|
let verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = _PathConstraint.NONE;
|
|
5111
5162
|
if (!path.constantSpeed) {
|
|
@@ -5362,12 +5413,10 @@ var spine = (() => {
|
|
|
5362
5413
|
// spine-core/src/Slot.ts
|
|
5363
5414
|
var Slot = class {
|
|
5364
5415
|
constructor(data, bone) {
|
|
5365
|
-
this.data = null;
|
|
5366
|
-
this.bone = null;
|
|
5367
|
-
this.color = null;
|
|
5368
5416
|
this.darkColor = null;
|
|
5369
5417
|
this.attachment = null;
|
|
5370
5418
|
this.attachmentState = 0;
|
|
5419
|
+
this.sequenceIndex = -1;
|
|
5371
5420
|
this.deform = new Array();
|
|
5372
5421
|
if (!data)
|
|
5373
5422
|
throw new Error("data cannot be null.");
|
|
@@ -5410,9 +5459,6 @@ var spine = (() => {
|
|
|
5410
5459
|
// spine-core/src/TransformConstraint.ts
|
|
5411
5460
|
var TransformConstraint = class {
|
|
5412
5461
|
constructor(data, skeleton) {
|
|
5413
|
-
this.data = null;
|
|
5414
|
-
this.bones = null;
|
|
5415
|
-
this.target = null;
|
|
5416
5462
|
this.mixRotate = 0;
|
|
5417
5463
|
this.mixX = 0;
|
|
5418
5464
|
this.mixY = 0;
|
|
@@ -5433,9 +5479,16 @@ var spine = (() => {
|
|
|
5433
5479
|
this.mixScaleY = data.mixScaleY;
|
|
5434
5480
|
this.mixShearY = data.mixShearY;
|
|
5435
5481
|
this.bones = new Array();
|
|
5436
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
5437
|
-
|
|
5438
|
-
|
|
5482
|
+
for (let i = 0; i < data.bones.length; i++) {
|
|
5483
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
5484
|
+
if (!bone)
|
|
5485
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
5486
|
+
this.bones.push(bone);
|
|
5487
|
+
}
|
|
5488
|
+
let target = skeleton.findBone(data.target.name);
|
|
5489
|
+
if (!target)
|
|
5490
|
+
throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
5491
|
+
this.target = target;
|
|
5439
5492
|
}
|
|
5440
5493
|
isActive() {
|
|
5441
5494
|
return this.active;
|
|
@@ -5620,16 +5673,8 @@ var spine = (() => {
|
|
|
5620
5673
|
// spine-core/src/Skeleton.ts
|
|
5621
5674
|
var Skeleton = class {
|
|
5622
5675
|
constructor(data) {
|
|
5623
|
-
this.data = null;
|
|
5624
|
-
this.bones = null;
|
|
5625
|
-
this.slots = null;
|
|
5626
|
-
this.drawOrder = null;
|
|
5627
|
-
this.ikConstraints = null;
|
|
5628
|
-
this.transformConstraints = null;
|
|
5629
|
-
this.pathConstraints = null;
|
|
5630
5676
|
this._updateCache = new Array();
|
|
5631
5677
|
this.skin = null;
|
|
5632
|
-
this.color = null;
|
|
5633
5678
|
this.scaleX = 1;
|
|
5634
5679
|
this.scaleY = 1;
|
|
5635
5680
|
this.x = 0;
|
|
@@ -5824,6 +5869,8 @@ var spine = (() => {
|
|
|
5824
5869
|
}
|
|
5825
5870
|
}
|
|
5826
5871
|
sortBone(bone) {
|
|
5872
|
+
if (!bone)
|
|
5873
|
+
return;
|
|
5827
5874
|
if (bone.sorted)
|
|
5828
5875
|
return;
|
|
5829
5876
|
let parent = bone.parent;
|
|
@@ -5860,6 +5907,8 @@ var spine = (() => {
|
|
|
5860
5907
|
}
|
|
5861
5908
|
updateWorldTransformWith(parent) {
|
|
5862
5909
|
let rootBone = this.getRootBone();
|
|
5910
|
+
if (!rootBone)
|
|
5911
|
+
throw new Error("Root bone must not be null.");
|
|
5863
5912
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
5864
5913
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
5865
5914
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -5980,7 +6029,10 @@ var spine = (() => {
|
|
|
5980
6029
|
this.updateCache();
|
|
5981
6030
|
}
|
|
5982
6031
|
getAttachmentByName(slotName, attachmentName) {
|
|
5983
|
-
|
|
6032
|
+
let slot = this.data.findSlot(slotName);
|
|
6033
|
+
if (!slot)
|
|
6034
|
+
throw new Error(`Can't find slot with name ${slotName}`);
|
|
6035
|
+
return this.getAttachment(slot.index, attachmentName);
|
|
5984
6036
|
}
|
|
5985
6037
|
getAttachment(slotIndex, attachmentName) {
|
|
5986
6038
|
if (!attachmentName)
|
|
@@ -6046,6 +6098,12 @@ var spine = (() => {
|
|
|
6046
6098
|
}
|
|
6047
6099
|
return null;
|
|
6048
6100
|
}
|
|
6101
|
+
getBoundsRect() {
|
|
6102
|
+
let offset = new Vector2();
|
|
6103
|
+
let size = new Vector2();
|
|
6104
|
+
this.getBounds(offset, size);
|
|
6105
|
+
return { x: offset.x, y: offset.y, width: size.x, height: size.y };
|
|
6106
|
+
}
|
|
6049
6107
|
getBounds(offset, size, temp = new Array(2)) {
|
|
6050
6108
|
if (!offset)
|
|
6051
6109
|
throw new Error("offset cannot be null.");
|
|
@@ -6200,7 +6258,7 @@ var spine = (() => {
|
|
|
6200
6258
|
|
|
6201
6259
|
// spine-core/src/Skin.ts
|
|
6202
6260
|
var SkinEntry = class {
|
|
6203
|
-
constructor(slotIndex = 0, name
|
|
6261
|
+
constructor(slotIndex = 0, name, attachment) {
|
|
6204
6262
|
this.slotIndex = slotIndex;
|
|
6205
6263
|
this.name = name;
|
|
6206
6264
|
this.attachment = attachment;
|
|
@@ -6208,7 +6266,6 @@ var spine = (() => {
|
|
|
6208
6266
|
};
|
|
6209
6267
|
var Skin = class {
|
|
6210
6268
|
constructor(name) {
|
|
6211
|
-
this.name = null;
|
|
6212
6269
|
this.attachments = new Array();
|
|
6213
6270
|
this.bones = Array();
|
|
6214
6271
|
this.constraints = new Array();
|
|
@@ -6303,7 +6360,7 @@ var spine = (() => {
|
|
|
6303
6360
|
removeAttachment(slotIndex, name) {
|
|
6304
6361
|
let dictionary = this.attachments[slotIndex];
|
|
6305
6362
|
if (dictionary)
|
|
6306
|
-
dictionary[name]
|
|
6363
|
+
delete dictionary[name];
|
|
6307
6364
|
}
|
|
6308
6365
|
getAttachments() {
|
|
6309
6366
|
let entries = new Array();
|
|
@@ -6360,12 +6417,10 @@ var spine = (() => {
|
|
|
6360
6417
|
var SlotData = class {
|
|
6361
6418
|
constructor(index, name, boneData) {
|
|
6362
6419
|
this.index = 0;
|
|
6363
|
-
this.name = null;
|
|
6364
|
-
this.boneData = null;
|
|
6365
6420
|
this.color = new Color(1, 1, 1, 1);
|
|
6366
6421
|
this.darkColor = null;
|
|
6367
6422
|
this.attachmentName = null;
|
|
6368
|
-
this.blendMode =
|
|
6423
|
+
this.blendMode = BlendMode.Normal;
|
|
6369
6424
|
if (index < 0)
|
|
6370
6425
|
throw new Error("index must be >= 0.");
|
|
6371
6426
|
if (!name)
|
|
@@ -6390,7 +6445,7 @@ var spine = (() => {
|
|
|
6390
6445
|
constructor(name) {
|
|
6391
6446
|
super(name, 0, false);
|
|
6392
6447
|
this.bones = new Array();
|
|
6393
|
-
this.
|
|
6448
|
+
this._target = null;
|
|
6394
6449
|
this.mixRotate = 0;
|
|
6395
6450
|
this.mixX = 0;
|
|
6396
6451
|
this.mixY = 0;
|
|
@@ -6406,13 +6461,21 @@ var spine = (() => {
|
|
|
6406
6461
|
this.relative = false;
|
|
6407
6462
|
this.local = false;
|
|
6408
6463
|
}
|
|
6464
|
+
set target(boneData) {
|
|
6465
|
+
this._target = boneData;
|
|
6466
|
+
}
|
|
6467
|
+
get target() {
|
|
6468
|
+
if (!this._target)
|
|
6469
|
+
throw new Error("BoneData not set.");
|
|
6470
|
+
else
|
|
6471
|
+
return this._target;
|
|
6472
|
+
}
|
|
6409
6473
|
};
|
|
6410
6474
|
|
|
6411
6475
|
// spine-core/src/SkeletonBinary.ts
|
|
6412
6476
|
var SkeletonBinary = class {
|
|
6413
6477
|
constructor(attachmentLoader) {
|
|
6414
6478
|
this.scale = 1;
|
|
6415
|
-
this.attachmentLoader = null;
|
|
6416
6479
|
this.linkedMeshes = new Array();
|
|
6417
6480
|
this.attachmentLoader = attachmentLoader;
|
|
6418
6481
|
}
|
|
@@ -6437,11 +6500,17 @@ var spine = (() => {
|
|
|
6437
6500
|
}
|
|
6438
6501
|
let n = 0;
|
|
6439
6502
|
n = input.readInt(true);
|
|
6440
|
-
for (let i = 0; i < n; i++)
|
|
6441
|
-
input.
|
|
6503
|
+
for (let i = 0; i < n; i++) {
|
|
6504
|
+
let str = input.readString();
|
|
6505
|
+
if (!str)
|
|
6506
|
+
throw new Error("String in string table must not be null.");
|
|
6507
|
+
input.strings.push(str);
|
|
6508
|
+
}
|
|
6442
6509
|
n = input.readInt(true);
|
|
6443
6510
|
for (let i = 0; i < n; i++) {
|
|
6444
6511
|
let name = input.readString();
|
|
6512
|
+
if (!name)
|
|
6513
|
+
throw new Error("Bone name must not be null.");
|
|
6445
6514
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
6446
6515
|
let data = new BoneData(i, name, parent);
|
|
6447
6516
|
data.rotation = input.readFloat();
|
|
@@ -6461,6 +6530,8 @@ var spine = (() => {
|
|
|
6461
6530
|
n = input.readInt(true);
|
|
6462
6531
|
for (let i = 0; i < n; i++) {
|
|
6463
6532
|
let slotName = input.readString();
|
|
6533
|
+
if (!slotName)
|
|
6534
|
+
throw new Error("Slot name must not be null.");
|
|
6464
6535
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
6465
6536
|
let data = new SlotData(i, slotName, boneData);
|
|
6466
6537
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
@@ -6473,7 +6544,10 @@ var spine = (() => {
|
|
|
6473
6544
|
}
|
|
6474
6545
|
n = input.readInt(true);
|
|
6475
6546
|
for (let i = 0, nn; i < n; i++) {
|
|
6476
|
-
let
|
|
6547
|
+
let name = input.readString();
|
|
6548
|
+
if (!name)
|
|
6549
|
+
throw new Error("IK constraint data name must not be null.");
|
|
6550
|
+
let data = new IkConstraintData(name);
|
|
6477
6551
|
data.order = input.readInt(true);
|
|
6478
6552
|
data.skinRequired = input.readBoolean();
|
|
6479
6553
|
nn = input.readInt(true);
|
|
@@ -6490,7 +6564,10 @@ var spine = (() => {
|
|
|
6490
6564
|
}
|
|
6491
6565
|
n = input.readInt(true);
|
|
6492
6566
|
for (let i = 0, nn; i < n; i++) {
|
|
6493
|
-
let
|
|
6567
|
+
let name = input.readString();
|
|
6568
|
+
if (!name)
|
|
6569
|
+
throw new Error("Transform constraint data name must not be null.");
|
|
6570
|
+
let data = new TransformConstraintData(name);
|
|
6494
6571
|
data.order = input.readInt(true);
|
|
6495
6572
|
data.skinRequired = input.readBoolean();
|
|
6496
6573
|
nn = input.readInt(true);
|
|
@@ -6515,7 +6592,10 @@ var spine = (() => {
|
|
|
6515
6592
|
}
|
|
6516
6593
|
n = input.readInt(true);
|
|
6517
6594
|
for (let i = 0, nn; i < n; i++) {
|
|
6518
|
-
let
|
|
6595
|
+
let name = input.readString();
|
|
6596
|
+
if (!name)
|
|
6597
|
+
throw new Error("Path constraint data name must not be null.");
|
|
6598
|
+
let data = new PathConstraintData(name);
|
|
6519
6599
|
data.order = input.readInt(true);
|
|
6520
6600
|
data.skinRequired = input.readBoolean();
|
|
6521
6601
|
nn = input.readInt(true);
|
|
@@ -6545,14 +6625,24 @@ var spine = (() => {
|
|
|
6545
6625
|
{
|
|
6546
6626
|
let i = skeletonData.skins.length;
|
|
6547
6627
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
6548
|
-
for (; i < n; i++)
|
|
6549
|
-
|
|
6628
|
+
for (; i < n; i++) {
|
|
6629
|
+
let skin = this.readSkin(input, skeletonData, false, nonessential);
|
|
6630
|
+
if (!skin)
|
|
6631
|
+
throw new Error("readSkin() should not have returned null.");
|
|
6632
|
+
skeletonData.skins[i] = skin;
|
|
6633
|
+
}
|
|
6550
6634
|
}
|
|
6551
6635
|
n = this.linkedMeshes.length;
|
|
6552
6636
|
for (let i = 0; i < n; i++) {
|
|
6553
6637
|
let linkedMesh = this.linkedMeshes[i];
|
|
6554
6638
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
6639
|
+
if (!skin)
|
|
6640
|
+
throw new Error("Not skin found for linked mesh.");
|
|
6641
|
+
if (!linkedMesh.parent)
|
|
6642
|
+
throw new Error("Linked mesh parent must not be null");
|
|
6555
6643
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
6644
|
+
if (!parent)
|
|
6645
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
6556
6646
|
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
6557
6647
|
linkedMesh.mesh.setParentMesh(parent);
|
|
6558
6648
|
if (linkedMesh.mesh.region != null)
|
|
@@ -6561,7 +6651,10 @@ var spine = (() => {
|
|
|
6561
6651
|
this.linkedMeshes.length = 0;
|
|
6562
6652
|
n = input.readInt(true);
|
|
6563
6653
|
for (let i = 0; i < n; i++) {
|
|
6564
|
-
let
|
|
6654
|
+
let eventName = input.readStringRef();
|
|
6655
|
+
if (!eventName)
|
|
6656
|
+
throw new Error();
|
|
6657
|
+
let data = new EventData(eventName);
|
|
6565
6658
|
data.intValue = input.readInt(false);
|
|
6566
6659
|
data.floatValue = input.readFloat();
|
|
6567
6660
|
data.stringValue = input.readString();
|
|
@@ -6573,8 +6666,12 @@ var spine = (() => {
|
|
|
6573
6666
|
skeletonData.events.push(data);
|
|
6574
6667
|
}
|
|
6575
6668
|
n = input.readInt(true);
|
|
6576
|
-
for (let i = 0; i < n; i++)
|
|
6577
|
-
|
|
6669
|
+
for (let i = 0; i < n; i++) {
|
|
6670
|
+
let animationName = input.readString();
|
|
6671
|
+
if (!animationName)
|
|
6672
|
+
throw new Error("Animatio name must not be null.");
|
|
6673
|
+
skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
|
|
6674
|
+
}
|
|
6578
6675
|
return skeletonData;
|
|
6579
6676
|
}
|
|
6580
6677
|
readSkin(input, skeletonData, defaultSkin, nonessential) {
|
|
@@ -6586,7 +6683,10 @@ var spine = (() => {
|
|
|
6586
6683
|
return null;
|
|
6587
6684
|
skin = new Skin("default");
|
|
6588
6685
|
} else {
|
|
6589
|
-
|
|
6686
|
+
let skinName = input.readStringRef();
|
|
6687
|
+
if (!skinName)
|
|
6688
|
+
throw new Error("Skin name must not be null.");
|
|
6689
|
+
skin = new Skin(skinName);
|
|
6590
6690
|
skin.bones.length = input.readInt(true);
|
|
6591
6691
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
6592
6692
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -6602,6 +6702,8 @@ var spine = (() => {
|
|
|
6602
6702
|
let slotIndex = input.readInt(true);
|
|
6603
6703
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
6604
6704
|
let name = input.readStringRef();
|
|
6705
|
+
if (!name)
|
|
6706
|
+
throw new Error("Attachment name must not be null");
|
|
6605
6707
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
6606
6708
|
if (attachment)
|
|
6607
6709
|
skin.setAttachment(slotIndex, name, attachment);
|
|
@@ -6668,7 +6770,7 @@ var spine = (() => {
|
|
|
6668
6770
|
let vertices = this.readVertices(input, vertexCount);
|
|
6669
6771
|
let hullLength = input.readInt(true);
|
|
6670
6772
|
let sequence = this.readSequence(input);
|
|
6671
|
-
let edges =
|
|
6773
|
+
let edges = [];
|
|
6672
6774
|
let width = 0, height = 0;
|
|
6673
6775
|
if (nonessential) {
|
|
6674
6776
|
edges = this.readShortArray(input);
|
|
@@ -7170,6 +7272,8 @@ var spine = (() => {
|
|
|
7170
7272
|
let slotIndex = input.readInt(true);
|
|
7171
7273
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
7172
7274
|
let attachmentName = input.readStringRef();
|
|
7275
|
+
if (!attachmentName)
|
|
7276
|
+
throw new Error("attachmentName must not be null.");
|
|
7173
7277
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
7174
7278
|
let timelineType = input.readByte();
|
|
7175
7279
|
let frameCount = input.readInt(true);
|
|
@@ -7344,7 +7448,7 @@ var spine = (() => {
|
|
|
7344
7448
|
let chars = "";
|
|
7345
7449
|
let charCount = 0;
|
|
7346
7450
|
for (let i = 0; i < byteCount; ) {
|
|
7347
|
-
let b = this.
|
|
7451
|
+
let b = this.readUnsignedByte();
|
|
7348
7452
|
switch (b >> 4) {
|
|
7349
7453
|
case 12:
|
|
7350
7454
|
case 13:
|
|
@@ -7845,6 +7949,8 @@ var spine = (() => {
|
|
|
7845
7949
|
this.clippedVertices = new Array();
|
|
7846
7950
|
this.clippedTriangles = new Array();
|
|
7847
7951
|
this.scratch = new Array();
|
|
7952
|
+
this.clipAttachment = null;
|
|
7953
|
+
this.clippingPolygons = null;
|
|
7848
7954
|
}
|
|
7849
7955
|
clipStart(slot, clip) {
|
|
7850
7956
|
if (this.clipAttachment)
|
|
@@ -7884,7 +7990,7 @@ var spine = (() => {
|
|
|
7884
7990
|
let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
|
|
7885
7991
|
let clippedTriangles = this.clippedTriangles;
|
|
7886
7992
|
let polygons = this.clippingPolygons;
|
|
7887
|
-
let polygonsCount =
|
|
7993
|
+
let polygonsCount = polygons.length;
|
|
7888
7994
|
let vertexSize = twoColor ? 12 : 8;
|
|
7889
7995
|
let index = 0;
|
|
7890
7996
|
clippedVertices.length = 0;
|
|
@@ -8016,7 +8122,7 @@ var spine = (() => {
|
|
|
8016
8122
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8017
8123
|
let originalOutput = output;
|
|
8018
8124
|
let clipped = false;
|
|
8019
|
-
let input
|
|
8125
|
+
let input;
|
|
8020
8126
|
if (clippingArea.length % 4 >= 2) {
|
|
8021
8127
|
input = output;
|
|
8022
8128
|
output = this.scratch;
|
|
@@ -8124,7 +8230,6 @@ var spine = (() => {
|
|
|
8124
8230
|
// spine-core/src/SkeletonJson.ts
|
|
8125
8231
|
var SkeletonJson = class {
|
|
8126
8232
|
constructor(attachmentLoader) {
|
|
8127
|
-
this.attachmentLoader = null;
|
|
8128
8233
|
this.scale = 1;
|
|
8129
8234
|
this.linkedMeshes = new Array();
|
|
8130
8235
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8172,6 +8277,8 @@ var spine = (() => {
|
|
|
8172
8277
|
for (let i = 0; i < root.slots.length; i++) {
|
|
8173
8278
|
let slotMap = root.slots[i];
|
|
8174
8279
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
8280
|
+
if (!boneData)
|
|
8281
|
+
throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotMap.name}`);
|
|
8175
8282
|
let data = new SlotData(skeletonData.slots.length, slotMap.name, boneData);
|
|
8176
8283
|
let color = getValue(slotMap, "color", null);
|
|
8177
8284
|
if (color)
|
|
@@ -8190,9 +8297,17 @@ var spine = (() => {
|
|
|
8190
8297
|
let data = new IkConstraintData(constraintMap.name);
|
|
8191
8298
|
data.order = getValue(constraintMap, "order", 0);
|
|
8192
8299
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8193
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8194
|
-
|
|
8195
|
-
|
|
8300
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8301
|
+
let bone = skeletonData.findBone(constraintMap.bones[ii]);
|
|
8302
|
+
if (!bone)
|
|
8303
|
+
throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
8304
|
+
data.bones.push(bone);
|
|
8305
|
+
}
|
|
8306
|
+
let target = skeletonData.findBone(constraintMap.target);
|
|
8307
|
+
;
|
|
8308
|
+
if (!target)
|
|
8309
|
+
throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
8310
|
+
data.target = target;
|
|
8196
8311
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
8197
8312
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
8198
8313
|
data.bendDirection = getValue(constraintMap, "bendPositive", true) ? 1 : -1;
|
|
@@ -8208,10 +8323,18 @@ var spine = (() => {
|
|
|
8208
8323
|
let data = new TransformConstraintData(constraintMap.name);
|
|
8209
8324
|
data.order = getValue(constraintMap, "order", 0);
|
|
8210
8325
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8211
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8212
|
-
|
|
8326
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8327
|
+
let boneName = constraintMap.bones[ii];
|
|
8328
|
+
let bone = skeletonData.findBone(boneName);
|
|
8329
|
+
if (!bone)
|
|
8330
|
+
throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
8331
|
+
data.bones.push(bone);
|
|
8332
|
+
}
|
|
8213
8333
|
let targetName = constraintMap.target;
|
|
8214
|
-
|
|
8334
|
+
let target = skeletonData.findBone(targetName);
|
|
8335
|
+
if (!target)
|
|
8336
|
+
throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
8337
|
+
data.target = target;
|
|
8215
8338
|
data.local = getValue(constraintMap, "local", false);
|
|
8216
8339
|
data.relative = getValue(constraintMap, "relative", false);
|
|
8217
8340
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
@@ -8235,10 +8358,18 @@ var spine = (() => {
|
|
|
8235
8358
|
let data = new PathConstraintData(constraintMap.name);
|
|
8236
8359
|
data.order = getValue(constraintMap, "order", 0);
|
|
8237
8360
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8238
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8239
|
-
|
|
8361
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8362
|
+
let boneName = constraintMap.bones[ii];
|
|
8363
|
+
let bone = skeletonData.findBone(boneName);
|
|
8364
|
+
if (!bone)
|
|
8365
|
+
throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
8366
|
+
data.bones.push(bone);
|
|
8367
|
+
}
|
|
8240
8368
|
let targetName = constraintMap.target;
|
|
8241
|
-
|
|
8369
|
+
let target = skeletonData.findSlot(targetName);
|
|
8370
|
+
if (!target)
|
|
8371
|
+
throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
8372
|
+
data.target = target;
|
|
8242
8373
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
8243
8374
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
8244
8375
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
@@ -8260,23 +8391,45 @@ var spine = (() => {
|
|
|
8260
8391
|
let skinMap = root.skins[i];
|
|
8261
8392
|
let skin = new Skin(skinMap.name);
|
|
8262
8393
|
if (skinMap.bones) {
|
|
8263
|
-
for (let ii = 0; ii < skinMap.bones.length; ii++)
|
|
8264
|
-
|
|
8394
|
+
for (let ii = 0; ii < skinMap.bones.length; ii++) {
|
|
8395
|
+
let boneName = skinMap.bones[ii];
|
|
8396
|
+
let bone = skeletonData.findBone(boneName);
|
|
8397
|
+
if (!bone)
|
|
8398
|
+
throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
8399
|
+
skin.bones.push(bone);
|
|
8400
|
+
}
|
|
8265
8401
|
}
|
|
8266
8402
|
if (skinMap.ik) {
|
|
8267
|
-
for (let ii = 0; ii < skinMap.ik.length; ii++)
|
|
8268
|
-
|
|
8403
|
+
for (let ii = 0; ii < skinMap.ik.length; ii++) {
|
|
8404
|
+
let constraintName = skinMap.ik[ii];
|
|
8405
|
+
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8406
|
+
if (!constraint)
|
|
8407
|
+
throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8408
|
+
skin.constraints.push(constraint);
|
|
8409
|
+
}
|
|
8269
8410
|
}
|
|
8270
8411
|
if (skinMap.transform) {
|
|
8271
|
-
for (let ii = 0; ii < skinMap.transform.length; ii++)
|
|
8272
|
-
|
|
8412
|
+
for (let ii = 0; ii < skinMap.transform.length; ii++) {
|
|
8413
|
+
let constraintName = skinMap.transform[ii];
|
|
8414
|
+
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8415
|
+
if (!constraint)
|
|
8416
|
+
throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8417
|
+
skin.constraints.push(constraint);
|
|
8418
|
+
}
|
|
8273
8419
|
}
|
|
8274
8420
|
if (skinMap.path) {
|
|
8275
|
-
for (let ii = 0; ii < skinMap.path.length; ii++)
|
|
8276
|
-
|
|
8421
|
+
for (let ii = 0; ii < skinMap.path.length; ii++) {
|
|
8422
|
+
let constraintName = skinMap.path[ii];
|
|
8423
|
+
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8424
|
+
if (!constraint)
|
|
8425
|
+
throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8426
|
+
skin.constraints.push(constraint);
|
|
8427
|
+
}
|
|
8277
8428
|
}
|
|
8278
8429
|
for (let slotName in skinMap.attachments) {
|
|
8279
8430
|
let slot = skeletonData.findSlot(slotName);
|
|
8431
|
+
if (!slot)
|
|
8432
|
+
throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
8280
8433
|
let slotMap = skinMap.attachments[slotName];
|
|
8281
8434
|
for (let entryName in slotMap) {
|
|
8282
8435
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
@@ -8292,7 +8445,11 @@ var spine = (() => {
|
|
|
8292
8445
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
8293
8446
|
let linkedMesh = this.linkedMeshes[i];
|
|
8294
8447
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
8448
|
+
if (!skin)
|
|
8449
|
+
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
8295
8450
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8451
|
+
if (!parent)
|
|
8452
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8296
8453
|
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8297
8454
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8298
8455
|
if (linkedMesh.mesh.region != null)
|
|
@@ -8476,7 +8633,10 @@ var spine = (() => {
|
|
|
8476
8633
|
if (map.slots) {
|
|
8477
8634
|
for (let slotName in map.slots) {
|
|
8478
8635
|
let slotMap = map.slots[slotName];
|
|
8479
|
-
let
|
|
8636
|
+
let slot = skeletonData.findSlot(slotName);
|
|
8637
|
+
if (!slot)
|
|
8638
|
+
throw new Error("Slot not found: " + slotName);
|
|
8639
|
+
let slotIndex = slot.index;
|
|
8480
8640
|
for (let timelineName in slotMap) {
|
|
8481
8641
|
let timelineMap = slotMap[timelineName];
|
|
8482
8642
|
if (!timelineMap)
|
|
@@ -8612,7 +8772,10 @@ var spine = (() => {
|
|
|
8612
8772
|
if (map.bones) {
|
|
8613
8773
|
for (let boneName in map.bones) {
|
|
8614
8774
|
let boneMap = map.bones[boneName];
|
|
8615
|
-
let
|
|
8775
|
+
let bone = skeletonData.findBone(boneName);
|
|
8776
|
+
if (!bone)
|
|
8777
|
+
throw new Error("Bone not found: " + boneName);
|
|
8778
|
+
let boneIndex = bone.index;
|
|
8616
8779
|
for (let timelineName in boneMap) {
|
|
8617
8780
|
let timelineMap = boneMap[timelineName];
|
|
8618
8781
|
let frames = timelineMap.length;
|
|
@@ -8658,6 +8821,8 @@ var spine = (() => {
|
|
|
8658
8821
|
if (!keyMap)
|
|
8659
8822
|
continue;
|
|
8660
8823
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8824
|
+
if (!constraint)
|
|
8825
|
+
throw new Error("IK Constraint not found: " + constraintName);
|
|
8661
8826
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
8662
8827
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
8663
8828
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8693,6 +8858,8 @@ var spine = (() => {
|
|
|
8693
8858
|
if (!keyMap)
|
|
8694
8859
|
continue;
|
|
8695
8860
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8861
|
+
if (!constraint)
|
|
8862
|
+
throw new Error("Transform constraint not found: " + constraintName);
|
|
8696
8863
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
8697
8864
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
8698
8865
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8741,6 +8908,8 @@ var spine = (() => {
|
|
|
8741
8908
|
for (let constraintName in map.path) {
|
|
8742
8909
|
let constraintMap = map.path[constraintName];
|
|
8743
8910
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8911
|
+
if (!constraint)
|
|
8912
|
+
throw new Error("Path constraint not found: " + constraintName);
|
|
8744
8913
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
8745
8914
|
for (let timelineName in constraintMap) {
|
|
8746
8915
|
let timelineMap = constraintMap[timelineName];
|
|
@@ -8792,9 +8961,14 @@ var spine = (() => {
|
|
|
8792
8961
|
for (let attachmentsName in map.attachments) {
|
|
8793
8962
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
8794
8963
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
8964
|
+
if (!skin)
|
|
8965
|
+
throw new Error("Skin not found: " + attachmentsName);
|
|
8795
8966
|
for (let slotMapName in attachmentsMap) {
|
|
8796
8967
|
let slotMap = attachmentsMap[slotMapName];
|
|
8797
|
-
let
|
|
8968
|
+
let slot = skeletonData.findSlot(slotMapName);
|
|
8969
|
+
if (!slot)
|
|
8970
|
+
throw new Error("Slot not found: " + slotMapName);
|
|
8971
|
+
let slotIndex = slot.index;
|
|
8798
8972
|
for (let attachmentMapName in slotMap) {
|
|
8799
8973
|
let attachmentMap = slotMap[attachmentMapName];
|
|
8800
8974
|
let attachment = skin.getAttachment(slotIndex, attachmentMapName);
|
|
@@ -8874,7 +9048,10 @@ var spine = (() => {
|
|
|
8874
9048
|
let originalIndex = 0, unchangedIndex = 0;
|
|
8875
9049
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
8876
9050
|
let offsetMap = offsets[ii];
|
|
8877
|
-
let
|
|
9051
|
+
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
9052
|
+
if (!slot)
|
|
9053
|
+
throw new Error("Slot not found: " + slot);
|
|
9054
|
+
let slotIndex = slot.index;
|
|
8878
9055
|
while (originalIndex != slotIndex)
|
|
8879
9056
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
8880
9057
|
drawOrder[originalIndex + offsetMap.offset] = originalIndex++;
|
|
@@ -8895,6 +9072,8 @@ var spine = (() => {
|
|
|
8895
9072
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
8896
9073
|
let eventMap = map.events[i];
|
|
8897
9074
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
9075
|
+
if (!eventData)
|
|
9076
|
+
throw new Error("Event not found: " + eventMap.name);
|
|
8898
9077
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
8899
9078
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
8900
9079
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|