@esotericsoftware/spine-canvas 4.1.15 → 4.1.18
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/AssetManager.js +3 -3
- package/dist/CanvasTexture.d.ts +1 -1
- package/dist/CanvasTexture.js +1 -1
- package/dist/SkeletonRenderer.js +3 -2
- package/dist/iife/spine-canvas.js +358 -254
- package/dist/iife/spine-canvas.js.map +3 -3
- package/dist/iife/spine-canvas.min.js +2 -2
- package/package.json +2 -2
|
@@ -52,7 +52,6 @@ var spine = (() => {
|
|
|
52
52
|
IkConstraintTimeline: () => IkConstraintTimeline,
|
|
53
53
|
IntSet: () => IntSet,
|
|
54
54
|
Interpolation: () => Interpolation,
|
|
55
|
-
JitterEffect: () => JitterEffect,
|
|
56
55
|
MathUtils: () => MathUtils,
|
|
57
56
|
MeshAttachment: () => MeshAttachment,
|
|
58
57
|
MixBlend: () => MixBlend,
|
|
@@ -97,7 +96,6 @@ var spine = (() => {
|
|
|
97
96
|
SlotData: () => SlotData,
|
|
98
97
|
SpacingMode: () => SpacingMode,
|
|
99
98
|
StringSet: () => StringSet,
|
|
100
|
-
SwirlEffect: () => SwirlEffect,
|
|
101
99
|
Texture: () => Texture,
|
|
102
100
|
TextureAtlas: () => TextureAtlas,
|
|
103
101
|
TextureAtlasPage: () => TextureAtlasPage,
|
|
@@ -514,7 +512,7 @@ var spine = (() => {
|
|
|
514
512
|
super(name);
|
|
515
513
|
this.id = _VertexAttachment.nextID++;
|
|
516
514
|
this.bones = null;
|
|
517
|
-
this.vertices =
|
|
515
|
+
this.vertices = [];
|
|
518
516
|
this.worldVerticesLength = 0;
|
|
519
517
|
this.timelineAttahment = this;
|
|
520
518
|
}
|
|
@@ -585,8 +583,7 @@ var spine = (() => {
|
|
|
585
583
|
if (this.vertices) {
|
|
586
584
|
attachment.vertices = Utils.newFloatArray(this.vertices.length);
|
|
587
585
|
Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
|
588
|
-
}
|
|
589
|
-
attachment.vertices = null;
|
|
586
|
+
}
|
|
590
587
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
|
591
588
|
attachment.timelineAttahment = this.timelineAttahment;
|
|
592
589
|
}
|
|
@@ -660,8 +657,8 @@ var spine = (() => {
|
|
|
660
657
|
// spine-core/src/Animation.ts
|
|
661
658
|
var Animation = class {
|
|
662
659
|
constructor(name, timelines, duration) {
|
|
663
|
-
this.timelines =
|
|
664
|
-
this.timelineIds =
|
|
660
|
+
this.timelines = [];
|
|
661
|
+
this.timelineIds = new StringSet();
|
|
665
662
|
if (!name)
|
|
666
663
|
throw new Error("name cannot be null.");
|
|
667
664
|
this.name = name;
|
|
@@ -672,7 +669,7 @@ var spine = (() => {
|
|
|
672
669
|
if (!timelines)
|
|
673
670
|
throw new Error("timelines cannot be null.");
|
|
674
671
|
this.timelines = timelines;
|
|
675
|
-
this.timelineIds
|
|
672
|
+
this.timelineIds.clear();
|
|
676
673
|
for (var i = 0; i < timelines.length; i++)
|
|
677
674
|
this.timelineIds.addAll(timelines[i].getPropertyIds());
|
|
678
675
|
}
|
|
@@ -731,8 +728,6 @@ var spine = (() => {
|
|
|
731
728
|
};
|
|
732
729
|
var Timeline = class {
|
|
733
730
|
constructor(frameCount, propertyIds) {
|
|
734
|
-
this.propertyIds = null;
|
|
735
|
-
this.frames = null;
|
|
736
731
|
this.propertyIds = propertyIds;
|
|
737
732
|
this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries());
|
|
738
733
|
}
|
|
@@ -766,7 +761,6 @@ var spine = (() => {
|
|
|
766
761
|
var CurveTimeline = class extends Timeline {
|
|
767
762
|
constructor(frameCount, bezierCount, propertyIds) {
|
|
768
763
|
super(frameCount, propertyIds);
|
|
769
|
-
this.curves = null;
|
|
770
764
|
this.curves = Utils.newFloatArray(frameCount + bezierCount * 18);
|
|
771
765
|
this.curves[frameCount - 1] = 1;
|
|
772
766
|
}
|
|
@@ -1826,8 +1820,6 @@ var spine = (() => {
|
|
|
1826
1820
|
Property.deform + "|" + slotIndex + "|" + attachment.id
|
|
1827
1821
|
]);
|
|
1828
1822
|
this.slotIndex = 0;
|
|
1829
|
-
this.attachment = null;
|
|
1830
|
-
this.vertices = null;
|
|
1831
1823
|
this.slotIndex = slotIndex;
|
|
1832
1824
|
this.attachment = attachment;
|
|
1833
1825
|
this.vertices = new Array(frameCount);
|
|
@@ -1890,6 +1882,8 @@ var spine = (() => {
|
|
|
1890
1882
|
if (!slot.bone.active)
|
|
1891
1883
|
return;
|
|
1892
1884
|
let slotAttachment = slot.getAttachment();
|
|
1885
|
+
if (!slotAttachment)
|
|
1886
|
+
return;
|
|
1893
1887
|
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttahment != this.attachment)
|
|
1894
1888
|
return;
|
|
1895
1889
|
let deform = slot.deform;
|
|
@@ -2044,7 +2038,6 @@ var spine = (() => {
|
|
|
2044
2038
|
var _EventTimeline = class extends Timeline {
|
|
2045
2039
|
constructor(frameCount) {
|
|
2046
2040
|
super(frameCount, _EventTimeline.propertyIds);
|
|
2047
|
-
this.events = null;
|
|
2048
2041
|
this.events = new Array(frameCount);
|
|
2049
2042
|
}
|
|
2050
2043
|
getFrameCount() {
|
|
@@ -2087,7 +2080,6 @@ var spine = (() => {
|
|
|
2087
2080
|
var _DrawOrderTimeline = class extends Timeline {
|
|
2088
2081
|
constructor(frameCount) {
|
|
2089
2082
|
super(frameCount, _DrawOrderTimeline.propertyIds);
|
|
2090
|
-
this.drawOrders = null;
|
|
2091
2083
|
this.drawOrders = new Array(frameCount);
|
|
2092
2084
|
}
|
|
2093
2085
|
getFrameCount() {
|
|
@@ -2108,7 +2100,8 @@ var spine = (() => {
|
|
|
2108
2100
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2109
2101
|
return;
|
|
2110
2102
|
}
|
|
2111
|
-
let
|
|
2103
|
+
let idx = Timeline.search1(this.frames, time);
|
|
2104
|
+
let drawOrderToSetupIndex = this.drawOrders[idx];
|
|
2112
2105
|
if (!drawOrderToSetupIndex)
|
|
2113
2106
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2114
2107
|
else {
|
|
@@ -2524,9 +2517,8 @@ var spine = (() => {
|
|
|
2524
2517
|
SequenceTimeline.DELAY = 2;
|
|
2525
2518
|
|
|
2526
2519
|
// spine-core/src/AnimationState.ts
|
|
2527
|
-
var
|
|
2520
|
+
var _AnimationState = class {
|
|
2528
2521
|
constructor(data) {
|
|
2529
|
-
this.data = null;
|
|
2530
2522
|
this.tracks = new Array();
|
|
2531
2523
|
this.timeScale = 1;
|
|
2532
2524
|
this.unkeyedState = 0;
|
|
@@ -2539,9 +2531,7 @@ var spine = (() => {
|
|
|
2539
2531
|
this.data = data;
|
|
2540
2532
|
}
|
|
2541
2533
|
static emptyAnimation() {
|
|
2542
|
-
|
|
2543
|
-
_emptyAnimation = new Animation("<empty>", [], 0);
|
|
2544
|
-
return _emptyAnimation;
|
|
2534
|
+
return _AnimationState._emptyAnimation;
|
|
2545
2535
|
}
|
|
2546
2536
|
update(delta) {
|
|
2547
2537
|
delta *= this.timeScale;
|
|
@@ -2974,13 +2964,13 @@ var spine = (() => {
|
|
|
2974
2964
|
return entry;
|
|
2975
2965
|
}
|
|
2976
2966
|
setEmptyAnimation(trackIndex, mixDuration = 0) {
|
|
2977
|
-
let entry = this.setAnimationWith(trackIndex,
|
|
2967
|
+
let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
|
|
2978
2968
|
entry.mixDuration = mixDuration;
|
|
2979
2969
|
entry.trackEnd = mixDuration;
|
|
2980
2970
|
return entry;
|
|
2981
2971
|
}
|
|
2982
2972
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
2983
|
-
let entry = this.addAnimationWith(trackIndex,
|
|
2973
|
+
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
2984
2974
|
if (delay <= 0)
|
|
2985
2975
|
entry.delay += entry.mixDuration - mixDuration;
|
|
2986
2976
|
entry.mixDuration = mixDuration;
|
|
@@ -3119,6 +3109,8 @@ var spine = (() => {
|
|
|
3119
3109
|
this.queue.clear();
|
|
3120
3110
|
}
|
|
3121
3111
|
};
|
|
3112
|
+
var AnimationState = _AnimationState;
|
|
3113
|
+
AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
|
|
3122
3114
|
var TrackEntry = class {
|
|
3123
3115
|
constructor() {
|
|
3124
3116
|
this.animation = null;
|
|
@@ -3200,7 +3192,6 @@ var spine = (() => {
|
|
|
3200
3192
|
constructor(animState) {
|
|
3201
3193
|
this.objects = [];
|
|
3202
3194
|
this.drainDisabled = false;
|
|
3203
|
-
this.animState = null;
|
|
3204
3195
|
this.animState = animState;
|
|
3205
3196
|
}
|
|
3206
3197
|
start(entry) {
|
|
@@ -3243,45 +3234,57 @@ var spine = (() => {
|
|
|
3243
3234
|
case EventType.start:
|
|
3244
3235
|
if (entry.listener && entry.listener.start)
|
|
3245
3236
|
entry.listener.start(entry);
|
|
3246
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3247
|
-
|
|
3248
|
-
|
|
3237
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3238
|
+
let listener = listeners[ii];
|
|
3239
|
+
if (listener.start)
|
|
3240
|
+
listener.start(entry);
|
|
3241
|
+
}
|
|
3249
3242
|
break;
|
|
3250
3243
|
case EventType.interrupt:
|
|
3251
3244
|
if (entry.listener && entry.listener.interrupt)
|
|
3252
3245
|
entry.listener.interrupt(entry);
|
|
3253
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3254
|
-
|
|
3255
|
-
|
|
3246
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3247
|
+
let listener = listeners[ii];
|
|
3248
|
+
if (listener.interrupt)
|
|
3249
|
+
listener.interrupt(entry);
|
|
3250
|
+
}
|
|
3256
3251
|
break;
|
|
3257
3252
|
case EventType.end:
|
|
3258
3253
|
if (entry.listener && entry.listener.end)
|
|
3259
3254
|
entry.listener.end(entry);
|
|
3260
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3261
|
-
|
|
3262
|
-
|
|
3255
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3256
|
+
let listener = listeners[ii];
|
|
3257
|
+
if (listener.end)
|
|
3258
|
+
listener.end(entry);
|
|
3259
|
+
}
|
|
3263
3260
|
case EventType.dispose:
|
|
3264
3261
|
if (entry.listener && entry.listener.dispose)
|
|
3265
3262
|
entry.listener.dispose(entry);
|
|
3266
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3267
|
-
|
|
3268
|
-
|
|
3263
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3264
|
+
let listener = listeners[ii];
|
|
3265
|
+
if (listener.dispose)
|
|
3266
|
+
listener.dispose(entry);
|
|
3267
|
+
}
|
|
3269
3268
|
this.animState.trackEntryPool.free(entry);
|
|
3270
3269
|
break;
|
|
3271
3270
|
case EventType.complete:
|
|
3272
3271
|
if (entry.listener && entry.listener.complete)
|
|
3273
3272
|
entry.listener.complete(entry);
|
|
3274
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3275
|
-
|
|
3276
|
-
|
|
3273
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3274
|
+
let listener = listeners[ii];
|
|
3275
|
+
if (listener.complete)
|
|
3276
|
+
listener.complete(entry);
|
|
3277
|
+
}
|
|
3277
3278
|
break;
|
|
3278
3279
|
case EventType.event:
|
|
3279
3280
|
let event = objects[i++ + 2];
|
|
3280
3281
|
if (entry.listener && entry.listener.event)
|
|
3281
3282
|
entry.listener.event(entry, event);
|
|
3282
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3283
|
-
|
|
3284
|
-
|
|
3283
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3284
|
+
let listener = listeners[ii];
|
|
3285
|
+
if (listener.event)
|
|
3286
|
+
listener.event(entry, event);
|
|
3287
|
+
}
|
|
3285
3288
|
break;
|
|
3286
3289
|
}
|
|
3287
3290
|
}
|
|
@@ -3322,12 +3325,10 @@ var spine = (() => {
|
|
|
3322
3325
|
var HOLD_MIX = 4;
|
|
3323
3326
|
var SETUP = 1;
|
|
3324
3327
|
var CURRENT = 2;
|
|
3325
|
-
var _emptyAnimation = null;
|
|
3326
3328
|
|
|
3327
3329
|
// spine-core/src/AnimationStateData.ts
|
|
3328
3330
|
var AnimationStateData = class {
|
|
3329
3331
|
constructor(skeletonData) {
|
|
3330
|
-
this.skeletonData = null;
|
|
3331
3332
|
this.animationToMixTime = {};
|
|
3332
3333
|
this.defaultMix = 0;
|
|
3333
3334
|
if (!skeletonData)
|
|
@@ -3444,65 +3445,63 @@ var spine = (() => {
|
|
|
3444
3445
|
this.regions = new Array();
|
|
3445
3446
|
let reader = new TextureAtlasReader(atlasText);
|
|
3446
3447
|
let entry = new Array(4);
|
|
3447
|
-
let page = null;
|
|
3448
|
-
let region = null;
|
|
3449
3448
|
let pageFields = {};
|
|
3450
|
-
pageFields["size"] = () => {
|
|
3451
|
-
|
|
3452
|
-
|
|
3449
|
+
pageFields["size"] = (page2) => {
|
|
3450
|
+
page2.width = parseInt(entry[1]);
|
|
3451
|
+
page2.height = parseInt(entry[2]);
|
|
3453
3452
|
};
|
|
3454
3453
|
pageFields["format"] = () => {
|
|
3455
3454
|
};
|
|
3456
|
-
pageFields["filter"] = () => {
|
|
3457
|
-
|
|
3458
|
-
|
|
3455
|
+
pageFields["filter"] = (page2) => {
|
|
3456
|
+
page2.minFilter = Utils.enumValue(TextureFilter, entry[1]);
|
|
3457
|
+
page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
|
|
3459
3458
|
};
|
|
3460
|
-
pageFields["repeat"] = () => {
|
|
3459
|
+
pageFields["repeat"] = (page2) => {
|
|
3461
3460
|
if (entry[1].indexOf("x") != -1)
|
|
3462
|
-
|
|
3461
|
+
page2.uWrap = TextureWrap.Repeat;
|
|
3463
3462
|
if (entry[1].indexOf("y") != -1)
|
|
3464
|
-
|
|
3463
|
+
page2.vWrap = TextureWrap.Repeat;
|
|
3465
3464
|
};
|
|
3466
|
-
pageFields["pma"] = () => {
|
|
3467
|
-
|
|
3465
|
+
pageFields["pma"] = (page2) => {
|
|
3466
|
+
page2.pma = entry[1] == "true";
|
|
3468
3467
|
};
|
|
3469
3468
|
var regionFields = {};
|
|
3470
|
-
regionFields["xy"] = () => {
|
|
3469
|
+
regionFields["xy"] = (region) => {
|
|
3471
3470
|
region.x = parseInt(entry[1]);
|
|
3472
3471
|
region.y = parseInt(entry[2]);
|
|
3473
3472
|
};
|
|
3474
|
-
regionFields["size"] = () => {
|
|
3473
|
+
regionFields["size"] = (region) => {
|
|
3475
3474
|
region.width = parseInt(entry[1]);
|
|
3476
3475
|
region.height = parseInt(entry[2]);
|
|
3477
3476
|
};
|
|
3478
|
-
regionFields["bounds"] = () => {
|
|
3477
|
+
regionFields["bounds"] = (region) => {
|
|
3479
3478
|
region.x = parseInt(entry[1]);
|
|
3480
3479
|
region.y = parseInt(entry[2]);
|
|
3481
3480
|
region.width = parseInt(entry[3]);
|
|
3482
3481
|
region.height = parseInt(entry[4]);
|
|
3483
3482
|
};
|
|
3484
|
-
regionFields["offset"] = () => {
|
|
3483
|
+
regionFields["offset"] = (region) => {
|
|
3485
3484
|
region.offsetX = parseInt(entry[1]);
|
|
3486
3485
|
region.offsetY = parseInt(entry[2]);
|
|
3487
3486
|
};
|
|
3488
|
-
regionFields["orig"] = () => {
|
|
3487
|
+
regionFields["orig"] = (region) => {
|
|
3489
3488
|
region.originalWidth = parseInt(entry[1]);
|
|
3490
3489
|
region.originalHeight = parseInt(entry[2]);
|
|
3491
3490
|
};
|
|
3492
|
-
regionFields["offsets"] = () => {
|
|
3491
|
+
regionFields["offsets"] = (region) => {
|
|
3493
3492
|
region.offsetX = parseInt(entry[1]);
|
|
3494
3493
|
region.offsetY = parseInt(entry[2]);
|
|
3495
3494
|
region.originalWidth = parseInt(entry[3]);
|
|
3496
3495
|
region.originalHeight = parseInt(entry[4]);
|
|
3497
3496
|
};
|
|
3498
|
-
regionFields["rotate"] = () => {
|
|
3497
|
+
regionFields["rotate"] = (region) => {
|
|
3499
3498
|
let value = entry[1];
|
|
3500
3499
|
if (value == "true")
|
|
3501
3500
|
region.degrees = 90;
|
|
3502
3501
|
else if (value != "false")
|
|
3503
3502
|
region.degrees = parseInt(value);
|
|
3504
3503
|
};
|
|
3505
|
-
regionFields["index"] = () => {
|
|
3504
|
+
regionFields["index"] = (region) => {
|
|
3506
3505
|
region.index = parseInt(entry[1]);
|
|
3507
3506
|
};
|
|
3508
3507
|
let line = reader.readLine();
|
|
@@ -3515,6 +3514,7 @@ var spine = (() => {
|
|
|
3515
3514
|
break;
|
|
3516
3515
|
line = reader.readLine();
|
|
3517
3516
|
}
|
|
3517
|
+
let page = null;
|
|
3518
3518
|
let names = null;
|
|
3519
3519
|
let values = null;
|
|
3520
3520
|
while (true) {
|
|
@@ -3524,32 +3524,29 @@ var spine = (() => {
|
|
|
3524
3524
|
page = null;
|
|
3525
3525
|
line = reader.readLine();
|
|
3526
3526
|
} else if (!page) {
|
|
3527
|
-
page = new TextureAtlasPage();
|
|
3528
|
-
page.name = line.trim();
|
|
3527
|
+
page = new TextureAtlasPage(line.trim());
|
|
3529
3528
|
while (true) {
|
|
3530
3529
|
if (reader.readEntry(entry, line = reader.readLine()) == 0)
|
|
3531
3530
|
break;
|
|
3532
3531
|
let field = pageFields[entry[0]];
|
|
3533
3532
|
if (field)
|
|
3534
|
-
field();
|
|
3533
|
+
field(page);
|
|
3535
3534
|
}
|
|
3536
3535
|
this.pages.push(page);
|
|
3537
3536
|
} else {
|
|
3538
|
-
region = new TextureAtlasRegion();
|
|
3539
|
-
region.page = page;
|
|
3540
|
-
region.name = line;
|
|
3537
|
+
let region = new TextureAtlasRegion(page, line);
|
|
3541
3538
|
while (true) {
|
|
3542
3539
|
let count = reader.readEntry(entry, line = reader.readLine());
|
|
3543
3540
|
if (count == 0)
|
|
3544
3541
|
break;
|
|
3545
3542
|
let field = regionFields[entry[0]];
|
|
3546
3543
|
if (field)
|
|
3547
|
-
field();
|
|
3544
|
+
field(region);
|
|
3548
3545
|
else {
|
|
3549
|
-
if (!names)
|
|
3546
|
+
if (!names)
|
|
3550
3547
|
names = [];
|
|
3548
|
+
if (!values)
|
|
3551
3549
|
values = [];
|
|
3552
|
-
}
|
|
3553
3550
|
names.push(entry[0]);
|
|
3554
3551
|
let entryValues = [];
|
|
3555
3552
|
for (let i = 0; i < count; i++)
|
|
@@ -3561,7 +3558,7 @@ var spine = (() => {
|
|
|
3561
3558
|
region.originalWidth = region.width;
|
|
3562
3559
|
region.originalHeight = region.height;
|
|
3563
3560
|
}
|
|
3564
|
-
if (names && names.length > 0) {
|
|
3561
|
+
if (names && names.length > 0 && values && values.length > 0) {
|
|
3565
3562
|
region.names = names;
|
|
3566
3563
|
region.values = values;
|
|
3567
3564
|
names = null;
|
|
@@ -3593,14 +3590,14 @@ var spine = (() => {
|
|
|
3593
3590
|
page.setTexture(assetManager.get(pathPrefix + page.name));
|
|
3594
3591
|
}
|
|
3595
3592
|
dispose() {
|
|
3593
|
+
var _a;
|
|
3596
3594
|
for (let i = 0; i < this.pages.length; i++) {
|
|
3597
|
-
this.pages[i].texture.dispose();
|
|
3595
|
+
(_a = this.pages[i].texture) == null ? void 0 : _a.dispose();
|
|
3598
3596
|
}
|
|
3599
3597
|
}
|
|
3600
3598
|
};
|
|
3601
3599
|
var TextureAtlasReader = class {
|
|
3602
3600
|
constructor(text) {
|
|
3603
|
-
this.lines = null;
|
|
3604
3601
|
this.index = 0;
|
|
3605
3602
|
this.lines = text.split(/\r\n|\r|\n/);
|
|
3606
3603
|
}
|
|
@@ -3633,8 +3630,7 @@ var spine = (() => {
|
|
|
3633
3630
|
}
|
|
3634
3631
|
};
|
|
3635
3632
|
var TextureAtlasPage = class {
|
|
3636
|
-
constructor() {
|
|
3637
|
-
this.name = null;
|
|
3633
|
+
constructor(name) {
|
|
3638
3634
|
this.minFilter = TextureFilter.Nearest;
|
|
3639
3635
|
this.magFilter = TextureFilter.Nearest;
|
|
3640
3636
|
this.uWrap = TextureWrap.ClampToEdge;
|
|
@@ -3643,6 +3639,7 @@ var spine = (() => {
|
|
|
3643
3639
|
this.width = 0;
|
|
3644
3640
|
this.height = 0;
|
|
3645
3641
|
this.pma = false;
|
|
3642
|
+
this.name = name;
|
|
3646
3643
|
}
|
|
3647
3644
|
setTexture(texture) {
|
|
3648
3645
|
this.texture = texture;
|
|
@@ -3651,10 +3648,8 @@ var spine = (() => {
|
|
|
3651
3648
|
}
|
|
3652
3649
|
};
|
|
3653
3650
|
var TextureAtlasRegion = class extends TextureRegion {
|
|
3654
|
-
constructor() {
|
|
3655
|
-
super(
|
|
3656
|
-
this.page = null;
|
|
3657
|
-
this.name = null;
|
|
3651
|
+
constructor(page, name) {
|
|
3652
|
+
super();
|
|
3658
3653
|
this.x = 0;
|
|
3659
3654
|
this.y = 0;
|
|
3660
3655
|
this.offsetX = 0;
|
|
@@ -3665,28 +3660,32 @@ var spine = (() => {
|
|
|
3665
3660
|
this.degrees = 0;
|
|
3666
3661
|
this.names = null;
|
|
3667
3662
|
this.values = null;
|
|
3663
|
+
this.page = page;
|
|
3664
|
+
this.name = name;
|
|
3668
3665
|
}
|
|
3669
3666
|
};
|
|
3670
3667
|
|
|
3671
3668
|
// spine-core/src/attachments/MeshAttachment.ts
|
|
3672
3669
|
var MeshAttachment = class extends VertexAttachment {
|
|
3673
|
-
constructor(name) {
|
|
3670
|
+
constructor(name, path) {
|
|
3674
3671
|
super(name);
|
|
3675
3672
|
this.region = null;
|
|
3676
|
-
this.
|
|
3677
|
-
this.
|
|
3678
|
-
this.
|
|
3679
|
-
this.triangles = null;
|
|
3673
|
+
this.regionUVs = [];
|
|
3674
|
+
this.uvs = [];
|
|
3675
|
+
this.triangles = [];
|
|
3680
3676
|
this.color = new Color(1, 1, 1, 1);
|
|
3681
3677
|
this.width = 0;
|
|
3682
3678
|
this.height = 0;
|
|
3683
3679
|
this.hullLength = 0;
|
|
3684
|
-
this.edges =
|
|
3680
|
+
this.edges = [];
|
|
3685
3681
|
this.parentMesh = null;
|
|
3686
3682
|
this.sequence = null;
|
|
3687
3683
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3684
|
+
this.path = path;
|
|
3688
3685
|
}
|
|
3689
3686
|
updateRegion() {
|
|
3687
|
+
if (!this.region)
|
|
3688
|
+
throw new Error("Region not set.");
|
|
3690
3689
|
let regionUVs = this.regionUVs;
|
|
3691
3690
|
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
3692
3691
|
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
@@ -3762,9 +3761,8 @@ var spine = (() => {
|
|
|
3762
3761
|
copy() {
|
|
3763
3762
|
if (this.parentMesh)
|
|
3764
3763
|
return this.newLinkedMesh();
|
|
3765
|
-
let copy = new MeshAttachment(this.name);
|
|
3764
|
+
let copy = new MeshAttachment(this.name, this.path);
|
|
3766
3765
|
copy.region = this.region;
|
|
3767
|
-
copy.path = this.path;
|
|
3768
3766
|
copy.color.setFromColor(this.color);
|
|
3769
3767
|
this.copyTo(copy);
|
|
3770
3768
|
copy.regionUVs = new Array(this.regionUVs.length);
|
|
@@ -3789,9 +3787,8 @@ var spine = (() => {
|
|
|
3789
3787
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
3790
3788
|
}
|
|
3791
3789
|
newLinkedMesh() {
|
|
3792
|
-
let copy = new MeshAttachment(this.name);
|
|
3790
|
+
let copy = new MeshAttachment(this.name, this.path);
|
|
3793
3791
|
copy.region = this.region;
|
|
3794
|
-
copy.path = this.path;
|
|
3795
3792
|
copy.color.setFromColor(this.color);
|
|
3796
3793
|
copy.timelineAttahment = this.timelineAttahment;
|
|
3797
3794
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
@@ -3805,7 +3802,7 @@ var spine = (() => {
|
|
|
3805
3802
|
var PathAttachment = class extends VertexAttachment {
|
|
3806
3803
|
constructor(name) {
|
|
3807
3804
|
super(name);
|
|
3808
|
-
this.lengths =
|
|
3805
|
+
this.lengths = [];
|
|
3809
3806
|
this.closed = false;
|
|
3810
3807
|
this.constantSpeed = false;
|
|
3811
3808
|
this.color = new Color(1, 1, 1, 1);
|
|
@@ -3854,7 +3851,7 @@ var spine = (() => {
|
|
|
3854
3851
|
|
|
3855
3852
|
// spine-core/src/attachments/RegionAttachment.ts
|
|
3856
3853
|
var _RegionAttachment = class extends Attachment {
|
|
3857
|
-
constructor(name) {
|
|
3854
|
+
constructor(name, path) {
|
|
3858
3855
|
super(name);
|
|
3859
3856
|
this.x = 0;
|
|
3860
3857
|
this.y = 0;
|
|
@@ -3864,15 +3861,17 @@ var spine = (() => {
|
|
|
3864
3861
|
this.width = 0;
|
|
3865
3862
|
this.height = 0;
|
|
3866
3863
|
this.color = new Color(1, 1, 1, 1);
|
|
3867
|
-
this.path = null;
|
|
3868
3864
|
this.rendererObject = null;
|
|
3869
3865
|
this.region = null;
|
|
3870
3866
|
this.sequence = null;
|
|
3871
3867
|
this.offset = Utils.newFloatArray(8);
|
|
3872
3868
|
this.uvs = Utils.newFloatArray(8);
|
|
3873
3869
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3870
|
+
this.path = path;
|
|
3874
3871
|
}
|
|
3875
3872
|
updateRegion() {
|
|
3873
|
+
if (!this.region)
|
|
3874
|
+
throw new Error("Region not set.");
|
|
3876
3875
|
let region = this.region;
|
|
3877
3876
|
let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
3878
3877
|
let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
@@ -3951,10 +3950,9 @@ var spine = (() => {
|
|
|
3951
3950
|
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
|
3952
3951
|
}
|
|
3953
3952
|
copy() {
|
|
3954
|
-
let copy = new _RegionAttachment(this.name);
|
|
3953
|
+
let copy = new _RegionAttachment(this.name, this.path);
|
|
3955
3954
|
copy.region = this.region;
|
|
3956
3955
|
copy.rendererObject = this.rendererObject;
|
|
3957
|
-
copy.path = this.path;
|
|
3958
3956
|
copy.x = this.x;
|
|
3959
3957
|
copy.y = this.y;
|
|
3960
3958
|
copy.scaleX = this.scaleX;
|
|
@@ -4006,21 +4004,21 @@ var spine = (() => {
|
|
|
4006
4004
|
// spine-core/src/AtlasAttachmentLoader.ts
|
|
4007
4005
|
var AtlasAttachmentLoader = class {
|
|
4008
4006
|
constructor(atlas) {
|
|
4009
|
-
this.atlas = null;
|
|
4010
4007
|
this.atlas = atlas;
|
|
4011
4008
|
}
|
|
4012
4009
|
loadSequence(name, basePath, sequence) {
|
|
4013
4010
|
let regions = sequence.regions;
|
|
4014
4011
|
for (let i = 0, n = regions.length; i < n; i++) {
|
|
4015
4012
|
let path = sequence.getPath(basePath, i);
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
if (regions[i] == null)
|
|
4013
|
+
let region = this.atlas.findRegion(path);
|
|
4014
|
+
if (region == null)
|
|
4019
4015
|
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
4016
|
+
regions[i] = region;
|
|
4017
|
+
regions[i].renderObject = regions[i];
|
|
4020
4018
|
}
|
|
4021
4019
|
}
|
|
4022
4020
|
newRegionAttachment(skin, name, path, sequence) {
|
|
4023
|
-
let attachment = new RegionAttachment(name);
|
|
4021
|
+
let attachment = new RegionAttachment(name, path);
|
|
4024
4022
|
if (sequence != null) {
|
|
4025
4023
|
this.loadSequence(name, path, sequence);
|
|
4026
4024
|
} else {
|
|
@@ -4033,7 +4031,7 @@ var spine = (() => {
|
|
|
4033
4031
|
return attachment;
|
|
4034
4032
|
}
|
|
4035
4033
|
newMeshAttachment(skin, name, path, sequence) {
|
|
4036
|
-
let attachment = new MeshAttachment(name);
|
|
4034
|
+
let attachment = new MeshAttachment(name, path);
|
|
4037
4035
|
if (sequence != null) {
|
|
4038
4036
|
this.loadSequence(name, path, sequence);
|
|
4039
4037
|
} else {
|
|
@@ -4063,7 +4061,6 @@ var spine = (() => {
|
|
|
4063
4061
|
var BoneData = class {
|
|
4064
4062
|
constructor(index, name, parent) {
|
|
4065
4063
|
this.index = 0;
|
|
4066
|
-
this.name = null;
|
|
4067
4064
|
this.parent = null;
|
|
4068
4065
|
this.length = 0;
|
|
4069
4066
|
this.x = 0;
|
|
@@ -4097,8 +4094,6 @@ var spine = (() => {
|
|
|
4097
4094
|
// spine-core/src/Bone.ts
|
|
4098
4095
|
var Bone = class {
|
|
4099
4096
|
constructor(data, skeleton, parent) {
|
|
4100
|
-
this.data = null;
|
|
4101
|
-
this.skeleton = null;
|
|
4102
4097
|
this.parent = null;
|
|
4103
4098
|
this.children = new Array();
|
|
4104
4099
|
this.x = 0;
|
|
@@ -4351,15 +4346,15 @@ var spine = (() => {
|
|
|
4351
4346
|
|
|
4352
4347
|
// spine-core/src/AssetManagerBase.ts
|
|
4353
4348
|
var AssetManagerBase = class {
|
|
4354
|
-
constructor(textureLoader, pathPrefix = "", downloader =
|
|
4355
|
-
this.pathPrefix =
|
|
4349
|
+
constructor(textureLoader, pathPrefix = "", downloader = new Downloader()) {
|
|
4350
|
+
this.pathPrefix = "";
|
|
4356
4351
|
this.assets = {};
|
|
4357
4352
|
this.errors = {};
|
|
4358
4353
|
this.toLoad = 0;
|
|
4359
4354
|
this.loaded = 0;
|
|
4360
4355
|
this.textureLoader = textureLoader;
|
|
4361
4356
|
this.pathPrefix = pathPrefix;
|
|
4362
|
-
this.downloader = downloader
|
|
4357
|
+
this.downloader = downloader;
|
|
4363
4358
|
}
|
|
4364
4359
|
start(path) {
|
|
4365
4360
|
this.toLoad++;
|
|
@@ -4398,7 +4393,9 @@ var spine = (() => {
|
|
|
4398
4393
|
setRawDataURI(path, data) {
|
|
4399
4394
|
this.downloader.rawDataUris[this.pathPrefix + path] = data;
|
|
4400
4395
|
}
|
|
4401
|
-
loadBinary(path, success =
|
|
4396
|
+
loadBinary(path, success = () => {
|
|
4397
|
+
}, error = () => {
|
|
4398
|
+
}) {
|
|
4402
4399
|
path = this.start(path);
|
|
4403
4400
|
this.downloader.downloadBinary(path, (data) => {
|
|
4404
4401
|
this.success(success, path, data);
|
|
@@ -4406,7 +4403,9 @@ var spine = (() => {
|
|
|
4406
4403
|
this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
|
|
4407
4404
|
});
|
|
4408
4405
|
}
|
|
4409
|
-
loadText(path, success =
|
|
4406
|
+
loadText(path, success = () => {
|
|
4407
|
+
}, error = () => {
|
|
4408
|
+
}) {
|
|
4410
4409
|
path = this.start(path);
|
|
4411
4410
|
this.downloader.downloadText(path, (data) => {
|
|
4412
4411
|
this.success(success, path, data);
|
|
@@ -4414,7 +4413,9 @@ var spine = (() => {
|
|
|
4414
4413
|
this.error(error, path, `Couldn't load text ${path}: status ${status}, ${responseText}`);
|
|
4415
4414
|
});
|
|
4416
4415
|
}
|
|
4417
|
-
loadJson(path, success =
|
|
4416
|
+
loadJson(path, success = () => {
|
|
4417
|
+
}, error = () => {
|
|
4418
|
+
}) {
|
|
4418
4419
|
path = this.start(path);
|
|
4419
4420
|
this.downloader.downloadJson(path, (data) => {
|
|
4420
4421
|
this.success(success, path, data);
|
|
@@ -4422,7 +4423,9 @@ var spine = (() => {
|
|
|
4422
4423
|
this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
|
|
4423
4424
|
});
|
|
4424
4425
|
}
|
|
4425
|
-
loadTexture(path, success =
|
|
4426
|
+
loadTexture(path, success = () => {
|
|
4427
|
+
}, error = () => {
|
|
4428
|
+
}) {
|
|
4426
4429
|
path = this.start(path);
|
|
4427
4430
|
let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
|
|
4428
4431
|
let isWebWorker = !isBrowser;
|
|
@@ -4452,7 +4455,9 @@ var spine = (() => {
|
|
|
4452
4455
|
image.src = path;
|
|
4453
4456
|
}
|
|
4454
4457
|
}
|
|
4455
|
-
loadTextureAtlas(path, success =
|
|
4458
|
+
loadTextureAtlas(path, success = () => {
|
|
4459
|
+
}, error = () => {
|
|
4460
|
+
}, fileAlias) {
|
|
4456
4461
|
let index = path.lastIndexOf("/");
|
|
4457
4462
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
4458
4463
|
path = this.start(path);
|
|
@@ -4461,7 +4466,7 @@ var spine = (() => {
|
|
|
4461
4466
|
let atlas = new TextureAtlas(atlasText);
|
|
4462
4467
|
let toLoad = atlas.pages.length, abort = false;
|
|
4463
4468
|
for (let page of atlas.pages) {
|
|
4464
|
-
this.loadTexture(fileAlias
|
|
4469
|
+
this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
|
|
4465
4470
|
if (!abort) {
|
|
4466
4471
|
page.setTexture(texture);
|
|
4467
4472
|
if (--toLoad == 0)
|
|
@@ -4638,7 +4643,6 @@ var spine = (() => {
|
|
|
4638
4643
|
// spine-core/src/Event.ts
|
|
4639
4644
|
var Event = class {
|
|
4640
4645
|
constructor(time, data) {
|
|
4641
|
-
this.data = null;
|
|
4642
4646
|
this.intValue = 0;
|
|
4643
4647
|
this.floatValue = 0;
|
|
4644
4648
|
this.stringValue = null;
|
|
@@ -4655,7 +4659,6 @@ var spine = (() => {
|
|
|
4655
4659
|
// spine-core/src/EventData.ts
|
|
4656
4660
|
var EventData = class {
|
|
4657
4661
|
constructor(name) {
|
|
4658
|
-
this.name = null;
|
|
4659
4662
|
this.intValue = 0;
|
|
4660
4663
|
this.floatValue = 0;
|
|
4661
4664
|
this.stringValue = null;
|
|
@@ -4669,9 +4672,6 @@ var spine = (() => {
|
|
|
4669
4672
|
// spine-core/src/IkConstraint.ts
|
|
4670
4673
|
var IkConstraint = class {
|
|
4671
4674
|
constructor(data, skeleton) {
|
|
4672
|
-
this.data = null;
|
|
4673
|
-
this.bones = null;
|
|
4674
|
-
this.target = null;
|
|
4675
4675
|
this.bendDirection = 0;
|
|
4676
4676
|
this.compress = false;
|
|
4677
4677
|
this.stretch = false;
|
|
@@ -4689,9 +4689,16 @@ var spine = (() => {
|
|
|
4689
4689
|
this.compress = data.compress;
|
|
4690
4690
|
this.stretch = data.stretch;
|
|
4691
4691
|
this.bones = new Array();
|
|
4692
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
4693
|
-
|
|
4694
|
-
|
|
4692
|
+
for (let i = 0; i < data.bones.length; i++) {
|
|
4693
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
4694
|
+
if (!bone)
|
|
4695
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
4696
|
+
this.bones.push(bone);
|
|
4697
|
+
}
|
|
4698
|
+
let target = skeleton.findBone(data.target.name);
|
|
4699
|
+
if (!target)
|
|
4700
|
+
throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
4701
|
+
this.target = target;
|
|
4695
4702
|
}
|
|
4696
4703
|
isActive() {
|
|
4697
4704
|
return this.active;
|
|
@@ -4712,6 +4719,8 @@ var spine = (() => {
|
|
|
4712
4719
|
}
|
|
4713
4720
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4714
4721
|
let p = bone.parent;
|
|
4722
|
+
if (!p)
|
|
4723
|
+
throw new Error("IK bone must have parent.");
|
|
4715
4724
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4716
4725
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4717
4726
|
switch (bone.data.transformMode) {
|
|
@@ -4789,6 +4798,8 @@ var spine = (() => {
|
|
|
4789
4798
|
cwy = c * cx + d * cy + parent.worldY;
|
|
4790
4799
|
}
|
|
4791
4800
|
let pp = parent.parent;
|
|
4801
|
+
if (!pp)
|
|
4802
|
+
throw new Error("IK parent must itself have a parent.");
|
|
4792
4803
|
a = pp.a;
|
|
4793
4804
|
b = pp.b;
|
|
4794
4805
|
c = pp.c;
|
|
@@ -4910,7 +4921,7 @@ var spine = (() => {
|
|
|
4910
4921
|
constructor(name) {
|
|
4911
4922
|
super(name, 0, false);
|
|
4912
4923
|
this.bones = new Array();
|
|
4913
|
-
this.
|
|
4924
|
+
this._target = null;
|
|
4914
4925
|
this.bendDirection = 1;
|
|
4915
4926
|
this.compress = false;
|
|
4916
4927
|
this.stretch = false;
|
|
@@ -4918,6 +4929,15 @@ var spine = (() => {
|
|
|
4918
4929
|
this.mix = 1;
|
|
4919
4930
|
this.softness = 0;
|
|
4920
4931
|
}
|
|
4932
|
+
set target(boneData) {
|
|
4933
|
+
this._target = boneData;
|
|
4934
|
+
}
|
|
4935
|
+
get target() {
|
|
4936
|
+
if (!this._target)
|
|
4937
|
+
throw new Error("BoneData not set.");
|
|
4938
|
+
else
|
|
4939
|
+
return this._target;
|
|
4940
|
+
}
|
|
4921
4941
|
};
|
|
4922
4942
|
|
|
4923
4943
|
// spine-core/src/PathConstraintData.ts
|
|
@@ -4925,10 +4945,10 @@ var spine = (() => {
|
|
|
4925
4945
|
constructor(name) {
|
|
4926
4946
|
super(name, 0, false);
|
|
4927
4947
|
this.bones = new Array();
|
|
4928
|
-
this.
|
|
4929
|
-
this.positionMode =
|
|
4930
|
-
this.spacingMode =
|
|
4931
|
-
this.rotateMode =
|
|
4948
|
+
this._target = null;
|
|
4949
|
+
this.positionMode = PositionMode.Fixed;
|
|
4950
|
+
this.spacingMode = SpacingMode.Fixed;
|
|
4951
|
+
this.rotateMode = RotateMode.Chain;
|
|
4932
4952
|
this.offsetRotation = 0;
|
|
4933
4953
|
this.position = 0;
|
|
4934
4954
|
this.spacing = 0;
|
|
@@ -4936,6 +4956,15 @@ var spine = (() => {
|
|
|
4936
4956
|
this.mixX = 0;
|
|
4937
4957
|
this.mixY = 0;
|
|
4938
4958
|
}
|
|
4959
|
+
set target(slotData) {
|
|
4960
|
+
this._target = slotData;
|
|
4961
|
+
}
|
|
4962
|
+
get target() {
|
|
4963
|
+
if (!this._target)
|
|
4964
|
+
throw new Error("SlotData not set.");
|
|
4965
|
+
else
|
|
4966
|
+
return this._target;
|
|
4967
|
+
}
|
|
4939
4968
|
};
|
|
4940
4969
|
var PositionMode;
|
|
4941
4970
|
(function(PositionMode2) {
|
|
@@ -4959,9 +4988,6 @@ var spine = (() => {
|
|
|
4959
4988
|
// spine-core/src/PathConstraint.ts
|
|
4960
4989
|
var _PathConstraint = class {
|
|
4961
4990
|
constructor(data, skeleton) {
|
|
4962
|
-
this.data = null;
|
|
4963
|
-
this.bones = null;
|
|
4964
|
-
this.target = null;
|
|
4965
4991
|
this.position = 0;
|
|
4966
4992
|
this.spacing = 0;
|
|
4967
4993
|
this.mixRotate = 0;
|
|
@@ -4980,9 +5006,16 @@ var spine = (() => {
|
|
|
4980
5006
|
throw new Error("skeleton cannot be null.");
|
|
4981
5007
|
this.data = data;
|
|
4982
5008
|
this.bones = new Array();
|
|
4983
|
-
for (let i = 0, n = data.bones.length; i < n; i++)
|
|
4984
|
-
|
|
4985
|
-
|
|
5009
|
+
for (let i = 0, n = data.bones.length; i < n; i++) {
|
|
5010
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
5011
|
+
if (!bone)
|
|
5012
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
5013
|
+
this.bones.push(bone);
|
|
5014
|
+
}
|
|
5015
|
+
let target = skeleton.findSlot(data.target.name);
|
|
5016
|
+
if (!target)
|
|
5017
|
+
throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
5018
|
+
this.target = target;
|
|
4986
5019
|
this.position = data.position;
|
|
4987
5020
|
this.spacing = data.spacing;
|
|
4988
5021
|
this.mixRotate = data.mixRotate;
|
|
@@ -5003,7 +5036,7 @@ var spine = (() => {
|
|
|
5003
5036
|
let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
|
|
5004
5037
|
let bones = this.bones;
|
|
5005
5038
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
5006
|
-
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) :
|
|
5039
|
+
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
|
|
5007
5040
|
let spacing = this.spacing;
|
|
5008
5041
|
switch (data.spacingMode) {
|
|
5009
5042
|
case SpacingMode.Percent:
|
|
@@ -5124,7 +5157,7 @@ var spine = (() => {
|
|
|
5124
5157
|
computeWorldPositions(path, spacesCount, tangents) {
|
|
5125
5158
|
let target = this.target;
|
|
5126
5159
|
let position = this.position;
|
|
5127
|
-
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world =
|
|
5160
|
+
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = this.world;
|
|
5128
5161
|
let closed2 = path.closed;
|
|
5129
5162
|
let verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = _PathConstraint.NONE;
|
|
5130
5163
|
if (!path.constantSpeed) {
|
|
@@ -5381,12 +5414,10 @@ var spine = (() => {
|
|
|
5381
5414
|
// spine-core/src/Slot.ts
|
|
5382
5415
|
var Slot = class {
|
|
5383
5416
|
constructor(data, bone) {
|
|
5384
|
-
this.data = null;
|
|
5385
|
-
this.bone = null;
|
|
5386
|
-
this.color = null;
|
|
5387
5417
|
this.darkColor = null;
|
|
5388
5418
|
this.attachment = null;
|
|
5389
5419
|
this.attachmentState = 0;
|
|
5420
|
+
this.sequenceIndex = -1;
|
|
5390
5421
|
this.deform = new Array();
|
|
5391
5422
|
if (!data)
|
|
5392
5423
|
throw new Error("data cannot be null.");
|
|
@@ -5429,9 +5460,6 @@ var spine = (() => {
|
|
|
5429
5460
|
// spine-core/src/TransformConstraint.ts
|
|
5430
5461
|
var TransformConstraint = class {
|
|
5431
5462
|
constructor(data, skeleton) {
|
|
5432
|
-
this.data = null;
|
|
5433
|
-
this.bones = null;
|
|
5434
|
-
this.target = null;
|
|
5435
5463
|
this.mixRotate = 0;
|
|
5436
5464
|
this.mixX = 0;
|
|
5437
5465
|
this.mixY = 0;
|
|
@@ -5452,9 +5480,16 @@ var spine = (() => {
|
|
|
5452
5480
|
this.mixScaleY = data.mixScaleY;
|
|
5453
5481
|
this.mixShearY = data.mixShearY;
|
|
5454
5482
|
this.bones = new Array();
|
|
5455
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
5456
|
-
|
|
5457
|
-
|
|
5483
|
+
for (let i = 0; i < data.bones.length; i++) {
|
|
5484
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
5485
|
+
if (!bone)
|
|
5486
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
5487
|
+
this.bones.push(bone);
|
|
5488
|
+
}
|
|
5489
|
+
let target = skeleton.findBone(data.target.name);
|
|
5490
|
+
if (!target)
|
|
5491
|
+
throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
5492
|
+
this.target = target;
|
|
5458
5493
|
}
|
|
5459
5494
|
isActive() {
|
|
5460
5495
|
return this.active;
|
|
@@ -5639,16 +5674,8 @@ var spine = (() => {
|
|
|
5639
5674
|
// spine-core/src/Skeleton.ts
|
|
5640
5675
|
var Skeleton = class {
|
|
5641
5676
|
constructor(data) {
|
|
5642
|
-
this.data = null;
|
|
5643
|
-
this.bones = null;
|
|
5644
|
-
this.slots = null;
|
|
5645
|
-
this.drawOrder = null;
|
|
5646
|
-
this.ikConstraints = null;
|
|
5647
|
-
this.transformConstraints = null;
|
|
5648
|
-
this.pathConstraints = null;
|
|
5649
5677
|
this._updateCache = new Array();
|
|
5650
5678
|
this.skin = null;
|
|
5651
|
-
this.color = null;
|
|
5652
5679
|
this.scaleX = 1;
|
|
5653
5680
|
this.scaleY = 1;
|
|
5654
5681
|
this.x = 0;
|
|
@@ -5843,6 +5870,8 @@ var spine = (() => {
|
|
|
5843
5870
|
}
|
|
5844
5871
|
}
|
|
5845
5872
|
sortBone(bone) {
|
|
5873
|
+
if (!bone)
|
|
5874
|
+
return;
|
|
5846
5875
|
if (bone.sorted)
|
|
5847
5876
|
return;
|
|
5848
5877
|
let parent = bone.parent;
|
|
@@ -5879,6 +5908,8 @@ var spine = (() => {
|
|
|
5879
5908
|
}
|
|
5880
5909
|
updateWorldTransformWith(parent) {
|
|
5881
5910
|
let rootBone = this.getRootBone();
|
|
5911
|
+
if (!rootBone)
|
|
5912
|
+
throw new Error("Root bone must not be null.");
|
|
5882
5913
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
5883
5914
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
5884
5915
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -5999,7 +6030,10 @@ var spine = (() => {
|
|
|
5999
6030
|
this.updateCache();
|
|
6000
6031
|
}
|
|
6001
6032
|
getAttachmentByName(slotName, attachmentName) {
|
|
6002
|
-
|
|
6033
|
+
let slot = this.data.findSlot(slotName);
|
|
6034
|
+
if (!slot)
|
|
6035
|
+
throw new Error(`Can't find slot with name ${slotName}`);
|
|
6036
|
+
return this.getAttachment(slot.index, attachmentName);
|
|
6003
6037
|
}
|
|
6004
6038
|
getAttachment(slotIndex, attachmentName) {
|
|
6005
6039
|
if (!attachmentName)
|
|
@@ -6225,7 +6259,7 @@ var spine = (() => {
|
|
|
6225
6259
|
|
|
6226
6260
|
// spine-core/src/Skin.ts
|
|
6227
6261
|
var SkinEntry = class {
|
|
6228
|
-
constructor(slotIndex = 0, name
|
|
6262
|
+
constructor(slotIndex = 0, name, attachment) {
|
|
6229
6263
|
this.slotIndex = slotIndex;
|
|
6230
6264
|
this.name = name;
|
|
6231
6265
|
this.attachment = attachment;
|
|
@@ -6233,7 +6267,6 @@ var spine = (() => {
|
|
|
6233
6267
|
};
|
|
6234
6268
|
var Skin = class {
|
|
6235
6269
|
constructor(name) {
|
|
6236
|
-
this.name = null;
|
|
6237
6270
|
this.attachments = new Array();
|
|
6238
6271
|
this.bones = Array();
|
|
6239
6272
|
this.constraints = new Array();
|
|
@@ -6328,7 +6361,7 @@ var spine = (() => {
|
|
|
6328
6361
|
removeAttachment(slotIndex, name) {
|
|
6329
6362
|
let dictionary = this.attachments[slotIndex];
|
|
6330
6363
|
if (dictionary)
|
|
6331
|
-
dictionary[name]
|
|
6364
|
+
delete dictionary[name];
|
|
6332
6365
|
}
|
|
6333
6366
|
getAttachments() {
|
|
6334
6367
|
let entries = new Array();
|
|
@@ -6385,12 +6418,10 @@ var spine = (() => {
|
|
|
6385
6418
|
var SlotData = class {
|
|
6386
6419
|
constructor(index, name, boneData) {
|
|
6387
6420
|
this.index = 0;
|
|
6388
|
-
this.name = null;
|
|
6389
|
-
this.boneData = null;
|
|
6390
6421
|
this.color = new Color(1, 1, 1, 1);
|
|
6391
6422
|
this.darkColor = null;
|
|
6392
6423
|
this.attachmentName = null;
|
|
6393
|
-
this.blendMode =
|
|
6424
|
+
this.blendMode = BlendMode.Normal;
|
|
6394
6425
|
if (index < 0)
|
|
6395
6426
|
throw new Error("index must be >= 0.");
|
|
6396
6427
|
if (!name)
|
|
@@ -6415,7 +6446,7 @@ var spine = (() => {
|
|
|
6415
6446
|
constructor(name) {
|
|
6416
6447
|
super(name, 0, false);
|
|
6417
6448
|
this.bones = new Array();
|
|
6418
|
-
this.
|
|
6449
|
+
this._target = null;
|
|
6419
6450
|
this.mixRotate = 0;
|
|
6420
6451
|
this.mixX = 0;
|
|
6421
6452
|
this.mixY = 0;
|
|
@@ -6431,13 +6462,21 @@ var spine = (() => {
|
|
|
6431
6462
|
this.relative = false;
|
|
6432
6463
|
this.local = false;
|
|
6433
6464
|
}
|
|
6465
|
+
set target(boneData) {
|
|
6466
|
+
this._target = boneData;
|
|
6467
|
+
}
|
|
6468
|
+
get target() {
|
|
6469
|
+
if (!this._target)
|
|
6470
|
+
throw new Error("BoneData not set.");
|
|
6471
|
+
else
|
|
6472
|
+
return this._target;
|
|
6473
|
+
}
|
|
6434
6474
|
};
|
|
6435
6475
|
|
|
6436
6476
|
// spine-core/src/SkeletonBinary.ts
|
|
6437
6477
|
var SkeletonBinary = class {
|
|
6438
6478
|
constructor(attachmentLoader) {
|
|
6439
6479
|
this.scale = 1;
|
|
6440
|
-
this.attachmentLoader = null;
|
|
6441
6480
|
this.linkedMeshes = new Array();
|
|
6442
6481
|
this.attachmentLoader = attachmentLoader;
|
|
6443
6482
|
}
|
|
@@ -6462,11 +6501,17 @@ var spine = (() => {
|
|
|
6462
6501
|
}
|
|
6463
6502
|
let n = 0;
|
|
6464
6503
|
n = input.readInt(true);
|
|
6465
|
-
for (let i = 0; i < n; i++)
|
|
6466
|
-
input.
|
|
6504
|
+
for (let i = 0; i < n; i++) {
|
|
6505
|
+
let str = input.readString();
|
|
6506
|
+
if (!str)
|
|
6507
|
+
throw new Error("String in string table must not be null.");
|
|
6508
|
+
input.strings.push(str);
|
|
6509
|
+
}
|
|
6467
6510
|
n = input.readInt(true);
|
|
6468
6511
|
for (let i = 0; i < n; i++) {
|
|
6469
6512
|
let name = input.readString();
|
|
6513
|
+
if (!name)
|
|
6514
|
+
throw new Error("Bone name must not be null.");
|
|
6470
6515
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
6471
6516
|
let data = new BoneData(i, name, parent);
|
|
6472
6517
|
data.rotation = input.readFloat();
|
|
@@ -6486,6 +6531,8 @@ var spine = (() => {
|
|
|
6486
6531
|
n = input.readInt(true);
|
|
6487
6532
|
for (let i = 0; i < n; i++) {
|
|
6488
6533
|
let slotName = input.readString();
|
|
6534
|
+
if (!slotName)
|
|
6535
|
+
throw new Error("Slot name must not be null.");
|
|
6489
6536
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
6490
6537
|
let data = new SlotData(i, slotName, boneData);
|
|
6491
6538
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
@@ -6498,7 +6545,10 @@ var spine = (() => {
|
|
|
6498
6545
|
}
|
|
6499
6546
|
n = input.readInt(true);
|
|
6500
6547
|
for (let i = 0, nn; i < n; i++) {
|
|
6501
|
-
let
|
|
6548
|
+
let name = input.readString();
|
|
6549
|
+
if (!name)
|
|
6550
|
+
throw new Error("IK constraint data name must not be null.");
|
|
6551
|
+
let data = new IkConstraintData(name);
|
|
6502
6552
|
data.order = input.readInt(true);
|
|
6503
6553
|
data.skinRequired = input.readBoolean();
|
|
6504
6554
|
nn = input.readInt(true);
|
|
@@ -6515,7 +6565,10 @@ var spine = (() => {
|
|
|
6515
6565
|
}
|
|
6516
6566
|
n = input.readInt(true);
|
|
6517
6567
|
for (let i = 0, nn; i < n; i++) {
|
|
6518
|
-
let
|
|
6568
|
+
let name = input.readString();
|
|
6569
|
+
if (!name)
|
|
6570
|
+
throw new Error("Transform constraint data name must not be null.");
|
|
6571
|
+
let data = new TransformConstraintData(name);
|
|
6519
6572
|
data.order = input.readInt(true);
|
|
6520
6573
|
data.skinRequired = input.readBoolean();
|
|
6521
6574
|
nn = input.readInt(true);
|
|
@@ -6540,7 +6593,10 @@ var spine = (() => {
|
|
|
6540
6593
|
}
|
|
6541
6594
|
n = input.readInt(true);
|
|
6542
6595
|
for (let i = 0, nn; i < n; i++) {
|
|
6543
|
-
let
|
|
6596
|
+
let name = input.readString();
|
|
6597
|
+
if (!name)
|
|
6598
|
+
throw new Error("Path constraint data name must not be null.");
|
|
6599
|
+
let data = new PathConstraintData(name);
|
|
6544
6600
|
data.order = input.readInt(true);
|
|
6545
6601
|
data.skinRequired = input.readBoolean();
|
|
6546
6602
|
nn = input.readInt(true);
|
|
@@ -6570,14 +6626,24 @@ var spine = (() => {
|
|
|
6570
6626
|
{
|
|
6571
6627
|
let i = skeletonData.skins.length;
|
|
6572
6628
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
6573
|
-
for (; i < n; i++)
|
|
6574
|
-
|
|
6629
|
+
for (; i < n; i++) {
|
|
6630
|
+
let skin = this.readSkin(input, skeletonData, false, nonessential);
|
|
6631
|
+
if (!skin)
|
|
6632
|
+
throw new Error("readSkin() should not have returned null.");
|
|
6633
|
+
skeletonData.skins[i] = skin;
|
|
6634
|
+
}
|
|
6575
6635
|
}
|
|
6576
6636
|
n = this.linkedMeshes.length;
|
|
6577
6637
|
for (let i = 0; i < n; i++) {
|
|
6578
6638
|
let linkedMesh = this.linkedMeshes[i];
|
|
6579
6639
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
6640
|
+
if (!skin)
|
|
6641
|
+
throw new Error("Not skin found for linked mesh.");
|
|
6642
|
+
if (!linkedMesh.parent)
|
|
6643
|
+
throw new Error("Linked mesh parent must not be null");
|
|
6580
6644
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
6645
|
+
if (!parent)
|
|
6646
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
6581
6647
|
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
6582
6648
|
linkedMesh.mesh.setParentMesh(parent);
|
|
6583
6649
|
if (linkedMesh.mesh.region != null)
|
|
@@ -6586,7 +6652,10 @@ var spine = (() => {
|
|
|
6586
6652
|
this.linkedMeshes.length = 0;
|
|
6587
6653
|
n = input.readInt(true);
|
|
6588
6654
|
for (let i = 0; i < n; i++) {
|
|
6589
|
-
let
|
|
6655
|
+
let eventName = input.readStringRef();
|
|
6656
|
+
if (!eventName)
|
|
6657
|
+
throw new Error();
|
|
6658
|
+
let data = new EventData(eventName);
|
|
6590
6659
|
data.intValue = input.readInt(false);
|
|
6591
6660
|
data.floatValue = input.readFloat();
|
|
6592
6661
|
data.stringValue = input.readString();
|
|
@@ -6598,8 +6667,12 @@ var spine = (() => {
|
|
|
6598
6667
|
skeletonData.events.push(data);
|
|
6599
6668
|
}
|
|
6600
6669
|
n = input.readInt(true);
|
|
6601
|
-
for (let i = 0; i < n; i++)
|
|
6602
|
-
|
|
6670
|
+
for (let i = 0; i < n; i++) {
|
|
6671
|
+
let animationName = input.readString();
|
|
6672
|
+
if (!animationName)
|
|
6673
|
+
throw new Error("Animatio name must not be null.");
|
|
6674
|
+
skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
|
|
6675
|
+
}
|
|
6603
6676
|
return skeletonData;
|
|
6604
6677
|
}
|
|
6605
6678
|
readSkin(input, skeletonData, defaultSkin, nonessential) {
|
|
@@ -6611,7 +6684,10 @@ var spine = (() => {
|
|
|
6611
6684
|
return null;
|
|
6612
6685
|
skin = new Skin("default");
|
|
6613
6686
|
} else {
|
|
6614
|
-
|
|
6687
|
+
let skinName = input.readStringRef();
|
|
6688
|
+
if (!skinName)
|
|
6689
|
+
throw new Error("Skin name must not be null.");
|
|
6690
|
+
skin = new Skin(skinName);
|
|
6615
6691
|
skin.bones.length = input.readInt(true);
|
|
6616
6692
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
6617
6693
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -6627,6 +6703,8 @@ var spine = (() => {
|
|
|
6627
6703
|
let slotIndex = input.readInt(true);
|
|
6628
6704
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
6629
6705
|
let name = input.readStringRef();
|
|
6706
|
+
if (!name)
|
|
6707
|
+
throw new Error("Attachment name must not be null");
|
|
6630
6708
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
6631
6709
|
if (attachment)
|
|
6632
6710
|
skin.setAttachment(slotIndex, name, attachment);
|
|
@@ -6693,7 +6771,7 @@ var spine = (() => {
|
|
|
6693
6771
|
let vertices = this.readVertices(input, vertexCount);
|
|
6694
6772
|
let hullLength = input.readInt(true);
|
|
6695
6773
|
let sequence = this.readSequence(input);
|
|
6696
|
-
let edges =
|
|
6774
|
+
let edges = [];
|
|
6697
6775
|
let width = 0, height = 0;
|
|
6698
6776
|
if (nonessential) {
|
|
6699
6777
|
edges = this.readShortArray(input);
|
|
@@ -7195,6 +7273,8 @@ var spine = (() => {
|
|
|
7195
7273
|
let slotIndex = input.readInt(true);
|
|
7196
7274
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
7197
7275
|
let attachmentName = input.readStringRef();
|
|
7276
|
+
if (!attachmentName)
|
|
7277
|
+
throw new Error("attachmentName must not be null.");
|
|
7198
7278
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
7199
7279
|
let timelineType = input.readByte();
|
|
7200
7280
|
let frameCount = input.readInt(true);
|
|
@@ -7369,7 +7449,7 @@ var spine = (() => {
|
|
|
7369
7449
|
let chars = "";
|
|
7370
7450
|
let charCount = 0;
|
|
7371
7451
|
for (let i = 0; i < byteCount; ) {
|
|
7372
|
-
let b = this.
|
|
7452
|
+
let b = this.readUnsignedByte();
|
|
7373
7453
|
switch (b >> 4) {
|
|
7374
7454
|
case 12:
|
|
7375
7455
|
case 13:
|
|
@@ -7870,6 +7950,8 @@ var spine = (() => {
|
|
|
7870
7950
|
this.clippedVertices = new Array();
|
|
7871
7951
|
this.clippedTriangles = new Array();
|
|
7872
7952
|
this.scratch = new Array();
|
|
7953
|
+
this.clipAttachment = null;
|
|
7954
|
+
this.clippingPolygons = null;
|
|
7873
7955
|
}
|
|
7874
7956
|
clipStart(slot, clip) {
|
|
7875
7957
|
if (this.clipAttachment)
|
|
@@ -7909,7 +7991,7 @@ var spine = (() => {
|
|
|
7909
7991
|
let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
|
|
7910
7992
|
let clippedTriangles = this.clippedTriangles;
|
|
7911
7993
|
let polygons = this.clippingPolygons;
|
|
7912
|
-
let polygonsCount =
|
|
7994
|
+
let polygonsCount = polygons.length;
|
|
7913
7995
|
let vertexSize = twoColor ? 12 : 8;
|
|
7914
7996
|
let index = 0;
|
|
7915
7997
|
clippedVertices.length = 0;
|
|
@@ -8041,7 +8123,7 @@ var spine = (() => {
|
|
|
8041
8123
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8042
8124
|
let originalOutput = output;
|
|
8043
8125
|
let clipped = false;
|
|
8044
|
-
let input
|
|
8126
|
+
let input;
|
|
8045
8127
|
if (clippingArea.length % 4 >= 2) {
|
|
8046
8128
|
input = output;
|
|
8047
8129
|
output = this.scratch;
|
|
@@ -8149,7 +8231,6 @@ var spine = (() => {
|
|
|
8149
8231
|
// spine-core/src/SkeletonJson.ts
|
|
8150
8232
|
var SkeletonJson = class {
|
|
8151
8233
|
constructor(attachmentLoader) {
|
|
8152
|
-
this.attachmentLoader = null;
|
|
8153
8234
|
this.scale = 1;
|
|
8154
8235
|
this.linkedMeshes = new Array();
|
|
8155
8236
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8197,6 +8278,8 @@ var spine = (() => {
|
|
|
8197
8278
|
for (let i = 0; i < root.slots.length; i++) {
|
|
8198
8279
|
let slotMap = root.slots[i];
|
|
8199
8280
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
8281
|
+
if (!boneData)
|
|
8282
|
+
throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotMap.name}`);
|
|
8200
8283
|
let data = new SlotData(skeletonData.slots.length, slotMap.name, boneData);
|
|
8201
8284
|
let color = getValue(slotMap, "color", null);
|
|
8202
8285
|
if (color)
|
|
@@ -8215,9 +8298,17 @@ var spine = (() => {
|
|
|
8215
8298
|
let data = new IkConstraintData(constraintMap.name);
|
|
8216
8299
|
data.order = getValue(constraintMap, "order", 0);
|
|
8217
8300
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8218
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8219
|
-
|
|
8220
|
-
|
|
8301
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8302
|
+
let bone = skeletonData.findBone(constraintMap.bones[ii]);
|
|
8303
|
+
if (!bone)
|
|
8304
|
+
throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
8305
|
+
data.bones.push(bone);
|
|
8306
|
+
}
|
|
8307
|
+
let target = skeletonData.findBone(constraintMap.target);
|
|
8308
|
+
;
|
|
8309
|
+
if (!target)
|
|
8310
|
+
throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
8311
|
+
data.target = target;
|
|
8221
8312
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
8222
8313
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
8223
8314
|
data.bendDirection = getValue(constraintMap, "bendPositive", true) ? 1 : -1;
|
|
@@ -8233,10 +8324,18 @@ var spine = (() => {
|
|
|
8233
8324
|
let data = new TransformConstraintData(constraintMap.name);
|
|
8234
8325
|
data.order = getValue(constraintMap, "order", 0);
|
|
8235
8326
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8236
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8237
|
-
|
|
8327
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8328
|
+
let boneName = constraintMap.bones[ii];
|
|
8329
|
+
let bone = skeletonData.findBone(boneName);
|
|
8330
|
+
if (!bone)
|
|
8331
|
+
throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
8332
|
+
data.bones.push(bone);
|
|
8333
|
+
}
|
|
8238
8334
|
let targetName = constraintMap.target;
|
|
8239
|
-
|
|
8335
|
+
let target = skeletonData.findBone(targetName);
|
|
8336
|
+
if (!target)
|
|
8337
|
+
throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
8338
|
+
data.target = target;
|
|
8240
8339
|
data.local = getValue(constraintMap, "local", false);
|
|
8241
8340
|
data.relative = getValue(constraintMap, "relative", false);
|
|
8242
8341
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
@@ -8260,10 +8359,18 @@ var spine = (() => {
|
|
|
8260
8359
|
let data = new PathConstraintData(constraintMap.name);
|
|
8261
8360
|
data.order = getValue(constraintMap, "order", 0);
|
|
8262
8361
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8263
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8264
|
-
|
|
8362
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8363
|
+
let boneName = constraintMap.bones[ii];
|
|
8364
|
+
let bone = skeletonData.findBone(boneName);
|
|
8365
|
+
if (!bone)
|
|
8366
|
+
throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
8367
|
+
data.bones.push(bone);
|
|
8368
|
+
}
|
|
8265
8369
|
let targetName = constraintMap.target;
|
|
8266
|
-
|
|
8370
|
+
let target = skeletonData.findSlot(targetName);
|
|
8371
|
+
if (!target)
|
|
8372
|
+
throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
8373
|
+
data.target = target;
|
|
8267
8374
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
8268
8375
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
8269
8376
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
@@ -8285,23 +8392,45 @@ var spine = (() => {
|
|
|
8285
8392
|
let skinMap = root.skins[i];
|
|
8286
8393
|
let skin = new Skin(skinMap.name);
|
|
8287
8394
|
if (skinMap.bones) {
|
|
8288
|
-
for (let ii = 0; ii < skinMap.bones.length; ii++)
|
|
8289
|
-
|
|
8395
|
+
for (let ii = 0; ii < skinMap.bones.length; ii++) {
|
|
8396
|
+
let boneName = skinMap.bones[ii];
|
|
8397
|
+
let bone = skeletonData.findBone(boneName);
|
|
8398
|
+
if (!bone)
|
|
8399
|
+
throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
8400
|
+
skin.bones.push(bone);
|
|
8401
|
+
}
|
|
8290
8402
|
}
|
|
8291
8403
|
if (skinMap.ik) {
|
|
8292
|
-
for (let ii = 0; ii < skinMap.ik.length; ii++)
|
|
8293
|
-
|
|
8404
|
+
for (let ii = 0; ii < skinMap.ik.length; ii++) {
|
|
8405
|
+
let constraintName = skinMap.ik[ii];
|
|
8406
|
+
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8407
|
+
if (!constraint)
|
|
8408
|
+
throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8409
|
+
skin.constraints.push(constraint);
|
|
8410
|
+
}
|
|
8294
8411
|
}
|
|
8295
8412
|
if (skinMap.transform) {
|
|
8296
|
-
for (let ii = 0; ii < skinMap.transform.length; ii++)
|
|
8297
|
-
|
|
8413
|
+
for (let ii = 0; ii < skinMap.transform.length; ii++) {
|
|
8414
|
+
let constraintName = skinMap.transform[ii];
|
|
8415
|
+
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8416
|
+
if (!constraint)
|
|
8417
|
+
throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8418
|
+
skin.constraints.push(constraint);
|
|
8419
|
+
}
|
|
8298
8420
|
}
|
|
8299
8421
|
if (skinMap.path) {
|
|
8300
|
-
for (let ii = 0; ii < skinMap.path.length; ii++)
|
|
8301
|
-
|
|
8422
|
+
for (let ii = 0; ii < skinMap.path.length; ii++) {
|
|
8423
|
+
let constraintName = skinMap.path[ii];
|
|
8424
|
+
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8425
|
+
if (!constraint)
|
|
8426
|
+
throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8427
|
+
skin.constraints.push(constraint);
|
|
8428
|
+
}
|
|
8302
8429
|
}
|
|
8303
8430
|
for (let slotName in skinMap.attachments) {
|
|
8304
8431
|
let slot = skeletonData.findSlot(slotName);
|
|
8432
|
+
if (!slot)
|
|
8433
|
+
throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
8305
8434
|
let slotMap = skinMap.attachments[slotName];
|
|
8306
8435
|
for (let entryName in slotMap) {
|
|
8307
8436
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
@@ -8317,7 +8446,11 @@ var spine = (() => {
|
|
|
8317
8446
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
8318
8447
|
let linkedMesh = this.linkedMeshes[i];
|
|
8319
8448
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
8449
|
+
if (!skin)
|
|
8450
|
+
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
8320
8451
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8452
|
+
if (!parent)
|
|
8453
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8321
8454
|
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8322
8455
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8323
8456
|
if (linkedMesh.mesh.region != null)
|
|
@@ -8501,7 +8634,10 @@ var spine = (() => {
|
|
|
8501
8634
|
if (map.slots) {
|
|
8502
8635
|
for (let slotName in map.slots) {
|
|
8503
8636
|
let slotMap = map.slots[slotName];
|
|
8504
|
-
let
|
|
8637
|
+
let slot = skeletonData.findSlot(slotName);
|
|
8638
|
+
if (!slot)
|
|
8639
|
+
throw new Error("Slot not found: " + slotName);
|
|
8640
|
+
let slotIndex = slot.index;
|
|
8505
8641
|
for (let timelineName in slotMap) {
|
|
8506
8642
|
let timelineMap = slotMap[timelineName];
|
|
8507
8643
|
if (!timelineMap)
|
|
@@ -8637,7 +8773,10 @@ var spine = (() => {
|
|
|
8637
8773
|
if (map.bones) {
|
|
8638
8774
|
for (let boneName in map.bones) {
|
|
8639
8775
|
let boneMap = map.bones[boneName];
|
|
8640
|
-
let
|
|
8776
|
+
let bone = skeletonData.findBone(boneName);
|
|
8777
|
+
if (!bone)
|
|
8778
|
+
throw new Error("Bone not found: " + boneName);
|
|
8779
|
+
let boneIndex = bone.index;
|
|
8641
8780
|
for (let timelineName in boneMap) {
|
|
8642
8781
|
let timelineMap = boneMap[timelineName];
|
|
8643
8782
|
let frames = timelineMap.length;
|
|
@@ -8683,6 +8822,8 @@ var spine = (() => {
|
|
|
8683
8822
|
if (!keyMap)
|
|
8684
8823
|
continue;
|
|
8685
8824
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8825
|
+
if (!constraint)
|
|
8826
|
+
throw new Error("IK Constraint not found: " + constraintName);
|
|
8686
8827
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
8687
8828
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
8688
8829
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8718,6 +8859,8 @@ var spine = (() => {
|
|
|
8718
8859
|
if (!keyMap)
|
|
8719
8860
|
continue;
|
|
8720
8861
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8862
|
+
if (!constraint)
|
|
8863
|
+
throw new Error("Transform constraint not found: " + constraintName);
|
|
8721
8864
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
8722
8865
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
8723
8866
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8766,6 +8909,8 @@ var spine = (() => {
|
|
|
8766
8909
|
for (let constraintName in map.path) {
|
|
8767
8910
|
let constraintMap = map.path[constraintName];
|
|
8768
8911
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8912
|
+
if (!constraint)
|
|
8913
|
+
throw new Error("Path constraint not found: " + constraintName);
|
|
8769
8914
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
8770
8915
|
for (let timelineName in constraintMap) {
|
|
8771
8916
|
let timelineMap = constraintMap[timelineName];
|
|
@@ -8817,9 +8962,14 @@ var spine = (() => {
|
|
|
8817
8962
|
for (let attachmentsName in map.attachments) {
|
|
8818
8963
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
8819
8964
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
8965
|
+
if (!skin)
|
|
8966
|
+
throw new Error("Skin not found: " + attachmentsName);
|
|
8820
8967
|
for (let slotMapName in attachmentsMap) {
|
|
8821
8968
|
let slotMap = attachmentsMap[slotMapName];
|
|
8822
|
-
let
|
|
8969
|
+
let slot = skeletonData.findSlot(slotMapName);
|
|
8970
|
+
if (!slot)
|
|
8971
|
+
throw new Error("Slot not found: " + slotMapName);
|
|
8972
|
+
let slotIndex = slot.index;
|
|
8823
8973
|
for (let attachmentMapName in slotMap) {
|
|
8824
8974
|
let attachmentMap = slotMap[attachmentMapName];
|
|
8825
8975
|
let attachment = skin.getAttachment(slotIndex, attachmentMapName);
|
|
@@ -8899,7 +9049,10 @@ var spine = (() => {
|
|
|
8899
9049
|
let originalIndex = 0, unchangedIndex = 0;
|
|
8900
9050
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
8901
9051
|
let offsetMap = offsets[ii];
|
|
8902
|
-
let
|
|
9052
|
+
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
9053
|
+
if (!slot)
|
|
9054
|
+
throw new Error("Slot not found: " + slot);
|
|
9055
|
+
let slotIndex = slot.index;
|
|
8903
9056
|
while (originalIndex != slotIndex)
|
|
8904
9057
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
8905
9058
|
drawOrder[originalIndex + offsetMap.offset] = originalIndex++;
|
|
@@ -8920,6 +9073,8 @@ var spine = (() => {
|
|
|
8920
9073
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
8921
9074
|
let eventMap = map.events[i];
|
|
8922
9075
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
9076
|
+
if (!eventData)
|
|
9077
|
+
throw new Error("Event not found: " + eventMap.name);
|
|
8923
9078
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
8924
9079
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
8925
9080
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|
|
@@ -9023,58 +9178,6 @@ var spine = (() => {
|
|
|
9023
9178
|
}
|
|
9024
9179
|
})();
|
|
9025
9180
|
|
|
9026
|
-
// spine-core/src/vertexeffects/JitterEffect.ts
|
|
9027
|
-
var JitterEffect = class {
|
|
9028
|
-
constructor(jitterX, jitterY) {
|
|
9029
|
-
this.jitterX = 0;
|
|
9030
|
-
this.jitterY = 0;
|
|
9031
|
-
this.jitterX = jitterX;
|
|
9032
|
-
this.jitterY = jitterY;
|
|
9033
|
-
}
|
|
9034
|
-
begin(skeleton) {
|
|
9035
|
-
}
|
|
9036
|
-
transform(position, uv, light, dark) {
|
|
9037
|
-
position.x += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
|
9038
|
-
position.y += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
|
9039
|
-
}
|
|
9040
|
-
end() {
|
|
9041
|
-
}
|
|
9042
|
-
};
|
|
9043
|
-
|
|
9044
|
-
// spine-core/src/vertexeffects/SwirlEffect.ts
|
|
9045
|
-
var _SwirlEffect = class {
|
|
9046
|
-
constructor(radius) {
|
|
9047
|
-
this.centerX = 0;
|
|
9048
|
-
this.centerY = 0;
|
|
9049
|
-
this.radius = 0;
|
|
9050
|
-
this.angle = 0;
|
|
9051
|
-
this.worldX = 0;
|
|
9052
|
-
this.worldY = 0;
|
|
9053
|
-
this.radius = radius;
|
|
9054
|
-
}
|
|
9055
|
-
begin(skeleton) {
|
|
9056
|
-
this.worldX = skeleton.x + this.centerX;
|
|
9057
|
-
this.worldY = skeleton.y + this.centerY;
|
|
9058
|
-
}
|
|
9059
|
-
transform(position, uv, light, dark) {
|
|
9060
|
-
let radAngle = this.angle * MathUtils.degreesToRadians;
|
|
9061
|
-
let x = position.x - this.worldX;
|
|
9062
|
-
let y = position.y - this.worldY;
|
|
9063
|
-
let dist = Math.sqrt(x * x + y * y);
|
|
9064
|
-
if (dist < this.radius) {
|
|
9065
|
-
let theta = _SwirlEffect.interpolation.apply(0, radAngle, (this.radius - dist) / this.radius);
|
|
9066
|
-
let cos = Math.cos(theta);
|
|
9067
|
-
let sin = Math.sin(theta);
|
|
9068
|
-
position.x = cos * x - sin * y + this.worldX;
|
|
9069
|
-
position.y = sin * x + cos * y + this.worldY;
|
|
9070
|
-
}
|
|
9071
|
-
}
|
|
9072
|
-
end() {
|
|
9073
|
-
}
|
|
9074
|
-
};
|
|
9075
|
-
var SwirlEffect = _SwirlEffect;
|
|
9076
|
-
SwirlEffect.interpolation = new PowOut(2);
|
|
9077
|
-
|
|
9078
9181
|
// spine-canvas/src/CanvasTexture.ts
|
|
9079
9182
|
var CanvasTexture = class extends Texture {
|
|
9080
9183
|
constructor(image) {
|
|
@@ -9090,7 +9193,7 @@ var spine = (() => {
|
|
|
9090
9193
|
|
|
9091
9194
|
// spine-canvas/src/AssetManager.ts
|
|
9092
9195
|
var AssetManager = class extends AssetManagerBase {
|
|
9093
|
-
constructor(pathPrefix = "", downloader =
|
|
9196
|
+
constructor(pathPrefix = "", downloader = new Downloader()) {
|
|
9094
9197
|
super((image) => {
|
|
9095
9198
|
return new CanvasTexture(image);
|
|
9096
9199
|
}, pathPrefix, downloader);
|
|
@@ -9178,7 +9281,8 @@ var spine = (() => {
|
|
|
9178
9281
|
let mesh = attachment;
|
|
9179
9282
|
vertices = this.computeMeshVertices(slot, mesh, false);
|
|
9180
9283
|
triangles = mesh.triangles;
|
|
9181
|
-
|
|
9284
|
+
let region2 = mesh.region.renderObject;
|
|
9285
|
+
texture = region2.page.texture.getImage();
|
|
9182
9286
|
} else
|
|
9183
9287
|
continue;
|
|
9184
9288
|
if (texture) {
|