@esotericsoftware/spine-canvaskit 4.2.81 → 4.2.83
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/LICENSE +12 -12
- package/dist/esm/spine-canvaskit.min.mjs +2 -2
- package/dist/esm/spine-canvaskit.mjs +836 -1244
- package/dist/esm/spine-canvaskit.mjs.map +3 -3
- package/dist/iife/spine-canvaskit.js +839 -1245
- package/dist/iife/spine-canvaskit.js.map +3 -3
- package/dist/iife/spine-canvaskit.min.js +2 -2
- package/package.json +2 -2
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
1
|
// spine-core/src/Utils.ts
|
|
9
2
|
var IntSet = class {
|
|
10
3
|
array = new Array();
|
|
@@ -49,13 +42,18 @@ var StringSet = class {
|
|
|
49
42
|
this.size = 0;
|
|
50
43
|
}
|
|
51
44
|
};
|
|
52
|
-
var
|
|
45
|
+
var Color = class _Color {
|
|
53
46
|
constructor(r = 0, g = 0, b = 0, a = 0) {
|
|
54
47
|
this.r = r;
|
|
55
48
|
this.g = g;
|
|
56
49
|
this.b = b;
|
|
57
50
|
this.a = a;
|
|
58
51
|
}
|
|
52
|
+
static WHITE = new _Color(1, 1, 1, 1);
|
|
53
|
+
static RED = new _Color(1, 0, 0, 1);
|
|
54
|
+
static GREEN = new _Color(0, 1, 0, 1);
|
|
55
|
+
static BLUE = new _Color(0, 0, 1, 1);
|
|
56
|
+
static MAGENTA = new _Color(1, 0, 1, 1);
|
|
59
57
|
set(r, g, b, a) {
|
|
60
58
|
this.r = r;
|
|
61
59
|
this.g = g;
|
|
@@ -86,22 +84,14 @@ var _Color = class {
|
|
|
86
84
|
return this.clamp();
|
|
87
85
|
}
|
|
88
86
|
clamp() {
|
|
89
|
-
if (this.r < 0)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (this.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (this.b < 0)
|
|
98
|
-
this.b = 0;
|
|
99
|
-
else if (this.b > 1)
|
|
100
|
-
this.b = 1;
|
|
101
|
-
if (this.a < 0)
|
|
102
|
-
this.a = 0;
|
|
103
|
-
else if (this.a > 1)
|
|
104
|
-
this.a = 1;
|
|
87
|
+
if (this.r < 0) this.r = 0;
|
|
88
|
+
else if (this.r > 1) this.r = 1;
|
|
89
|
+
if (this.g < 0) this.g = 0;
|
|
90
|
+
else if (this.g > 1) this.g = 1;
|
|
91
|
+
if (this.b < 0) this.b = 0;
|
|
92
|
+
else if (this.b > 1) this.b = 1;
|
|
93
|
+
if (this.a < 0) this.a = 0;
|
|
94
|
+
else if (this.a > 1) this.a = 1;
|
|
105
95
|
return this;
|
|
106
96
|
}
|
|
107
97
|
static rgba8888ToColor(color, value) {
|
|
@@ -119,22 +109,21 @@ var _Color = class {
|
|
|
119
109
|
const hex = (x) => ("0" + (x * 255).toString(16)).slice(-2);
|
|
120
110
|
return Number("0x" + hex(this.r) + hex(this.g) + hex(this.b));
|
|
121
111
|
}
|
|
122
|
-
static fromString(hex) {
|
|
123
|
-
return
|
|
112
|
+
static fromString(hex, color = new _Color()) {
|
|
113
|
+
return color.setFromString(hex);
|
|
124
114
|
}
|
|
125
115
|
};
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
116
|
+
var MathUtils = class _MathUtils {
|
|
117
|
+
static PI = 3.1415927;
|
|
118
|
+
static PI2 = _MathUtils.PI * 2;
|
|
119
|
+
static invPI2 = 1 / _MathUtils.PI2;
|
|
120
|
+
static radiansToDegrees = 180 / _MathUtils.PI;
|
|
121
|
+
static radDeg = _MathUtils.radiansToDegrees;
|
|
122
|
+
static degreesToRadians = _MathUtils.PI / 180;
|
|
123
|
+
static degRad = _MathUtils.degreesToRadians;
|
|
133
124
|
static clamp(value, min, max) {
|
|
134
|
-
if (value < min)
|
|
135
|
-
|
|
136
|
-
if (value > max)
|
|
137
|
-
return max;
|
|
125
|
+
if (value < min) return min;
|
|
126
|
+
if (value > max) return max;
|
|
138
127
|
return value;
|
|
139
128
|
}
|
|
140
129
|
static cosDeg(degrees) {
|
|
@@ -162,22 +151,13 @@ var _MathUtils = class {
|
|
|
162
151
|
static randomTriangularWith(min, max, mode) {
|
|
163
152
|
let u = Math.random();
|
|
164
153
|
let d = max - min;
|
|
165
|
-
if (u <= (mode - min) / d)
|
|
166
|
-
return min + Math.sqrt(u * d * (mode - min));
|
|
154
|
+
if (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min));
|
|
167
155
|
return max - Math.sqrt((1 - u) * d * (max - mode));
|
|
168
156
|
}
|
|
169
157
|
static isPowerOfTwo(value) {
|
|
170
158
|
return value && (value & value - 1) === 0;
|
|
171
159
|
}
|
|
172
160
|
};
|
|
173
|
-
var MathUtils = _MathUtils;
|
|
174
|
-
__publicField(MathUtils, "PI", 3.1415927);
|
|
175
|
-
__publicField(MathUtils, "PI2", _MathUtils.PI * 2);
|
|
176
|
-
__publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
|
|
177
|
-
__publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
|
|
178
|
-
__publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
|
|
179
|
-
__publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
|
|
180
|
-
__publicField(MathUtils, "degRad", _MathUtils.degreesToRadians);
|
|
181
161
|
var Interpolation = class {
|
|
182
162
|
apply(start, end, a) {
|
|
183
163
|
return start + (end - start) * this.applyInternal(a);
|
|
@@ -190,8 +170,7 @@ var Pow = class extends Interpolation {
|
|
|
190
170
|
this.power = power;
|
|
191
171
|
}
|
|
192
172
|
applyInternal(a) {
|
|
193
|
-
if (a <= 0.5)
|
|
194
|
-
return Math.pow(a * 2, this.power) / 2;
|
|
173
|
+
if (a <= 0.5) return Math.pow(a * 2, this.power) / 2;
|
|
195
174
|
return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;
|
|
196
175
|
}
|
|
197
176
|
};
|
|
@@ -203,7 +182,8 @@ var PowOut = class extends Pow {
|
|
|
203
182
|
return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;
|
|
204
183
|
}
|
|
205
184
|
};
|
|
206
|
-
var
|
|
185
|
+
var Utils = class _Utils {
|
|
186
|
+
static SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== "undefined";
|
|
207
187
|
static arrayCopy(source, sourceStart, dest, destStart, numElements) {
|
|
208
188
|
for (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {
|
|
209
189
|
dest[j] = source[i];
|
|
@@ -215,24 +195,20 @@ var _Utils = class {
|
|
|
215
195
|
}
|
|
216
196
|
static setArraySize(array, size, value = 0) {
|
|
217
197
|
let oldSize = array.length;
|
|
218
|
-
if (oldSize == size)
|
|
219
|
-
return array;
|
|
198
|
+
if (oldSize == size) return array;
|
|
220
199
|
array.length = size;
|
|
221
200
|
if (oldSize < size) {
|
|
222
|
-
for (let i = oldSize; i < size; i++)
|
|
223
|
-
array[i] = value;
|
|
201
|
+
for (let i = oldSize; i < size; i++) array[i] = value;
|
|
224
202
|
}
|
|
225
203
|
return array;
|
|
226
204
|
}
|
|
227
205
|
static ensureArrayCapacity(array, size, value = 0) {
|
|
228
|
-
if (array.length >= size)
|
|
229
|
-
return array;
|
|
206
|
+
if (array.length >= size) return array;
|
|
230
207
|
return _Utils.setArraySize(array, size, value);
|
|
231
208
|
}
|
|
232
209
|
static newArray(size, defaultValue) {
|
|
233
210
|
let array = new Array(size);
|
|
234
|
-
for (let i = 0; i < size; i++)
|
|
235
|
-
array[i] = defaultValue;
|
|
211
|
+
for (let i = 0; i < size; i++) array[i] = defaultValue;
|
|
236
212
|
return array;
|
|
237
213
|
}
|
|
238
214
|
static newFloatArray(size) {
|
|
@@ -240,8 +216,7 @@ var _Utils = class {
|
|
|
240
216
|
return new Float32Array(size);
|
|
241
217
|
else {
|
|
242
218
|
let array = new Array(size);
|
|
243
|
-
for (let i = 0; i < array.length; i++)
|
|
244
|
-
array[i] = 0;
|
|
219
|
+
for (let i = 0; i < array.length; i++) array[i] = 0;
|
|
245
220
|
return array;
|
|
246
221
|
}
|
|
247
222
|
}
|
|
@@ -250,8 +225,7 @@ var _Utils = class {
|
|
|
250
225
|
return new Int16Array(size);
|
|
251
226
|
else {
|
|
252
227
|
let array = new Array(size);
|
|
253
|
-
for (let i = 0; i < array.length; i++)
|
|
254
|
-
array[i] = 0;
|
|
228
|
+
for (let i = 0; i < array.length; i++) array[i] = 0;
|
|
255
229
|
return array;
|
|
256
230
|
}
|
|
257
231
|
}
|
|
@@ -266,16 +240,13 @@ var _Utils = class {
|
|
|
266
240
|
}
|
|
267
241
|
static contains(array, element, identity = true) {
|
|
268
242
|
for (var i = 0; i < array.length; i++)
|
|
269
|
-
if (array[i] == element)
|
|
270
|
-
return true;
|
|
243
|
+
if (array[i] == element) return true;
|
|
271
244
|
return false;
|
|
272
245
|
}
|
|
273
246
|
static enumValue(type, name) {
|
|
274
247
|
return type[name[0].toUpperCase() + name.slice(1)];
|
|
275
248
|
}
|
|
276
249
|
};
|
|
277
|
-
var Utils = _Utils;
|
|
278
|
-
__publicField(Utils, "SUPPORTS_TYPED_ARRAYS", typeof Float32Array !== "undefined");
|
|
279
250
|
var DebugUtils = class {
|
|
280
251
|
static logBones(skeleton) {
|
|
281
252
|
for (let i = 0; i < skeleton.bones.length; i++) {
|
|
@@ -294,8 +265,7 @@ var Pool = class {
|
|
|
294
265
|
return this.items.length > 0 ? this.items.pop() : this.instantiator();
|
|
295
266
|
}
|
|
296
267
|
free(item) {
|
|
297
|
-
if (item.reset)
|
|
298
|
-
item.reset();
|
|
268
|
+
if (item.reset) item.reset();
|
|
299
269
|
this.items.push(item);
|
|
300
270
|
}
|
|
301
271
|
freeAll(items) {
|
|
@@ -343,8 +313,7 @@ var TimeKeeper = class {
|
|
|
343
313
|
this.delta = now - this.lastTime;
|
|
344
314
|
this.frameTime += this.delta;
|
|
345
315
|
this.totalTime += this.delta;
|
|
346
|
-
if (this.delta > this.maxDelta)
|
|
347
|
-
this.delta = this.maxDelta;
|
|
316
|
+
if (this.delta > this.maxDelta) this.delta = this.maxDelta;
|
|
348
317
|
this.lastTime = now;
|
|
349
318
|
this.frameCount++;
|
|
350
319
|
if (this.frameTime > 1) {
|
|
@@ -367,11 +336,9 @@ var WindowedMean = class {
|
|
|
367
336
|
return this.addedValues >= this.values.length;
|
|
368
337
|
}
|
|
369
338
|
addValue(value) {
|
|
370
|
-
if (this.addedValues < this.values.length)
|
|
371
|
-
this.addedValues++;
|
|
339
|
+
if (this.addedValues < this.values.length) this.addedValues++;
|
|
372
340
|
this.values[this.lastValue++] = value;
|
|
373
|
-
if (this.lastValue > this.values.length - 1)
|
|
374
|
-
this.lastValue = 0;
|
|
341
|
+
if (this.lastValue > this.values.length - 1) this.lastValue = 0;
|
|
375
342
|
this.dirty = true;
|
|
376
343
|
}
|
|
377
344
|
getMean() {
|
|
@@ -393,12 +360,12 @@ var WindowedMean = class {
|
|
|
393
360
|
var Attachment = class {
|
|
394
361
|
name;
|
|
395
362
|
constructor(name) {
|
|
396
|
-
if (!name)
|
|
397
|
-
throw new Error("name cannot be null.");
|
|
363
|
+
if (!name) throw new Error("name cannot be null.");
|
|
398
364
|
this.name = name;
|
|
399
365
|
}
|
|
400
366
|
};
|
|
401
|
-
var
|
|
367
|
+
var VertexAttachment = class _VertexAttachment extends Attachment {
|
|
368
|
+
static nextID = 0;
|
|
402
369
|
/** The unique ID for this attachment. */
|
|
403
370
|
id = _VertexAttachment.nextID++;
|
|
404
371
|
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
|
|
@@ -436,8 +403,7 @@ var _VertexAttachment = class extends Attachment {
|
|
|
436
403
|
let vertices = this.vertices;
|
|
437
404
|
let bones = this.bones;
|
|
438
405
|
if (!bones) {
|
|
439
|
-
if (deformArray.length > 0)
|
|
440
|
-
vertices = deformArray;
|
|
406
|
+
if (deformArray.length > 0) vertices = deformArray;
|
|
441
407
|
let bone = slot.bone;
|
|
442
408
|
let x = bone.worldX;
|
|
443
409
|
let y = bone.worldY;
|
|
@@ -502,11 +468,10 @@ var _VertexAttachment = class extends Attachment {
|
|
|
502
468
|
attachment.timelineAttachment = this.timelineAttachment;
|
|
503
469
|
}
|
|
504
470
|
};
|
|
505
|
-
var VertexAttachment = _VertexAttachment;
|
|
506
|
-
__publicField(VertexAttachment, "nextID", 0);
|
|
507
471
|
|
|
508
472
|
// spine-core/src/attachments/Sequence.ts
|
|
509
|
-
var
|
|
473
|
+
var Sequence = class _Sequence {
|
|
474
|
+
static _nextID = 0;
|
|
510
475
|
id = _Sequence.nextID();
|
|
511
476
|
regions;
|
|
512
477
|
start = 0;
|
|
@@ -526,10 +491,8 @@ var _Sequence = class {
|
|
|
526
491
|
}
|
|
527
492
|
apply(slot, attachment) {
|
|
528
493
|
let index = slot.sequenceIndex;
|
|
529
|
-
if (index == -1)
|
|
530
|
-
|
|
531
|
-
if (index >= this.regions.length)
|
|
532
|
-
index = this.regions.length - 1;
|
|
494
|
+
if (index == -1) index = this.setupIndex;
|
|
495
|
+
if (index >= this.regions.length) index = this.regions.length - 1;
|
|
533
496
|
let region = this.regions[index];
|
|
534
497
|
if (attachment.region != region) {
|
|
535
498
|
attachment.region = region;
|
|
@@ -548,8 +511,6 @@ var _Sequence = class {
|
|
|
548
511
|
return _Sequence._nextID++;
|
|
549
512
|
}
|
|
550
513
|
};
|
|
551
|
-
var Sequence = _Sequence;
|
|
552
|
-
__publicField(Sequence, "_nextID", 0);
|
|
553
514
|
var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
|
|
554
515
|
SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
|
|
555
516
|
SequenceMode2[SequenceMode2["once"] = 1] = "once";
|
|
@@ -579,15 +540,13 @@ var Animation = class {
|
|
|
579
540
|
/** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
|
|
580
541
|
duration;
|
|
581
542
|
constructor(name, timelines, duration) {
|
|
582
|
-
if (!name)
|
|
583
|
-
throw new Error("name cannot be null.");
|
|
543
|
+
if (!name) throw new Error("name cannot be null.");
|
|
584
544
|
this.name = name;
|
|
585
545
|
this.setTimelines(timelines);
|
|
586
546
|
this.duration = duration;
|
|
587
547
|
}
|
|
588
548
|
setTimelines(timelines) {
|
|
589
|
-
if (!timelines)
|
|
590
|
-
throw new Error("timelines cannot be null.");
|
|
549
|
+
if (!timelines) throw new Error("timelines cannot be null.");
|
|
591
550
|
this.timelines = timelines;
|
|
592
551
|
this.timelineIds.clear();
|
|
593
552
|
for (var i = 0; i < timelines.length; i++)
|
|
@@ -595,8 +554,7 @@ var Animation = class {
|
|
|
595
554
|
}
|
|
596
555
|
hasTimeline(ids) {
|
|
597
556
|
for (let i = 0; i < ids.length; i++)
|
|
598
|
-
if (this.timelineIds.contains(ids[i]))
|
|
599
|
-
return true;
|
|
557
|
+
if (this.timelineIds.contains(ids[i])) return true;
|
|
600
558
|
return false;
|
|
601
559
|
}
|
|
602
560
|
/** Applies all the animation's timelines to the specified skeleton.
|
|
@@ -605,12 +563,10 @@ var Animation = class {
|
|
|
605
563
|
* @param loop If true, the animation repeats after {@link #getDuration()}.
|
|
606
564
|
* @param events May be null to ignore fired events. */
|
|
607
565
|
apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
|
608
|
-
if (!skeleton)
|
|
609
|
-
throw new Error("skeleton cannot be null.");
|
|
566
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
610
567
|
if (loop && this.duration != 0) {
|
|
611
568
|
time %= this.duration;
|
|
612
|
-
if (lastTime > 0)
|
|
613
|
-
lastTime %= this.duration;
|
|
569
|
+
if (lastTime > 0) lastTime %= this.duration;
|
|
614
570
|
}
|
|
615
571
|
let timelines = this.timelines;
|
|
616
572
|
for (let i = 0, n = timelines.length; i < n; i++)
|
|
@@ -682,15 +638,13 @@ var Timeline = class {
|
|
|
682
638
|
static search1(frames, time) {
|
|
683
639
|
let n = frames.length;
|
|
684
640
|
for (let i = 1; i < n; i++)
|
|
685
|
-
if (frames[i] > time)
|
|
686
|
-
return i - 1;
|
|
641
|
+
if (frames[i] > time) return i - 1;
|
|
687
642
|
return n - 1;
|
|
688
643
|
}
|
|
689
644
|
static search(frames, time, step) {
|
|
690
645
|
let n = frames.length;
|
|
691
646
|
for (let i = step; i < n; i += step)
|
|
692
|
-
if (frames[i] > time)
|
|
693
|
-
return i - step;
|
|
647
|
+
if (frames[i] > time) return i - step;
|
|
694
648
|
return n - step;
|
|
695
649
|
}
|
|
696
650
|
};
|
|
@@ -740,8 +694,7 @@ var CurveTimeline = class extends Timeline {
|
|
|
740
694
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
741
695
|
let curves = this.curves;
|
|
742
696
|
let i = this.getFrameCount() + bezier * 18;
|
|
743
|
-
if (value == 0)
|
|
744
|
-
curves[frame] = 2 + i;
|
|
697
|
+
if (value == 0) curves[frame] = 2 + i;
|
|
745
698
|
let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = (value1 - cy1 * 2 + cy2) * 0.03;
|
|
746
699
|
let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = ((cy1 - cy2) * 3 - value1 + value2) * 6e-3;
|
|
747
700
|
let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
|
|
@@ -867,8 +820,7 @@ var CurveTimeline1 = class extends CurveTimeline {
|
|
|
867
820
|
return current;
|
|
868
821
|
}
|
|
869
822
|
let value = this.getCurveValue(time);
|
|
870
|
-
if (blend == 0 /* setup */)
|
|
871
|
-
return setup + (value - setup) * alpha;
|
|
823
|
+
if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
|
|
872
824
|
return current + (value - current) * alpha;
|
|
873
825
|
}
|
|
874
826
|
getAbsoluteValue2(time, alpha, blend, current, setup, value) {
|
|
@@ -881,8 +833,7 @@ var CurveTimeline1 = class extends CurveTimeline {
|
|
|
881
833
|
}
|
|
882
834
|
return current;
|
|
883
835
|
}
|
|
884
|
-
if (blend == 0 /* setup */)
|
|
885
|
-
return setup + (value - setup) * alpha;
|
|
836
|
+
if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
|
|
886
837
|
return current + (value - current) * alpha;
|
|
887
838
|
}
|
|
888
839
|
getScaleValue(time, alpha, blend, direction, current, setup) {
|
|
@@ -898,8 +849,7 @@ var CurveTimeline1 = class extends CurveTimeline {
|
|
|
898
849
|
}
|
|
899
850
|
let value = this.getCurveValue(time) * setup;
|
|
900
851
|
if (alpha == 1) {
|
|
901
|
-
if (blend == 3 /* add */)
|
|
902
|
-
return current + value - setup;
|
|
852
|
+
if (blend == 3 /* add */) return current + value - setup;
|
|
903
853
|
return value;
|
|
904
854
|
}
|
|
905
855
|
if (direction == 1 /* mixOut */) {
|
|
@@ -958,8 +908,7 @@ var RotateTimeline = class extends CurveTimeline1 {
|
|
|
958
908
|
}
|
|
959
909
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
960
910
|
let bone = skeleton.bones[this.boneIndex];
|
|
961
|
-
if (bone.active)
|
|
962
|
-
bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
|
|
911
|
+
if (bone.active) bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
|
|
963
912
|
}
|
|
964
913
|
};
|
|
965
914
|
var TranslateTimeline = class extends CurveTimeline2 {
|
|
@@ -975,8 +924,7 @@ var TranslateTimeline = class extends CurveTimeline2 {
|
|
|
975
924
|
}
|
|
976
925
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
977
926
|
let bone = skeleton.bones[this.boneIndex];
|
|
978
|
-
if (!bone.active)
|
|
979
|
-
return;
|
|
927
|
+
if (!bone.active) return;
|
|
980
928
|
let frames = this.frames;
|
|
981
929
|
if (time < frames[0]) {
|
|
982
930
|
switch (blend) {
|
|
@@ -1075,8 +1023,7 @@ var TranslateXTimeline = class extends CurveTimeline1 {
|
|
|
1075
1023
|
}
|
|
1076
1024
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1077
1025
|
let bone = skeleton.bones[this.boneIndex];
|
|
1078
|
-
if (bone.active)
|
|
1079
|
-
bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
|
|
1026
|
+
if (bone.active) bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
|
|
1080
1027
|
}
|
|
1081
1028
|
};
|
|
1082
1029
|
var TranslateYTimeline = class extends CurveTimeline1 {
|
|
@@ -1087,8 +1034,7 @@ var TranslateYTimeline = class extends CurveTimeline1 {
|
|
|
1087
1034
|
}
|
|
1088
1035
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1089
1036
|
let bone = skeleton.bones[this.boneIndex];
|
|
1090
|
-
if (bone.active)
|
|
1091
|
-
bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
|
|
1037
|
+
if (bone.active) bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
|
|
1092
1038
|
}
|
|
1093
1039
|
};
|
|
1094
1040
|
var ScaleTimeline = class extends CurveTimeline2 {
|
|
@@ -1104,8 +1050,7 @@ var ScaleTimeline = class extends CurveTimeline2 {
|
|
|
1104
1050
|
}
|
|
1105
1051
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1106
1052
|
let bone = skeleton.bones[this.boneIndex];
|
|
1107
|
-
if (!bone.active)
|
|
1108
|
-
return;
|
|
1053
|
+
if (!bone.active) return;
|
|
1109
1054
|
let frames = this.frames;
|
|
1110
1055
|
if (time < frames[0]) {
|
|
1111
1056
|
switch (blend) {
|
|
@@ -1242,8 +1187,7 @@ var ScaleXTimeline = class extends CurveTimeline1 {
|
|
|
1242
1187
|
}
|
|
1243
1188
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1244
1189
|
let bone = skeleton.bones[this.boneIndex];
|
|
1245
|
-
if (bone.active)
|
|
1246
|
-
bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
|
|
1190
|
+
if (bone.active) bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
|
|
1247
1191
|
}
|
|
1248
1192
|
};
|
|
1249
1193
|
var ScaleYTimeline = class extends CurveTimeline1 {
|
|
@@ -1254,8 +1198,7 @@ var ScaleYTimeline = class extends CurveTimeline1 {
|
|
|
1254
1198
|
}
|
|
1255
1199
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1256
1200
|
let bone = skeleton.bones[this.boneIndex];
|
|
1257
|
-
if (bone.active)
|
|
1258
|
-
bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
|
|
1201
|
+
if (bone.active) bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
|
|
1259
1202
|
}
|
|
1260
1203
|
};
|
|
1261
1204
|
var ShearTimeline = class extends CurveTimeline2 {
|
|
@@ -1271,8 +1214,7 @@ var ShearTimeline = class extends CurveTimeline2 {
|
|
|
1271
1214
|
}
|
|
1272
1215
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1273
1216
|
let bone = skeleton.bones[this.boneIndex];
|
|
1274
|
-
if (!bone.active)
|
|
1275
|
-
return;
|
|
1217
|
+
if (!bone.active) return;
|
|
1276
1218
|
let frames = this.frames;
|
|
1277
1219
|
if (time < frames[0]) {
|
|
1278
1220
|
switch (blend) {
|
|
@@ -1371,8 +1313,7 @@ var ShearXTimeline = class extends CurveTimeline1 {
|
|
|
1371
1313
|
}
|
|
1372
1314
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1373
1315
|
let bone = skeleton.bones[this.boneIndex];
|
|
1374
|
-
if (bone.active)
|
|
1375
|
-
bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
|
|
1316
|
+
if (bone.active) bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
|
|
1376
1317
|
}
|
|
1377
1318
|
};
|
|
1378
1319
|
var ShearYTimeline = class extends CurveTimeline1 {
|
|
@@ -1383,8 +1324,7 @@ var ShearYTimeline = class extends CurveTimeline1 {
|
|
|
1383
1324
|
}
|
|
1384
1325
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1385
1326
|
let bone = skeleton.bones[this.boneIndex];
|
|
1386
|
-
if (bone.active)
|
|
1387
|
-
bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
|
|
1327
|
+
if (bone.active) bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
|
|
1388
1328
|
}
|
|
1389
1329
|
};
|
|
1390
1330
|
var InheritTimeline = class extends Timeline {
|
|
@@ -1409,17 +1349,14 @@ var InheritTimeline = class extends Timeline {
|
|
|
1409
1349
|
}
|
|
1410
1350
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1411
1351
|
let bone = skeleton.bones[this.boneIndex];
|
|
1412
|
-
if (!bone.active)
|
|
1413
|
-
return;
|
|
1352
|
+
if (!bone.active) return;
|
|
1414
1353
|
if (direction == 1 /* mixOut */) {
|
|
1415
|
-
if (blend == 0 /* setup */)
|
|
1416
|
-
bone.inherit = bone.data.inherit;
|
|
1354
|
+
if (blend == 0 /* setup */) bone.inherit = bone.data.inherit;
|
|
1417
1355
|
return;
|
|
1418
1356
|
}
|
|
1419
1357
|
let frames = this.frames;
|
|
1420
1358
|
if (time < frames[0]) {
|
|
1421
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
1422
|
-
bone.inherit = bone.data.inherit;
|
|
1359
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) bone.inherit = bone.data.inherit;
|
|
1423
1360
|
return;
|
|
1424
1361
|
}
|
|
1425
1362
|
bone.inherit = this.frames[
|
|
@@ -1468,8 +1405,7 @@ var RGBATimeline = class extends CurveTimeline {
|
|
|
1468
1405
|
}
|
|
1469
1406
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1470
1407
|
let slot = skeleton.slots[this.slotIndex];
|
|
1471
|
-
if (!slot.bone.active)
|
|
1472
|
-
return;
|
|
1408
|
+
if (!slot.bone.active) return;
|
|
1473
1409
|
let frames = this.frames;
|
|
1474
1410
|
let color = slot.color;
|
|
1475
1411
|
if (time < frames[0]) {
|
|
@@ -1590,8 +1526,7 @@ var RGBATimeline = class extends CurveTimeline {
|
|
|
1590
1526
|
if (alpha == 1)
|
|
1591
1527
|
color.set(r, g, b, a);
|
|
1592
1528
|
else {
|
|
1593
|
-
if (blend == 0 /* setup */)
|
|
1594
|
-
color.setFromColor(slot.data.color);
|
|
1529
|
+
if (blend == 0 /* setup */) color.setFromColor(slot.data.color);
|
|
1595
1530
|
color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
|
|
1596
1531
|
}
|
|
1597
1532
|
}
|
|
@@ -1626,8 +1561,7 @@ var RGBTimeline = class extends CurveTimeline {
|
|
|
1626
1561
|
}
|
|
1627
1562
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1628
1563
|
let slot = skeleton.slots[this.slotIndex];
|
|
1629
|
-
if (!slot.bone.active)
|
|
1630
|
-
return;
|
|
1564
|
+
if (!slot.bone.active) return;
|
|
1631
1565
|
let frames = this.frames;
|
|
1632
1566
|
let color = slot.color;
|
|
1633
1567
|
if (time < frames[0]) {
|
|
@@ -1747,8 +1681,7 @@ var AlphaTimeline = class extends CurveTimeline1 {
|
|
|
1747
1681
|
}
|
|
1748
1682
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1749
1683
|
let slot = skeleton.slots[this.slotIndex];
|
|
1750
|
-
if (!slot.bone.active)
|
|
1751
|
-
return;
|
|
1684
|
+
if (!slot.bone.active) return;
|
|
1752
1685
|
let color = slot.color;
|
|
1753
1686
|
if (time < this.frames[0]) {
|
|
1754
1687
|
let setup = slot.data.color;
|
|
@@ -1765,8 +1698,7 @@ var AlphaTimeline = class extends CurveTimeline1 {
|
|
|
1765
1698
|
if (alpha == 1)
|
|
1766
1699
|
color.a = a;
|
|
1767
1700
|
else {
|
|
1768
|
-
if (blend == 0 /* setup */)
|
|
1769
|
-
color.a = slot.data.color.a;
|
|
1701
|
+
if (blend == 0 /* setup */) color.a = slot.data.color.a;
|
|
1770
1702
|
color.a += (a - color.a) * alpha;
|
|
1771
1703
|
}
|
|
1772
1704
|
}
|
|
@@ -1819,8 +1751,7 @@ var RGBA2Timeline = class extends CurveTimeline {
|
|
|
1819
1751
|
}
|
|
1820
1752
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1821
1753
|
let slot = skeleton.slots[this.slotIndex];
|
|
1822
|
-
if (!slot.bone.active)
|
|
1823
|
-
return;
|
|
1754
|
+
if (!slot.bone.active) return;
|
|
1824
1755
|
let frames = this.frames;
|
|
1825
1756
|
let light = slot.color, dark = slot.darkColor;
|
|
1826
1757
|
if (time < frames[0]) {
|
|
@@ -2061,8 +1992,7 @@ var RGB2Timeline = class extends CurveTimeline {
|
|
|
2061
1992
|
}
|
|
2062
1993
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
2063
1994
|
let slot = skeleton.slots[this.slotIndex];
|
|
2064
|
-
if (!slot.bone.active)
|
|
2065
|
-
return;
|
|
1995
|
+
if (!slot.bone.active) return;
|
|
2066
1996
|
let frames = this.frames;
|
|
2067
1997
|
let light = slot.color, dark = slot.darkColor;
|
|
2068
1998
|
if (time < frames[0]) {
|
|
@@ -2270,16 +2200,13 @@ var AttachmentTimeline = class extends Timeline {
|
|
|
2270
2200
|
}
|
|
2271
2201
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
2272
2202
|
let slot = skeleton.slots[this.slotIndex];
|
|
2273
|
-
if (!slot.bone.active)
|
|
2274
|
-
return;
|
|
2203
|
+
if (!slot.bone.active) return;
|
|
2275
2204
|
if (direction == 1 /* mixOut */) {
|
|
2276
|
-
if (blend == 0 /* setup */)
|
|
2277
|
-
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2205
|
+
if (blend == 0 /* setup */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2278
2206
|
return;
|
|
2279
2207
|
}
|
|
2280
2208
|
if (time < this.frames[0]) {
|
|
2281
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2282
|
-
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2209
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2283
2210
|
return;
|
|
2284
2211
|
}
|
|
2285
2212
|
this.setAttachment(skeleton, slot, this.attachmentNames[Timeline.search1(this.frames, time)]);
|
|
@@ -2316,8 +2243,7 @@ var DeformTimeline = class extends CurveTimeline {
|
|
|
2316
2243
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
2317
2244
|
let curves = this.curves;
|
|
2318
2245
|
let i = this.getFrameCount() + bezier * 18;
|
|
2319
|
-
if (value == 0)
|
|
2320
|
-
curves[frame] = 2 + i;
|
|
2246
|
+
if (value == 0) curves[frame] = 2 + i;
|
|
2321
2247
|
let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = cy2 * 0.03 - cy1 * 0.06;
|
|
2322
2248
|
let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = (cy1 - cy2 + 0.33333333) * 0.018;
|
|
2323
2249
|
let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
|
|
@@ -2361,16 +2287,12 @@ var DeformTimeline = class extends CurveTimeline {
|
|
|
2361
2287
|
}
|
|
2362
2288
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2363
2289
|
let slot = skeleton.slots[this.slotIndex];
|
|
2364
|
-
if (!slot.bone.active)
|
|
2365
|
-
return;
|
|
2290
|
+
if (!slot.bone.active) return;
|
|
2366
2291
|
let slotAttachment = slot.getAttachment();
|
|
2367
|
-
if (!slotAttachment)
|
|
2368
|
-
|
|
2369
|
-
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment)
|
|
2370
|
-
return;
|
|
2292
|
+
if (!slotAttachment) return;
|
|
2293
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment) return;
|
|
2371
2294
|
let deform = slot.deform;
|
|
2372
|
-
if (deform.length == 0)
|
|
2373
|
-
blend = 0 /* setup */;
|
|
2295
|
+
if (deform.length == 0) blend = 0 /* setup */;
|
|
2374
2296
|
let vertices = this.vertices;
|
|
2375
2297
|
let vertexCount = vertices[0].length;
|
|
2376
2298
|
let frames = this.frames;
|
|
@@ -2517,7 +2439,8 @@ var DeformTimeline = class extends CurveTimeline {
|
|
|
2517
2439
|
}
|
|
2518
2440
|
}
|
|
2519
2441
|
};
|
|
2520
|
-
var
|
|
2442
|
+
var EventTimeline = class _EventTimeline extends Timeline {
|
|
2443
|
+
static propertyIds = ["" + Property.event];
|
|
2521
2444
|
/** The event for each key frame. */
|
|
2522
2445
|
events;
|
|
2523
2446
|
constructor(frameCount) {
|
|
@@ -2534,8 +2457,7 @@ var _EventTimeline = class extends Timeline {
|
|
|
2534
2457
|
}
|
|
2535
2458
|
/** Fires events for frames > `lastTime` and <= `time`. */
|
|
2536
2459
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2537
|
-
if (!firedEvents)
|
|
2538
|
-
return;
|
|
2460
|
+
if (!firedEvents) return;
|
|
2539
2461
|
let frames = this.frames;
|
|
2540
2462
|
let frameCount = this.frames.length;
|
|
2541
2463
|
if (lastTime > time) {
|
|
@@ -2543,8 +2465,7 @@ var _EventTimeline = class extends Timeline {
|
|
|
2543
2465
|
lastTime = -1;
|
|
2544
2466
|
} else if (lastTime >= frames[frameCount - 1])
|
|
2545
2467
|
return;
|
|
2546
|
-
if (time < frames[0])
|
|
2547
|
-
return;
|
|
2468
|
+
if (time < frames[0]) return;
|
|
2548
2469
|
let i = 0;
|
|
2549
2470
|
if (lastTime < frames[0])
|
|
2550
2471
|
i = 0;
|
|
@@ -2552,8 +2473,7 @@ var _EventTimeline = class extends Timeline {
|
|
|
2552
2473
|
i = Timeline.search1(frames, lastTime) + 1;
|
|
2553
2474
|
let frameTime = frames[i];
|
|
2554
2475
|
while (i > 0) {
|
|
2555
|
-
if (frames[i - 1] != frameTime)
|
|
2556
|
-
break;
|
|
2476
|
+
if (frames[i - 1] != frameTime) break;
|
|
2557
2477
|
i--;
|
|
2558
2478
|
}
|
|
2559
2479
|
}
|
|
@@ -2561,9 +2481,8 @@ var _EventTimeline = class extends Timeline {
|
|
|
2561
2481
|
firedEvents.push(this.events[i]);
|
|
2562
2482
|
}
|
|
2563
2483
|
};
|
|
2564
|
-
var
|
|
2565
|
-
|
|
2566
|
-
var _DrawOrderTimeline = class extends Timeline {
|
|
2484
|
+
var DrawOrderTimeline = class _DrawOrderTimeline extends Timeline {
|
|
2485
|
+
static propertyIds = ["" + Property.drawOrder];
|
|
2567
2486
|
/** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
|
|
2568
2487
|
drawOrders;
|
|
2569
2488
|
constructor(frameCount) {
|
|
@@ -2582,13 +2501,11 @@ var _DrawOrderTimeline = class extends Timeline {
|
|
|
2582
2501
|
}
|
|
2583
2502
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2584
2503
|
if (direction == 1 /* mixOut */) {
|
|
2585
|
-
if (blend == 0 /* setup */)
|
|
2586
|
-
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2504
|
+
if (blend == 0 /* setup */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2587
2505
|
return;
|
|
2588
2506
|
}
|
|
2589
2507
|
if (time < this.frames[0]) {
|
|
2590
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2591
|
-
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2508
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2592
2509
|
return;
|
|
2593
2510
|
}
|
|
2594
2511
|
let idx = Timeline.search1(this.frames, time);
|
|
@@ -2603,8 +2520,6 @@ var _DrawOrderTimeline = class extends Timeline {
|
|
|
2603
2520
|
}
|
|
2604
2521
|
}
|
|
2605
2522
|
};
|
|
2606
|
-
var DrawOrderTimeline = _DrawOrderTimeline;
|
|
2607
|
-
__publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
|
|
2608
2523
|
var IkConstraintTimeline = class extends CurveTimeline {
|
|
2609
2524
|
/** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is applied */
|
|
2610
2525
|
constraintIndex = 0;
|
|
@@ -2644,8 +2559,7 @@ var IkConstraintTimeline = class extends CurveTimeline {
|
|
|
2644
2559
|
}
|
|
2645
2560
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2646
2561
|
let constraint = skeleton.ikConstraints[this.constraintIndex];
|
|
2647
|
-
if (!constraint.active)
|
|
2648
|
-
return;
|
|
2562
|
+
if (!constraint.active) return;
|
|
2649
2563
|
let frames = this.frames;
|
|
2650
2564
|
if (time < frames[0]) {
|
|
2651
2565
|
switch (blend) {
|
|
@@ -2811,8 +2725,7 @@ var TransformConstraintTimeline = class extends CurveTimeline {
|
|
|
2811
2725
|
}
|
|
2812
2726
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2813
2727
|
let constraint = skeleton.transformConstraints[this.constraintIndex];
|
|
2814
|
-
if (!constraint.active)
|
|
2815
|
-
return;
|
|
2728
|
+
if (!constraint.active) return;
|
|
2816
2729
|
let frames = this.frames;
|
|
2817
2730
|
if (time < frames[0]) {
|
|
2818
2731
|
let data = constraint.data;
|
|
@@ -3050,8 +2963,7 @@ var PathConstraintMixTimeline = class extends CurveTimeline {
|
|
|
3050
2963
|
}
|
|
3051
2964
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3052
2965
|
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3053
|
-
if (!constraint.active)
|
|
3054
|
-
return;
|
|
2966
|
+
if (!constraint.active) return;
|
|
3055
2967
|
let frames = this.frames;
|
|
3056
2968
|
if (time < frames[0]) {
|
|
3057
2969
|
switch (blend) {
|
|
@@ -3175,8 +3087,7 @@ var PhysicsConstraintTimeline = class extends CurveTimeline1 {
|
|
|
3175
3087
|
}
|
|
3176
3088
|
} else {
|
|
3177
3089
|
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3178
|
-
if (constraint.active)
|
|
3179
|
-
this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
|
|
3090
|
+
if (constraint.active) this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
|
|
3180
3091
|
}
|
|
3181
3092
|
}
|
|
3182
3093
|
};
|
|
@@ -3299,7 +3210,8 @@ var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
|
|
|
3299
3210
|
return constraint.mixGlobal;
|
|
3300
3211
|
}
|
|
3301
3212
|
};
|
|
3302
|
-
var
|
|
3213
|
+
var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
|
|
3214
|
+
static propertyIds = [Property.physicsConstraintReset.toString()];
|
|
3303
3215
|
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
|
|
3304
3216
|
* applied, or -1 if all physics constraints in the skeleton will be reset. */
|
|
3305
3217
|
constraintIndex;
|
|
@@ -3321,8 +3233,7 @@ var _PhysicsConstraintResetTimeline = class extends Timeline {
|
|
|
3321
3233
|
let constraint;
|
|
3322
3234
|
if (this.constraintIndex != -1) {
|
|
3323
3235
|
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3324
|
-
if (!constraint.active)
|
|
3325
|
-
return;
|
|
3236
|
+
if (!constraint.active) return;
|
|
3326
3237
|
}
|
|
3327
3238
|
const frames = this.frames;
|
|
3328
3239
|
if (lastTime > time) {
|
|
@@ -3330,23 +3241,22 @@ var _PhysicsConstraintResetTimeline = class extends Timeline {
|
|
|
3330
3241
|
lastTime = -1;
|
|
3331
3242
|
} else if (lastTime >= frames[frames.length - 1])
|
|
3332
3243
|
return;
|
|
3333
|
-
if (time < frames[0])
|
|
3334
|
-
return;
|
|
3244
|
+
if (time < frames[0]) return;
|
|
3335
3245
|
if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
|
|
3336
3246
|
if (constraint != null)
|
|
3337
3247
|
constraint.reset();
|
|
3338
3248
|
else {
|
|
3339
3249
|
for (const constraint2 of skeleton.physicsConstraints) {
|
|
3340
|
-
if (constraint2.active)
|
|
3341
|
-
constraint2.reset();
|
|
3250
|
+
if (constraint2.active) constraint2.reset();
|
|
3342
3251
|
}
|
|
3343
3252
|
}
|
|
3344
3253
|
}
|
|
3345
3254
|
}
|
|
3346
3255
|
};
|
|
3347
|
-
var
|
|
3348
|
-
|
|
3349
|
-
|
|
3256
|
+
var SequenceTimeline = class _SequenceTimeline extends Timeline {
|
|
3257
|
+
static ENTRIES = 3;
|
|
3258
|
+
static MODE = 1;
|
|
3259
|
+
static DELAY = 2;
|
|
3350
3260
|
slotIndex;
|
|
3351
3261
|
attachment;
|
|
3352
3262
|
constructor(frameCount, slotIndex, attachment) {
|
|
@@ -3377,31 +3287,26 @@ var _SequenceTimeline = class extends Timeline {
|
|
|
3377
3287
|
}
|
|
3378
3288
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
3379
3289
|
let slot = skeleton.slots[this.slotIndex];
|
|
3380
|
-
if (!slot.bone.active)
|
|
3381
|
-
return;
|
|
3290
|
+
if (!slot.bone.active) return;
|
|
3382
3291
|
let slotAttachment = slot.attachment;
|
|
3383
3292
|
let attachment = this.attachment;
|
|
3384
3293
|
if (slotAttachment != attachment) {
|
|
3385
|
-
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment)
|
|
3386
|
-
return;
|
|
3294
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment) return;
|
|
3387
3295
|
}
|
|
3388
3296
|
if (direction == 1 /* mixOut */) {
|
|
3389
|
-
if (blend == 0 /* setup */)
|
|
3390
|
-
slot.sequenceIndex = -1;
|
|
3297
|
+
if (blend == 0 /* setup */) slot.sequenceIndex = -1;
|
|
3391
3298
|
return;
|
|
3392
3299
|
}
|
|
3393
3300
|
let frames = this.frames;
|
|
3394
3301
|
if (time < frames[0]) {
|
|
3395
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
3396
|
-
slot.sequenceIndex = -1;
|
|
3302
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) slot.sequenceIndex = -1;
|
|
3397
3303
|
return;
|
|
3398
3304
|
}
|
|
3399
3305
|
let i = Timeline.search(frames, time, _SequenceTimeline.ENTRIES);
|
|
3400
3306
|
let before = frames[i];
|
|
3401
3307
|
let modeAndIndex = frames[i + _SequenceTimeline.MODE];
|
|
3402
3308
|
let delay = frames[i + _SequenceTimeline.DELAY];
|
|
3403
|
-
if (!this.attachment.sequence)
|
|
3404
|
-
return;
|
|
3309
|
+
if (!this.attachment.sequence) return;
|
|
3405
3310
|
let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
|
|
3406
3311
|
let mode = SequenceModeValues[modeAndIndex & 15];
|
|
3407
3312
|
if (mode != 0 /* hold */) {
|
|
@@ -3416,8 +3321,7 @@ var _SequenceTimeline = class extends Timeline {
|
|
|
3416
3321
|
case 3 /* pingpong */: {
|
|
3417
3322
|
let n = (count << 1) - 2;
|
|
3418
3323
|
index = n == 0 ? 0 : index % n;
|
|
3419
|
-
if (index >= count)
|
|
3420
|
-
index = n - index;
|
|
3324
|
+
if (index >= count) index = n - index;
|
|
3421
3325
|
break;
|
|
3422
3326
|
}
|
|
3423
3327
|
case 4 /* onceReverse */:
|
|
@@ -3429,21 +3333,17 @@ var _SequenceTimeline = class extends Timeline {
|
|
|
3429
3333
|
case 6 /* pingpongReverse */: {
|
|
3430
3334
|
let n = (count << 1) - 2;
|
|
3431
3335
|
index = n == 0 ? 0 : (index + count - 1) % n;
|
|
3432
|
-
if (index >= count)
|
|
3433
|
-
index = n - index;
|
|
3336
|
+
if (index >= count) index = n - index;
|
|
3434
3337
|
}
|
|
3435
3338
|
}
|
|
3436
3339
|
}
|
|
3437
3340
|
slot.sequenceIndex = index;
|
|
3438
3341
|
}
|
|
3439
3342
|
};
|
|
3440
|
-
var SequenceTimeline = _SequenceTimeline;
|
|
3441
|
-
__publicField(SequenceTimeline, "ENTRIES", 3);
|
|
3442
|
-
__publicField(SequenceTimeline, "MODE", 1);
|
|
3443
|
-
__publicField(SequenceTimeline, "DELAY", 2);
|
|
3444
3343
|
|
|
3445
3344
|
// spine-core/src/AnimationState.ts
|
|
3446
|
-
var
|
|
3345
|
+
var AnimationState = class _AnimationState {
|
|
3346
|
+
static _emptyAnimation = new Animation("<empty>", [], 0);
|
|
3447
3347
|
static emptyAnimation() {
|
|
3448
3348
|
return _AnimationState._emptyAnimation;
|
|
3449
3349
|
}
|
|
@@ -3472,15 +3372,13 @@ var _AnimationState = class {
|
|
|
3472
3372
|
let tracks = this.tracks;
|
|
3473
3373
|
for (let i = 0, n = tracks.length; i < n; i++) {
|
|
3474
3374
|
let current = tracks[i];
|
|
3475
|
-
if (!current)
|
|
3476
|
-
continue;
|
|
3375
|
+
if (!current) continue;
|
|
3477
3376
|
current.animationLast = current.nextAnimationLast;
|
|
3478
3377
|
current.trackLast = current.nextTrackLast;
|
|
3479
3378
|
let currentDelta = delta * current.timeScale;
|
|
3480
3379
|
if (current.delay > 0) {
|
|
3481
3380
|
current.delay -= currentDelta;
|
|
3482
|
-
if (current.delay > 0)
|
|
3483
|
-
continue;
|
|
3381
|
+
if (current.delay > 0) continue;
|
|
3484
3382
|
currentDelta = -current.delay;
|
|
3485
3383
|
current.delay = 0;
|
|
3486
3384
|
}
|
|
@@ -3507,8 +3405,7 @@ var _AnimationState = class {
|
|
|
3507
3405
|
if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
|
|
3508
3406
|
let from = current.mixingFrom;
|
|
3509
3407
|
current.mixingFrom = null;
|
|
3510
|
-
if (from)
|
|
3511
|
-
from.mixingTo = null;
|
|
3408
|
+
if (from) from.mixingTo = null;
|
|
3512
3409
|
while (from) {
|
|
3513
3410
|
this.queue.end(from);
|
|
3514
3411
|
from = from.mixingFrom;
|
|
@@ -3521,16 +3418,14 @@ var _AnimationState = class {
|
|
|
3521
3418
|
/** Returns true when all mixing from entries are complete. */
|
|
3522
3419
|
updateMixingFrom(to, delta) {
|
|
3523
3420
|
let from = to.mixingFrom;
|
|
3524
|
-
if (!from)
|
|
3525
|
-
return true;
|
|
3421
|
+
if (!from) return true;
|
|
3526
3422
|
let finished = this.updateMixingFrom(from, delta);
|
|
3527
3423
|
from.animationLast = from.nextAnimationLast;
|
|
3528
3424
|
from.trackLast = from.nextTrackLast;
|
|
3529
3425
|
if (to.nextTrackLast != -1 && to.mixTime >= to.mixDuration) {
|
|
3530
3426
|
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
|
3531
3427
|
to.mixingFrom = from.mixingFrom;
|
|
3532
|
-
if (from.mixingFrom != null)
|
|
3533
|
-
from.mixingFrom.mixingTo = to;
|
|
3428
|
+
if (from.mixingFrom != null) from.mixingFrom.mixingTo = to;
|
|
3534
3429
|
to.interruptAlpha = from.interruptAlpha;
|
|
3535
3430
|
this.queue.end(from);
|
|
3536
3431
|
}
|
|
@@ -3544,17 +3439,14 @@ var _AnimationState = class {
|
|
|
3544
3439
|
* animation state can be applied to multiple skeletons to pose them identically.
|
|
3545
3440
|
* @returns True if any animations were applied. */
|
|
3546
3441
|
apply(skeleton) {
|
|
3547
|
-
if (!skeleton)
|
|
3548
|
-
|
|
3549
|
-
if (this.animationsChanged)
|
|
3550
|
-
this._animationsChanged();
|
|
3442
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
3443
|
+
if (this.animationsChanged) this._animationsChanged();
|
|
3551
3444
|
let events = this.events;
|
|
3552
3445
|
let tracks = this.tracks;
|
|
3553
3446
|
let applied = false;
|
|
3554
3447
|
for (let i2 = 0, n2 = tracks.length; i2 < n2; i2++) {
|
|
3555
3448
|
let current = tracks[i2];
|
|
3556
|
-
if (!current || current.delay > 0)
|
|
3557
|
-
continue;
|
|
3449
|
+
if (!current || current.delay > 0) continue;
|
|
3558
3450
|
applied = true;
|
|
3559
3451
|
let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
|
|
3560
3452
|
let alpha = current.alpha;
|
|
@@ -3572,8 +3464,7 @@ var _AnimationState = class {
|
|
|
3572
3464
|
let timelines = current.animation.timelines;
|
|
3573
3465
|
let timelineCount = timelines.length;
|
|
3574
3466
|
if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
|
|
3575
|
-
if (i2 == 0)
|
|
3576
|
-
attachments = true;
|
|
3467
|
+
if (i2 == 0) attachments = true;
|
|
3577
3468
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
3578
3469
|
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3579
3470
|
var timeline = timelines[ii];
|
|
@@ -3586,8 +3477,7 @@ var _AnimationState = class {
|
|
|
3586
3477
|
let timelineMode = current.timelineMode;
|
|
3587
3478
|
let shortestRotation = current.shortestRotation;
|
|
3588
3479
|
let firstFrame = !shortestRotation && current.timelinesRotation.length != timelineCount << 1;
|
|
3589
|
-
if (firstFrame)
|
|
3590
|
-
current.timelinesRotation.length = timelineCount << 1;
|
|
3480
|
+
if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
|
|
3591
3481
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
3592
3482
|
let timeline2 = timelines[ii];
|
|
3593
3483
|
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
|
|
@@ -3621,19 +3511,15 @@ var _AnimationState = class {
|
|
|
3621
3511
|
}
|
|
3622
3512
|
applyMixingFrom(to, skeleton, blend) {
|
|
3623
3513
|
let from = to.mixingFrom;
|
|
3624
|
-
if (from.mixingFrom)
|
|
3625
|
-
this.applyMixingFrom(from, skeleton, blend);
|
|
3514
|
+
if (from.mixingFrom) this.applyMixingFrom(from, skeleton, blend);
|
|
3626
3515
|
let mix = 0;
|
|
3627
3516
|
if (to.mixDuration == 0) {
|
|
3628
3517
|
mix = 1;
|
|
3629
|
-
if (blend == 1 /* first */)
|
|
3630
|
-
blend = 0 /* setup */;
|
|
3518
|
+
if (blend == 1 /* first */) blend = 0 /* setup */;
|
|
3631
3519
|
} else {
|
|
3632
3520
|
mix = to.mixTime / to.mixDuration;
|
|
3633
|
-
if (mix > 1)
|
|
3634
|
-
|
|
3635
|
-
if (blend != 1 /* first */)
|
|
3636
|
-
blend = from.mixBlend;
|
|
3521
|
+
if (mix > 1) mix = 1;
|
|
3522
|
+
if (blend != 1 /* first */) blend = from.mixBlend;
|
|
3637
3523
|
}
|
|
3638
3524
|
let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
|
|
3639
3525
|
let timelines = from.animation.timelines;
|
|
@@ -3653,8 +3539,7 @@ var _AnimationState = class {
|
|
|
3653
3539
|
let timelineHoldMix = from.timelineHoldMix;
|
|
3654
3540
|
let shortestRotation = from.shortestRotation;
|
|
3655
3541
|
let firstFrame = !shortestRotation && from.timelinesRotation.length != timelineCount << 1;
|
|
3656
|
-
if (firstFrame)
|
|
3657
|
-
from.timelinesRotation.length = timelineCount << 1;
|
|
3542
|
+
if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
|
|
3658
3543
|
from.totalAlpha = 0;
|
|
3659
3544
|
for (let i = 0; i < timelineCount; i++) {
|
|
3660
3545
|
let timeline = timelines[i];
|
|
@@ -3663,8 +3548,7 @@ var _AnimationState = class {
|
|
|
3663
3548
|
let alpha = 0;
|
|
3664
3549
|
switch (timelineMode[i]) {
|
|
3665
3550
|
case SUBSEQUENT:
|
|
3666
|
-
if (!drawOrder && timeline instanceof DrawOrderTimeline)
|
|
3667
|
-
continue;
|
|
3551
|
+
if (!drawOrder && timeline instanceof DrawOrderTimeline) continue;
|
|
3668
3552
|
timelineBlend = blend;
|
|
3669
3553
|
alpha = alphaMix;
|
|
3670
3554
|
break;
|
|
@@ -3699,8 +3583,7 @@ var _AnimationState = class {
|
|
|
3699
3583
|
}
|
|
3700
3584
|
}
|
|
3701
3585
|
}
|
|
3702
|
-
if (to.mixDuration > 0)
|
|
3703
|
-
this.queueEvents(from, animationTime);
|
|
3586
|
+
if (to.mixDuration > 0) this.queueEvents(from, animationTime);
|
|
3704
3587
|
this.events.length = 0;
|
|
3705
3588
|
from.nextAnimationLast = animationTime;
|
|
3706
3589
|
from.nextTrackLast = from.trackTime;
|
|
@@ -3708,31 +3591,26 @@ var _AnimationState = class {
|
|
|
3708
3591
|
}
|
|
3709
3592
|
applyAttachmentTimeline(timeline, skeleton, time, blend, attachments) {
|
|
3710
3593
|
var slot = skeleton.slots[timeline.slotIndex];
|
|
3711
|
-
if (!slot.bone.active)
|
|
3712
|
-
return;
|
|
3594
|
+
if (!slot.bone.active) return;
|
|
3713
3595
|
if (time < timeline.frames[0]) {
|
|
3714
3596
|
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
3715
3597
|
this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
|
3716
3598
|
} else
|
|
3717
3599
|
this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
|
|
3718
|
-
if (slot.attachmentState <= this.unkeyedState)
|
|
3719
|
-
slot.attachmentState = this.unkeyedState + SETUP;
|
|
3600
|
+
if (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + SETUP;
|
|
3720
3601
|
}
|
|
3721
3602
|
setAttachment(skeleton, slot, attachmentName, attachments) {
|
|
3722
3603
|
slot.setAttachment(!attachmentName ? null : skeleton.getAttachment(slot.data.index, attachmentName));
|
|
3723
|
-
if (attachments)
|
|
3724
|
-
slot.attachmentState = this.unkeyedState + CURRENT;
|
|
3604
|
+
if (attachments) slot.attachmentState = this.unkeyedState + CURRENT;
|
|
3725
3605
|
}
|
|
3726
3606
|
applyRotateTimeline(timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame) {
|
|
3727
|
-
if (firstFrame)
|
|
3728
|
-
timelinesRotation[i] = 0;
|
|
3607
|
+
if (firstFrame) timelinesRotation[i] = 0;
|
|
3729
3608
|
if (alpha == 1) {
|
|
3730
3609
|
timeline.apply(skeleton, 0, time, null, 1, blend, 0 /* mixIn */);
|
|
3731
3610
|
return;
|
|
3732
3611
|
}
|
|
3733
3612
|
let bone = skeleton.bones[timeline.boneIndex];
|
|
3734
|
-
if (!bone.active)
|
|
3735
|
-
return;
|
|
3613
|
+
if (!bone.active) return;
|
|
3736
3614
|
let frames = timeline.frames;
|
|
3737
3615
|
let r1 = 0, r2 = 0;
|
|
3738
3616
|
if (time < frames[0]) {
|
|
@@ -3774,8 +3652,7 @@ var _AnimationState = class {
|
|
|
3774
3652
|
else
|
|
3775
3653
|
dir = current;
|
|
3776
3654
|
}
|
|
3777
|
-
if (dir != current)
|
|
3778
|
-
total += 360 * MathUtils.signum(lastTotal);
|
|
3655
|
+
if (dir != current) total += 360 * MathUtils.signum(lastTotal);
|
|
3779
3656
|
timelinesRotation[i] = total;
|
|
3780
3657
|
}
|
|
3781
3658
|
timelinesRotation[i + 1] = diff;
|
|
@@ -3789,10 +3666,8 @@ var _AnimationState = class {
|
|
|
3789
3666
|
let i = 0, n = events.length;
|
|
3790
3667
|
for (; i < n; i++) {
|
|
3791
3668
|
let event = events[i];
|
|
3792
|
-
if (event.time < trackLastWrapped)
|
|
3793
|
-
|
|
3794
|
-
if (event.time > animationEnd)
|
|
3795
|
-
continue;
|
|
3669
|
+
if (event.time < trackLastWrapped) break;
|
|
3670
|
+
if (event.time > animationEnd) continue;
|
|
3796
3671
|
this.queue.event(entry, event);
|
|
3797
3672
|
}
|
|
3798
3673
|
let complete = false;
|
|
@@ -3805,12 +3680,10 @@ var _AnimationState = class {
|
|
|
3805
3680
|
}
|
|
3806
3681
|
} else
|
|
3807
3682
|
complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
|
|
3808
|
-
if (complete)
|
|
3809
|
-
this.queue.complete(entry);
|
|
3683
|
+
if (complete) this.queue.complete(entry);
|
|
3810
3684
|
for (; i < n; i++) {
|
|
3811
3685
|
let event = events[i];
|
|
3812
|
-
if (event.time < animationStart)
|
|
3813
|
-
continue;
|
|
3686
|
+
if (event.time < animationStart) continue;
|
|
3814
3687
|
this.queue.event(entry, event);
|
|
3815
3688
|
}
|
|
3816
3689
|
}
|
|
@@ -3832,18 +3705,15 @@ var _AnimationState = class {
|
|
|
3832
3705
|
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3833
3706
|
* rather than leaving them in their current pose. */
|
|
3834
3707
|
clearTrack(trackIndex) {
|
|
3835
|
-
if (trackIndex >= this.tracks.length)
|
|
3836
|
-
return;
|
|
3708
|
+
if (trackIndex >= this.tracks.length) return;
|
|
3837
3709
|
let current = this.tracks[trackIndex];
|
|
3838
|
-
if (!current)
|
|
3839
|
-
return;
|
|
3710
|
+
if (!current) return;
|
|
3840
3711
|
this.queue.end(current);
|
|
3841
3712
|
this.clearNext(current);
|
|
3842
3713
|
let entry = current;
|
|
3843
3714
|
while (true) {
|
|
3844
3715
|
let from = entry.mixingFrom;
|
|
3845
|
-
if (!from)
|
|
3846
|
-
break;
|
|
3716
|
+
if (!from) break;
|
|
3847
3717
|
this.queue.end(from);
|
|
3848
3718
|
entry.mixingFrom = null;
|
|
3849
3719
|
entry.mixingTo = null;
|
|
@@ -3857,8 +3727,7 @@ var _AnimationState = class {
|
|
|
3857
3727
|
this.tracks[index] = current;
|
|
3858
3728
|
current.previous = null;
|
|
3859
3729
|
if (from) {
|
|
3860
|
-
if (interrupt)
|
|
3861
|
-
this.queue.interrupt(from);
|
|
3730
|
+
if (interrupt) this.queue.interrupt(from);
|
|
3862
3731
|
current.mixingFrom = from;
|
|
3863
3732
|
from.mixingTo = current;
|
|
3864
3733
|
current.mixTime = 0;
|
|
@@ -3873,8 +3742,7 @@ var _AnimationState = class {
|
|
|
3873
3742
|
* See {@link #setAnimationWith()}. */
|
|
3874
3743
|
setAnimation(trackIndex, animationName, loop = false) {
|
|
3875
3744
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
3876
|
-
if (!animation)
|
|
3877
|
-
throw new Error("Animation not found: " + animationName);
|
|
3745
|
+
if (!animation) throw new Error("Animation not found: " + animationName);
|
|
3878
3746
|
return this.setAnimationWith(trackIndex, animation, loop);
|
|
3879
3747
|
}
|
|
3880
3748
|
/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
|
|
@@ -3884,8 +3752,7 @@ var _AnimationState = class {
|
|
|
3884
3752
|
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3885
3753
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
3886
3754
|
setAnimationWith(trackIndex, animation, loop = false) {
|
|
3887
|
-
if (!animation)
|
|
3888
|
-
throw new Error("animation cannot be null.");
|
|
3755
|
+
if (!animation) throw new Error("animation cannot be null.");
|
|
3889
3756
|
let interrupt = true;
|
|
3890
3757
|
let current = this.expandToIndex(trackIndex);
|
|
3891
3758
|
if (current) {
|
|
@@ -3909,8 +3776,7 @@ var _AnimationState = class {
|
|
|
3909
3776
|
* See {@link #addAnimationWith()}. */
|
|
3910
3777
|
addAnimation(trackIndex, animationName, loop = false, delay = 0) {
|
|
3911
3778
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
3912
|
-
if (!animation)
|
|
3913
|
-
throw new Error("Animation not found: " + animationName);
|
|
3779
|
+
if (!animation) throw new Error("Animation not found: " + animationName);
|
|
3914
3780
|
return this.addAnimationWith(trackIndex, animation, loop, delay);
|
|
3915
3781
|
}
|
|
3916
3782
|
/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
|
|
@@ -3922,8 +3788,7 @@ var _AnimationState = class {
|
|
|
3922
3788
|
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3923
3789
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
3924
3790
|
addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
|
|
3925
|
-
if (!animation)
|
|
3926
|
-
throw new Error("animation cannot be null.");
|
|
3791
|
+
if (!animation) throw new Error("animation cannot be null.");
|
|
3927
3792
|
let last = this.expandToIndex(trackIndex);
|
|
3928
3793
|
if (last) {
|
|
3929
3794
|
while (last.next)
|
|
@@ -3933,13 +3798,11 @@ var _AnimationState = class {
|
|
|
3933
3798
|
if (!last) {
|
|
3934
3799
|
this.setCurrent(trackIndex, entry, true);
|
|
3935
3800
|
this.queue.drain();
|
|
3936
|
-
if (delay < 0)
|
|
3937
|
-
delay = 0;
|
|
3801
|
+
if (delay < 0) delay = 0;
|
|
3938
3802
|
} else {
|
|
3939
3803
|
last.next = entry;
|
|
3940
3804
|
entry.previous = last;
|
|
3941
|
-
if (delay <= 0)
|
|
3942
|
-
delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
|
|
3805
|
+
if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
|
|
3943
3806
|
}
|
|
3944
3807
|
entry.delay = delay;
|
|
3945
3808
|
return entry;
|
|
@@ -3977,8 +3840,7 @@ var _AnimationState = class {
|
|
|
3977
3840
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
3978
3841
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
3979
3842
|
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
3980
|
-
if (delay <= 0)
|
|
3981
|
-
entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
|
|
3843
|
+
if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
|
|
3982
3844
|
entry.mixDuration = mixDuration;
|
|
3983
3845
|
entry.trackEnd = mixDuration;
|
|
3984
3846
|
return entry;
|
|
@@ -3990,15 +3852,13 @@ var _AnimationState = class {
|
|
|
3990
3852
|
this.queue.drainDisabled = true;
|
|
3991
3853
|
for (let i = 0, n = this.tracks.length; i < n; i++) {
|
|
3992
3854
|
let current = this.tracks[i];
|
|
3993
|
-
if (current)
|
|
3994
|
-
this.setEmptyAnimation(current.trackIndex, mixDuration);
|
|
3855
|
+
if (current) this.setEmptyAnimation(current.trackIndex, mixDuration);
|
|
3995
3856
|
}
|
|
3996
3857
|
this.queue.drainDisabled = oldDrainDisabled;
|
|
3997
3858
|
this.queue.drain();
|
|
3998
3859
|
}
|
|
3999
3860
|
expandToIndex(index) {
|
|
4000
|
-
if (index < this.tracks.length)
|
|
4001
|
-
return this.tracks[index];
|
|
3861
|
+
if (index < this.tracks.length) return this.tracks[index];
|
|
4002
3862
|
Utils.ensureArrayCapacity(this.tracks, index + 1, null);
|
|
4003
3863
|
this.tracks.length = index + 1;
|
|
4004
3864
|
return null;
|
|
@@ -4050,13 +3910,11 @@ var _AnimationState = class {
|
|
|
4050
3910
|
let tracks = this.tracks;
|
|
4051
3911
|
for (let i = 0, n = tracks.length; i < n; i++) {
|
|
4052
3912
|
let entry = tracks[i];
|
|
4053
|
-
if (!entry)
|
|
4054
|
-
continue;
|
|
3913
|
+
if (!entry) continue;
|
|
4055
3914
|
while (entry.mixingFrom)
|
|
4056
3915
|
entry = entry.mixingFrom;
|
|
4057
3916
|
do {
|
|
4058
|
-
if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
|
|
4059
|
-
this.computeHold(entry);
|
|
3917
|
+
if (!entry.mixingTo || entry.mixBlend != 3 /* add */) this.computeHold(entry);
|
|
4060
3918
|
entry = entry.mixingTo;
|
|
4061
3919
|
} while (entry);
|
|
4062
3920
|
}
|
|
@@ -4085,8 +3943,7 @@ var _AnimationState = class {
|
|
|
4085
3943
|
timelineMode[i] = FIRST;
|
|
4086
3944
|
} else {
|
|
4087
3945
|
for (let next = to.mixingTo; next; next = next.mixingTo) {
|
|
4088
|
-
if (next.animation.hasTimeline(ids))
|
|
4089
|
-
continue;
|
|
3946
|
+
if (next.animation.hasTimeline(ids)) continue;
|
|
4090
3947
|
if (entry.mixDuration > 0) {
|
|
4091
3948
|
timelineMode[i] = HOLD_MIX;
|
|
4092
3949
|
timelineHoldMix[i] = next;
|
|
@@ -4100,21 +3957,18 @@ var _AnimationState = class {
|
|
|
4100
3957
|
}
|
|
4101
3958
|
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
|
|
4102
3959
|
getCurrent(trackIndex) {
|
|
4103
|
-
if (trackIndex >= this.tracks.length)
|
|
4104
|
-
return null;
|
|
3960
|
+
if (trackIndex >= this.tracks.length) return null;
|
|
4105
3961
|
return this.tracks[trackIndex];
|
|
4106
3962
|
}
|
|
4107
3963
|
/** Adds a listener to receive events for all track entries. */
|
|
4108
3964
|
addListener(listener) {
|
|
4109
|
-
if (!listener)
|
|
4110
|
-
throw new Error("listener cannot be null.");
|
|
3965
|
+
if (!listener) throw new Error("listener cannot be null.");
|
|
4111
3966
|
this.listeners.push(listener);
|
|
4112
3967
|
}
|
|
4113
3968
|
/** Removes the listener added with {@link #addListener()}. */
|
|
4114
3969
|
removeListener(listener) {
|
|
4115
3970
|
let index = this.listeners.indexOf(listener);
|
|
4116
|
-
if (index >= 0)
|
|
4117
|
-
this.listeners.splice(index, 1);
|
|
3971
|
+
if (index >= 0) this.listeners.splice(index, 1);
|
|
4118
3972
|
}
|
|
4119
3973
|
/** Removes all listeners added with {@link #addListener()}. */
|
|
4120
3974
|
clearListeners() {
|
|
@@ -4127,8 +3981,6 @@ var _AnimationState = class {
|
|
|
4127
3981
|
this.queue.clear();
|
|
4128
3982
|
}
|
|
4129
3983
|
};
|
|
4130
|
-
var AnimationState = _AnimationState;
|
|
4131
|
-
__publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
|
|
4132
3984
|
var TrackEntry = class {
|
|
4133
3985
|
/** The animation to apply for this track entry. */
|
|
4134
3986
|
animation = null;
|
|
@@ -4297,8 +4149,7 @@ var TrackEntry = class {
|
|
|
4297
4149
|
getAnimationTime() {
|
|
4298
4150
|
if (this.loop) {
|
|
4299
4151
|
let duration = this.animationEnd - this.animationStart;
|
|
4300
|
-
if (duration == 0)
|
|
4301
|
-
return this.animationStart;
|
|
4152
|
+
if (duration == 0) return this.animationStart;
|
|
4302
4153
|
return this.trackTime % duration + this.animationStart;
|
|
4303
4154
|
}
|
|
4304
4155
|
return Math.min(this.trackTime + this.animationStart, this.animationEnd);
|
|
@@ -4326,10 +4177,8 @@ var TrackEntry = class {
|
|
|
4326
4177
|
getTrackComplete() {
|
|
4327
4178
|
let duration = this.animationEnd - this.animationStart;
|
|
4328
4179
|
if (duration != 0) {
|
|
4329
|
-
if (this.loop)
|
|
4330
|
-
|
|
4331
|
-
if (this.trackTime < duration)
|
|
4332
|
-
return duration;
|
|
4180
|
+
if (this.loop) return duration * (1 + (this.trackTime / duration | 0));
|
|
4181
|
+
if (this.trackTime < duration) return duration;
|
|
4333
4182
|
}
|
|
4334
4183
|
return this.trackTime;
|
|
4335
4184
|
}
|
|
@@ -4353,35 +4202,34 @@ var EventQueue = class {
|
|
|
4353
4202
|
this.animState = animState;
|
|
4354
4203
|
}
|
|
4355
4204
|
start(entry) {
|
|
4356
|
-
this.objects.push(
|
|
4205
|
+
this.objects.push(0 /* start */);
|
|
4357
4206
|
this.objects.push(entry);
|
|
4358
4207
|
this.animState.animationsChanged = true;
|
|
4359
4208
|
}
|
|
4360
4209
|
interrupt(entry) {
|
|
4361
|
-
this.objects.push(
|
|
4210
|
+
this.objects.push(1 /* interrupt */);
|
|
4362
4211
|
this.objects.push(entry);
|
|
4363
4212
|
}
|
|
4364
4213
|
end(entry) {
|
|
4365
|
-
this.objects.push(
|
|
4214
|
+
this.objects.push(2 /* end */);
|
|
4366
4215
|
this.objects.push(entry);
|
|
4367
4216
|
this.animState.animationsChanged = true;
|
|
4368
4217
|
}
|
|
4369
4218
|
dispose(entry) {
|
|
4370
|
-
this.objects.push(
|
|
4219
|
+
this.objects.push(3 /* dispose */);
|
|
4371
4220
|
this.objects.push(entry);
|
|
4372
4221
|
}
|
|
4373
4222
|
complete(entry) {
|
|
4374
|
-
this.objects.push(
|
|
4223
|
+
this.objects.push(4 /* complete */);
|
|
4375
4224
|
this.objects.push(entry);
|
|
4376
4225
|
}
|
|
4377
4226
|
event(entry, event) {
|
|
4378
|
-
this.objects.push(
|
|
4227
|
+
this.objects.push(5 /* event */);
|
|
4379
4228
|
this.objects.push(entry);
|
|
4380
4229
|
this.objects.push(event);
|
|
4381
4230
|
}
|
|
4382
4231
|
drain() {
|
|
4383
|
-
if (this.drainDisabled)
|
|
4384
|
-
return;
|
|
4232
|
+
if (this.drainDisabled) return;
|
|
4385
4233
|
this.drainDisabled = true;
|
|
4386
4234
|
let objects = this.objects;
|
|
4387
4235
|
let listeners = this.animState.listeners;
|
|
@@ -4389,59 +4237,48 @@ var EventQueue = class {
|
|
|
4389
4237
|
let type = objects[i];
|
|
4390
4238
|
let entry = objects[i + 1];
|
|
4391
4239
|
switch (type) {
|
|
4392
|
-
case
|
|
4393
|
-
if (entry.listener && entry.listener.start)
|
|
4394
|
-
entry.listener.start(entry);
|
|
4240
|
+
case 0 /* start */:
|
|
4241
|
+
if (entry.listener && entry.listener.start) entry.listener.start(entry);
|
|
4395
4242
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4396
4243
|
let listener = listeners[ii];
|
|
4397
|
-
if (listener.start)
|
|
4398
|
-
listener.start(entry);
|
|
4244
|
+
if (listener.start) listener.start(entry);
|
|
4399
4245
|
}
|
|
4400
4246
|
break;
|
|
4401
|
-
case
|
|
4402
|
-
if (entry.listener && entry.listener.interrupt)
|
|
4403
|
-
entry.listener.interrupt(entry);
|
|
4247
|
+
case 1 /* interrupt */:
|
|
4248
|
+
if (entry.listener && entry.listener.interrupt) entry.listener.interrupt(entry);
|
|
4404
4249
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4405
4250
|
let listener = listeners[ii];
|
|
4406
|
-
if (listener.interrupt)
|
|
4407
|
-
listener.interrupt(entry);
|
|
4251
|
+
if (listener.interrupt) listener.interrupt(entry);
|
|
4408
4252
|
}
|
|
4409
4253
|
break;
|
|
4410
|
-
case
|
|
4411
|
-
if (entry.listener && entry.listener.end)
|
|
4412
|
-
entry.listener.end(entry);
|
|
4254
|
+
case 2 /* end */:
|
|
4255
|
+
if (entry.listener && entry.listener.end) entry.listener.end(entry);
|
|
4413
4256
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4414
4257
|
let listener = listeners[ii];
|
|
4415
|
-
if (listener.end)
|
|
4416
|
-
listener.end(entry);
|
|
4258
|
+
if (listener.end) listener.end(entry);
|
|
4417
4259
|
}
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4260
|
+
// Fall through.
|
|
4261
|
+
case 3 /* dispose */:
|
|
4262
|
+
if (entry.listener && entry.listener.dispose) entry.listener.dispose(entry);
|
|
4421
4263
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4422
4264
|
let listener = listeners[ii];
|
|
4423
|
-
if (listener.dispose)
|
|
4424
|
-
listener.dispose(entry);
|
|
4265
|
+
if (listener.dispose) listener.dispose(entry);
|
|
4425
4266
|
}
|
|
4426
4267
|
this.animState.trackEntryPool.free(entry);
|
|
4427
4268
|
break;
|
|
4428
|
-
case
|
|
4429
|
-
if (entry.listener && entry.listener.complete)
|
|
4430
|
-
entry.listener.complete(entry);
|
|
4269
|
+
case 4 /* complete */:
|
|
4270
|
+
if (entry.listener && entry.listener.complete) entry.listener.complete(entry);
|
|
4431
4271
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4432
4272
|
let listener = listeners[ii];
|
|
4433
|
-
if (listener.complete)
|
|
4434
|
-
listener.complete(entry);
|
|
4273
|
+
if (listener.complete) listener.complete(entry);
|
|
4435
4274
|
}
|
|
4436
4275
|
break;
|
|
4437
|
-
case
|
|
4276
|
+
case 5 /* event */:
|
|
4438
4277
|
let event = objects[i++ + 2];
|
|
4439
|
-
if (entry.listener && entry.listener.event)
|
|
4440
|
-
entry.listener.event(entry, event);
|
|
4278
|
+
if (entry.listener && entry.listener.event) entry.listener.event(entry, event);
|
|
4441
4279
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4442
4280
|
let listener = listeners[ii];
|
|
4443
|
-
if (listener.event)
|
|
4444
|
-
listener.event(entry, event);
|
|
4281
|
+
if (listener.event) listener.event(entry, event);
|
|
4445
4282
|
}
|
|
4446
4283
|
break;
|
|
4447
4284
|
}
|
|
@@ -4492,8 +4329,7 @@ var AnimationStateData = class {
|
|
|
4492
4329
|
/** The mix duration to use when no mix duration has been defined between two animations. */
|
|
4493
4330
|
defaultMix = 0;
|
|
4494
4331
|
constructor(skeletonData) {
|
|
4495
|
-
if (!skeletonData)
|
|
4496
|
-
throw new Error("skeletonData cannot be null.");
|
|
4332
|
+
if (!skeletonData) throw new Error("skeletonData cannot be null.");
|
|
4497
4333
|
this.skeletonData = skeletonData;
|
|
4498
4334
|
}
|
|
4499
4335
|
/** Sets a mix duration by animation name.
|
|
@@ -4501,21 +4337,17 @@ var AnimationStateData = class {
|
|
|
4501
4337
|
* See {@link #setMixWith()}. */
|
|
4502
4338
|
setMix(fromName, toName, duration) {
|
|
4503
4339
|
let from = this.skeletonData.findAnimation(fromName);
|
|
4504
|
-
if (!from)
|
|
4505
|
-
throw new Error("Animation not found: " + fromName);
|
|
4340
|
+
if (!from) throw new Error("Animation not found: " + fromName);
|
|
4506
4341
|
let to = this.skeletonData.findAnimation(toName);
|
|
4507
|
-
if (!to)
|
|
4508
|
-
throw new Error("Animation not found: " + toName);
|
|
4342
|
+
if (!to) throw new Error("Animation not found: " + toName);
|
|
4509
4343
|
this.setMixWith(from, to, duration);
|
|
4510
4344
|
}
|
|
4511
4345
|
/** Sets the mix duration when changing from the specified animation to the other.
|
|
4512
4346
|
*
|
|
4513
4347
|
* See {@link TrackEntry#mixDuration}. */
|
|
4514
4348
|
setMixWith(from, to, duration) {
|
|
4515
|
-
if (!from)
|
|
4516
|
-
|
|
4517
|
-
if (!to)
|
|
4518
|
-
throw new Error("to cannot be null.");
|
|
4349
|
+
if (!from) throw new Error("from cannot be null.");
|
|
4350
|
+
if (!to) throw new Error("to cannot be null.");
|
|
4519
4351
|
let key = from.name + "." + to.name;
|
|
4520
4352
|
this.animationToMixTime[key] = duration;
|
|
4521
4353
|
}
|
|
@@ -4529,13 +4361,13 @@ var AnimationStateData = class {
|
|
|
4529
4361
|
};
|
|
4530
4362
|
|
|
4531
4363
|
// spine-core/src/attachments/BoundingBoxAttachment.ts
|
|
4532
|
-
var BoundingBoxAttachment = class extends VertexAttachment {
|
|
4364
|
+
var BoundingBoxAttachment = class _BoundingBoxAttachment extends VertexAttachment {
|
|
4533
4365
|
color = new Color(1, 1, 1, 1);
|
|
4534
4366
|
constructor(name) {
|
|
4535
4367
|
super(name);
|
|
4536
4368
|
}
|
|
4537
4369
|
copy() {
|
|
4538
|
-
let copy = new
|
|
4370
|
+
let copy = new _BoundingBoxAttachment(this.name);
|
|
4539
4371
|
this.copyTo(copy);
|
|
4540
4372
|
copy.color.setFromColor(this.color);
|
|
4541
4373
|
return copy;
|
|
@@ -4543,7 +4375,7 @@ var BoundingBoxAttachment = class extends VertexAttachment {
|
|
|
4543
4375
|
};
|
|
4544
4376
|
|
|
4545
4377
|
// spine-core/src/attachments/ClippingAttachment.ts
|
|
4546
|
-
var ClippingAttachment = class extends VertexAttachment {
|
|
4378
|
+
var ClippingAttachment = class _ClippingAttachment extends VertexAttachment {
|
|
4547
4379
|
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
|
|
4548
4380
|
* the skeleton's rendering. */
|
|
4549
4381
|
endSlot = null;
|
|
@@ -4556,7 +4388,7 @@ var ClippingAttachment = class extends VertexAttachment {
|
|
|
4556
4388
|
super(name);
|
|
4557
4389
|
}
|
|
4558
4390
|
copy() {
|
|
4559
|
-
let copy = new
|
|
4391
|
+
let copy = new _ClippingAttachment(this.name);
|
|
4560
4392
|
this.copyTo(copy);
|
|
4561
4393
|
copy.endSlot = this.endSlot;
|
|
4562
4394
|
copy.color.setFromColor(this.color);
|
|
@@ -4632,10 +4464,8 @@ var TextureAtlas = class {
|
|
|
4632
4464
|
page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
|
|
4633
4465
|
};
|
|
4634
4466
|
pageFields["repeat"] = (page2) => {
|
|
4635
|
-
if (entry[1].indexOf("x") != -1)
|
|
4636
|
-
|
|
4637
|
-
if (entry[1].indexOf("y") != -1)
|
|
4638
|
-
page2.vWrap = 10497 /* Repeat */;
|
|
4467
|
+
if (entry[1].indexOf("x") != -1) page2.uWrap = 10497 /* Repeat */;
|
|
4468
|
+
if (entry[1].indexOf("y") != -1) page2.vWrap = 10497 /* Repeat */;
|
|
4639
4469
|
};
|
|
4640
4470
|
pageFields["pma"] = (page2) => {
|
|
4641
4471
|
page2.pma = entry[1] == "true";
|
|
@@ -4683,45 +4513,37 @@ var TextureAtlas = class {
|
|
|
4683
4513
|
while (line && line.trim().length == 0)
|
|
4684
4514
|
line = reader.readLine();
|
|
4685
4515
|
while (true) {
|
|
4686
|
-
if (!line || line.trim().length == 0)
|
|
4687
|
-
|
|
4688
|
-
if (reader.readEntry(entry, line) == 0)
|
|
4689
|
-
break;
|
|
4516
|
+
if (!line || line.trim().length == 0) break;
|
|
4517
|
+
if (reader.readEntry(entry, line) == 0) break;
|
|
4690
4518
|
line = reader.readLine();
|
|
4691
4519
|
}
|
|
4692
4520
|
let page = null;
|
|
4693
4521
|
let names = null;
|
|
4694
4522
|
let values = null;
|
|
4695
4523
|
while (true) {
|
|
4696
|
-
if (line === null)
|
|
4697
|
-
break;
|
|
4524
|
+
if (line === null) break;
|
|
4698
4525
|
if (line.trim().length == 0) {
|
|
4699
4526
|
page = null;
|
|
4700
4527
|
line = reader.readLine();
|
|
4701
4528
|
} else if (!page) {
|
|
4702
4529
|
page = new TextureAtlasPage(line.trim());
|
|
4703
4530
|
while (true) {
|
|
4704
|
-
if (reader.readEntry(entry, line = reader.readLine()) == 0)
|
|
4705
|
-
break;
|
|
4531
|
+
if (reader.readEntry(entry, line = reader.readLine()) == 0) break;
|
|
4706
4532
|
let field = pageFields[entry[0]];
|
|
4707
|
-
if (field)
|
|
4708
|
-
field(page);
|
|
4533
|
+
if (field) field(page);
|
|
4709
4534
|
}
|
|
4710
4535
|
this.pages.push(page);
|
|
4711
4536
|
} else {
|
|
4712
4537
|
let region = new TextureAtlasRegion(page, line);
|
|
4713
4538
|
while (true) {
|
|
4714
4539
|
let count = reader.readEntry(entry, line = reader.readLine());
|
|
4715
|
-
if (count == 0)
|
|
4716
|
-
break;
|
|
4540
|
+
if (count == 0) break;
|
|
4717
4541
|
let field = regionFields[entry[0]];
|
|
4718
4542
|
if (field)
|
|
4719
4543
|
field(region);
|
|
4720
4544
|
else {
|
|
4721
|
-
if (!names)
|
|
4722
|
-
|
|
4723
|
-
if (!values)
|
|
4724
|
-
values = [];
|
|
4545
|
+
if (!names) names = [];
|
|
4546
|
+
if (!values) values = [];
|
|
4725
4547
|
names.push(entry[0]);
|
|
4726
4548
|
let entryValues = [];
|
|
4727
4549
|
for (let i = 0; i < count; i++)
|
|
@@ -4782,14 +4604,11 @@ var TextureAtlasReader = class {
|
|
|
4782
4604
|
return this.lines[this.index++];
|
|
4783
4605
|
}
|
|
4784
4606
|
readEntry(entry, line) {
|
|
4785
|
-
if (!line)
|
|
4786
|
-
return 0;
|
|
4607
|
+
if (!line) return 0;
|
|
4787
4608
|
line = line.trim();
|
|
4788
|
-
if (line.length == 0)
|
|
4789
|
-
return 0;
|
|
4609
|
+
if (line.length == 0) return 0;
|
|
4790
4610
|
let colon = line.indexOf(":");
|
|
4791
|
-
if (colon == -1)
|
|
4792
|
-
return 0;
|
|
4611
|
+
if (colon == -1) return 0;
|
|
4793
4612
|
entry[0] = line.substr(0, colon).trim();
|
|
4794
4613
|
for (let i = 1, lastMatch = colon + 1; ; i++) {
|
|
4795
4614
|
let comma = line.indexOf(",", lastMatch);
|
|
@@ -4799,8 +4618,7 @@ var TextureAtlasReader = class {
|
|
|
4799
4618
|
}
|
|
4800
4619
|
entry[i] = line.substr(lastMatch, comma - lastMatch).trim();
|
|
4801
4620
|
lastMatch = comma + 1;
|
|
4802
|
-
if (i == 4)
|
|
4803
|
-
return 4;
|
|
4621
|
+
if (i == 4) return 4;
|
|
4804
4622
|
}
|
|
4805
4623
|
}
|
|
4806
4624
|
};
|
|
@@ -4848,7 +4666,7 @@ var TextureAtlasRegion = class extends TextureRegion {
|
|
|
4848
4666
|
};
|
|
4849
4667
|
|
|
4850
4668
|
// spine-core/src/attachments/MeshAttachment.ts
|
|
4851
|
-
var MeshAttachment = class extends VertexAttachment {
|
|
4669
|
+
var MeshAttachment = class _MeshAttachment extends VertexAttachment {
|
|
4852
4670
|
region = null;
|
|
4853
4671
|
/** The name of the texture region for this attachment. */
|
|
4854
4672
|
path;
|
|
@@ -4881,11 +4699,9 @@ var MeshAttachment = class extends VertexAttachment {
|
|
|
4881
4699
|
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
|
|
4882
4700
|
* the {@link #regionUVs} are changed. */
|
|
4883
4701
|
updateRegion() {
|
|
4884
|
-
if (!this.region)
|
|
4885
|
-
throw new Error("Region not set.");
|
|
4702
|
+
if (!this.region) throw new Error("Region not set.");
|
|
4886
4703
|
let regionUVs = this.regionUVs;
|
|
4887
|
-
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
4888
|
-
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
4704
|
+
if (!this.uvs || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
4889
4705
|
let uvs = this.uvs;
|
|
4890
4706
|
let n = this.uvs.length;
|
|
4891
4707
|
let u = this.region.u, v = this.region.v, width = 0, height = 0;
|
|
@@ -4960,9 +4776,8 @@ var MeshAttachment = class extends VertexAttachment {
|
|
|
4960
4776
|
}
|
|
4961
4777
|
}
|
|
4962
4778
|
copy() {
|
|
4963
|
-
if (this.parentMesh)
|
|
4964
|
-
|
|
4965
|
-
let copy = new MeshAttachment(this.name, this.path);
|
|
4779
|
+
if (this.parentMesh) return this.newLinkedMesh();
|
|
4780
|
+
let copy = new _MeshAttachment(this.name, this.path);
|
|
4966
4781
|
copy.region = this.region;
|
|
4967
4782
|
copy.color.setFromColor(this.color);
|
|
4968
4783
|
this.copyTo(copy);
|
|
@@ -4983,25 +4798,23 @@ var MeshAttachment = class extends VertexAttachment {
|
|
|
4983
4798
|
return copy;
|
|
4984
4799
|
}
|
|
4985
4800
|
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
|
|
4986
|
-
if (this.sequence != null)
|
|
4987
|
-
this.sequence.apply(slot, this);
|
|
4801
|
+
if (this.sequence != null) this.sequence.apply(slot, this);
|
|
4988
4802
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
4989
4803
|
}
|
|
4990
4804
|
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
|
|
4991
4805
|
newLinkedMesh() {
|
|
4992
|
-
let copy = new
|
|
4806
|
+
let copy = new _MeshAttachment(this.name, this.path);
|
|
4993
4807
|
copy.region = this.region;
|
|
4994
4808
|
copy.color.setFromColor(this.color);
|
|
4995
4809
|
copy.timelineAttachment = this.timelineAttachment;
|
|
4996
4810
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
4997
|
-
if (copy.region != null)
|
|
4998
|
-
copy.updateRegion();
|
|
4811
|
+
if (copy.region != null) copy.updateRegion();
|
|
4999
4812
|
return copy;
|
|
5000
4813
|
}
|
|
5001
4814
|
};
|
|
5002
4815
|
|
|
5003
4816
|
// spine-core/src/attachments/PathAttachment.ts
|
|
5004
|
-
var PathAttachment = class extends VertexAttachment {
|
|
4817
|
+
var PathAttachment = class _PathAttachment extends VertexAttachment {
|
|
5005
4818
|
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
|
5006
4819
|
lengths = [];
|
|
5007
4820
|
/** If true, the start and end knots are connected. */
|
|
@@ -5016,7 +4829,7 @@ var PathAttachment = class extends VertexAttachment {
|
|
|
5016
4829
|
super(name);
|
|
5017
4830
|
}
|
|
5018
4831
|
copy() {
|
|
5019
|
-
let copy = new
|
|
4832
|
+
let copy = new _PathAttachment(this.name);
|
|
5020
4833
|
this.copyTo(copy);
|
|
5021
4834
|
copy.lengths = new Array(this.lengths.length);
|
|
5022
4835
|
Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
|
@@ -5028,7 +4841,7 @@ var PathAttachment = class extends VertexAttachment {
|
|
|
5028
4841
|
};
|
|
5029
4842
|
|
|
5030
4843
|
// spine-core/src/attachments/PointAttachment.ts
|
|
5031
|
-
var PointAttachment = class extends VertexAttachment {
|
|
4844
|
+
var PointAttachment = class _PointAttachment extends VertexAttachment {
|
|
5032
4845
|
x = 0;
|
|
5033
4846
|
y = 0;
|
|
5034
4847
|
rotation = 0;
|
|
@@ -5050,7 +4863,7 @@ var PointAttachment = class extends VertexAttachment {
|
|
|
5050
4863
|
return MathUtils.atan2Deg(y, x);
|
|
5051
4864
|
}
|
|
5052
4865
|
copy() {
|
|
5053
|
-
let copy = new
|
|
4866
|
+
let copy = new _PointAttachment(this.name);
|
|
5054
4867
|
copy.x = this.x;
|
|
5055
4868
|
copy.y = this.y;
|
|
5056
4869
|
copy.rotation = this.rotation;
|
|
@@ -5060,7 +4873,7 @@ var PointAttachment = class extends VertexAttachment {
|
|
|
5060
4873
|
};
|
|
5061
4874
|
|
|
5062
4875
|
// spine-core/src/attachments/RegionAttachment.ts
|
|
5063
|
-
var
|
|
4876
|
+
var RegionAttachment = class _RegionAttachment extends Attachment {
|
|
5064
4877
|
/** The local x translation. */
|
|
5065
4878
|
x = 0;
|
|
5066
4879
|
/** The local y translation. */
|
|
@@ -5093,8 +4906,7 @@ var _RegionAttachment = class extends Attachment {
|
|
|
5093
4906
|
}
|
|
5094
4907
|
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
|
|
5095
4908
|
updateRegion() {
|
|
5096
|
-
if (!this.region)
|
|
5097
|
-
throw new Error("Region not set.");
|
|
4909
|
+
if (!this.region) throw new Error("Region not set.");
|
|
5098
4910
|
let region = this.region;
|
|
5099
4911
|
let uvs = this.uvs;
|
|
5100
4912
|
if (region == null) {
|
|
@@ -5207,40 +5019,39 @@ var _RegionAttachment = class extends Attachment {
|
|
|
5207
5019
|
copy.sequence = this.sequence != null ? this.sequence.copy() : null;
|
|
5208
5020
|
return copy;
|
|
5209
5021
|
}
|
|
5022
|
+
static X1 = 0;
|
|
5023
|
+
static Y1 = 1;
|
|
5024
|
+
static C1R = 2;
|
|
5025
|
+
static C1G = 3;
|
|
5026
|
+
static C1B = 4;
|
|
5027
|
+
static C1A = 5;
|
|
5028
|
+
static U1 = 6;
|
|
5029
|
+
static V1 = 7;
|
|
5030
|
+
static X2 = 8;
|
|
5031
|
+
static Y2 = 9;
|
|
5032
|
+
static C2R = 10;
|
|
5033
|
+
static C2G = 11;
|
|
5034
|
+
static C2B = 12;
|
|
5035
|
+
static C2A = 13;
|
|
5036
|
+
static U2 = 14;
|
|
5037
|
+
static V2 = 15;
|
|
5038
|
+
static X3 = 16;
|
|
5039
|
+
static Y3 = 17;
|
|
5040
|
+
static C3R = 18;
|
|
5041
|
+
static C3G = 19;
|
|
5042
|
+
static C3B = 20;
|
|
5043
|
+
static C3A = 21;
|
|
5044
|
+
static U3 = 22;
|
|
5045
|
+
static V3 = 23;
|
|
5046
|
+
static X4 = 24;
|
|
5047
|
+
static Y4 = 25;
|
|
5048
|
+
static C4R = 26;
|
|
5049
|
+
static C4G = 27;
|
|
5050
|
+
static C4B = 28;
|
|
5051
|
+
static C4A = 29;
|
|
5052
|
+
static U4 = 30;
|
|
5053
|
+
static V4 = 31;
|
|
5210
5054
|
};
|
|
5211
|
-
var RegionAttachment = _RegionAttachment;
|
|
5212
|
-
__publicField(RegionAttachment, "X1", 0);
|
|
5213
|
-
__publicField(RegionAttachment, "Y1", 1);
|
|
5214
|
-
__publicField(RegionAttachment, "C1R", 2);
|
|
5215
|
-
__publicField(RegionAttachment, "C1G", 3);
|
|
5216
|
-
__publicField(RegionAttachment, "C1B", 4);
|
|
5217
|
-
__publicField(RegionAttachment, "C1A", 5);
|
|
5218
|
-
__publicField(RegionAttachment, "U1", 6);
|
|
5219
|
-
__publicField(RegionAttachment, "V1", 7);
|
|
5220
|
-
__publicField(RegionAttachment, "X2", 8);
|
|
5221
|
-
__publicField(RegionAttachment, "Y2", 9);
|
|
5222
|
-
__publicField(RegionAttachment, "C2R", 10);
|
|
5223
|
-
__publicField(RegionAttachment, "C2G", 11);
|
|
5224
|
-
__publicField(RegionAttachment, "C2B", 12);
|
|
5225
|
-
__publicField(RegionAttachment, "C2A", 13);
|
|
5226
|
-
__publicField(RegionAttachment, "U2", 14);
|
|
5227
|
-
__publicField(RegionAttachment, "V2", 15);
|
|
5228
|
-
__publicField(RegionAttachment, "X3", 16);
|
|
5229
|
-
__publicField(RegionAttachment, "Y3", 17);
|
|
5230
|
-
__publicField(RegionAttachment, "C3R", 18);
|
|
5231
|
-
__publicField(RegionAttachment, "C3G", 19);
|
|
5232
|
-
__publicField(RegionAttachment, "C3B", 20);
|
|
5233
|
-
__publicField(RegionAttachment, "C3A", 21);
|
|
5234
|
-
__publicField(RegionAttachment, "U3", 22);
|
|
5235
|
-
__publicField(RegionAttachment, "V3", 23);
|
|
5236
|
-
__publicField(RegionAttachment, "X4", 24);
|
|
5237
|
-
__publicField(RegionAttachment, "Y4", 25);
|
|
5238
|
-
__publicField(RegionAttachment, "C4R", 26);
|
|
5239
|
-
__publicField(RegionAttachment, "C4G", 27);
|
|
5240
|
-
__publicField(RegionAttachment, "C4B", 28);
|
|
5241
|
-
__publicField(RegionAttachment, "C4A", 29);
|
|
5242
|
-
__publicField(RegionAttachment, "U4", 30);
|
|
5243
|
-
__publicField(RegionAttachment, "V4", 31);
|
|
5244
5055
|
|
|
5245
5056
|
// spine-core/src/AtlasAttachmentLoader.ts
|
|
5246
5057
|
var AtlasAttachmentLoader = class {
|
|
@@ -5253,8 +5064,7 @@ var AtlasAttachmentLoader = class {
|
|
|
5253
5064
|
for (let i = 0, n = regions.length; i < n; i++) {
|
|
5254
5065
|
let path = sequence.getPath(basePath, i);
|
|
5255
5066
|
let region = this.atlas.findRegion(path);
|
|
5256
|
-
if (region == null)
|
|
5257
|
-
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
5067
|
+
if (region == null) throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
5258
5068
|
regions[i] = region;
|
|
5259
5069
|
}
|
|
5260
5070
|
}
|
|
@@ -5264,8 +5074,7 @@ var AtlasAttachmentLoader = class {
|
|
|
5264
5074
|
this.loadSequence(name, path, sequence);
|
|
5265
5075
|
} else {
|
|
5266
5076
|
let region = this.atlas.findRegion(path);
|
|
5267
|
-
if (!region)
|
|
5268
|
-
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
5077
|
+
if (!region) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
5269
5078
|
attachment.region = region;
|
|
5270
5079
|
}
|
|
5271
5080
|
return attachment;
|
|
@@ -5276,8 +5085,7 @@ var AtlasAttachmentLoader = class {
|
|
|
5276
5085
|
this.loadSequence(name, path, sequence);
|
|
5277
5086
|
} else {
|
|
5278
5087
|
let region = this.atlas.findRegion(path);
|
|
5279
|
-
if (!region)
|
|
5280
|
-
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
5088
|
+
if (!region) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
5281
5089
|
attachment.region = region;
|
|
5282
5090
|
}
|
|
5283
5091
|
return attachment;
|
|
@@ -5321,7 +5129,7 @@ var BoneData = class {
|
|
|
5321
5129
|
/** The local shearX. */
|
|
5322
5130
|
shearY = 0;
|
|
5323
5131
|
/** The transform mode for how parent world transforms affect this bone. */
|
|
5324
|
-
inherit =
|
|
5132
|
+
inherit = 0 /* Normal */;
|
|
5325
5133
|
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
|
|
5326
5134
|
* bone.
|
|
5327
5135
|
* @see Skin#bones */
|
|
@@ -5334,10 +5142,8 @@ var BoneData = class {
|
|
|
5334
5142
|
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
5335
5143
|
visible = false;
|
|
5336
5144
|
constructor(index, name, parent) {
|
|
5337
|
-
if (index < 0)
|
|
5338
|
-
|
|
5339
|
-
if (!name)
|
|
5340
|
-
throw new Error("name cannot be null.");
|
|
5145
|
+
if (index < 0) throw new Error("index must be >= 0.");
|
|
5146
|
+
if (!name) throw new Error("name cannot be null.");
|
|
5341
5147
|
this.index = index;
|
|
5342
5148
|
this.name = name;
|
|
5343
5149
|
this.parent = parent;
|
|
@@ -5407,10 +5213,8 @@ var Bone = class {
|
|
|
5407
5213
|
active = false;
|
|
5408
5214
|
/** @param parent May be null. */
|
|
5409
5215
|
constructor(data, skeleton, parent) {
|
|
5410
|
-
if (!data)
|
|
5411
|
-
|
|
5412
|
-
if (!skeleton)
|
|
5413
|
-
throw new Error("skeleton cannot be null.");
|
|
5216
|
+
if (!data) throw new Error("data cannot be null.");
|
|
5217
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
5414
5218
|
this.data = data;
|
|
5415
5219
|
this.skeleton = skeleton;
|
|
5416
5220
|
this.parent = parent;
|
|
@@ -5519,13 +5323,11 @@ var Bone = class {
|
|
|
5519
5323
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5520
5324
|
let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5521
5325
|
let s = Math.sqrt(za * za + zc * zc);
|
|
5522
|
-
if (s > 1e-5)
|
|
5523
|
-
s = 1 / s;
|
|
5326
|
+
if (s > 1e-5) s = 1 / s;
|
|
5524
5327
|
za *= s;
|
|
5525
5328
|
zc *= s;
|
|
5526
5329
|
s = Math.sqrt(za * za + zc * zc);
|
|
5527
|
-
if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5528
|
-
s = -s;
|
|
5330
|
+
if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
|
|
5529
5331
|
rotation = Math.PI / 2 + Math.atan2(zc, za);
|
|
5530
5332
|
const zb = Math.cos(rotation) * s;
|
|
5531
5333
|
const zd = Math.sin(rotation) * s;
|
|
@@ -5608,13 +5410,11 @@ var Bone = class {
|
|
|
5608
5410
|
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5609
5411
|
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5610
5412
|
let s = Math.sqrt(pa * pa + pc * pc);
|
|
5611
|
-
if (s > 1e-5)
|
|
5612
|
-
s = 1 / s;
|
|
5413
|
+
if (s > 1e-5) s = 1 / s;
|
|
5613
5414
|
pa *= s;
|
|
5614
5415
|
pc *= s;
|
|
5615
5416
|
s = Math.sqrt(pa * pa + pc * pc);
|
|
5616
|
-
if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5617
|
-
s = -s;
|
|
5417
|
+
if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
|
|
5618
5418
|
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
5619
5419
|
pb = Math.cos(r) * s;
|
|
5620
5420
|
pd = Math.sin(r) * s;
|
|
@@ -5676,14 +5476,12 @@ var Bone = class {
|
|
|
5676
5476
|
}
|
|
5677
5477
|
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
|
|
5678
5478
|
worldToParent(world) {
|
|
5679
|
-
if (world == null)
|
|
5680
|
-
throw new Error("world cannot be null.");
|
|
5479
|
+
if (world == null) throw new Error("world cannot be null.");
|
|
5681
5480
|
return this.parent == null ? world : this.parent.worldToLocal(world);
|
|
5682
5481
|
}
|
|
5683
5482
|
/** Transforms a point from the parent bone's coordinates to world coordinates. */
|
|
5684
5483
|
parentToWorld(world) {
|
|
5685
|
-
if (world == null)
|
|
5686
|
-
throw new Error("world cannot be null.");
|
|
5484
|
+
if (world == null) throw new Error("world cannot be null.");
|
|
5687
5485
|
return this.parent == null ? world : this.parent.localToWorld(world);
|
|
5688
5486
|
}
|
|
5689
5487
|
/** Transforms a world rotation to a local rotation. */
|
|
@@ -5727,6 +5525,8 @@ var AssetManagerBase = class {
|
|
|
5727
5525
|
textureLoader;
|
|
5728
5526
|
downloader;
|
|
5729
5527
|
assets = {};
|
|
5528
|
+
assetsRefCount = {};
|
|
5529
|
+
assetsLoaded = {};
|
|
5730
5530
|
errors = {};
|
|
5731
5531
|
toLoad = 0;
|
|
5732
5532
|
loaded = 0;
|
|
@@ -5743,24 +5543,21 @@ var AssetManagerBase = class {
|
|
|
5743
5543
|
this.toLoad--;
|
|
5744
5544
|
this.loaded++;
|
|
5745
5545
|
this.assets[path] = asset;
|
|
5746
|
-
|
|
5747
|
-
|
|
5546
|
+
this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
|
|
5547
|
+
if (callback) callback(path, asset);
|
|
5748
5548
|
}
|
|
5749
5549
|
error(callback, path, message) {
|
|
5750
5550
|
this.toLoad--;
|
|
5751
5551
|
this.loaded++;
|
|
5752
5552
|
this.errors[path] = message;
|
|
5753
|
-
if (callback)
|
|
5754
|
-
callback(path, message);
|
|
5553
|
+
if (callback) callback(path, message);
|
|
5755
5554
|
}
|
|
5756
5555
|
loadAll() {
|
|
5757
5556
|
let promise = new Promise((resolve, reject) => {
|
|
5758
5557
|
let check = () => {
|
|
5759
5558
|
if (this.isLoadingComplete()) {
|
|
5760
|
-
if (this.hasErrors())
|
|
5761
|
-
|
|
5762
|
-
else
|
|
5763
|
-
resolve(this);
|
|
5559
|
+
if (this.hasErrors()) reject(this.errors);
|
|
5560
|
+
else resolve(this);
|
|
5764
5561
|
return;
|
|
5765
5562
|
}
|
|
5766
5563
|
requestAnimationFrame(check);
|
|
@@ -5776,10 +5573,16 @@ var AssetManagerBase = class {
|
|
|
5776
5573
|
}, error = () => {
|
|
5777
5574
|
}) {
|
|
5778
5575
|
path = this.start(path);
|
|
5779
|
-
this.
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5576
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5577
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5578
|
+
this.downloader.downloadBinary(path, (data) => {
|
|
5579
|
+
this.success(success, path, data);
|
|
5580
|
+
resolve(data);
|
|
5581
|
+
}, (status, responseText) => {
|
|
5582
|
+
const errorMsg = `Couldn't load binary ${path}: status ${status}, ${responseText}`;
|
|
5583
|
+
this.error(error, path, errorMsg);
|
|
5584
|
+
reject(errorMsg);
|
|
5585
|
+
});
|
|
5783
5586
|
});
|
|
5784
5587
|
}
|
|
5785
5588
|
loadText(path, success = () => {
|
|
@@ -5796,43 +5599,69 @@ var AssetManagerBase = class {
|
|
|
5796
5599
|
}, error = () => {
|
|
5797
5600
|
}) {
|
|
5798
5601
|
path = this.start(path);
|
|
5799
|
-
this.
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5602
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5603
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5604
|
+
this.downloader.downloadJson(path, (data) => {
|
|
5605
|
+
this.success(success, path, data);
|
|
5606
|
+
resolve(data);
|
|
5607
|
+
}, (status, responseText) => {
|
|
5608
|
+
const errorMsg = `Couldn't load JSON ${path}: status ${status}, ${responseText}`;
|
|
5609
|
+
this.error(error, path, errorMsg);
|
|
5610
|
+
reject(errorMsg);
|
|
5611
|
+
});
|
|
5803
5612
|
});
|
|
5804
5613
|
}
|
|
5614
|
+
reuseAssets(path, success = () => {
|
|
5615
|
+
}, error = () => {
|
|
5616
|
+
}) {
|
|
5617
|
+
const loadedStatus = this.assetsLoaded[path];
|
|
5618
|
+
const alreadyExistsOrLoading = loadedStatus !== void 0;
|
|
5619
|
+
if (alreadyExistsOrLoading) {
|
|
5620
|
+
loadedStatus.then((data) => this.success(success, path, data)).catch((errorMsg) => this.error(error, path, errorMsg));
|
|
5621
|
+
}
|
|
5622
|
+
return alreadyExistsOrLoading;
|
|
5623
|
+
}
|
|
5805
5624
|
loadTexture(path, success = () => {
|
|
5806
5625
|
}, error = () => {
|
|
5807
5626
|
}) {
|
|
5808
5627
|
path = this.start(path);
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5628
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5629
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5630
|
+
let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
|
|
5631
|
+
let isWebWorker = !isBrowser;
|
|
5632
|
+
if (isWebWorker) {
|
|
5633
|
+
fetch(path, { mode: "cors" }).then((response) => {
|
|
5634
|
+
if (response.ok) return response.blob();
|
|
5635
|
+
const errorMsg = `Couldn't load image: ${path}`;
|
|
5636
|
+
this.error(error, path, `Couldn't load image: ${path}`);
|
|
5637
|
+
reject(errorMsg);
|
|
5638
|
+
}).then((blob) => {
|
|
5639
|
+
return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
|
|
5640
|
+
}).then((bitmap) => {
|
|
5641
|
+
if (bitmap) {
|
|
5642
|
+
const texture = this.textureLoader(bitmap);
|
|
5643
|
+
this.success(success, path, texture);
|
|
5644
|
+
resolve(texture);
|
|
5645
|
+
}
|
|
5646
|
+
;
|
|
5647
|
+
});
|
|
5648
|
+
} else {
|
|
5649
|
+
let image = new Image();
|
|
5650
|
+
image.crossOrigin = "anonymous";
|
|
5651
|
+
image.onload = () => {
|
|
5652
|
+
const texture = this.textureLoader(image);
|
|
5653
|
+
this.success(success, path, texture);
|
|
5654
|
+
resolve(texture);
|
|
5655
|
+
};
|
|
5656
|
+
image.onerror = () => {
|
|
5657
|
+
const errorMsg = `Couldn't load image: ${path}`;
|
|
5658
|
+
this.error(error, path, errorMsg);
|
|
5659
|
+
reject(errorMsg);
|
|
5660
|
+
};
|
|
5661
|
+
if (this.downloader.rawDataUris[path]) path = this.downloader.rawDataUris[path];
|
|
5662
|
+
image.src = path;
|
|
5663
|
+
}
|
|
5664
|
+
});
|
|
5836
5665
|
}
|
|
5837
5666
|
loadTextureAtlas(path, success = () => {
|
|
5838
5667
|
}, error = () => {
|
|
@@ -5840,32 +5669,113 @@ var AssetManagerBase = class {
|
|
|
5840
5669
|
let index = path.lastIndexOf("/");
|
|
5841
5670
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
5842
5671
|
path = this.start(path);
|
|
5843
|
-
this.
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
(
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
if (
|
|
5854
|
-
|
|
5672
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5673
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5674
|
+
this.downloader.downloadText(path, (atlasText) => {
|
|
5675
|
+
try {
|
|
5676
|
+
let atlas = new TextureAtlas(atlasText);
|
|
5677
|
+
let toLoad = atlas.pages.length, abort = false;
|
|
5678
|
+
for (let page of atlas.pages) {
|
|
5679
|
+
this.loadTexture(
|
|
5680
|
+
!fileAlias ? parent + page.name : fileAlias[page.name],
|
|
5681
|
+
(imagePath, texture) => {
|
|
5682
|
+
if (!abort) {
|
|
5683
|
+
page.setTexture(texture);
|
|
5684
|
+
if (--toLoad == 0) {
|
|
5685
|
+
this.success(success, path, atlas);
|
|
5686
|
+
resolve(atlas);
|
|
5687
|
+
}
|
|
5688
|
+
}
|
|
5689
|
+
},
|
|
5690
|
+
(imagePath, message) => {
|
|
5691
|
+
if (!abort) {
|
|
5692
|
+
const errorMsg = `Couldn't load texture atlas ${path} page image: ${imagePath}`;
|
|
5693
|
+
this.error(error, path, errorMsg);
|
|
5694
|
+
reject(errorMsg);
|
|
5695
|
+
}
|
|
5696
|
+
abort = true;
|
|
5855
5697
|
}
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
);
|
|
5698
|
+
);
|
|
5699
|
+
}
|
|
5700
|
+
} catch (e) {
|
|
5701
|
+
const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
|
|
5702
|
+
this.error(error, path, errorMsg);
|
|
5703
|
+
reject(errorMsg);
|
|
5863
5704
|
}
|
|
5864
|
-
}
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5705
|
+
}, (status, responseText) => {
|
|
5706
|
+
const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
|
|
5707
|
+
this.error(error, path, errorMsg);
|
|
5708
|
+
reject(errorMsg);
|
|
5709
|
+
});
|
|
5710
|
+
});
|
|
5711
|
+
}
|
|
5712
|
+
loadTextureAtlasButNoTextures(path, success = () => {
|
|
5713
|
+
}, error = () => {
|
|
5714
|
+
}, fileAlias) {
|
|
5715
|
+
path = this.start(path);
|
|
5716
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5717
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5718
|
+
this.downloader.downloadText(path, (atlasText) => {
|
|
5719
|
+
try {
|
|
5720
|
+
const atlas = new TextureAtlas(atlasText);
|
|
5721
|
+
this.success(success, path, atlas);
|
|
5722
|
+
resolve(atlas);
|
|
5723
|
+
} catch (e) {
|
|
5724
|
+
const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
|
|
5725
|
+
this.error(error, path, errorMsg);
|
|
5726
|
+
reject(errorMsg);
|
|
5727
|
+
}
|
|
5728
|
+
}, (status, responseText) => {
|
|
5729
|
+
const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
|
|
5730
|
+
this.error(error, path, errorMsg);
|
|
5731
|
+
reject(errorMsg);
|
|
5732
|
+
});
|
|
5733
|
+
});
|
|
5734
|
+
}
|
|
5735
|
+
// Promisified versions of load function
|
|
5736
|
+
async loadBinaryAsync(path) {
|
|
5737
|
+
return new Promise((resolve, reject) => {
|
|
5738
|
+
this.loadBinary(
|
|
5739
|
+
path,
|
|
5740
|
+
(_, binary) => resolve(binary),
|
|
5741
|
+
(_, message) => reject(message)
|
|
5742
|
+
);
|
|
5743
|
+
});
|
|
5744
|
+
}
|
|
5745
|
+
async loadJsonAsync(path) {
|
|
5746
|
+
return new Promise((resolve, reject) => {
|
|
5747
|
+
this.loadJson(
|
|
5748
|
+
path,
|
|
5749
|
+
(_, object) => resolve(object),
|
|
5750
|
+
(_, message) => reject(message)
|
|
5751
|
+
);
|
|
5752
|
+
});
|
|
5753
|
+
}
|
|
5754
|
+
async loadTextureAsync(path) {
|
|
5755
|
+
return new Promise((resolve, reject) => {
|
|
5756
|
+
this.loadTexture(
|
|
5757
|
+
path,
|
|
5758
|
+
(_, texture) => resolve(texture),
|
|
5759
|
+
(_, message) => reject(message)
|
|
5760
|
+
);
|
|
5761
|
+
});
|
|
5762
|
+
}
|
|
5763
|
+
async loadTextureAtlasAsync(path) {
|
|
5764
|
+
return new Promise((resolve, reject) => {
|
|
5765
|
+
this.loadTextureAtlas(
|
|
5766
|
+
path,
|
|
5767
|
+
(_, atlas) => resolve(atlas),
|
|
5768
|
+
(_, message) => reject(message)
|
|
5769
|
+
);
|
|
5770
|
+
});
|
|
5771
|
+
}
|
|
5772
|
+
async loadTextureAtlasButNoTexturesAsync(path) {
|
|
5773
|
+
return new Promise((resolve, reject) => {
|
|
5774
|
+
this.loadTextureAtlasButNoTextures(
|
|
5775
|
+
path,
|
|
5776
|
+
(_, atlas) => resolve(atlas),
|
|
5777
|
+
(_, message) => reject(message)
|
|
5778
|
+
);
|
|
5869
5779
|
});
|
|
5870
5780
|
}
|
|
5871
5781
|
get(path) {
|
|
@@ -5874,26 +5784,27 @@ var AssetManagerBase = class {
|
|
|
5874
5784
|
require(path) {
|
|
5875
5785
|
path = this.pathPrefix + path;
|
|
5876
5786
|
let asset = this.assets[path];
|
|
5877
|
-
if (asset)
|
|
5878
|
-
return asset;
|
|
5787
|
+
if (asset) return asset;
|
|
5879
5788
|
let error = this.errors[path];
|
|
5880
5789
|
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
|
5881
5790
|
}
|
|
5882
5791
|
remove(path) {
|
|
5883
5792
|
path = this.pathPrefix + path;
|
|
5884
5793
|
let asset = this.assets[path];
|
|
5885
|
-
if (asset.dispose)
|
|
5886
|
-
asset.dispose();
|
|
5794
|
+
if (asset.dispose) asset.dispose();
|
|
5887
5795
|
delete this.assets[path];
|
|
5796
|
+
delete this.assetsRefCount[path];
|
|
5797
|
+
delete this.assetsLoaded[path];
|
|
5888
5798
|
return asset;
|
|
5889
5799
|
}
|
|
5890
5800
|
removeAll() {
|
|
5891
|
-
for (let
|
|
5892
|
-
let asset = this.assets[
|
|
5893
|
-
if (asset.dispose)
|
|
5894
|
-
asset.dispose();
|
|
5801
|
+
for (let path in this.assets) {
|
|
5802
|
+
let asset = this.assets[path];
|
|
5803
|
+
if (asset.dispose) asset.dispose();
|
|
5895
5804
|
}
|
|
5896
5805
|
this.assets = {};
|
|
5806
|
+
this.assetsLoaded = {};
|
|
5807
|
+
this.assetsRefCount = {};
|
|
5897
5808
|
}
|
|
5898
5809
|
isLoadingComplete() {
|
|
5899
5810
|
return this.toLoad == 0;
|
|
@@ -5907,6 +5818,12 @@ var AssetManagerBase = class {
|
|
|
5907
5818
|
dispose() {
|
|
5908
5819
|
this.removeAll();
|
|
5909
5820
|
}
|
|
5821
|
+
// dispose asset only if it's not used by others
|
|
5822
|
+
disposeAsset(path) {
|
|
5823
|
+
if (--this.assetsRefCount[path] === 0) {
|
|
5824
|
+
this.remove(path);
|
|
5825
|
+
}
|
|
5826
|
+
}
|
|
5910
5827
|
hasErrors() {
|
|
5911
5828
|
return Object.keys(this.errors).length > 0;
|
|
5912
5829
|
}
|
|
@@ -5943,18 +5860,16 @@ var Downloader = class {
|
|
|
5943
5860
|
throw new Error("Not a data URI.");
|
|
5944
5861
|
}
|
|
5945
5862
|
let base64Idx = dataUri.indexOf("base64,");
|
|
5946
|
-
if (base64Idx == -1)
|
|
5947
|
-
throw new Error("Not a binary data URI.");
|
|
5863
|
+
if (base64Idx == -1) throw new Error("Not a binary data URI.");
|
|
5948
5864
|
base64Idx += "base64,".length;
|
|
5949
5865
|
return this.base64ToUint8Array(dataUri.substr(base64Idx));
|
|
5950
5866
|
}
|
|
5951
5867
|
downloadText(url, success, error) {
|
|
5952
|
-
if (this.start(url, success, error))
|
|
5953
|
-
|
|
5954
|
-
if (
|
|
5868
|
+
if (this.start(url, success, error)) return;
|
|
5869
|
+
const rawDataUri = this.rawDataUris[url];
|
|
5870
|
+
if (rawDataUri && !rawDataUri.includes(".")) {
|
|
5955
5871
|
try {
|
|
5956
|
-
|
|
5957
|
-
this.finish(url, 200, this.dataUriToString(dataUri));
|
|
5872
|
+
this.finish(url, 200, this.dataUriToString(rawDataUri));
|
|
5958
5873
|
} catch (e) {
|
|
5959
5874
|
this.finish(url, 400, JSON.stringify(e));
|
|
5960
5875
|
}
|
|
@@ -5962,7 +5877,7 @@ var Downloader = class {
|
|
|
5962
5877
|
}
|
|
5963
5878
|
let request = new XMLHttpRequest();
|
|
5964
5879
|
request.overrideMimeType("text/html");
|
|
5965
|
-
request.open("GET", url, true);
|
|
5880
|
+
request.open("GET", rawDataUri ? rawDataUri : url, true);
|
|
5966
5881
|
let done = () => {
|
|
5967
5882
|
this.finish(url, request.status, request.responseText);
|
|
5968
5883
|
};
|
|
@@ -5976,19 +5891,18 @@ var Downloader = class {
|
|
|
5976
5891
|
}, error);
|
|
5977
5892
|
}
|
|
5978
5893
|
downloadBinary(url, success, error) {
|
|
5979
|
-
if (this.start(url, success, error))
|
|
5980
|
-
|
|
5981
|
-
if (
|
|
5894
|
+
if (this.start(url, success, error)) return;
|
|
5895
|
+
const rawDataUri = this.rawDataUris[url];
|
|
5896
|
+
if (rawDataUri && !rawDataUri.includes(".")) {
|
|
5982
5897
|
try {
|
|
5983
|
-
|
|
5984
|
-
this.finish(url, 200, this.dataUriToUint8Array(dataUri));
|
|
5898
|
+
this.finish(url, 200, this.dataUriToUint8Array(rawDataUri));
|
|
5985
5899
|
} catch (e) {
|
|
5986
5900
|
this.finish(url, 400, JSON.stringify(e));
|
|
5987
5901
|
}
|
|
5988
5902
|
return;
|
|
5989
5903
|
}
|
|
5990
5904
|
let request = new XMLHttpRequest();
|
|
5991
|
-
request.open("GET", url, true);
|
|
5905
|
+
request.open("GET", rawDataUri ? rawDataUri : url, true);
|
|
5992
5906
|
request.responseType = "arraybuffer";
|
|
5993
5907
|
let onerror = () => {
|
|
5994
5908
|
this.finish(url, request.status, request.response);
|
|
@@ -6005,8 +5919,7 @@ var Downloader = class {
|
|
|
6005
5919
|
start(url, success, error) {
|
|
6006
5920
|
let callbacks = this.callbacks[url];
|
|
6007
5921
|
try {
|
|
6008
|
-
if (callbacks)
|
|
6009
|
-
return true;
|
|
5922
|
+
if (callbacks) return true;
|
|
6010
5923
|
this.callbacks[url] = callbacks = [];
|
|
6011
5924
|
} finally {
|
|
6012
5925
|
callbacks.push(success, error);
|
|
@@ -6031,8 +5944,7 @@ var Event = class {
|
|
|
6031
5944
|
volume = 0;
|
|
6032
5945
|
balance = 0;
|
|
6033
5946
|
constructor(time, data) {
|
|
6034
|
-
if (!data)
|
|
6035
|
-
throw new Error("data cannot be null.");
|
|
5947
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6036
5948
|
this.time = time;
|
|
6037
5949
|
this.data = data;
|
|
6038
5950
|
}
|
|
@@ -6073,21 +5985,17 @@ var IkConstraint = class {
|
|
|
6073
5985
|
softness = 0;
|
|
6074
5986
|
active = false;
|
|
6075
5987
|
constructor(data, skeleton) {
|
|
6076
|
-
if (!data)
|
|
6077
|
-
|
|
6078
|
-
if (!skeleton)
|
|
6079
|
-
throw new Error("skeleton cannot be null.");
|
|
5988
|
+
if (!data) throw new Error("data cannot be null.");
|
|
5989
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
6080
5990
|
this.data = data;
|
|
6081
5991
|
this.bones = new Array();
|
|
6082
5992
|
for (let i = 0; i < data.bones.length; i++) {
|
|
6083
5993
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
6084
|
-
if (!bone)
|
|
6085
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
5994
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
6086
5995
|
this.bones.push(bone);
|
|
6087
5996
|
}
|
|
6088
5997
|
let target = skeleton.findBone(data.target.name);
|
|
6089
|
-
if (!target)
|
|
6090
|
-
throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
5998
|
+
if (!target) throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
6091
5999
|
this.target = target;
|
|
6092
6000
|
this.mix = data.mix;
|
|
6093
6001
|
this.softness = data.softness;
|
|
@@ -6107,8 +6015,7 @@ var IkConstraint = class {
|
|
|
6107
6015
|
this.stretch = data.stretch;
|
|
6108
6016
|
}
|
|
6109
6017
|
update(physics) {
|
|
6110
|
-
if (this.mix == 0)
|
|
6111
|
-
return;
|
|
6018
|
+
if (this.mix == 0) return;
|
|
6112
6019
|
let target = this.target;
|
|
6113
6020
|
let bones = this.bones;
|
|
6114
6021
|
switch (bones.length) {
|
|
@@ -6123,8 +6030,7 @@ var IkConstraint = class {
|
|
|
6123
6030
|
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
|
|
6124
6031
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
6125
6032
|
let p = bone.parent;
|
|
6126
|
-
if (!p)
|
|
6127
|
-
throw new Error("IK bone must have parent.");
|
|
6033
|
+
if (!p) throw new Error("IK bone must have parent.");
|
|
6128
6034
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
6129
6035
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
6130
6036
|
switch (bone.inherit) {
|
|
@@ -6139,6 +6045,7 @@ var IkConstraint = class {
|
|
|
6139
6045
|
pb = -sc * s * bone.skeleton.scaleX;
|
|
6140
6046
|
pd = sa * s * bone.skeleton.scaleY;
|
|
6141
6047
|
rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;
|
|
6048
|
+
// Fall through
|
|
6142
6049
|
default:
|
|
6143
6050
|
let x = targetX - p.worldX, y = targetY - p.worldY;
|
|
6144
6051
|
let d = pa * pd - pb * pc;
|
|
@@ -6151,8 +6058,7 @@ var IkConstraint = class {
|
|
|
6151
6058
|
}
|
|
6152
6059
|
}
|
|
6153
6060
|
rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
|
|
6154
|
-
if (bone.ascaleX < 0)
|
|
6155
|
-
rotationIK += 180;
|
|
6061
|
+
if (bone.ascaleX < 0) rotationIK += 180;
|
|
6156
6062
|
if (rotationIK > 180)
|
|
6157
6063
|
rotationIK -= 360;
|
|
6158
6064
|
else if (rotationIK < -180)
|
|
@@ -6171,8 +6077,7 @@ var IkConstraint = class {
|
|
|
6171
6077
|
if (compress && dd < b * b || stretch && dd > b * b) {
|
|
6172
6078
|
const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
|
|
6173
6079
|
sx *= s;
|
|
6174
|
-
if (uniform)
|
|
6175
|
-
sy *= s;
|
|
6080
|
+
if (uniform) sy *= s;
|
|
6176
6081
|
}
|
|
6177
6082
|
}
|
|
6178
6083
|
}
|
|
@@ -6189,8 +6094,7 @@ var IkConstraint = class {
|
|
|
6189
6094
|
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6190
6095
|
* @param child A direct descendant of the parent bone. */
|
|
6191
6096
|
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
6192
|
-
if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */)
|
|
6193
|
-
return;
|
|
6097
|
+
if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */) return;
|
|
6194
6098
|
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
6195
6099
|
let os1 = 0, os2 = 0, s2 = 0;
|
|
6196
6100
|
if (psx < 0) {
|
|
@@ -6222,8 +6126,7 @@ var IkConstraint = class {
|
|
|
6222
6126
|
cwy = c * cx + d * cy + parent.worldY;
|
|
6223
6127
|
}
|
|
6224
6128
|
let pp = parent.parent;
|
|
6225
|
-
if (!pp)
|
|
6226
|
-
throw new Error("IK parent must itself have a parent.");
|
|
6129
|
+
if (!pp) throw new Error("IK parent must itself have a parent.");
|
|
6227
6130
|
a = pp.a;
|
|
6228
6131
|
b = pp.b;
|
|
6229
6132
|
c = pp.c;
|
|
@@ -6265,8 +6168,7 @@ var IkConstraint = class {
|
|
|
6265
6168
|
if (stretch) {
|
|
6266
6169
|
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
|
6267
6170
|
sx *= a;
|
|
6268
|
-
if (uniform)
|
|
6269
|
-
sy *= a;
|
|
6171
|
+
if (uniform) sy *= a;
|
|
6270
6172
|
}
|
|
6271
6173
|
} else
|
|
6272
6174
|
a2 = Math.acos(cos) * bendDir;
|
|
@@ -6282,8 +6184,7 @@ var IkConstraint = class {
|
|
|
6282
6184
|
d = c1 * c1 - 4 * c2 * c;
|
|
6283
6185
|
if (d >= 0) {
|
|
6284
6186
|
let q = Math.sqrt(d);
|
|
6285
|
-
if (c1 < 0)
|
|
6286
|
-
q = -q;
|
|
6187
|
+
if (c1 < 0) q = -q;
|
|
6287
6188
|
q = -(c1 + q) * 0.5;
|
|
6288
6189
|
let r0 = q / c2, r1 = c / q;
|
|
6289
6190
|
let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
|
@@ -6352,10 +6253,8 @@ var IkConstraintData = class extends ConstraintData {
|
|
|
6352
6253
|
this._target = boneData;
|
|
6353
6254
|
}
|
|
6354
6255
|
get target() {
|
|
6355
|
-
if (!this._target)
|
|
6356
|
-
|
|
6357
|
-
else
|
|
6358
|
-
return this._target;
|
|
6256
|
+
if (!this._target) throw new Error("BoneData not set.");
|
|
6257
|
+
else return this._target;
|
|
6359
6258
|
}
|
|
6360
6259
|
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
6361
6260
|
bendDirection = 0;
|
|
@@ -6386,17 +6285,15 @@ var PathConstraintData = class extends ConstraintData {
|
|
|
6386
6285
|
this._target = slotData;
|
|
6387
6286
|
}
|
|
6388
6287
|
get target() {
|
|
6389
|
-
if (!this._target)
|
|
6390
|
-
|
|
6391
|
-
else
|
|
6392
|
-
return this._target;
|
|
6288
|
+
if (!this._target) throw new Error("SlotData not set.");
|
|
6289
|
+
else return this._target;
|
|
6393
6290
|
}
|
|
6394
6291
|
/** The mode for positioning the first bone on the path. */
|
|
6395
|
-
positionMode =
|
|
6292
|
+
positionMode = 0 /* Fixed */;
|
|
6396
6293
|
/** The mode for positioning the bones after the first bone on the path. */
|
|
6397
|
-
spacingMode =
|
|
6294
|
+
spacingMode = 1 /* Fixed */;
|
|
6398
6295
|
/** The mode for adjusting the rotation of the bones. */
|
|
6399
|
-
rotateMode =
|
|
6296
|
+
rotateMode = 1 /* Chain */;
|
|
6400
6297
|
/** An offset added to the constrained bone rotation. */
|
|
6401
6298
|
offsetRotation = 0;
|
|
6402
6299
|
/** The position along the path. */
|
|
@@ -6430,7 +6327,11 @@ var RotateMode = /* @__PURE__ */ ((RotateMode2) => {
|
|
|
6430
6327
|
})(RotateMode || {});
|
|
6431
6328
|
|
|
6432
6329
|
// spine-core/src/PathConstraint.ts
|
|
6433
|
-
var
|
|
6330
|
+
var PathConstraint = class _PathConstraint {
|
|
6331
|
+
static NONE = -1;
|
|
6332
|
+
static BEFORE = -2;
|
|
6333
|
+
static AFTER = -3;
|
|
6334
|
+
static epsilon = 1e-5;
|
|
6434
6335
|
/** The path constraint's setup pose data. */
|
|
6435
6336
|
data;
|
|
6436
6337
|
/** The bones that will be modified by this path constraint. */
|
|
@@ -6452,21 +6353,17 @@ var _PathConstraint = class {
|
|
|
6452
6353
|
segments = new Array();
|
|
6453
6354
|
active = false;
|
|
6454
6355
|
constructor(data, skeleton) {
|
|
6455
|
-
if (!data)
|
|
6456
|
-
|
|
6457
|
-
if (!skeleton)
|
|
6458
|
-
throw new Error("skeleton cannot be null.");
|
|
6356
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6357
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
6459
6358
|
this.data = data;
|
|
6460
6359
|
this.bones = new Array();
|
|
6461
6360
|
for (let i = 0, n = data.bones.length; i < n; i++) {
|
|
6462
6361
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
6463
|
-
if (!bone)
|
|
6464
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
6362
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
6465
6363
|
this.bones.push(bone);
|
|
6466
6364
|
}
|
|
6467
6365
|
let target = skeleton.findSlot(data.target.name);
|
|
6468
|
-
if (!target)
|
|
6469
|
-
throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
6366
|
+
if (!target) throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
6470
6367
|
this.target = target;
|
|
6471
6368
|
this.position = data.position;
|
|
6472
6369
|
this.spacing = data.spacing;
|
|
@@ -6487,11 +6384,9 @@ var _PathConstraint = class {
|
|
|
6487
6384
|
}
|
|
6488
6385
|
update(physics) {
|
|
6489
6386
|
let attachment = this.target.getAttachment();
|
|
6490
|
-
if (!(attachment instanceof PathAttachment))
|
|
6491
|
-
return;
|
|
6387
|
+
if (!(attachment instanceof PathAttachment)) return;
|
|
6492
6388
|
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY;
|
|
6493
|
-
if (mixRotate == 0 && mixX == 0 && mixY == 0)
|
|
6494
|
-
return;
|
|
6389
|
+
if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
|
|
6495
6390
|
let data = this.data;
|
|
6496
6391
|
let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
|
|
6497
6392
|
let bones = this.bones;
|
|
@@ -6516,14 +6411,12 @@ var _PathConstraint = class {
|
|
|
6516
6411
|
let bone = bones[i];
|
|
6517
6412
|
let setupLength = bone.data.length;
|
|
6518
6413
|
if (setupLength < _PathConstraint.epsilon) {
|
|
6519
|
-
if (scale)
|
|
6520
|
-
lengths[i] = 0;
|
|
6414
|
+
if (scale) lengths[i] = 0;
|
|
6521
6415
|
spaces[++i] = spacing;
|
|
6522
6416
|
} else {
|
|
6523
6417
|
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6524
6418
|
let length = Math.sqrt(x * x + y * y);
|
|
6525
|
-
if (scale)
|
|
6526
|
-
lengths[i] = length;
|
|
6419
|
+
if (scale) lengths[i] = length;
|
|
6527
6420
|
spaces[++i] = length;
|
|
6528
6421
|
sum += length;
|
|
6529
6422
|
}
|
|
@@ -6540,14 +6433,12 @@ var _PathConstraint = class {
|
|
|
6540
6433
|
let bone = bones[i];
|
|
6541
6434
|
let setupLength = bone.data.length;
|
|
6542
6435
|
if (setupLength < _PathConstraint.epsilon) {
|
|
6543
|
-
if (scale)
|
|
6544
|
-
lengths[i] = 0;
|
|
6436
|
+
if (scale) lengths[i] = 0;
|
|
6545
6437
|
spaces[++i] = spacing;
|
|
6546
6438
|
} else {
|
|
6547
6439
|
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6548
6440
|
let length = Math.sqrt(x * x + y * y);
|
|
6549
|
-
if (scale)
|
|
6550
|
-
lengths[i] = length;
|
|
6441
|
+
if (scale) lengths[i] = length;
|
|
6551
6442
|
spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
|
|
6552
6443
|
}
|
|
6553
6444
|
}
|
|
@@ -6620,8 +6511,7 @@ var _PathConstraint = class {
|
|
|
6620
6511
|
let lengths = path.lengths;
|
|
6621
6512
|
curveCount -= closed2 ? 1 : 2;
|
|
6622
6513
|
let pathLength2 = lengths[curveCount];
|
|
6623
|
-
if (this.data.positionMode == 1 /* Percent */)
|
|
6624
|
-
position *= pathLength2;
|
|
6514
|
+
if (this.data.positionMode == 1 /* Percent */) position *= pathLength2;
|
|
6625
6515
|
let multiplier2;
|
|
6626
6516
|
switch (this.data.spacingMode) {
|
|
6627
6517
|
case 2 /* Percent */:
|
|
@@ -6640,8 +6530,7 @@ var _PathConstraint = class {
|
|
|
6640
6530
|
let p = position;
|
|
6641
6531
|
if (closed2) {
|
|
6642
6532
|
p %= pathLength2;
|
|
6643
|
-
if (p < 0)
|
|
6644
|
-
p += pathLength2;
|
|
6533
|
+
if (p < 0) p += pathLength2;
|
|
6645
6534
|
curve = 0;
|
|
6646
6535
|
} else if (p < 0) {
|
|
6647
6536
|
if (prevCurve != _PathConstraint.BEFORE) {
|
|
@@ -6660,8 +6549,7 @@ var _PathConstraint = class {
|
|
|
6660
6549
|
}
|
|
6661
6550
|
for (; ; curve++) {
|
|
6662
6551
|
let length = lengths[curve];
|
|
6663
|
-
if (p > length)
|
|
6664
|
-
continue;
|
|
6552
|
+
if (p > length) continue;
|
|
6665
6553
|
if (curve == 0)
|
|
6666
6554
|
p /= length;
|
|
6667
6555
|
else {
|
|
@@ -6743,8 +6631,7 @@ var _PathConstraint = class {
|
|
|
6743
6631
|
x1 = x2;
|
|
6744
6632
|
y1 = y2;
|
|
6745
6633
|
}
|
|
6746
|
-
if (this.data.positionMode == 1 /* Percent */)
|
|
6747
|
-
position *= pathLength;
|
|
6634
|
+
if (this.data.positionMode == 1 /* Percent */) position *= pathLength;
|
|
6748
6635
|
let multiplier;
|
|
6749
6636
|
switch (this.data.spacingMode) {
|
|
6750
6637
|
case 2 /* Percent */:
|
|
@@ -6764,8 +6651,7 @@ var _PathConstraint = class {
|
|
|
6764
6651
|
let p = position;
|
|
6765
6652
|
if (closed2) {
|
|
6766
6653
|
p %= pathLength;
|
|
6767
|
-
if (p < 0)
|
|
6768
|
-
p += pathLength;
|
|
6654
|
+
if (p < 0) p += pathLength;
|
|
6769
6655
|
curve = 0;
|
|
6770
6656
|
} else if (p < 0) {
|
|
6771
6657
|
this.addBeforePosition(p, world, 0, out, o);
|
|
@@ -6776,8 +6662,7 @@ var _PathConstraint = class {
|
|
|
6776
6662
|
}
|
|
6777
6663
|
for (; ; curve++) {
|
|
6778
6664
|
let length = curves[curve];
|
|
6779
|
-
if (p > length)
|
|
6780
|
-
continue;
|
|
6665
|
+
if (p > length) continue;
|
|
6781
6666
|
if (curve == 0)
|
|
6782
6667
|
p /= length;
|
|
6783
6668
|
else {
|
|
@@ -6828,8 +6713,7 @@ var _PathConstraint = class {
|
|
|
6828
6713
|
p *= curveLength;
|
|
6829
6714
|
for (; ; segment++) {
|
|
6830
6715
|
let length = segments[segment];
|
|
6831
|
-
if (p > length)
|
|
6832
|
-
continue;
|
|
6716
|
+
if (p > length) continue;
|
|
6833
6717
|
if (segment == 0)
|
|
6834
6718
|
p /= length;
|
|
6835
6719
|
else {
|
|
@@ -6874,11 +6758,6 @@ var _PathConstraint = class {
|
|
|
6874
6758
|
}
|
|
6875
6759
|
}
|
|
6876
6760
|
};
|
|
6877
|
-
var PathConstraint = _PathConstraint;
|
|
6878
|
-
__publicField(PathConstraint, "NONE", -1);
|
|
6879
|
-
__publicField(PathConstraint, "BEFORE", -2);
|
|
6880
|
-
__publicField(PathConstraint, "AFTER", -3);
|
|
6881
|
-
__publicField(PathConstraint, "epsilon", 1e-5);
|
|
6882
6761
|
|
|
6883
6762
|
// spine-core/src/PhysicsConstraint.ts
|
|
6884
6763
|
var PhysicsConstraint = class {
|
|
@@ -6889,10 +6768,8 @@ var PhysicsConstraint = class {
|
|
|
6889
6768
|
this._bone = bone;
|
|
6890
6769
|
}
|
|
6891
6770
|
get bone() {
|
|
6892
|
-
if (!this._bone)
|
|
6893
|
-
|
|
6894
|
-
else
|
|
6895
|
-
return this._bone;
|
|
6771
|
+
if (!this._bone) throw new Error("Bone not set.");
|
|
6772
|
+
else return this._bone;
|
|
6896
6773
|
}
|
|
6897
6774
|
inertia = 0;
|
|
6898
6775
|
strength = 0;
|
|
@@ -6961,8 +6838,7 @@ var PhysicsConstraint = class {
|
|
|
6961
6838
|
/** Applies the constraint to the constrained bones. */
|
|
6962
6839
|
update(physics) {
|
|
6963
6840
|
const mix = this.mix;
|
|
6964
|
-
if (mix == 0)
|
|
6965
|
-
return;
|
|
6841
|
+
if (mix == 0) return;
|
|
6966
6842
|
const x = this.data.x > 0, y = this.data.y > 0, rotateOrShearX = this.data.rotate > 0 || this.data.shearX > 0, scaleX = this.data.scaleX > 0;
|
|
6967
6843
|
const bone = this.bone;
|
|
6968
6844
|
const l = bone.data.length;
|
|
@@ -6971,6 +6847,7 @@ var PhysicsConstraint = class {
|
|
|
6971
6847
|
return;
|
|
6972
6848
|
case 1 /* reset */:
|
|
6973
6849
|
this.reset();
|
|
6850
|
+
// Fall through.
|
|
6974
6851
|
case 2 /* update */:
|
|
6975
6852
|
const skeleton = this.skeleton;
|
|
6976
6853
|
const delta = Math.max(this.skeleton.time - this.lastTime, 0);
|
|
@@ -7013,10 +6890,8 @@ var PhysicsConstraint = class {
|
|
|
7013
6890
|
a -= t;
|
|
7014
6891
|
} while (a >= t);
|
|
7015
6892
|
}
|
|
7016
|
-
if (x)
|
|
7017
|
-
|
|
7018
|
-
if (y)
|
|
7019
|
-
bone.worldY += this.yOffset * mix * this.data.y;
|
|
6893
|
+
if (x) bone.worldX += this.xOffset * mix * this.data.x;
|
|
6894
|
+
if (y) bone.worldY += this.yOffset * mix * this.data.y;
|
|
7020
6895
|
}
|
|
7021
6896
|
if (rotateOrShearX || scaleX) {
|
|
7022
6897
|
let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
|
|
@@ -7038,20 +6913,17 @@ var PhysicsConstraint = class {
|
|
|
7038
6913
|
s = Math.sin(r);
|
|
7039
6914
|
if (scaleX) {
|
|
7040
6915
|
r = l * bone.getWorldScaleX();
|
|
7041
|
-
if (r > 0)
|
|
7042
|
-
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
6916
|
+
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7043
6917
|
}
|
|
7044
6918
|
} else {
|
|
7045
6919
|
c = Math.cos(ca);
|
|
7046
6920
|
s = Math.sin(ca);
|
|
7047
6921
|
const r = l * bone.getWorldScaleX();
|
|
7048
|
-
if (r > 0)
|
|
7049
|
-
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
6922
|
+
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7050
6923
|
}
|
|
7051
6924
|
a = this.remaining;
|
|
7052
6925
|
if (a >= t) {
|
|
7053
|
-
if (d == -1)
|
|
7054
|
-
d = Math.pow(this.damping, 60 * t);
|
|
6926
|
+
if (d == -1) d = Math.pow(this.damping, 60 * t);
|
|
7055
6927
|
const m = this.massInverse * t, e = this.strength, w = this.wind, g = Skeleton.yDown ? -this.gravity : this.gravity, h = l / f;
|
|
7056
6928
|
while (true) {
|
|
7057
6929
|
a -= t;
|
|
@@ -7064,8 +6936,7 @@ var PhysicsConstraint = class {
|
|
|
7064
6936
|
this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
|
|
7065
6937
|
this.rotateOffset += this.rotateVelocity * t;
|
|
7066
6938
|
this.rotateVelocity *= d;
|
|
7067
|
-
if (a < t)
|
|
7068
|
-
break;
|
|
6939
|
+
if (a < t) break;
|
|
7069
6940
|
const r = this.rotateOffset * mr + ca;
|
|
7070
6941
|
c = Math.cos(r);
|
|
7071
6942
|
s = Math.sin(r);
|
|
@@ -7080,10 +6951,8 @@ var PhysicsConstraint = class {
|
|
|
7080
6951
|
this.cy = bone.worldY;
|
|
7081
6952
|
break;
|
|
7082
6953
|
case 3 /* pose */:
|
|
7083
|
-
if (x)
|
|
7084
|
-
|
|
7085
|
-
if (y)
|
|
7086
|
-
bone.worldY += this.yOffset * mix * this.data.y;
|
|
6954
|
+
if (x) bone.worldX += this.xOffset * mix * this.data.x;
|
|
6955
|
+
if (y) bone.worldY += this.yOffset * mix * this.data.y;
|
|
7087
6956
|
}
|
|
7088
6957
|
if (rotateOrShearX) {
|
|
7089
6958
|
let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
|
|
@@ -7166,10 +7035,8 @@ var Slot = class {
|
|
|
7166
7035
|
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
|
|
7167
7036
|
deform = new Array();
|
|
7168
7037
|
constructor(data, bone) {
|
|
7169
|
-
if (!data)
|
|
7170
|
-
|
|
7171
|
-
if (!bone)
|
|
7172
|
-
throw new Error("bone cannot be null.");
|
|
7038
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7039
|
+
if (!bone) throw new Error("bone cannot be null.");
|
|
7173
7040
|
this.data = data;
|
|
7174
7041
|
this.bone = bone;
|
|
7175
7042
|
this.color = new Color();
|
|
@@ -7188,8 +7055,7 @@ var Slot = class {
|
|
|
7188
7055
|
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
|
|
7189
7056
|
* specified attachment. */
|
|
7190
7057
|
setAttachment(attachment) {
|
|
7191
|
-
if (this.attachment == attachment)
|
|
7192
|
-
return;
|
|
7058
|
+
if (this.attachment == attachment) return;
|
|
7193
7059
|
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttachment != this.attachment.timelineAttachment) {
|
|
7194
7060
|
this.deform.length = 0;
|
|
7195
7061
|
}
|
|
@@ -7199,8 +7065,7 @@ var Slot = class {
|
|
|
7199
7065
|
/** Sets this slot to the setup pose. */
|
|
7200
7066
|
setToSetupPose() {
|
|
7201
7067
|
this.color.setFromColor(this.data.color);
|
|
7202
|
-
if (this.darkColor)
|
|
7203
|
-
this.darkColor.setFromColor(this.data.darkColor);
|
|
7068
|
+
if (this.darkColor) this.darkColor.setFromColor(this.data.darkColor);
|
|
7204
7069
|
if (!this.data.attachmentName)
|
|
7205
7070
|
this.attachment = null;
|
|
7206
7071
|
else {
|
|
@@ -7227,21 +7092,17 @@ var TransformConstraint = class {
|
|
|
7227
7092
|
temp = new Vector2();
|
|
7228
7093
|
active = false;
|
|
7229
7094
|
constructor(data, skeleton) {
|
|
7230
|
-
if (!data)
|
|
7231
|
-
|
|
7232
|
-
if (!skeleton)
|
|
7233
|
-
throw new Error("skeleton cannot be null.");
|
|
7095
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7096
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
7234
7097
|
this.data = data;
|
|
7235
7098
|
this.bones = new Array();
|
|
7236
7099
|
for (let i = 0; i < data.bones.length; i++) {
|
|
7237
7100
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
7238
|
-
if (!bone)
|
|
7239
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
7101
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
7240
7102
|
this.bones.push(bone);
|
|
7241
7103
|
}
|
|
7242
7104
|
let target = skeleton.findBone(data.target.name);
|
|
7243
|
-
if (!target)
|
|
7244
|
-
throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
7105
|
+
if (!target) throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
7245
7106
|
this.target = target;
|
|
7246
7107
|
this.mixRotate = data.mixRotate;
|
|
7247
7108
|
this.mixX = data.mixX;
|
|
@@ -7263,8 +7124,7 @@ var TransformConstraint = class {
|
|
|
7263
7124
|
this.mixShearY = data.mixShearY;
|
|
7264
7125
|
}
|
|
7265
7126
|
update(physics) {
|
|
7266
|
-
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
7267
|
-
return;
|
|
7127
|
+
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0) return;
|
|
7268
7128
|
if (this.data.local) {
|
|
7269
7129
|
if (this.data.relative)
|
|
7270
7130
|
this.applyRelativeLocal();
|
|
@@ -7310,15 +7170,13 @@ var TransformConstraint = class {
|
|
|
7310
7170
|
}
|
|
7311
7171
|
if (mixScaleX != 0) {
|
|
7312
7172
|
let s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
|
|
7313
|
-
if (s != 0)
|
|
7314
|
-
s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
|
|
7173
|
+
if (s != 0) s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
|
|
7315
7174
|
bone.a *= s;
|
|
7316
7175
|
bone.c *= s;
|
|
7317
7176
|
}
|
|
7318
7177
|
if (mixScaleY != 0) {
|
|
7319
7178
|
let s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
|
|
7320
|
-
if (s != 0)
|
|
7321
|
-
s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
|
|
7179
|
+
if (s != 0) s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
|
|
7322
7180
|
bone.b *= s;
|
|
7323
7181
|
bone.d *= s;
|
|
7324
7182
|
}
|
|
@@ -7400,8 +7258,7 @@ var TransformConstraint = class {
|
|
|
7400
7258
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7401
7259
|
let bone = bones[i];
|
|
7402
7260
|
let rotation = bone.arotation;
|
|
7403
|
-
if (mixRotate != 0)
|
|
7404
|
-
rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7261
|
+
if (mixRotate != 0) rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7405
7262
|
let x = bone.ax, y = bone.ay;
|
|
7406
7263
|
x += (target.ax - x + this.data.offsetX) * mixX;
|
|
7407
7264
|
y += (target.ay - y + this.data.offsetY) * mixY;
|
|
@@ -7411,8 +7268,7 @@ var TransformConstraint = class {
|
|
|
7411
7268
|
if (mixScaleY != 0 && scaleY != 0)
|
|
7412
7269
|
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
|
|
7413
7270
|
let shearY = bone.ashearY;
|
|
7414
|
-
if (mixShearY != 0)
|
|
7415
|
-
shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7271
|
+
if (mixShearY != 0) shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7416
7272
|
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
|
|
7417
7273
|
}
|
|
7418
7274
|
}
|
|
@@ -7434,7 +7290,9 @@ var TransformConstraint = class {
|
|
|
7434
7290
|
};
|
|
7435
7291
|
|
|
7436
7292
|
// spine-core/src/Skeleton.ts
|
|
7437
|
-
var
|
|
7293
|
+
var Skeleton = class _Skeleton {
|
|
7294
|
+
static quadTriangles = [0, 1, 2, 2, 3, 0];
|
|
7295
|
+
static yDown = false;
|
|
7438
7296
|
/** The skeleton's setup pose data. */
|
|
7439
7297
|
data;
|
|
7440
7298
|
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
@@ -7478,8 +7336,7 @@ var _Skeleton = class {
|
|
|
7478
7336
|
* See {@link #update(float)}. */
|
|
7479
7337
|
time = 0;
|
|
7480
7338
|
constructor(data) {
|
|
7481
|
-
if (!data)
|
|
7482
|
-
throw new Error("data cannot be null.");
|
|
7339
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7483
7340
|
this.data = data;
|
|
7484
7341
|
this.bones = new Array();
|
|
7485
7342
|
for (let i = 0; i < data.bones.length; i++) {
|
|
@@ -7590,8 +7447,7 @@ var _Skeleton = class {
|
|
|
7590
7447
|
}
|
|
7591
7448
|
sortIkConstraint(constraint) {
|
|
7592
7449
|
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7593
|
-
if (!constraint.active)
|
|
7594
|
-
return;
|
|
7450
|
+
if (!constraint.active) return;
|
|
7595
7451
|
let target = constraint.target;
|
|
7596
7452
|
this.sortBone(target);
|
|
7597
7453
|
let constrained = constraint.bones;
|
|
@@ -7610,20 +7466,17 @@ var _Skeleton = class {
|
|
|
7610
7466
|
}
|
|
7611
7467
|
sortPathConstraint(constraint) {
|
|
7612
7468
|
constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7613
|
-
if (!constraint.active)
|
|
7614
|
-
return;
|
|
7469
|
+
if (!constraint.active) return;
|
|
7615
7470
|
let slot = constraint.target;
|
|
7616
7471
|
let slotIndex = slot.data.index;
|
|
7617
7472
|
let slotBone = slot.bone;
|
|
7618
|
-
if (this.skin)
|
|
7619
|
-
this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
|
|
7473
|
+
if (this.skin) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
|
|
7620
7474
|
if (this.data.defaultSkin && this.data.defaultSkin != this.skin)
|
|
7621
7475
|
this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
|
|
7622
7476
|
for (let i = 0, n = this.data.skins.length; i < n; i++)
|
|
7623
7477
|
this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
|
|
7624
7478
|
let attachment = slot.getAttachment();
|
|
7625
|
-
if (attachment instanceof PathAttachment)
|
|
7626
|
-
this.sortPathConstraintAttachmentWith(attachment, slotBone);
|
|
7479
|
+
if (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);
|
|
7627
7480
|
let constrained = constraint.bones;
|
|
7628
7481
|
let boneCount = constrained.length;
|
|
7629
7482
|
for (let i = 0; i < boneCount; i++)
|
|
@@ -7636,8 +7489,7 @@ var _Skeleton = class {
|
|
|
7636
7489
|
}
|
|
7637
7490
|
sortTransformConstraint(constraint) {
|
|
7638
7491
|
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7639
|
-
if (!constraint.active)
|
|
7640
|
-
return;
|
|
7492
|
+
if (!constraint.active) return;
|
|
7641
7493
|
this.sortBone(constraint.target);
|
|
7642
7494
|
let constrained = constraint.bones;
|
|
7643
7495
|
let boneCount = constrained.length;
|
|
@@ -7660,15 +7512,13 @@ var _Skeleton = class {
|
|
|
7660
7512
|
}
|
|
7661
7513
|
sortPathConstraintAttachment(skin, slotIndex, slotBone) {
|
|
7662
7514
|
let attachments = skin.attachments[slotIndex];
|
|
7663
|
-
if (!attachments)
|
|
7664
|
-
return;
|
|
7515
|
+
if (!attachments) return;
|
|
7665
7516
|
for (let key in attachments) {
|
|
7666
7517
|
this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
|
|
7667
7518
|
}
|
|
7668
7519
|
}
|
|
7669
7520
|
sortPathConstraintAttachmentWith(attachment, slotBone) {
|
|
7670
|
-
if (!(attachment instanceof PathAttachment))
|
|
7671
|
-
return;
|
|
7521
|
+
if (!(attachment instanceof PathAttachment)) return;
|
|
7672
7522
|
let pathBones = attachment.bones;
|
|
7673
7523
|
if (!pathBones)
|
|
7674
7524
|
this.sortBone(slotBone);
|
|
@@ -7685,31 +7535,25 @@ var _Skeleton = class {
|
|
|
7685
7535
|
sortPhysicsConstraint(constraint) {
|
|
7686
7536
|
const bone = constraint.bone;
|
|
7687
7537
|
constraint.active = bone.active && (!constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7688
|
-
if (!constraint.active)
|
|
7689
|
-
return;
|
|
7538
|
+
if (!constraint.active) return;
|
|
7690
7539
|
this.sortBone(bone);
|
|
7691
7540
|
this._updateCache.push(constraint);
|
|
7692
7541
|
this.sortReset(bone.children);
|
|
7693
7542
|
bone.sorted = true;
|
|
7694
7543
|
}
|
|
7695
7544
|
sortBone(bone) {
|
|
7696
|
-
if (!bone)
|
|
7697
|
-
|
|
7698
|
-
if (bone.sorted)
|
|
7699
|
-
return;
|
|
7545
|
+
if (!bone) return;
|
|
7546
|
+
if (bone.sorted) return;
|
|
7700
7547
|
let parent = bone.parent;
|
|
7701
|
-
if (parent)
|
|
7702
|
-
this.sortBone(parent);
|
|
7548
|
+
if (parent) this.sortBone(parent);
|
|
7703
7549
|
bone.sorted = true;
|
|
7704
7550
|
this._updateCache.push(bone);
|
|
7705
7551
|
}
|
|
7706
7552
|
sortReset(bones) {
|
|
7707
7553
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7708
7554
|
let bone = bones[i];
|
|
7709
|
-
if (!bone.active)
|
|
7710
|
-
|
|
7711
|
-
if (bone.sorted)
|
|
7712
|
-
this.sortReset(bone.children);
|
|
7555
|
+
if (!bone.active) continue;
|
|
7556
|
+
if (bone.sorted) this.sortReset(bone.children);
|
|
7713
7557
|
bone.sorted = false;
|
|
7714
7558
|
}
|
|
7715
7559
|
}
|
|
@@ -7718,8 +7562,7 @@ var _Skeleton = class {
|
|
|
7718
7562
|
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7719
7563
|
* Runtimes Guide. */
|
|
7720
7564
|
updateWorldTransform(physics) {
|
|
7721
|
-
if (physics === void 0 || physics === null)
|
|
7722
|
-
throw new Error("physics is undefined");
|
|
7565
|
+
if (physics === void 0 || physics === null) throw new Error("physics is undefined");
|
|
7723
7566
|
let bones = this.bones;
|
|
7724
7567
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7725
7568
|
let bone = bones[i];
|
|
@@ -7736,8 +7579,7 @@ var _Skeleton = class {
|
|
|
7736
7579
|
updateCache[i].update(physics);
|
|
7737
7580
|
}
|
|
7738
7581
|
updateWorldTransformWith(physics, parent) {
|
|
7739
|
-
if (!parent)
|
|
7740
|
-
throw new Error("parent cannot be null.");
|
|
7582
|
+
if (!parent) throw new Error("parent cannot be null.");
|
|
7741
7583
|
let bones = this.bones;
|
|
7742
7584
|
for (let i = 1, n = bones.length; i < n; i++) {
|
|
7743
7585
|
let bone = bones[i];
|
|
@@ -7750,8 +7592,7 @@ var _Skeleton = class {
|
|
|
7750
7592
|
bone.ashearY = bone.shearY;
|
|
7751
7593
|
}
|
|
7752
7594
|
let rootBone = this.getRootBone();
|
|
7753
|
-
if (!rootBone)
|
|
7754
|
-
throw new Error("Root bone must not be null.");
|
|
7595
|
+
if (!rootBone) throw new Error("Root bone must not be null.");
|
|
7755
7596
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
7756
7597
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
7757
7598
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -7768,8 +7609,7 @@ var _Skeleton = class {
|
|
|
7768
7609
|
let updateCache = this._updateCache;
|
|
7769
7610
|
for (let i = 0, n = updateCache.length; i < n; i++) {
|
|
7770
7611
|
let updatable = updateCache[i];
|
|
7771
|
-
if (updatable != rootBone)
|
|
7772
|
-
updatable.update(physics);
|
|
7612
|
+
if (updatable != rootBone) updatable.update(physics);
|
|
7773
7613
|
}
|
|
7774
7614
|
}
|
|
7775
7615
|
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
@@ -7779,16 +7619,11 @@ var _Skeleton = class {
|
|
|
7779
7619
|
}
|
|
7780
7620
|
/** Sets the bones and constraints to their setup pose values. */
|
|
7781
7621
|
setBonesToSetupPose() {
|
|
7782
|
-
for (const bone of this.bones)
|
|
7783
|
-
|
|
7784
|
-
for (const constraint of this.
|
|
7785
|
-
|
|
7786
|
-
for (const constraint of this.
|
|
7787
|
-
constraint.setToSetupPose();
|
|
7788
|
-
for (const constraint of this.pathConstraints)
|
|
7789
|
-
constraint.setToSetupPose();
|
|
7790
|
-
for (const constraint of this.physicsConstraints)
|
|
7791
|
-
constraint.setToSetupPose();
|
|
7622
|
+
for (const bone of this.bones) bone.setToSetupPose();
|
|
7623
|
+
for (const constraint of this.ikConstraints) constraint.setToSetupPose();
|
|
7624
|
+
for (const constraint of this.transformConstraints) constraint.setToSetupPose();
|
|
7625
|
+
for (const constraint of this.pathConstraints) constraint.setToSetupPose();
|
|
7626
|
+
for (const constraint of this.physicsConstraints) constraint.setToSetupPose();
|
|
7792
7627
|
}
|
|
7793
7628
|
/** Sets the slots and draw order to their setup pose values. */
|
|
7794
7629
|
setSlotsToSetupPose() {
|
|
@@ -7799,19 +7634,16 @@ var _Skeleton = class {
|
|
|
7799
7634
|
}
|
|
7800
7635
|
/** @returns May return null. */
|
|
7801
7636
|
getRootBone() {
|
|
7802
|
-
if (this.bones.length == 0)
|
|
7803
|
-
return null;
|
|
7637
|
+
if (this.bones.length == 0) return null;
|
|
7804
7638
|
return this.bones[0];
|
|
7805
7639
|
}
|
|
7806
7640
|
/** @returns May be null. */
|
|
7807
7641
|
findBone(boneName) {
|
|
7808
|
-
if (!boneName)
|
|
7809
|
-
throw new Error("boneName cannot be null.");
|
|
7642
|
+
if (!boneName) throw new Error("boneName cannot be null.");
|
|
7810
7643
|
let bones = this.bones;
|
|
7811
7644
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7812
7645
|
let bone = bones[i];
|
|
7813
|
-
if (bone.data.name == boneName)
|
|
7814
|
-
return bone;
|
|
7646
|
+
if (bone.data.name == boneName) return bone;
|
|
7815
7647
|
}
|
|
7816
7648
|
return null;
|
|
7817
7649
|
}
|
|
@@ -7819,13 +7651,11 @@ var _Skeleton = class {
|
|
|
7819
7651
|
* repeatedly.
|
|
7820
7652
|
* @returns May be null. */
|
|
7821
7653
|
findSlot(slotName) {
|
|
7822
|
-
if (!slotName)
|
|
7823
|
-
throw new Error("slotName cannot be null.");
|
|
7654
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
7824
7655
|
let slots = this.slots;
|
|
7825
7656
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
7826
7657
|
let slot = slots[i];
|
|
7827
|
-
if (slot.data.name == slotName)
|
|
7828
|
-
return slot;
|
|
7658
|
+
if (slot.data.name == slotName) return slot;
|
|
7829
7659
|
}
|
|
7830
7660
|
return null;
|
|
7831
7661
|
}
|
|
@@ -7834,8 +7664,7 @@ var _Skeleton = class {
|
|
|
7834
7664
|
* See {@link #setSkin()}. */
|
|
7835
7665
|
setSkinByName(skinName) {
|
|
7836
7666
|
let skin = this.data.findSkin(skinName);
|
|
7837
|
-
if (!skin)
|
|
7838
|
-
throw new Error("Skin not found: " + skinName);
|
|
7667
|
+
if (!skin) throw new Error("Skin not found: " + skinName);
|
|
7839
7668
|
this.setSkin(skin);
|
|
7840
7669
|
}
|
|
7841
7670
|
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
|
|
@@ -7849,8 +7678,7 @@ var _Skeleton = class {
|
|
|
7849
7678
|
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
|
|
7850
7679
|
* @param newSkin May be null. */
|
|
7851
7680
|
setSkin(newSkin) {
|
|
7852
|
-
if (newSkin == this.skin)
|
|
7853
|
-
return;
|
|
7681
|
+
if (newSkin == this.skin) return;
|
|
7854
7682
|
if (newSkin) {
|
|
7855
7683
|
if (this.skin)
|
|
7856
7684
|
newSkin.attachAll(this, this.skin);
|
|
@@ -7861,8 +7689,7 @@ var _Skeleton = class {
|
|
|
7861
7689
|
let name = slot.data.attachmentName;
|
|
7862
7690
|
if (name) {
|
|
7863
7691
|
let attachment = newSkin.getAttachment(i, name);
|
|
7864
|
-
if (attachment)
|
|
7865
|
-
slot.setAttachment(attachment);
|
|
7692
|
+
if (attachment) slot.setAttachment(attachment);
|
|
7866
7693
|
}
|
|
7867
7694
|
}
|
|
7868
7695
|
}
|
|
@@ -7877,8 +7704,7 @@ var _Skeleton = class {
|
|
|
7877
7704
|
* @returns May be null. */
|
|
7878
7705
|
getAttachmentByName(slotName, attachmentName) {
|
|
7879
7706
|
let slot = this.data.findSlot(slotName);
|
|
7880
|
-
if (!slot)
|
|
7881
|
-
throw new Error(`Can't find slot with name ${slotName}`);
|
|
7707
|
+
if (!slot) throw new Error(`Can't find slot with name ${slotName}`);
|
|
7882
7708
|
return this.getAttachment(slot.index, attachmentName);
|
|
7883
7709
|
}
|
|
7884
7710
|
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
|
|
@@ -7887,23 +7713,19 @@ var _Skeleton = class {
|
|
|
7887
7713
|
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
|
7888
7714
|
* @returns May be null. */
|
|
7889
7715
|
getAttachment(slotIndex, attachmentName) {
|
|
7890
|
-
if (!attachmentName)
|
|
7891
|
-
throw new Error("attachmentName cannot be null.");
|
|
7716
|
+
if (!attachmentName) throw new Error("attachmentName cannot be null.");
|
|
7892
7717
|
if (this.skin) {
|
|
7893
7718
|
let attachment = this.skin.getAttachment(slotIndex, attachmentName);
|
|
7894
|
-
if (attachment)
|
|
7895
|
-
return attachment;
|
|
7719
|
+
if (attachment) return attachment;
|
|
7896
7720
|
}
|
|
7897
|
-
if (this.data.defaultSkin)
|
|
7898
|
-
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
7721
|
+
if (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
7899
7722
|
return null;
|
|
7900
7723
|
}
|
|
7901
7724
|
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
|
7902
7725
|
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
|
7903
7726
|
* @param attachmentName May be null to clear the slot's attachment. */
|
|
7904
7727
|
setAttachment(slotName, attachmentName) {
|
|
7905
|
-
if (!slotName)
|
|
7906
|
-
throw new Error("slotName cannot be null.");
|
|
7728
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
7907
7729
|
let slots = this.slots;
|
|
7908
7730
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
7909
7731
|
let slot = slots[i];
|
|
@@ -7911,8 +7733,7 @@ var _Skeleton = class {
|
|
|
7911
7733
|
let attachment = null;
|
|
7912
7734
|
if (attachmentName) {
|
|
7913
7735
|
attachment = this.getAttachment(i, attachmentName);
|
|
7914
|
-
if (!attachment)
|
|
7915
|
-
throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
|
|
7736
|
+
if (!attachment) throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
|
|
7916
7737
|
}
|
|
7917
7738
|
slot.setAttachment(attachment);
|
|
7918
7739
|
return;
|
|
@@ -7924,31 +7745,27 @@ var _Skeleton = class {
|
|
|
7924
7745
|
* than to call it repeatedly.
|
|
7925
7746
|
* @return May be null. */
|
|
7926
7747
|
findIkConstraint(constraintName) {
|
|
7927
|
-
if (!constraintName)
|
|
7928
|
-
throw new Error("constraintName cannot be null.");
|
|
7748
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
7929
7749
|
return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7930
7750
|
}
|
|
7931
7751
|
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7932
7752
|
* this method than to call it repeatedly.
|
|
7933
7753
|
* @return May be null. */
|
|
7934
7754
|
findTransformConstraint(constraintName) {
|
|
7935
|
-
if (!constraintName)
|
|
7936
|
-
throw new Error("constraintName cannot be null.");
|
|
7755
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
7937
7756
|
return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7938
7757
|
}
|
|
7939
7758
|
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7940
7759
|
* than to call it repeatedly.
|
|
7941
7760
|
* @return May be null. */
|
|
7942
7761
|
findPathConstraint(constraintName) {
|
|
7943
|
-
if (!constraintName)
|
|
7944
|
-
throw new Error("constraintName cannot be null.");
|
|
7762
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
7945
7763
|
return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7946
7764
|
}
|
|
7947
7765
|
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
|
|
7948
7766
|
* method than to call it repeatedly. */
|
|
7949
7767
|
findPhysicsConstraint(constraintName) {
|
|
7950
|
-
if (constraintName == null)
|
|
7951
|
-
throw new Error("constraintName cannot be null.");
|
|
7768
|
+
if (constraintName == null) throw new Error("constraintName cannot be null.");
|
|
7952
7769
|
return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7953
7770
|
}
|
|
7954
7771
|
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
|
|
@@ -7965,16 +7782,13 @@ var _Skeleton = class {
|
|
|
7965
7782
|
* @param temp Working memory to temporarily store attachments' computed world vertices.
|
|
7966
7783
|
* @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
|
|
7967
7784
|
getBounds(offset, size, temp = new Array(2), clipper = null) {
|
|
7968
|
-
if (!offset)
|
|
7969
|
-
|
|
7970
|
-
if (!size)
|
|
7971
|
-
throw new Error("size cannot be null.");
|
|
7785
|
+
if (!offset) throw new Error("offset cannot be null.");
|
|
7786
|
+
if (!size) throw new Error("size cannot be null.");
|
|
7972
7787
|
let drawOrder = this.drawOrder;
|
|
7973
7788
|
let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
|
7974
7789
|
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
|
7975
7790
|
let slot = drawOrder[i];
|
|
7976
|
-
if (!slot.bone.active)
|
|
7977
|
-
continue;
|
|
7791
|
+
if (!slot.bone.active) continue;
|
|
7978
7792
|
let verticesLength = 0;
|
|
7979
7793
|
let vertices = null;
|
|
7980
7794
|
let triangles = null;
|
|
@@ -8008,11 +7822,9 @@ var _Skeleton = class {
|
|
|
8008
7822
|
maxY = Math.max(maxY, y);
|
|
8009
7823
|
}
|
|
8010
7824
|
}
|
|
8011
|
-
if (clipper != null)
|
|
8012
|
-
clipper.clipEndWithSlot(slot);
|
|
7825
|
+
if (clipper != null) clipper.clipEndWithSlot(slot);
|
|
8013
7826
|
}
|
|
8014
|
-
if (clipper != null)
|
|
8015
|
-
clipper.clipEnd();
|
|
7827
|
+
if (clipper != null) clipper.clipEnd();
|
|
8016
7828
|
offset.set(minX, minY);
|
|
8017
7829
|
size.set(maxX - minX, maxY - minY);
|
|
8018
7830
|
}
|
|
@@ -8032,9 +7844,6 @@ var _Skeleton = class {
|
|
|
8032
7844
|
physicsConstraints[i].rotate(x, y, degrees);
|
|
8033
7845
|
}
|
|
8034
7846
|
};
|
|
8035
|
-
var Skeleton = _Skeleton;
|
|
8036
|
-
__publicField(Skeleton, "quadTriangles", [0, 1, 2, 2, 3, 0]);
|
|
8037
|
-
__publicField(Skeleton, "yDown", false);
|
|
8038
7847
|
var Physics = /* @__PURE__ */ ((Physics2) => {
|
|
8039
7848
|
Physics2[Physics2["none"] = 0] = "none";
|
|
8040
7849
|
Physics2[Physics2["reset"] = 1] = "reset";
|
|
@@ -8051,10 +7860,8 @@ var PhysicsConstraintData = class extends ConstraintData {
|
|
|
8051
7860
|
this._bone = boneData;
|
|
8052
7861
|
}
|
|
8053
7862
|
get bone() {
|
|
8054
|
-
if (!this._bone)
|
|
8055
|
-
|
|
8056
|
-
else
|
|
8057
|
-
return this._bone;
|
|
7863
|
+
if (!this._bone) throw new Error("BoneData not set.");
|
|
7864
|
+
else return this._bone;
|
|
8058
7865
|
}
|
|
8059
7866
|
x = 0;
|
|
8060
7867
|
y = 0;
|
|
@@ -8137,13 +7944,11 @@ var SkeletonData = class {
|
|
|
8137
7944
|
* multiple times.
|
|
8138
7945
|
* @returns May be null. */
|
|
8139
7946
|
findBone(boneName) {
|
|
8140
|
-
if (!boneName)
|
|
8141
|
-
throw new Error("boneName cannot be null.");
|
|
7947
|
+
if (!boneName) throw new Error("boneName cannot be null.");
|
|
8142
7948
|
let bones = this.bones;
|
|
8143
7949
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
8144
7950
|
let bone = bones[i];
|
|
8145
|
-
if (bone.name == boneName)
|
|
8146
|
-
return bone;
|
|
7951
|
+
if (bone.name == boneName) return bone;
|
|
8147
7952
|
}
|
|
8148
7953
|
return null;
|
|
8149
7954
|
}
|
|
@@ -8151,13 +7956,11 @@ var SkeletonData = class {
|
|
|
8151
7956
|
* multiple times.
|
|
8152
7957
|
* @returns May be null. */
|
|
8153
7958
|
findSlot(slotName) {
|
|
8154
|
-
if (!slotName)
|
|
8155
|
-
throw new Error("slotName cannot be null.");
|
|
7959
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
8156
7960
|
let slots = this.slots;
|
|
8157
7961
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
8158
7962
|
let slot = slots[i];
|
|
8159
|
-
if (slot.name == slotName)
|
|
8160
|
-
return slot;
|
|
7963
|
+
if (slot.name == slotName) return slot;
|
|
8161
7964
|
}
|
|
8162
7965
|
return null;
|
|
8163
7966
|
}
|
|
@@ -8165,13 +7968,11 @@ var SkeletonData = class {
|
|
|
8165
7968
|
* multiple times.
|
|
8166
7969
|
* @returns May be null. */
|
|
8167
7970
|
findSkin(skinName) {
|
|
8168
|
-
if (!skinName)
|
|
8169
|
-
throw new Error("skinName cannot be null.");
|
|
7971
|
+
if (!skinName) throw new Error("skinName cannot be null.");
|
|
8170
7972
|
let skins = this.skins;
|
|
8171
7973
|
for (let i = 0, n = skins.length; i < n; i++) {
|
|
8172
7974
|
let skin = skins[i];
|
|
8173
|
-
if (skin.name == skinName)
|
|
8174
|
-
return skin;
|
|
7975
|
+
if (skin.name == skinName) return skin;
|
|
8175
7976
|
}
|
|
8176
7977
|
return null;
|
|
8177
7978
|
}
|
|
@@ -8179,13 +7980,11 @@ var SkeletonData = class {
|
|
|
8179
7980
|
* multiple times.
|
|
8180
7981
|
* @returns May be null. */
|
|
8181
7982
|
findEvent(eventDataName) {
|
|
8182
|
-
if (!eventDataName)
|
|
8183
|
-
throw new Error("eventDataName cannot be null.");
|
|
7983
|
+
if (!eventDataName) throw new Error("eventDataName cannot be null.");
|
|
8184
7984
|
let events = this.events;
|
|
8185
7985
|
for (let i = 0, n = events.length; i < n; i++) {
|
|
8186
7986
|
let event = events[i];
|
|
8187
|
-
if (event.name == eventDataName)
|
|
8188
|
-
return event;
|
|
7987
|
+
if (event.name == eventDataName) return event;
|
|
8189
7988
|
}
|
|
8190
7989
|
return null;
|
|
8191
7990
|
}
|
|
@@ -8193,13 +7992,11 @@ var SkeletonData = class {
|
|
|
8193
7992
|
* call it multiple times.
|
|
8194
7993
|
* @returns May be null. */
|
|
8195
7994
|
findAnimation(animationName) {
|
|
8196
|
-
if (!animationName)
|
|
8197
|
-
throw new Error("animationName cannot be null.");
|
|
7995
|
+
if (!animationName) throw new Error("animationName cannot be null.");
|
|
8198
7996
|
let animations = this.animations;
|
|
8199
7997
|
for (let i = 0, n = animations.length; i < n; i++) {
|
|
8200
7998
|
let animation = animations[i];
|
|
8201
|
-
if (animation.name == animationName)
|
|
8202
|
-
return animation;
|
|
7999
|
+
if (animation.name == animationName) return animation;
|
|
8203
8000
|
}
|
|
8204
8001
|
return null;
|
|
8205
8002
|
}
|
|
@@ -8207,13 +8004,11 @@ var SkeletonData = class {
|
|
|
8207
8004
|
* than to call it multiple times.
|
|
8208
8005
|
* @return May be null. */
|
|
8209
8006
|
findIkConstraint(constraintName) {
|
|
8210
|
-
if (!constraintName)
|
|
8211
|
-
throw new Error("constraintName cannot be null.");
|
|
8007
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8212
8008
|
const ikConstraints = this.ikConstraints;
|
|
8213
8009
|
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
|
8214
8010
|
const constraint = ikConstraints[i];
|
|
8215
|
-
if (constraint.name == constraintName)
|
|
8216
|
-
return constraint;
|
|
8011
|
+
if (constraint.name == constraintName) return constraint;
|
|
8217
8012
|
}
|
|
8218
8013
|
return null;
|
|
8219
8014
|
}
|
|
@@ -8221,13 +8016,11 @@ var SkeletonData = class {
|
|
|
8221
8016
|
* this method than to call it multiple times.
|
|
8222
8017
|
* @return May be null. */
|
|
8223
8018
|
findTransformConstraint(constraintName) {
|
|
8224
|
-
if (!constraintName)
|
|
8225
|
-
throw new Error("constraintName cannot be null.");
|
|
8019
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8226
8020
|
const transformConstraints = this.transformConstraints;
|
|
8227
8021
|
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
8228
8022
|
const constraint = transformConstraints[i];
|
|
8229
|
-
if (constraint.name == constraintName)
|
|
8230
|
-
return constraint;
|
|
8023
|
+
if (constraint.name == constraintName) return constraint;
|
|
8231
8024
|
}
|
|
8232
8025
|
return null;
|
|
8233
8026
|
}
|
|
@@ -8235,13 +8028,11 @@ var SkeletonData = class {
|
|
|
8235
8028
|
* than to call it multiple times.
|
|
8236
8029
|
* @return May be null. */
|
|
8237
8030
|
findPathConstraint(constraintName) {
|
|
8238
|
-
if (!constraintName)
|
|
8239
|
-
throw new Error("constraintName cannot be null.");
|
|
8031
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8240
8032
|
const pathConstraints = this.pathConstraints;
|
|
8241
8033
|
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
|
8242
8034
|
const constraint = pathConstraints[i];
|
|
8243
|
-
if (constraint.name == constraintName)
|
|
8244
|
-
return constraint;
|
|
8035
|
+
if (constraint.name == constraintName) return constraint;
|
|
8245
8036
|
}
|
|
8246
8037
|
return null;
|
|
8247
8038
|
}
|
|
@@ -8249,13 +8040,11 @@ var SkeletonData = class {
|
|
|
8249
8040
|
* than to call it multiple times.
|
|
8250
8041
|
* @return May be null. */
|
|
8251
8042
|
findPhysicsConstraint(constraintName) {
|
|
8252
|
-
if (!constraintName)
|
|
8253
|
-
throw new Error("constraintName cannot be null.");
|
|
8043
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8254
8044
|
const physicsConstraints = this.physicsConstraints;
|
|
8255
8045
|
for (let i = 0, n = physicsConstraints.length; i < n; i++) {
|
|
8256
8046
|
const constraint = physicsConstraints[i];
|
|
8257
|
-
if (constraint.name == constraintName)
|
|
8258
|
-
return constraint;
|
|
8047
|
+
if (constraint.name == constraintName) return constraint;
|
|
8259
8048
|
}
|
|
8260
8049
|
return null;
|
|
8261
8050
|
}
|
|
@@ -8279,19 +8068,15 @@ var Skin = class {
|
|
|
8279
8068
|
color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
|
|
8280
8069
|
// fe9e4fff
|
|
8281
8070
|
constructor(name) {
|
|
8282
|
-
if (!name)
|
|
8283
|
-
throw new Error("name cannot be null.");
|
|
8071
|
+
if (!name) throw new Error("name cannot be null.");
|
|
8284
8072
|
this.name = name;
|
|
8285
8073
|
}
|
|
8286
8074
|
/** Adds an attachment to the skin for the specified slot index and name. */
|
|
8287
8075
|
setAttachment(slotIndex, name, attachment) {
|
|
8288
|
-
if (!attachment)
|
|
8289
|
-
throw new Error("attachment cannot be null.");
|
|
8076
|
+
if (!attachment) throw new Error("attachment cannot be null.");
|
|
8290
8077
|
let attachments = this.attachments;
|
|
8291
|
-
if (slotIndex >= attachments.length)
|
|
8292
|
-
|
|
8293
|
-
if (!attachments[slotIndex])
|
|
8294
|
-
attachments[slotIndex] = {};
|
|
8078
|
+
if (slotIndex >= attachments.length) attachments.length = slotIndex + 1;
|
|
8079
|
+
if (!attachments[slotIndex]) attachments[slotIndex] = {};
|
|
8295
8080
|
attachments[slotIndex][name] = attachment;
|
|
8296
8081
|
}
|
|
8297
8082
|
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
|
@@ -8305,8 +8090,7 @@ var Skin = class {
|
|
|
8305
8090
|
break;
|
|
8306
8091
|
}
|
|
8307
8092
|
}
|
|
8308
|
-
if (!contained)
|
|
8309
|
-
this.bones.push(bone);
|
|
8093
|
+
if (!contained) this.bones.push(bone);
|
|
8310
8094
|
}
|
|
8311
8095
|
for (let i = 0; i < skin.constraints.length; i++) {
|
|
8312
8096
|
let constraint = skin.constraints[i];
|
|
@@ -8317,8 +8101,7 @@ var Skin = class {
|
|
|
8317
8101
|
break;
|
|
8318
8102
|
}
|
|
8319
8103
|
}
|
|
8320
|
-
if (!contained)
|
|
8321
|
-
this.constraints.push(constraint);
|
|
8104
|
+
if (!contained) this.constraints.push(constraint);
|
|
8322
8105
|
}
|
|
8323
8106
|
let attachments = skin.getAttachments();
|
|
8324
8107
|
for (let i = 0; i < attachments.length; i++) {
|
|
@@ -8338,8 +8121,7 @@ var Skin = class {
|
|
|
8338
8121
|
break;
|
|
8339
8122
|
}
|
|
8340
8123
|
}
|
|
8341
|
-
if (!contained)
|
|
8342
|
-
this.bones.push(bone);
|
|
8124
|
+
if (!contained) this.bones.push(bone);
|
|
8343
8125
|
}
|
|
8344
8126
|
for (let i = 0; i < skin.constraints.length; i++) {
|
|
8345
8127
|
let constraint = skin.constraints[i];
|
|
@@ -8350,14 +8132,12 @@ var Skin = class {
|
|
|
8350
8132
|
break;
|
|
8351
8133
|
}
|
|
8352
8134
|
}
|
|
8353
|
-
if (!contained)
|
|
8354
|
-
this.constraints.push(constraint);
|
|
8135
|
+
if (!contained) this.constraints.push(constraint);
|
|
8355
8136
|
}
|
|
8356
8137
|
let attachments = skin.getAttachments();
|
|
8357
8138
|
for (let i = 0; i < attachments.length; i++) {
|
|
8358
8139
|
var attachment = attachments[i];
|
|
8359
|
-
if (!attachment.attachment)
|
|
8360
|
-
continue;
|
|
8140
|
+
if (!attachment.attachment) continue;
|
|
8361
8141
|
if (attachment.attachment instanceof MeshAttachment) {
|
|
8362
8142
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
|
8363
8143
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
@@ -8375,8 +8155,7 @@ var Skin = class {
|
|
|
8375
8155
|
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
|
8376
8156
|
removeAttachment(slotIndex, name) {
|
|
8377
8157
|
let dictionary = this.attachments[slotIndex];
|
|
8378
|
-
if (dictionary)
|
|
8379
|
-
delete dictionary[name];
|
|
8158
|
+
if (dictionary) delete dictionary[name];
|
|
8380
8159
|
}
|
|
8381
8160
|
/** Returns all attachments in this skin. */
|
|
8382
8161
|
getAttachments() {
|
|
@@ -8386,8 +8165,7 @@ var Skin = class {
|
|
|
8386
8165
|
if (slotAttachments) {
|
|
8387
8166
|
for (let name in slotAttachments) {
|
|
8388
8167
|
let attachment = slotAttachments[name];
|
|
8389
|
-
if (attachment)
|
|
8390
|
-
entries.push(new SkinEntry(i, name, attachment));
|
|
8168
|
+
if (attachment) entries.push(new SkinEntry(i, name, attachment));
|
|
8391
8169
|
}
|
|
8392
8170
|
}
|
|
8393
8171
|
}
|
|
@@ -8399,8 +8177,7 @@ var Skin = class {
|
|
|
8399
8177
|
if (slotAttachments) {
|
|
8400
8178
|
for (let name in slotAttachments) {
|
|
8401
8179
|
let attachment = slotAttachments[name];
|
|
8402
|
-
if (attachment)
|
|
8403
|
-
attachments.push(new SkinEntry(slotIndex, name, attachment));
|
|
8180
|
+
if (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));
|
|
8404
8181
|
}
|
|
8405
8182
|
}
|
|
8406
8183
|
}
|
|
@@ -8422,8 +8199,7 @@ var Skin = class {
|
|
|
8422
8199
|
let skinAttachment = dictionary[key];
|
|
8423
8200
|
if (slotAttachment == skinAttachment) {
|
|
8424
8201
|
let attachment = this.getAttachment(slotIndex, key);
|
|
8425
|
-
if (attachment)
|
|
8426
|
-
slot.setAttachment(attachment);
|
|
8202
|
+
if (attachment) slot.setAttachment(attachment);
|
|
8427
8203
|
break;
|
|
8428
8204
|
}
|
|
8429
8205
|
}
|
|
@@ -8450,16 +8226,13 @@ var SlotData = class {
|
|
|
8450
8226
|
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
|
8451
8227
|
attachmentName = null;
|
|
8452
8228
|
/** The blend mode for drawing the slot's attachment. */
|
|
8453
|
-
blendMode =
|
|
8229
|
+
blendMode = 0 /* Normal */;
|
|
8454
8230
|
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
8455
8231
|
visible = true;
|
|
8456
8232
|
constructor(index, name, boneData) {
|
|
8457
|
-
if (index < 0)
|
|
8458
|
-
|
|
8459
|
-
if (!
|
|
8460
|
-
throw new Error("name cannot be null.");
|
|
8461
|
-
if (!boneData)
|
|
8462
|
-
throw new Error("boneData cannot be null.");
|
|
8233
|
+
if (index < 0) throw new Error("index must be >= 0.");
|
|
8234
|
+
if (!name) throw new Error("name cannot be null.");
|
|
8235
|
+
if (!boneData) throw new Error("boneData cannot be null.");
|
|
8463
8236
|
this.index = index;
|
|
8464
8237
|
this.name = name;
|
|
8465
8238
|
this.boneData = boneData;
|
|
@@ -8483,10 +8256,8 @@ var TransformConstraintData = class extends ConstraintData {
|
|
|
8483
8256
|
this._target = boneData;
|
|
8484
8257
|
}
|
|
8485
8258
|
get target() {
|
|
8486
|
-
if (!this._target)
|
|
8487
|
-
|
|
8488
|
-
else
|
|
8489
|
-
return this._target;
|
|
8259
|
+
if (!this._target) throw new Error("BoneData not set.");
|
|
8260
|
+
else return this._target;
|
|
8490
8261
|
}
|
|
8491
8262
|
mixRotate = 0;
|
|
8492
8263
|
mixX = 0;
|
|
@@ -8549,15 +8320,13 @@ var SkeletonBinary = class {
|
|
|
8549
8320
|
n = input.readInt(true);
|
|
8550
8321
|
for (let i = 0; i < n; i++) {
|
|
8551
8322
|
let str = input.readString();
|
|
8552
|
-
if (!str)
|
|
8553
|
-
throw new Error("String in string table must not be null.");
|
|
8323
|
+
if (!str) throw new Error("String in string table must not be null.");
|
|
8554
8324
|
input.strings.push(str);
|
|
8555
8325
|
}
|
|
8556
8326
|
n = input.readInt(true);
|
|
8557
8327
|
for (let i = 0; i < n; i++) {
|
|
8558
8328
|
let name = input.readString();
|
|
8559
|
-
if (!name)
|
|
8560
|
-
throw new Error("Bone name must not be null.");
|
|
8329
|
+
if (!name) throw new Error("Bone name must not be null.");
|
|
8561
8330
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
8562
8331
|
let data = new BoneData(i, name, parent);
|
|
8563
8332
|
data.rotation = input.readFloat();
|
|
@@ -8580,25 +8349,21 @@ var SkeletonBinary = class {
|
|
|
8580
8349
|
n = input.readInt(true);
|
|
8581
8350
|
for (let i = 0; i < n; i++) {
|
|
8582
8351
|
let slotName = input.readString();
|
|
8583
|
-
if (!slotName)
|
|
8584
|
-
throw new Error("Slot name must not be null.");
|
|
8352
|
+
if (!slotName) throw new Error("Slot name must not be null.");
|
|
8585
8353
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
8586
8354
|
let data = new SlotData(i, slotName, boneData);
|
|
8587
8355
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
8588
8356
|
let darkColor = input.readInt32();
|
|
8589
|
-
if (darkColor != -1)
|
|
8590
|
-
Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
|
|
8357
|
+
if (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
|
|
8591
8358
|
data.attachmentName = input.readStringRef();
|
|
8592
8359
|
data.blendMode = input.readInt(true);
|
|
8593
|
-
if (nonessential)
|
|
8594
|
-
data.visible = input.readBoolean();
|
|
8360
|
+
if (nonessential) data.visible = input.readBoolean();
|
|
8595
8361
|
skeletonData.slots.push(data);
|
|
8596
8362
|
}
|
|
8597
8363
|
n = input.readInt(true);
|
|
8598
8364
|
for (let i = 0, nn; i < n; i++) {
|
|
8599
8365
|
let name = input.readString();
|
|
8600
|
-
if (!name)
|
|
8601
|
-
throw new Error("IK constraint data name must not be null.");
|
|
8366
|
+
if (!name) throw new Error("IK constraint data name must not be null.");
|
|
8602
8367
|
let data = new IkConstraintData(name);
|
|
8603
8368
|
data.order = input.readInt(true);
|
|
8604
8369
|
nn = input.readInt(true);
|
|
@@ -8611,17 +8376,14 @@ var SkeletonBinary = class {
|
|
|
8611
8376
|
data.compress = (flags & 4) != 0;
|
|
8612
8377
|
data.stretch = (flags & 8) != 0;
|
|
8613
8378
|
data.uniform = (flags & 16) != 0;
|
|
8614
|
-
if ((flags & 32) != 0)
|
|
8615
|
-
|
|
8616
|
-
if ((flags & 128) != 0)
|
|
8617
|
-
data.softness = input.readFloat() * scale;
|
|
8379
|
+
if ((flags & 32) != 0) data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
|
|
8380
|
+
if ((flags & 128) != 0) data.softness = input.readFloat() * scale;
|
|
8618
8381
|
skeletonData.ikConstraints.push(data);
|
|
8619
8382
|
}
|
|
8620
8383
|
n = input.readInt(true);
|
|
8621
8384
|
for (let i = 0, nn; i < n; i++) {
|
|
8622
8385
|
let name = input.readString();
|
|
8623
|
-
if (!name)
|
|
8624
|
-
throw new Error("Transform constraint data name must not be null.");
|
|
8386
|
+
if (!name) throw new Error("Transform constraint data name must not be null.");
|
|
8625
8387
|
let data = new TransformConstraintData(name);
|
|
8626
8388
|
data.order = input.readInt(true);
|
|
8627
8389
|
nn = input.readInt(true);
|
|
@@ -8632,38 +8394,25 @@ var SkeletonBinary = class {
|
|
|
8632
8394
|
data.skinRequired = (flags & 1) != 0;
|
|
8633
8395
|
data.local = (flags & 2) != 0;
|
|
8634
8396
|
data.relative = (flags & 4) != 0;
|
|
8635
|
-
if ((flags & 8) != 0)
|
|
8636
|
-
|
|
8637
|
-
if ((flags &
|
|
8638
|
-
|
|
8639
|
-
if ((flags &
|
|
8640
|
-
data.offsetY = input.readFloat() * scale;
|
|
8641
|
-
if ((flags & 64) != 0)
|
|
8642
|
-
data.offsetScaleX = input.readFloat();
|
|
8643
|
-
if ((flags & 128) != 0)
|
|
8644
|
-
data.offsetScaleY = input.readFloat();
|
|
8397
|
+
if ((flags & 8) != 0) data.offsetRotation = input.readFloat();
|
|
8398
|
+
if ((flags & 16) != 0) data.offsetX = input.readFloat() * scale;
|
|
8399
|
+
if ((flags & 32) != 0) data.offsetY = input.readFloat() * scale;
|
|
8400
|
+
if ((flags & 64) != 0) data.offsetScaleX = input.readFloat();
|
|
8401
|
+
if ((flags & 128) != 0) data.offsetScaleY = input.readFloat();
|
|
8645
8402
|
flags = input.readByte();
|
|
8646
|
-
if ((flags & 1) != 0)
|
|
8647
|
-
|
|
8648
|
-
if ((flags &
|
|
8649
|
-
|
|
8650
|
-
if ((flags &
|
|
8651
|
-
|
|
8652
|
-
if ((flags &
|
|
8653
|
-
data.mixY = input.readFloat();
|
|
8654
|
-
if ((flags & 16) != 0)
|
|
8655
|
-
data.mixScaleX = input.readFloat();
|
|
8656
|
-
if ((flags & 32) != 0)
|
|
8657
|
-
data.mixScaleY = input.readFloat();
|
|
8658
|
-
if ((flags & 64) != 0)
|
|
8659
|
-
data.mixShearY = input.readFloat();
|
|
8403
|
+
if ((flags & 1) != 0) data.offsetShearY = input.readFloat();
|
|
8404
|
+
if ((flags & 2) != 0) data.mixRotate = input.readFloat();
|
|
8405
|
+
if ((flags & 4) != 0) data.mixX = input.readFloat();
|
|
8406
|
+
if ((flags & 8) != 0) data.mixY = input.readFloat();
|
|
8407
|
+
if ((flags & 16) != 0) data.mixScaleX = input.readFloat();
|
|
8408
|
+
if ((flags & 32) != 0) data.mixScaleY = input.readFloat();
|
|
8409
|
+
if ((flags & 64) != 0) data.mixShearY = input.readFloat();
|
|
8660
8410
|
skeletonData.transformConstraints.push(data);
|
|
8661
8411
|
}
|
|
8662
8412
|
n = input.readInt(true);
|
|
8663
8413
|
for (let i = 0, nn; i < n; i++) {
|
|
8664
8414
|
let name = input.readString();
|
|
8665
|
-
if (!name)
|
|
8666
|
-
throw new Error("Path constraint data name must not be null.");
|
|
8415
|
+
if (!name) throw new Error("Path constraint data name must not be null.");
|
|
8667
8416
|
let data = new PathConstraintData(name);
|
|
8668
8417
|
data.order = input.readInt(true);
|
|
8669
8418
|
data.skinRequired = input.readBoolean();
|
|
@@ -8675,14 +8424,11 @@ var SkeletonBinary = class {
|
|
|
8675
8424
|
data.positionMode = flags & 1;
|
|
8676
8425
|
data.spacingMode = flags >> 1 & 3;
|
|
8677
8426
|
data.rotateMode = flags >> 3 & 3;
|
|
8678
|
-
if ((flags & 128) != 0)
|
|
8679
|
-
data.offsetRotation = input.readFloat();
|
|
8427
|
+
if ((flags & 128) != 0) data.offsetRotation = input.readFloat();
|
|
8680
8428
|
data.position = input.readFloat();
|
|
8681
|
-
if (data.positionMode == 0 /* Fixed */)
|
|
8682
|
-
data.position *= scale;
|
|
8429
|
+
if (data.positionMode == 0 /* Fixed */) data.position *= scale;
|
|
8683
8430
|
data.spacing = input.readFloat();
|
|
8684
|
-
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
8685
|
-
data.spacing *= scale;
|
|
8431
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
|
|
8686
8432
|
data.mixRotate = input.readFloat();
|
|
8687
8433
|
data.mixX = input.readFloat();
|
|
8688
8434
|
data.mixY = input.readFloat();
|
|
@@ -8691,23 +8437,17 @@ var SkeletonBinary = class {
|
|
|
8691
8437
|
n = input.readInt(true);
|
|
8692
8438
|
for (let i = 0, nn; i < n; i++) {
|
|
8693
8439
|
const name = input.readString();
|
|
8694
|
-
if (!name)
|
|
8695
|
-
throw new Error("Physics constraint data name must not be null.");
|
|
8440
|
+
if (!name) throw new Error("Physics constraint data name must not be null.");
|
|
8696
8441
|
const data = new PhysicsConstraintData(name);
|
|
8697
8442
|
data.order = input.readInt(true);
|
|
8698
8443
|
data.bone = skeletonData.bones[input.readInt(true)];
|
|
8699
8444
|
let flags = input.readByte();
|
|
8700
8445
|
data.skinRequired = (flags & 1) != 0;
|
|
8701
|
-
if ((flags & 2) != 0)
|
|
8702
|
-
|
|
8703
|
-
if ((flags &
|
|
8704
|
-
|
|
8705
|
-
if ((flags &
|
|
8706
|
-
data.rotate = input.readFloat();
|
|
8707
|
-
if ((flags & 16) != 0)
|
|
8708
|
-
data.scaleX = input.readFloat();
|
|
8709
|
-
if ((flags & 32) != 0)
|
|
8710
|
-
data.shearX = input.readFloat();
|
|
8446
|
+
if ((flags & 2) != 0) data.x = input.readFloat();
|
|
8447
|
+
if ((flags & 4) != 0) data.y = input.readFloat();
|
|
8448
|
+
if ((flags & 8) != 0) data.rotate = input.readFloat();
|
|
8449
|
+
if ((flags & 16) != 0) data.scaleX = input.readFloat();
|
|
8450
|
+
if ((flags & 32) != 0) data.shearX = input.readFloat();
|
|
8711
8451
|
data.limit = ((flags & 64) != 0 ? input.readFloat() : 5e3) * scale;
|
|
8712
8452
|
data.step = 1 / input.readUnsignedByte();
|
|
8713
8453
|
data.inertia = input.readFloat();
|
|
@@ -8717,20 +8457,13 @@ var SkeletonBinary = class {
|
|
|
8717
8457
|
data.wind = input.readFloat();
|
|
8718
8458
|
data.gravity = input.readFloat();
|
|
8719
8459
|
flags = input.readByte();
|
|
8720
|
-
if ((flags & 1) != 0)
|
|
8721
|
-
|
|
8722
|
-
if ((flags &
|
|
8723
|
-
|
|
8724
|
-
if ((flags &
|
|
8725
|
-
|
|
8726
|
-
if ((flags &
|
|
8727
|
-
data.massGlobal = true;
|
|
8728
|
-
if ((flags & 16) != 0)
|
|
8729
|
-
data.windGlobal = true;
|
|
8730
|
-
if ((flags & 32) != 0)
|
|
8731
|
-
data.gravityGlobal = true;
|
|
8732
|
-
if ((flags & 64) != 0)
|
|
8733
|
-
data.mixGlobal = true;
|
|
8460
|
+
if ((flags & 1) != 0) data.inertiaGlobal = true;
|
|
8461
|
+
if ((flags & 2) != 0) data.strengthGlobal = true;
|
|
8462
|
+
if ((flags & 4) != 0) data.dampingGlobal = true;
|
|
8463
|
+
if ((flags & 8) != 0) data.massGlobal = true;
|
|
8464
|
+
if ((flags & 16) != 0) data.windGlobal = true;
|
|
8465
|
+
if ((flags & 32) != 0) data.gravityGlobal = true;
|
|
8466
|
+
if ((flags & 64) != 0) data.mixGlobal = true;
|
|
8734
8467
|
data.mix = (flags & 128) != 0 ? input.readFloat() : 1;
|
|
8735
8468
|
skeletonData.physicsConstraints.push(data);
|
|
8736
8469
|
}
|
|
@@ -8744,8 +8477,7 @@ var SkeletonBinary = class {
|
|
|
8744
8477
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
8745
8478
|
for (; i < n; i++) {
|
|
8746
8479
|
let skin = this.readSkin(input, skeletonData, false, nonessential);
|
|
8747
|
-
if (!skin)
|
|
8748
|
-
throw new Error("readSkin() should not have returned null.");
|
|
8480
|
+
if (!skin) throw new Error("readSkin() should not have returned null.");
|
|
8749
8481
|
skeletonData.skins[i] = skin;
|
|
8750
8482
|
}
|
|
8751
8483
|
}
|
|
@@ -8753,22 +8485,18 @@ var SkeletonBinary = class {
|
|
|
8753
8485
|
for (let i = 0; i < n; i++) {
|
|
8754
8486
|
let linkedMesh = this.linkedMeshes[i];
|
|
8755
8487
|
const skin = skeletonData.skins[linkedMesh.skinIndex];
|
|
8756
|
-
if (!linkedMesh.parent)
|
|
8757
|
-
throw new Error("Linked mesh parent must not be null");
|
|
8488
|
+
if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null");
|
|
8758
8489
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8759
|
-
if (!parent)
|
|
8760
|
-
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8490
|
+
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8761
8491
|
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8762
8492
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8763
|
-
if (linkedMesh.mesh.region != null)
|
|
8764
|
-
linkedMesh.mesh.updateRegion();
|
|
8493
|
+
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
|
|
8765
8494
|
}
|
|
8766
8495
|
this.linkedMeshes.length = 0;
|
|
8767
8496
|
n = input.readInt(true);
|
|
8768
8497
|
for (let i = 0; i < n; i++) {
|
|
8769
8498
|
let eventName = input.readString();
|
|
8770
|
-
if (!eventName)
|
|
8771
|
-
throw new Error("Event data name must not be null");
|
|
8499
|
+
if (!eventName) throw new Error("Event data name must not be null");
|
|
8772
8500
|
let data = new EventData(eventName);
|
|
8773
8501
|
data.intValue = input.readInt(false);
|
|
8774
8502
|
data.floatValue = input.readFloat();
|
|
@@ -8783,8 +8511,7 @@ var SkeletonBinary = class {
|
|
|
8783
8511
|
n = input.readInt(true);
|
|
8784
8512
|
for (let i = 0; i < n; i++) {
|
|
8785
8513
|
let animationName = input.readString();
|
|
8786
|
-
if (!animationName)
|
|
8787
|
-
throw new Error("Animatio name must not be null.");
|
|
8514
|
+
if (!animationName) throw new Error("Animatio name must not be null.");
|
|
8788
8515
|
skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
|
|
8789
8516
|
}
|
|
8790
8517
|
return skeletonData;
|
|
@@ -8794,16 +8521,13 @@ var SkeletonBinary = class {
|
|
|
8794
8521
|
let slotCount = 0;
|
|
8795
8522
|
if (defaultSkin) {
|
|
8796
8523
|
slotCount = input.readInt(true);
|
|
8797
|
-
if (slotCount == 0)
|
|
8798
|
-
return null;
|
|
8524
|
+
if (slotCount == 0) return null;
|
|
8799
8525
|
skin = new Skin("default");
|
|
8800
8526
|
} else {
|
|
8801
8527
|
let skinName = input.readString();
|
|
8802
|
-
if (!skinName)
|
|
8803
|
-
throw new Error("Skin name must not be null.");
|
|
8528
|
+
if (!skinName) throw new Error("Skin name must not be null.");
|
|
8804
8529
|
skin = new Skin(skinName);
|
|
8805
|
-
if (nonessential)
|
|
8806
|
-
Color.rgba8888ToColor(skin.color, input.readInt32());
|
|
8530
|
+
if (nonessential) Color.rgba8888ToColor(skin.color, input.readInt32());
|
|
8807
8531
|
skin.bones.length = input.readInt(true);
|
|
8808
8532
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
8809
8533
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -8824,8 +8548,7 @@ var SkeletonBinary = class {
|
|
|
8824
8548
|
if (!name)
|
|
8825
8549
|
throw new Error("Attachment name must not be null");
|
|
8826
8550
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
8827
|
-
if (attachment)
|
|
8828
|
-
skin.setAttachment(slotIndex, name, attachment);
|
|
8551
|
+
if (attachment) skin.setAttachment(slotIndex, name, attachment);
|
|
8829
8552
|
}
|
|
8830
8553
|
}
|
|
8831
8554
|
return skin;
|
|
@@ -8834,10 +8557,10 @@ var SkeletonBinary = class {
|
|
|
8834
8557
|
let scale = this.scale;
|
|
8835
8558
|
let flags = input.readByte();
|
|
8836
8559
|
const name = (flags & 8) != 0 ? input.readStringRef() : attachmentName;
|
|
8837
|
-
if (!name)
|
|
8838
|
-
throw new Error("Attachment name must not be null");
|
|
8560
|
+
if (!name) throw new Error("Attachment name must not be null");
|
|
8839
8561
|
switch (flags & 7) {
|
|
8840
|
-
|
|
8562
|
+
// BUG?
|
|
8563
|
+
case 0 /* Region */: {
|
|
8841
8564
|
let path = (flags & 16) != 0 ? input.readStringRef() : null;
|
|
8842
8565
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
8843
8566
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
@@ -8848,11 +8571,9 @@ var SkeletonBinary = class {
|
|
|
8848
8571
|
let scaleY = input.readFloat();
|
|
8849
8572
|
let width = input.readFloat();
|
|
8850
8573
|
let height = input.readFloat();
|
|
8851
|
-
if (!path)
|
|
8852
|
-
path = name;
|
|
8574
|
+
if (!path) path = name;
|
|
8853
8575
|
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
8854
|
-
if (!region)
|
|
8855
|
-
return null;
|
|
8576
|
+
if (!region) return null;
|
|
8856
8577
|
region.path = path;
|
|
8857
8578
|
region.x = x * scale;
|
|
8858
8579
|
region.y = y * scale;
|
|
@@ -8863,24 +8584,21 @@ var SkeletonBinary = class {
|
|
|
8863
8584
|
region.height = height * scale;
|
|
8864
8585
|
Color.rgba8888ToColor(region.color, color);
|
|
8865
8586
|
region.sequence = sequence;
|
|
8866
|
-
if (sequence == null)
|
|
8867
|
-
region.updateRegion();
|
|
8587
|
+
if (sequence == null) region.updateRegion();
|
|
8868
8588
|
return region;
|
|
8869
8589
|
}
|
|
8870
|
-
case
|
|
8590
|
+
case 1 /* BoundingBox */: {
|
|
8871
8591
|
let vertices = this.readVertices(input, (flags & 16) != 0);
|
|
8872
8592
|
let color = nonessential ? input.readInt32() : 0;
|
|
8873
8593
|
let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
|
|
8874
|
-
if (!box)
|
|
8875
|
-
return null;
|
|
8594
|
+
if (!box) return null;
|
|
8876
8595
|
box.worldVerticesLength = vertices.length;
|
|
8877
8596
|
box.vertices = vertices.vertices;
|
|
8878
8597
|
box.bones = vertices.bones;
|
|
8879
|
-
if (nonessential)
|
|
8880
|
-
Color.rgba8888ToColor(box.color, color);
|
|
8598
|
+
if (nonessential) Color.rgba8888ToColor(box.color, color);
|
|
8881
8599
|
return box;
|
|
8882
8600
|
}
|
|
8883
|
-
case
|
|
8601
|
+
case 2 /* Mesh */: {
|
|
8884
8602
|
let path = (flags & 16) != 0 ? input.readStringRef() : name;
|
|
8885
8603
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
8886
8604
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
@@ -8895,11 +8613,9 @@ var SkeletonBinary = class {
|
|
|
8895
8613
|
width = input.readFloat();
|
|
8896
8614
|
height = input.readFloat();
|
|
8897
8615
|
}
|
|
8898
|
-
if (!path)
|
|
8899
|
-
path = name;
|
|
8616
|
+
if (!path) path = name;
|
|
8900
8617
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
8901
|
-
if (!mesh)
|
|
8902
|
-
return null;
|
|
8618
|
+
if (!mesh) return null;
|
|
8903
8619
|
mesh.path = path;
|
|
8904
8620
|
Color.rgba8888ToColor(mesh.color, color);
|
|
8905
8621
|
mesh.bones = vertices.bones;
|
|
@@ -8907,8 +8623,7 @@ var SkeletonBinary = class {
|
|
|
8907
8623
|
mesh.worldVerticesLength = vertices.length;
|
|
8908
8624
|
mesh.triangles = triangles;
|
|
8909
8625
|
mesh.regionUVs = uvs;
|
|
8910
|
-
if (sequence == null)
|
|
8911
|
-
mesh.updateRegion();
|
|
8626
|
+
if (sequence == null) mesh.updateRegion();
|
|
8912
8627
|
mesh.hullLength = hullLength << 1;
|
|
8913
8628
|
mesh.sequence = sequence;
|
|
8914
8629
|
if (nonessential) {
|
|
@@ -8918,10 +8633,9 @@ var SkeletonBinary = class {
|
|
|
8918
8633
|
}
|
|
8919
8634
|
return mesh;
|
|
8920
8635
|
}
|
|
8921
|
-
case
|
|
8636
|
+
case 3 /* LinkedMesh */: {
|
|
8922
8637
|
const path = (flags & 16) != 0 ? input.readStringRef() : name;
|
|
8923
|
-
if (path == null)
|
|
8924
|
-
throw new Error("Path of linked mesh must not be null");
|
|
8638
|
+
if (path == null) throw new Error("Path of linked mesh must not be null");
|
|
8925
8639
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
8926
8640
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
8927
8641
|
const inheritTimelines = (flags & 128) != 0;
|
|
@@ -8933,8 +8647,7 @@ var SkeletonBinary = class {
|
|
|
8933
8647
|
height = input.readFloat();
|
|
8934
8648
|
}
|
|
8935
8649
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
8936
|
-
if (!mesh)
|
|
8937
|
-
return null;
|
|
8650
|
+
if (!mesh) return null;
|
|
8938
8651
|
mesh.path = path;
|
|
8939
8652
|
Color.rgba8888ToColor(mesh.color, color);
|
|
8940
8653
|
mesh.sequence = sequence;
|
|
@@ -8945,7 +8658,7 @@ var SkeletonBinary = class {
|
|
|
8945
8658
|
this.linkedMeshes.push(new LinkedMesh(mesh, skinIndex, slotIndex, parent, inheritTimelines));
|
|
8946
8659
|
return mesh;
|
|
8947
8660
|
}
|
|
8948
|
-
case
|
|
8661
|
+
case 4 /* Path */: {
|
|
8949
8662
|
const closed2 = (flags & 16) != 0;
|
|
8950
8663
|
const constantSpeed = (flags & 32) != 0;
|
|
8951
8664
|
const vertices = this.readVertices(input, (flags & 64) != 0);
|
|
@@ -8954,46 +8667,40 @@ var SkeletonBinary = class {
|
|
|
8954
8667
|
lengths[i] = input.readFloat() * scale;
|
|
8955
8668
|
const color = nonessential ? input.readInt32() : 0;
|
|
8956
8669
|
const path = this.attachmentLoader.newPathAttachment(skin, name);
|
|
8957
|
-
if (!path)
|
|
8958
|
-
return null;
|
|
8670
|
+
if (!path) return null;
|
|
8959
8671
|
path.closed = closed2;
|
|
8960
8672
|
path.constantSpeed = constantSpeed;
|
|
8961
8673
|
path.worldVerticesLength = vertices.length;
|
|
8962
8674
|
path.vertices = vertices.vertices;
|
|
8963
8675
|
path.bones = vertices.bones;
|
|
8964
8676
|
path.lengths = lengths;
|
|
8965
|
-
if (nonessential)
|
|
8966
|
-
Color.rgba8888ToColor(path.color, color);
|
|
8677
|
+
if (nonessential) Color.rgba8888ToColor(path.color, color);
|
|
8967
8678
|
return path;
|
|
8968
8679
|
}
|
|
8969
|
-
case
|
|
8680
|
+
case 5 /* Point */: {
|
|
8970
8681
|
const rotation = input.readFloat();
|
|
8971
8682
|
const x = input.readFloat();
|
|
8972
8683
|
const y = input.readFloat();
|
|
8973
8684
|
const color = nonessential ? input.readInt32() : 0;
|
|
8974
8685
|
const point = this.attachmentLoader.newPointAttachment(skin, name);
|
|
8975
|
-
if (!point)
|
|
8976
|
-
return null;
|
|
8686
|
+
if (!point) return null;
|
|
8977
8687
|
point.x = x * scale;
|
|
8978
8688
|
point.y = y * scale;
|
|
8979
8689
|
point.rotation = rotation;
|
|
8980
|
-
if (nonessential)
|
|
8981
|
-
Color.rgba8888ToColor(point.color, color);
|
|
8690
|
+
if (nonessential) Color.rgba8888ToColor(point.color, color);
|
|
8982
8691
|
return point;
|
|
8983
8692
|
}
|
|
8984
|
-
case
|
|
8693
|
+
case 6 /* Clipping */: {
|
|
8985
8694
|
const endSlotIndex = input.readInt(true);
|
|
8986
8695
|
const vertices = this.readVertices(input, (flags & 16) != 0);
|
|
8987
8696
|
let color = nonessential ? input.readInt32() : 0;
|
|
8988
8697
|
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
|
|
8989
|
-
if (!clip)
|
|
8990
|
-
return null;
|
|
8698
|
+
if (!clip) return null;
|
|
8991
8699
|
clip.endSlot = skeletonData.slots[endSlotIndex];
|
|
8992
8700
|
clip.worldVerticesLength = vertices.length;
|
|
8993
8701
|
clip.vertices = vertices.vertices;
|
|
8994
8702
|
clip.bones = vertices.bones;
|
|
8995
|
-
if (nonessential)
|
|
8996
|
-
Color.rgba8888ToColor(clip.color, color);
|
|
8703
|
+
if (nonessential) Color.rgba8888ToColor(clip.color, color);
|
|
8997
8704
|
return clip;
|
|
8998
8705
|
}
|
|
8999
8706
|
}
|
|
@@ -9076,8 +8783,7 @@ var SkeletonBinary = class {
|
|
|
9076
8783
|
let a = input.readUnsignedByte() / 255;
|
|
9077
8784
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9078
8785
|
timeline.setFrame(frame, time, r, g, b, a);
|
|
9079
|
-
if (frame == frameLast)
|
|
9080
|
-
break;
|
|
8786
|
+
if (frame == frameLast) break;
|
|
9081
8787
|
let time2 = input.readFloat();
|
|
9082
8788
|
let r2 = input.readUnsignedByte() / 255;
|
|
9083
8789
|
let g2 = input.readUnsignedByte() / 255;
|
|
@@ -9111,8 +8817,7 @@ var SkeletonBinary = class {
|
|
|
9111
8817
|
let b = input.readUnsignedByte() / 255;
|
|
9112
8818
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9113
8819
|
timeline.setFrame(frame, time, r, g, b);
|
|
9114
|
-
if (frame == frameLast)
|
|
9115
|
-
break;
|
|
8820
|
+
if (frame == frameLast) break;
|
|
9116
8821
|
let time2 = input.readFloat();
|
|
9117
8822
|
let r2 = input.readUnsignedByte() / 255;
|
|
9118
8823
|
let g2 = input.readUnsignedByte() / 255;
|
|
@@ -9147,8 +8852,7 @@ var SkeletonBinary = class {
|
|
|
9147
8852
|
let b2 = input.readUnsignedByte() / 255;
|
|
9148
8853
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9149
8854
|
timeline.setFrame(frame, time, r, g, b, a, r2, g2, b2);
|
|
9150
|
-
if (frame == frameLast)
|
|
9151
|
-
break;
|
|
8855
|
+
if (frame == frameLast) break;
|
|
9152
8856
|
let time2 = input.readFloat();
|
|
9153
8857
|
let nr = input.readUnsignedByte() / 255;
|
|
9154
8858
|
let ng = input.readUnsignedByte() / 255;
|
|
@@ -9194,8 +8898,7 @@ var SkeletonBinary = class {
|
|
|
9194
8898
|
let b2 = input.readUnsignedByte() / 255;
|
|
9195
8899
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9196
8900
|
timeline.setFrame(frame, time, r, g, b, r2, g2, b2);
|
|
9197
|
-
if (frame == frameLast)
|
|
9198
|
-
break;
|
|
8901
|
+
if (frame == frameLast) break;
|
|
9199
8902
|
let time2 = input.readFloat();
|
|
9200
8903
|
let nr = input.readUnsignedByte() / 255;
|
|
9201
8904
|
let ng = input.readUnsignedByte() / 255;
|
|
@@ -9231,8 +8934,7 @@ var SkeletonBinary = class {
|
|
|
9231
8934
|
let time = input.readFloat(), a = input.readUnsignedByte() / 255;
|
|
9232
8935
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9233
8936
|
timeline.setFrame(frame, time, a);
|
|
9234
|
-
if (frame == frameLast)
|
|
9235
|
-
break;
|
|
8937
|
+
if (frame == frameLast) break;
|
|
9236
8938
|
let time2 = input.readFloat();
|
|
9237
8939
|
let a2 = input.readUnsignedByte() / 255;
|
|
9238
8940
|
switch (input.readByte()) {
|
|
@@ -9304,8 +9006,7 @@ var SkeletonBinary = class {
|
|
|
9304
9006
|
let softness = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
9305
9007
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9306
9008
|
timeline.setFrame(frame, time, mix, softness, (flags & 8) != 0 ? 1 : -1, (flags & 16) != 0, (flags & 32) != 0);
|
|
9307
|
-
if (frame == frameLast)
|
|
9308
|
-
break;
|
|
9009
|
+
if (frame == frameLast) break;
|
|
9309
9010
|
flags = input.readByte();
|
|
9310
9011
|
const time2 = input.readFloat(), mix2 = (flags & 1) != 0 ? (flags & 2) != 0 ? input.readFloat() : 1 : 0;
|
|
9311
9012
|
const softness2 = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
@@ -9327,8 +9028,7 @@ var SkeletonBinary = class {
|
|
|
9327
9028
|
let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat(), mixScaleX = input.readFloat(), mixScaleY = input.readFloat(), mixShearY = input.readFloat();
|
|
9328
9029
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9329
9030
|
timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
|
|
9330
|
-
if (frame == frameLast)
|
|
9331
|
-
break;
|
|
9031
|
+
if (frame == frameLast) break;
|
|
9332
9032
|
let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat(), mixScaleX2 = input.readFloat(), mixScaleY2 = input.readFloat(), mixShearY2 = input.readFloat();
|
|
9333
9033
|
switch (input.readByte()) {
|
|
9334
9034
|
case CURVE_STEPPED:
|
|
@@ -9377,8 +9077,7 @@ var SkeletonBinary = class {
|
|
|
9377
9077
|
let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat();
|
|
9378
9078
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9379
9079
|
timeline.setFrame(frame, time, mixRotate, mixX, mixY);
|
|
9380
|
-
if (frame == frameLast)
|
|
9381
|
-
break;
|
|
9080
|
+
if (frame == frameLast) break;
|
|
9382
9081
|
let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat();
|
|
9383
9082
|
switch (input.readByte()) {
|
|
9384
9083
|
case CURVE_STEPPED:
|
|
@@ -9440,8 +9139,7 @@ var SkeletonBinary = class {
|
|
|
9440
9139
|
let slotIndex = input.readInt(true);
|
|
9441
9140
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
9442
9141
|
let attachmentName = input.readStringRef();
|
|
9443
|
-
if (!attachmentName)
|
|
9444
|
-
throw new Error("attachmentName must not be null.");
|
|
9142
|
+
if (!attachmentName) throw new Error("attachmentName must not be null.");
|
|
9445
9143
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
9446
9144
|
let timelineType = input.readByte();
|
|
9447
9145
|
let frameCount = input.readInt(true);
|
|
@@ -9477,8 +9175,7 @@ var SkeletonBinary = class {
|
|
|
9477
9175
|
}
|
|
9478
9176
|
}
|
|
9479
9177
|
timeline.setFrame(frame, time, deform);
|
|
9480
|
-
if (frame == frameLast)
|
|
9481
|
-
break;
|
|
9178
|
+
if (frame == frameLast) break;
|
|
9482
9179
|
let time2 = input.readFloat();
|
|
9483
9180
|
switch (input.readByte()) {
|
|
9484
9181
|
case CURVE_STEPPED:
|
|
@@ -9533,8 +9230,7 @@ var SkeletonBinary = class {
|
|
|
9533
9230
|
while (originalIndex < slotCount)
|
|
9534
9231
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
9535
9232
|
for (let ii = slotCount - 1; ii >= 0; ii--)
|
|
9536
|
-
if (drawOrder[ii] == -1)
|
|
9537
|
-
drawOrder[ii] = unchanged[--unchangedIndex];
|
|
9233
|
+
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
|
|
9538
9234
|
timeline.setFrame(i, time, drawOrder);
|
|
9539
9235
|
}
|
|
9540
9236
|
timelines.push(timeline);
|
|
@@ -9549,8 +9245,7 @@ var SkeletonBinary = class {
|
|
|
9549
9245
|
event.intValue = input.readInt(false);
|
|
9550
9246
|
event.floatValue = input.readFloat();
|
|
9551
9247
|
event.stringValue = input.readString();
|
|
9552
|
-
if (event.stringValue == null)
|
|
9553
|
-
event.stringValue = eventData.stringValue;
|
|
9248
|
+
if (event.stringValue == null) event.stringValue = eventData.stringValue;
|
|
9554
9249
|
if (event.data.audioPath) {
|
|
9555
9250
|
event.volume = input.readFloat();
|
|
9556
9251
|
event.balance = input.readFloat();
|
|
@@ -9672,22 +9367,11 @@ var Vertices = class {
|
|
|
9672
9367
|
this.length = length;
|
|
9673
9368
|
}
|
|
9674
9369
|
};
|
|
9675
|
-
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
9676
|
-
AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
|
|
9677
|
-
AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
|
|
9678
|
-
AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
|
|
9679
|
-
AttachmentType2[AttachmentType2["LinkedMesh"] = 3] = "LinkedMesh";
|
|
9680
|
-
AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
|
|
9681
|
-
AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
|
|
9682
|
-
AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
|
|
9683
|
-
return AttachmentType2;
|
|
9684
|
-
})(AttachmentType || {});
|
|
9685
9370
|
function readTimeline1(input, timeline, scale) {
|
|
9686
9371
|
let time = input.readFloat(), value = input.readFloat() * scale;
|
|
9687
9372
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9688
9373
|
timeline.setFrame(frame, time, value);
|
|
9689
|
-
if (frame == frameLast)
|
|
9690
|
-
break;
|
|
9374
|
+
if (frame == frameLast) break;
|
|
9691
9375
|
let time2 = input.readFloat(), value2 = input.readFloat() * scale;
|
|
9692
9376
|
switch (input.readByte()) {
|
|
9693
9377
|
case CURVE_STEPPED:
|
|
@@ -9705,8 +9389,7 @@ function readTimeline2(input, timeline, scale) {
|
|
|
9705
9389
|
let time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
|
|
9706
9390
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9707
9391
|
timeline.setFrame(frame, time, value1, value2);
|
|
9708
|
-
if (frame == frameLast)
|
|
9709
|
-
break;
|
|
9392
|
+
if (frame == frameLast) break;
|
|
9710
9393
|
let time2 = input.readFloat(), nvalue1 = input.readFloat() * scale, nvalue2 = input.readFloat() * scale;
|
|
9711
9394
|
switch (input.readByte()) {
|
|
9712
9395
|
case CURVE_STEPPED:
|
|
@@ -9780,8 +9463,7 @@ var SkeletonBounds = class {
|
|
|
9780
9463
|
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
|
|
9781
9464
|
* SkeletonBounds AABB methods will always return true. */
|
|
9782
9465
|
update(skeleton, updateAabb) {
|
|
9783
|
-
if (!skeleton)
|
|
9784
|
-
throw new Error("skeleton cannot be null.");
|
|
9466
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
9785
9467
|
let boundingBoxes = this.boundingBoxes;
|
|
9786
9468
|
let polygons = this.polygons;
|
|
9787
9469
|
let polygonPool = this.polygonPool;
|
|
@@ -9792,8 +9474,7 @@ var SkeletonBounds = class {
|
|
|
9792
9474
|
polygons.length = 0;
|
|
9793
9475
|
for (let i = 0; i < slotCount; i++) {
|
|
9794
9476
|
let slot = slots[i];
|
|
9795
|
-
if (!slot.bone.active)
|
|
9796
|
-
continue;
|
|
9477
|
+
if (!slot.bone.active) continue;
|
|
9797
9478
|
let attachment = slot.getAttachment();
|
|
9798
9479
|
if (attachment instanceof BoundingBoxAttachment) {
|
|
9799
9480
|
let boundingBox = attachment;
|
|
@@ -9849,17 +9530,13 @@ var SkeletonBounds = class {
|
|
|
9849
9530
|
return false;
|
|
9850
9531
|
let m = (y2 - y1) / (x2 - x1);
|
|
9851
9532
|
let y = m * (minX - x1) + y1;
|
|
9852
|
-
if (y > minY && y < maxY)
|
|
9853
|
-
return true;
|
|
9533
|
+
if (y > minY && y < maxY) return true;
|
|
9854
9534
|
y = m * (maxX - x1) + y1;
|
|
9855
|
-
if (y > minY && y < maxY)
|
|
9856
|
-
return true;
|
|
9535
|
+
if (y > minY && y < maxY) return true;
|
|
9857
9536
|
let x = (minY - y1) / m + x1;
|
|
9858
|
-
if (x > minX && x < maxX)
|
|
9859
|
-
return true;
|
|
9537
|
+
if (x > minX && x < maxX) return true;
|
|
9860
9538
|
x = (maxY - y1) / m + x1;
|
|
9861
|
-
if (x > minX && x < maxX)
|
|
9862
|
-
return true;
|
|
9539
|
+
if (x > minX && x < maxX) return true;
|
|
9863
9540
|
return false;
|
|
9864
9541
|
}
|
|
9865
9542
|
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
|
@@ -9871,8 +9548,7 @@ var SkeletonBounds = class {
|
|
|
9871
9548
|
containsPoint(x, y) {
|
|
9872
9549
|
let polygons = this.polygons;
|
|
9873
9550
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
9874
|
-
if (this.containsPointPolygon(polygons[i], x, y))
|
|
9875
|
-
return this.boundingBoxes[i];
|
|
9551
|
+
if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i];
|
|
9876
9552
|
return null;
|
|
9877
9553
|
}
|
|
9878
9554
|
/** Returns true if the polygon contains the point. */
|
|
@@ -9886,8 +9562,7 @@ var SkeletonBounds = class {
|
|
|
9886
9562
|
let prevY = vertices[prevIndex + 1];
|
|
9887
9563
|
if (vertexY < y && prevY >= y || prevY < y && vertexY >= y) {
|
|
9888
9564
|
let vertexX = vertices[ii];
|
|
9889
|
-
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
|
|
9890
|
-
inside = !inside;
|
|
9565
|
+
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) inside = !inside;
|
|
9891
9566
|
}
|
|
9892
9567
|
prevIndex = ii;
|
|
9893
9568
|
}
|
|
@@ -9899,8 +9574,7 @@ var SkeletonBounds = class {
|
|
|
9899
9574
|
intersectsSegment(x1, y1, x2, y2) {
|
|
9900
9575
|
let polygons = this.polygons;
|
|
9901
9576
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
9902
|
-
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
|
|
9903
|
-
return this.boundingBoxes[i];
|
|
9577
|
+
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i];
|
|
9904
9578
|
return null;
|
|
9905
9579
|
}
|
|
9906
9580
|
/** Returns true if the polygon contains any part of the line segment. */
|
|
@@ -9918,8 +9592,7 @@ var SkeletonBounds = class {
|
|
|
9918
9592
|
let x = (det1 * width34 - width12 * det2) / det3;
|
|
9919
9593
|
if ((x >= x3 && x <= x4 || x >= x4 && x <= x3) && (x >= x1 && x <= x2 || x >= x2 && x <= x1)) {
|
|
9920
9594
|
let y = (det1 * height34 - height12 * det2) / det3;
|
|
9921
|
-
if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1))
|
|
9922
|
-
return true;
|
|
9595
|
+
if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1)) return true;
|
|
9923
9596
|
}
|
|
9924
9597
|
x3 = x4;
|
|
9925
9598
|
y3 = y4;
|
|
@@ -9928,8 +9601,7 @@ var SkeletonBounds = class {
|
|
|
9928
9601
|
}
|
|
9929
9602
|
/** Returns the polygon for the specified bounding box, or null. */
|
|
9930
9603
|
getPolygon(boundingBox) {
|
|
9931
|
-
if (!boundingBox)
|
|
9932
|
-
throw new Error("boundingBox cannot be null.");
|
|
9604
|
+
if (!boundingBox) throw new Error("boundingBox cannot be null.");
|
|
9933
9605
|
let index = this.boundingBoxes.indexOf(boundingBox);
|
|
9934
9606
|
return index == -1 ? null : this.polygons[index];
|
|
9935
9607
|
}
|
|
@@ -9944,7 +9616,7 @@ var SkeletonBounds = class {
|
|
|
9944
9616
|
};
|
|
9945
9617
|
|
|
9946
9618
|
// spine-core/src/Triangulator.ts
|
|
9947
|
-
var Triangulator = class {
|
|
9619
|
+
var Triangulator = class _Triangulator {
|
|
9948
9620
|
convexPolygons = new Array();
|
|
9949
9621
|
convexPolygonsIndices = new Array();
|
|
9950
9622
|
indicesArray = new Array();
|
|
@@ -9966,7 +9638,7 @@ var Triangulator = class {
|
|
|
9966
9638
|
let isConcave = this.isConcaveArray;
|
|
9967
9639
|
isConcave.length = 0;
|
|
9968
9640
|
for (let i = 0, n = vertexCount; i < n; ++i)
|
|
9969
|
-
isConcave[i] =
|
|
9641
|
+
isConcave[i] = _Triangulator.isConcave(i, vertexCount, vertices, indices);
|
|
9970
9642
|
let triangles = this.triangles;
|
|
9971
9643
|
triangles.length = 0;
|
|
9972
9644
|
while (vertexCount > 3) {
|
|
@@ -9979,14 +9651,12 @@ var Triangulator = class {
|
|
|
9979
9651
|
let p2x = vertices[p2], p2y = vertices[p2 + 1];
|
|
9980
9652
|
let p3x = vertices[p3], p3y = vertices[p3 + 1];
|
|
9981
9653
|
for (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
|
|
9982
|
-
if (!isConcave[ii])
|
|
9983
|
-
continue;
|
|
9654
|
+
if (!isConcave[ii]) continue;
|
|
9984
9655
|
let v = indices[ii] << 1;
|
|
9985
9656
|
let vx = vertices[v], vy = vertices[v + 1];
|
|
9986
|
-
if (
|
|
9987
|
-
if (
|
|
9988
|
-
if (
|
|
9989
|
-
break outer;
|
|
9657
|
+
if (_Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
|
|
9658
|
+
if (_Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
|
|
9659
|
+
if (_Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) break outer;
|
|
9990
9660
|
}
|
|
9991
9661
|
}
|
|
9992
9662
|
}
|
|
@@ -9994,8 +9664,7 @@ var Triangulator = class {
|
|
|
9994
9664
|
}
|
|
9995
9665
|
if (next == 0) {
|
|
9996
9666
|
do {
|
|
9997
|
-
if (!isConcave[i])
|
|
9998
|
-
break;
|
|
9667
|
+
if (!isConcave[i]) break;
|
|
9999
9668
|
i--;
|
|
10000
9669
|
} while (i > 0);
|
|
10001
9670
|
break;
|
|
@@ -10012,8 +9681,8 @@ var Triangulator = class {
|
|
|
10012
9681
|
vertexCount--;
|
|
10013
9682
|
let previousIndex = (vertexCount + i - 1) % vertexCount;
|
|
10014
9683
|
let nextIndex = i == vertexCount ? 0 : i;
|
|
10015
|
-
isConcave[previousIndex] =
|
|
10016
|
-
isConcave[nextIndex] =
|
|
9684
|
+
isConcave[previousIndex] = _Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
|
|
9685
|
+
isConcave[nextIndex] = _Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
|
|
10017
9686
|
}
|
|
10018
9687
|
if (vertexCount == 3) {
|
|
10019
9688
|
triangles.push(indices[2]);
|
|
@@ -10043,8 +9712,8 @@ var Triangulator = class {
|
|
|
10043
9712
|
let merged = false;
|
|
10044
9713
|
if (fanBaseIndex == t1) {
|
|
10045
9714
|
let o = polygon.length - 4;
|
|
10046
|
-
let winding1 =
|
|
10047
|
-
let winding2 =
|
|
9715
|
+
let winding1 = _Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
|
|
9716
|
+
let winding2 = _Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
|
|
10048
9717
|
if (winding1 == lastWinding && winding2 == lastWinding) {
|
|
10049
9718
|
polygon.push(x3);
|
|
10050
9719
|
polygon.push(y3);
|
|
@@ -10073,7 +9742,7 @@ var Triangulator = class {
|
|
|
10073
9742
|
polygonIndices.push(t1);
|
|
10074
9743
|
polygonIndices.push(t2);
|
|
10075
9744
|
polygonIndices.push(t3);
|
|
10076
|
-
lastWinding =
|
|
9745
|
+
lastWinding = _Triangulator.winding(x1, y1, x2, y2, x3, y3);
|
|
10077
9746
|
fanBaseIndex = t1;
|
|
10078
9747
|
}
|
|
10079
9748
|
}
|
|
@@ -10083,8 +9752,7 @@ var Triangulator = class {
|
|
|
10083
9752
|
}
|
|
10084
9753
|
for (let i = 0, n = convexPolygons.length; i < n; i++) {
|
|
10085
9754
|
polygonIndices = convexPolygonsIndices[i];
|
|
10086
|
-
if (polygonIndices.length == 0)
|
|
10087
|
-
continue;
|
|
9755
|
+
if (polygonIndices.length == 0) continue;
|
|
10088
9756
|
let firstIndex = polygonIndices[0];
|
|
10089
9757
|
let lastIndex = polygonIndices[polygonIndices.length - 1];
|
|
10090
9758
|
polygon = convexPolygons[i];
|
|
@@ -10093,22 +9761,19 @@ var Triangulator = class {
|
|
|
10093
9761
|
let prevX = polygon[o + 2], prevY = polygon[o + 3];
|
|
10094
9762
|
let firstX = polygon[0], firstY = polygon[1];
|
|
10095
9763
|
let secondX = polygon[2], secondY = polygon[3];
|
|
10096
|
-
let winding =
|
|
9764
|
+
let winding = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
|
|
10097
9765
|
for (let ii = 0; ii < n; ii++) {
|
|
10098
|
-
if (ii == i)
|
|
10099
|
-
continue;
|
|
9766
|
+
if (ii == i) continue;
|
|
10100
9767
|
let otherIndices = convexPolygonsIndices[ii];
|
|
10101
|
-
if (otherIndices.length != 3)
|
|
10102
|
-
continue;
|
|
9768
|
+
if (otherIndices.length != 3) continue;
|
|
10103
9769
|
let otherFirstIndex = otherIndices[0];
|
|
10104
9770
|
let otherSecondIndex = otherIndices[1];
|
|
10105
9771
|
let otherLastIndex = otherIndices[2];
|
|
10106
9772
|
let otherPoly = convexPolygons[ii];
|
|
10107
9773
|
let x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
|
|
10108
|
-
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
|
|
10109
|
-
|
|
10110
|
-
let
|
|
10111
|
-
let winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
|
|
9774
|
+
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue;
|
|
9775
|
+
let winding1 = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
|
|
9776
|
+
let winding2 = _Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
|
|
10112
9777
|
if (winding1 == winding && winding2 == winding) {
|
|
10113
9778
|
otherPoly.length = 0;
|
|
10114
9779
|
otherIndices.length = 0;
|
|
@@ -10158,7 +9823,7 @@ var Triangulator = class {
|
|
|
10158
9823
|
};
|
|
10159
9824
|
|
|
10160
9825
|
// spine-core/src/SkeletonClipping.ts
|
|
10161
|
-
var SkeletonClipping = class {
|
|
9826
|
+
var SkeletonClipping = class _SkeletonClipping {
|
|
10162
9827
|
triangulator = new Triangulator();
|
|
10163
9828
|
clippingPolygon = new Array();
|
|
10164
9829
|
clipOutput = new Array();
|
|
@@ -10169,30 +9834,27 @@ var SkeletonClipping = class {
|
|
|
10169
9834
|
clipAttachment = null;
|
|
10170
9835
|
clippingPolygons = null;
|
|
10171
9836
|
clipStart(slot, clip) {
|
|
10172
|
-
if (this.clipAttachment)
|
|
10173
|
-
return 0;
|
|
9837
|
+
if (this.clipAttachment) return 0;
|
|
10174
9838
|
this.clipAttachment = clip;
|
|
10175
9839
|
let n = clip.worldVerticesLength;
|
|
10176
9840
|
let vertices = Utils.setArraySize(this.clippingPolygon, n);
|
|
10177
9841
|
clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
|
|
10178
9842
|
let clippingPolygon = this.clippingPolygon;
|
|
10179
|
-
|
|
9843
|
+
_SkeletonClipping.makeClockwise(clippingPolygon);
|
|
10180
9844
|
let clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
|
|
10181
9845
|
for (let i = 0, n2 = clippingPolygons.length; i < n2; i++) {
|
|
10182
9846
|
let polygon = clippingPolygons[i];
|
|
10183
|
-
|
|
9847
|
+
_SkeletonClipping.makeClockwise(polygon);
|
|
10184
9848
|
polygon.push(polygon[0]);
|
|
10185
9849
|
polygon.push(polygon[1]);
|
|
10186
9850
|
}
|
|
10187
9851
|
return clippingPolygons.length;
|
|
10188
9852
|
}
|
|
10189
9853
|
clipEndWithSlot(slot) {
|
|
10190
|
-
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data)
|
|
10191
|
-
this.clipEnd();
|
|
9854
|
+
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data) this.clipEnd();
|
|
10192
9855
|
}
|
|
10193
9856
|
clipEnd() {
|
|
10194
|
-
if (!this.clipAttachment)
|
|
10195
|
-
return;
|
|
9857
|
+
if (!this.clipAttachment) return;
|
|
10196
9858
|
this.clipAttachment = null;
|
|
10197
9859
|
this.clippingPolygons = null;
|
|
10198
9860
|
this.clippedVertices.length = 0;
|
|
@@ -10248,8 +9910,7 @@ var SkeletonClipping = class {
|
|
|
10248
9910
|
let s = clippedVertices.length;
|
|
10249
9911
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10250
9912
|
let clipOutputLength = clipOutput.length;
|
|
10251
|
-
if (clipOutputLength == 0)
|
|
10252
|
-
continue;
|
|
9913
|
+
if (clipOutputLength == 0) continue;
|
|
10253
9914
|
let clipOutputCount = clipOutputLength >> 1;
|
|
10254
9915
|
let clipOutputItems = this.clipOutput;
|
|
10255
9916
|
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
|
|
@@ -10309,8 +9970,7 @@ var SkeletonClipping = class {
|
|
|
10309
9970
|
let s = clippedVertices.length;
|
|
10310
9971
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10311
9972
|
let clipOutputLength = clipOutput.length;
|
|
10312
|
-
if (clipOutputLength == 0)
|
|
10313
|
-
continue;
|
|
9973
|
+
if (clipOutputLength == 0) continue;
|
|
10314
9974
|
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
|
10315
9975
|
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
|
10316
9976
|
let clipOutputCount = clipOutputLength >> 1;
|
|
@@ -10439,8 +10099,7 @@ var SkeletonClipping = class {
|
|
|
10439
10099
|
let s = clippedVertices.length;
|
|
10440
10100
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10441
10101
|
let clipOutputLength = clipOutput.length;
|
|
10442
|
-
if (clipOutputLength == 0)
|
|
10443
|
-
continue;
|
|
10102
|
+
if (clipOutputLength == 0) continue;
|
|
10444
10103
|
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
|
10445
10104
|
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
|
10446
10105
|
let clipOutputCount = clipOutputLength >> 1;
|
|
@@ -10563,8 +10222,7 @@ var SkeletonClipping = class {
|
|
|
10563
10222
|
}
|
|
10564
10223
|
output.push(output[0]);
|
|
10565
10224
|
output.push(output[1]);
|
|
10566
|
-
if (i == clippingVerticesLast)
|
|
10567
|
-
break;
|
|
10225
|
+
if (i == clippingVerticesLast) break;
|
|
10568
10226
|
let temp = output;
|
|
10569
10227
|
output = input;
|
|
10570
10228
|
output.length = 0;
|
|
@@ -10589,8 +10247,7 @@ var SkeletonClipping = class {
|
|
|
10589
10247
|
p2y = vertices[i + 3];
|
|
10590
10248
|
area += p1x * p2y - p2x * p1y;
|
|
10591
10249
|
}
|
|
10592
|
-
if (area < 0)
|
|
10593
|
-
return;
|
|
10250
|
+
if (area < 0) return;
|
|
10594
10251
|
for (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
|
|
10595
10252
|
let x = vertices[i], y = vertices[i + 1];
|
|
10596
10253
|
let other = lastX - i;
|
|
@@ -10636,8 +10293,7 @@ var SkeletonJson = class {
|
|
|
10636
10293
|
let boneMap = root.bones[i];
|
|
10637
10294
|
let parent = null;
|
|
10638
10295
|
let parentName = getValue(boneMap, "parent", null);
|
|
10639
|
-
if (parentName)
|
|
10640
|
-
parent = skeletonData.findBone(parentName);
|
|
10296
|
+
if (parentName) parent = skeletonData.findBone(parentName);
|
|
10641
10297
|
let data = new BoneData(skeletonData.bones.length, boneMap.name, parent);
|
|
10642
10298
|
data.length = getValue(boneMap, "length", 0) * scale;
|
|
10643
10299
|
data.x = getValue(boneMap, "x", 0) * scale;
|
|
@@ -10650,8 +10306,7 @@ var SkeletonJson = class {
|
|
|
10650
10306
|
data.inherit = Utils.enumValue(Inherit, getValue(boneMap, "inherit", "Normal"));
|
|
10651
10307
|
data.skinRequired = getValue(boneMap, "skin", false);
|
|
10652
10308
|
let color = getValue(boneMap, "color", null);
|
|
10653
|
-
if (color)
|
|
10654
|
-
data.color.setFromString(color);
|
|
10309
|
+
if (color) data.color.setFromString(color);
|
|
10655
10310
|
skeletonData.bones.push(data);
|
|
10656
10311
|
}
|
|
10657
10312
|
}
|
|
@@ -10660,15 +10315,12 @@ var SkeletonJson = class {
|
|
|
10660
10315
|
let slotMap = root.slots[i];
|
|
10661
10316
|
let slotName = slotMap.name;
|
|
10662
10317
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
10663
|
-
if (!boneData)
|
|
10664
|
-
throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
|
|
10318
|
+
if (!boneData) throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
|
|
10665
10319
|
let data = new SlotData(skeletonData.slots.length, slotName, boneData);
|
|
10666
10320
|
let color = getValue(slotMap, "color", null);
|
|
10667
|
-
if (color)
|
|
10668
|
-
data.color.setFromString(color);
|
|
10321
|
+
if (color) data.color.setFromString(color);
|
|
10669
10322
|
let dark = getValue(slotMap, "dark", null);
|
|
10670
|
-
if (dark)
|
|
10671
|
-
data.darkColor = Color.fromString(dark);
|
|
10323
|
+
if (dark) data.darkColor = Color.fromString(dark);
|
|
10672
10324
|
data.attachmentName = getValue(slotMap, "attachment", null);
|
|
10673
10325
|
data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal"));
|
|
10674
10326
|
data.visible = getValue(slotMap, "visible", true);
|
|
@@ -10683,14 +10335,12 @@ var SkeletonJson = class {
|
|
|
10683
10335
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10684
10336
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10685
10337
|
let bone = skeletonData.findBone(constraintMap.bones[ii]);
|
|
10686
|
-
if (!bone)
|
|
10687
|
-
throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
10338
|
+
if (!bone) throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
10688
10339
|
data.bones.push(bone);
|
|
10689
10340
|
}
|
|
10690
10341
|
let target = skeletonData.findBone(constraintMap.target);
|
|
10691
10342
|
;
|
|
10692
|
-
if (!target)
|
|
10693
|
-
throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
10343
|
+
if (!target) throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
10694
10344
|
data.target = target;
|
|
10695
10345
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
10696
10346
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
@@ -10710,14 +10360,12 @@ var SkeletonJson = class {
|
|
|
10710
10360
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10711
10361
|
let boneName = constraintMap.bones[ii];
|
|
10712
10362
|
let bone = skeletonData.findBone(boneName);
|
|
10713
|
-
if (!bone)
|
|
10714
|
-
throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
10363
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
10715
10364
|
data.bones.push(bone);
|
|
10716
10365
|
}
|
|
10717
10366
|
let targetName = constraintMap.target;
|
|
10718
10367
|
let target = skeletonData.findBone(targetName);
|
|
10719
|
-
if (!target)
|
|
10720
|
-
throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
10368
|
+
if (!target) throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
10721
10369
|
data.target = target;
|
|
10722
10370
|
data.local = getValue(constraintMap, "local", false);
|
|
10723
10371
|
data.relative = getValue(constraintMap, "relative", false);
|
|
@@ -10745,25 +10393,21 @@ var SkeletonJson = class {
|
|
|
10745
10393
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10746
10394
|
let boneName = constraintMap.bones[ii];
|
|
10747
10395
|
let bone = skeletonData.findBone(boneName);
|
|
10748
|
-
if (!bone)
|
|
10749
|
-
throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
10396
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
10750
10397
|
data.bones.push(bone);
|
|
10751
10398
|
}
|
|
10752
10399
|
let targetName = constraintMap.target;
|
|
10753
10400
|
let target = skeletonData.findSlot(targetName);
|
|
10754
|
-
if (!target)
|
|
10755
|
-
throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
10401
|
+
if (!target) throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
10756
10402
|
data.target = target;
|
|
10757
10403
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
10758
10404
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
10759
10405
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
10760
10406
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
10761
10407
|
data.position = getValue(constraintMap, "position", 0);
|
|
10762
|
-
if (data.positionMode == 0 /* Fixed */)
|
|
10763
|
-
data.position *= scale;
|
|
10408
|
+
if (data.positionMode == 0 /* Fixed */) data.position *= scale;
|
|
10764
10409
|
data.spacing = getValue(constraintMap, "spacing", 0);
|
|
10765
|
-
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
10766
|
-
data.spacing *= scale;
|
|
10410
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
|
|
10767
10411
|
data.mixRotate = getValue(constraintMap, "mixRotate", 1);
|
|
10768
10412
|
data.mixX = getValue(constraintMap, "mixX", 1);
|
|
10769
10413
|
data.mixY = getValue(constraintMap, "mixY", data.mixX);
|
|
@@ -10778,8 +10422,7 @@ var SkeletonJson = class {
|
|
|
10778
10422
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10779
10423
|
const boneName = constraintMap.bone;
|
|
10780
10424
|
const bone = skeletonData.findBone(boneName);
|
|
10781
|
-
if (bone == null)
|
|
10782
|
-
throw new Error("Physics bone not found: " + boneName);
|
|
10425
|
+
if (bone == null) throw new Error("Physics bone not found: " + boneName);
|
|
10783
10426
|
data.bone = bone;
|
|
10784
10427
|
data.x = getValue(constraintMap, "x", 0);
|
|
10785
10428
|
data.y = getValue(constraintMap, "y", 0);
|
|
@@ -10813,8 +10456,7 @@ var SkeletonJson = class {
|
|
|
10813
10456
|
for (let ii = 0; ii < skinMap.bones.length; ii++) {
|
|
10814
10457
|
let boneName = skinMap.bones[ii];
|
|
10815
10458
|
let bone = skeletonData.findBone(boneName);
|
|
10816
|
-
if (!bone)
|
|
10817
|
-
throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
10459
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
10818
10460
|
skin.bones.push(bone);
|
|
10819
10461
|
}
|
|
10820
10462
|
}
|
|
@@ -10822,8 +10464,7 @@ var SkeletonJson = class {
|
|
|
10822
10464
|
for (let ii = 0; ii < skinMap.ik.length; ii++) {
|
|
10823
10465
|
let constraintName = skinMap.ik[ii];
|
|
10824
10466
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
10825
|
-
if (!constraint)
|
|
10826
|
-
throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10467
|
+
if (!constraint) throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10827
10468
|
skin.constraints.push(constraint);
|
|
10828
10469
|
}
|
|
10829
10470
|
}
|
|
@@ -10831,8 +10472,7 @@ var SkeletonJson = class {
|
|
|
10831
10472
|
for (let ii = 0; ii < skinMap.transform.length; ii++) {
|
|
10832
10473
|
let constraintName = skinMap.transform[ii];
|
|
10833
10474
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
10834
|
-
if (!constraint)
|
|
10835
|
-
throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10475
|
+
if (!constraint) throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10836
10476
|
skin.constraints.push(constraint);
|
|
10837
10477
|
}
|
|
10838
10478
|
}
|
|
@@ -10840,8 +10480,7 @@ var SkeletonJson = class {
|
|
|
10840
10480
|
for (let ii = 0; ii < skinMap.path.length; ii++) {
|
|
10841
10481
|
let constraintName = skinMap.path[ii];
|
|
10842
10482
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
10843
|
-
if (!constraint)
|
|
10844
|
-
throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10483
|
+
if (!constraint) throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10845
10484
|
skin.constraints.push(constraint);
|
|
10846
10485
|
}
|
|
10847
10486
|
}
|
|
@@ -10849,39 +10488,32 @@ var SkeletonJson = class {
|
|
|
10849
10488
|
for (let ii = 0; ii < skinMap.physics.length; ii++) {
|
|
10850
10489
|
let constraintName = skinMap.physics[ii];
|
|
10851
10490
|
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
10852
|
-
if (!constraint)
|
|
10853
|
-
throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10491
|
+
if (!constraint) throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10854
10492
|
skin.constraints.push(constraint);
|
|
10855
10493
|
}
|
|
10856
10494
|
}
|
|
10857
10495
|
for (let slotName in skinMap.attachments) {
|
|
10858
10496
|
let slot = skeletonData.findSlot(slotName);
|
|
10859
|
-
if (!slot)
|
|
10860
|
-
throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
10497
|
+
if (!slot) throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
10861
10498
|
let slotMap = skinMap.attachments[slotName];
|
|
10862
10499
|
for (let entryName in slotMap) {
|
|
10863
10500
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
10864
|
-
if (attachment)
|
|
10865
|
-
skin.setAttachment(slot.index, entryName, attachment);
|
|
10501
|
+
if (attachment) skin.setAttachment(slot.index, entryName, attachment);
|
|
10866
10502
|
}
|
|
10867
10503
|
}
|
|
10868
10504
|
skeletonData.skins.push(skin);
|
|
10869
|
-
if (skin.name == "default")
|
|
10870
|
-
skeletonData.defaultSkin = skin;
|
|
10505
|
+
if (skin.name == "default") skeletonData.defaultSkin = skin;
|
|
10871
10506
|
}
|
|
10872
10507
|
}
|
|
10873
10508
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
10874
10509
|
let linkedMesh = this.linkedMeshes[i];
|
|
10875
10510
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
10876
|
-
if (!skin)
|
|
10877
|
-
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
10511
|
+
if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
10878
10512
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
10879
|
-
if (!parent)
|
|
10880
|
-
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
10513
|
+
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
10881
10514
|
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
10882
10515
|
linkedMesh.mesh.setParentMesh(parent);
|
|
10883
|
-
if (linkedMesh.mesh.region != null)
|
|
10884
|
-
linkedMesh.mesh.updateRegion();
|
|
10516
|
+
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
|
|
10885
10517
|
}
|
|
10886
10518
|
this.linkedMeshes.length = 0;
|
|
10887
10519
|
if (root.events) {
|
|
@@ -10915,8 +10547,7 @@ var SkeletonJson = class {
|
|
|
10915
10547
|
let path = getValue(map, "path", name);
|
|
10916
10548
|
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
10917
10549
|
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
10918
|
-
if (!region)
|
|
10919
|
-
return null;
|
|
10550
|
+
if (!region) return null;
|
|
10920
10551
|
region.path = path;
|
|
10921
10552
|
region.x = getValue(map, "x", 0) * scale;
|
|
10922
10553
|
region.y = getValue(map, "y", 0) * scale;
|
|
@@ -10927,20 +10558,16 @@ var SkeletonJson = class {
|
|
|
10927
10558
|
region.height = map.height * scale;
|
|
10928
10559
|
region.sequence = sequence;
|
|
10929
10560
|
let color = getValue(map, "color", null);
|
|
10930
|
-
if (color)
|
|
10931
|
-
|
|
10932
|
-
if (region.region != null)
|
|
10933
|
-
region.updateRegion();
|
|
10561
|
+
if (color) region.color.setFromString(color);
|
|
10562
|
+
if (region.region != null) region.updateRegion();
|
|
10934
10563
|
return region;
|
|
10935
10564
|
}
|
|
10936
10565
|
case "boundingbox": {
|
|
10937
10566
|
let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
|
|
10938
|
-
if (!box)
|
|
10939
|
-
return null;
|
|
10567
|
+
if (!box) return null;
|
|
10940
10568
|
this.readVertices(map, box, map.vertexCount << 1);
|
|
10941
10569
|
let color = getValue(map, "color", null);
|
|
10942
|
-
if (color)
|
|
10943
|
-
box.color.setFromString(color);
|
|
10570
|
+
if (color) box.color.setFromString(color);
|
|
10944
10571
|
return box;
|
|
10945
10572
|
}
|
|
10946
10573
|
case "mesh":
|
|
@@ -10948,12 +10575,10 @@ var SkeletonJson = class {
|
|
|
10948
10575
|
let path = getValue(map, "path", name);
|
|
10949
10576
|
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
10950
10577
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
10951
|
-
if (!mesh)
|
|
10952
|
-
return null;
|
|
10578
|
+
if (!mesh) return null;
|
|
10953
10579
|
mesh.path = path;
|
|
10954
10580
|
let color = getValue(map, "color", null);
|
|
10955
|
-
if (color)
|
|
10956
|
-
mesh.color.setFromString(color);
|
|
10581
|
+
if (color) mesh.color.setFromString(color);
|
|
10957
10582
|
mesh.width = getValue(map, "width", 0) * scale;
|
|
10958
10583
|
mesh.height = getValue(map, "height", 0) * scale;
|
|
10959
10584
|
mesh.sequence = sequence;
|
|
@@ -10966,16 +10591,14 @@ var SkeletonJson = class {
|
|
|
10966
10591
|
this.readVertices(map, mesh, uvs.length);
|
|
10967
10592
|
mesh.triangles = map.triangles;
|
|
10968
10593
|
mesh.regionUVs = uvs;
|
|
10969
|
-
if (mesh.region != null)
|
|
10970
|
-
mesh.updateRegion();
|
|
10594
|
+
if (mesh.region != null) mesh.updateRegion();
|
|
10971
10595
|
mesh.edges = getValue(map, "edges", null);
|
|
10972
10596
|
mesh.hullLength = getValue(map, "hull", 0) * 2;
|
|
10973
10597
|
return mesh;
|
|
10974
10598
|
}
|
|
10975
10599
|
case "path": {
|
|
10976
10600
|
let path = this.attachmentLoader.newPathAttachment(skin, name);
|
|
10977
|
-
if (!path)
|
|
10978
|
-
return null;
|
|
10601
|
+
if (!path) return null;
|
|
10979
10602
|
path.closed = getValue(map, "closed", false);
|
|
10980
10603
|
path.constantSpeed = getValue(map, "constantSpeed", true);
|
|
10981
10604
|
let vertexCount = map.vertexCount;
|
|
@@ -10985,42 +10608,35 @@ var SkeletonJson = class {
|
|
|
10985
10608
|
lengths[i] = map.lengths[i] * scale;
|
|
10986
10609
|
path.lengths = lengths;
|
|
10987
10610
|
let color = getValue(map, "color", null);
|
|
10988
|
-
if (color)
|
|
10989
|
-
path.color.setFromString(color);
|
|
10611
|
+
if (color) path.color.setFromString(color);
|
|
10990
10612
|
return path;
|
|
10991
10613
|
}
|
|
10992
10614
|
case "point": {
|
|
10993
10615
|
let point = this.attachmentLoader.newPointAttachment(skin, name);
|
|
10994
|
-
if (!point)
|
|
10995
|
-
return null;
|
|
10616
|
+
if (!point) return null;
|
|
10996
10617
|
point.x = getValue(map, "x", 0) * scale;
|
|
10997
10618
|
point.y = getValue(map, "y", 0) * scale;
|
|
10998
10619
|
point.rotation = getValue(map, "rotation", 0);
|
|
10999
10620
|
let color = getValue(map, "color", null);
|
|
11000
|
-
if (color)
|
|
11001
|
-
point.color.setFromString(color);
|
|
10621
|
+
if (color) point.color.setFromString(color);
|
|
11002
10622
|
return point;
|
|
11003
10623
|
}
|
|
11004
10624
|
case "clipping": {
|
|
11005
10625
|
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
|
|
11006
|
-
if (!clip)
|
|
11007
|
-
return null;
|
|
10626
|
+
if (!clip) return null;
|
|
11008
10627
|
let end = getValue(map, "end", null);
|
|
11009
|
-
if (end)
|
|
11010
|
-
clip.endSlot = skeletonData.findSlot(end);
|
|
10628
|
+
if (end) clip.endSlot = skeletonData.findSlot(end);
|
|
11011
10629
|
let vertexCount = map.vertexCount;
|
|
11012
10630
|
this.readVertices(map, clip, vertexCount << 1);
|
|
11013
10631
|
let color = getValue(map, "color", null);
|
|
11014
|
-
if (color)
|
|
11015
|
-
clip.color.setFromString(color);
|
|
10632
|
+
if (color) clip.color.setFromString(color);
|
|
11016
10633
|
return clip;
|
|
11017
10634
|
}
|
|
11018
10635
|
}
|
|
11019
10636
|
return null;
|
|
11020
10637
|
}
|
|
11021
10638
|
readSequence(map) {
|
|
11022
|
-
if (map == null)
|
|
11023
|
-
return null;
|
|
10639
|
+
if (map == null) return null;
|
|
11024
10640
|
let sequence = new Sequence(getValue(map, "count", 0));
|
|
11025
10641
|
sequence.start = getValue(map, "start", 1);
|
|
11026
10642
|
sequence.digits = getValue(map, "digits", 0);
|
|
@@ -11062,13 +10678,11 @@ var SkeletonJson = class {
|
|
|
11062
10678
|
for (let slotName in map.slots) {
|
|
11063
10679
|
let slotMap = map.slots[slotName];
|
|
11064
10680
|
let slot = skeletonData.findSlot(slotName);
|
|
11065
|
-
if (!slot)
|
|
11066
|
-
throw new Error("Slot not found: " + slotName);
|
|
10681
|
+
if (!slot) throw new Error("Slot not found: " + slotName);
|
|
11067
10682
|
let slotIndex = slot.index;
|
|
11068
10683
|
for (let timelineName in slotMap) {
|
|
11069
10684
|
let timelineMap = slotMap[timelineName];
|
|
11070
|
-
if (!timelineMap)
|
|
11071
|
-
continue;
|
|
10685
|
+
if (!timelineMap) continue;
|
|
11072
10686
|
let frames = timelineMap.length;
|
|
11073
10687
|
if (timelineName == "attachment") {
|
|
11074
10688
|
let timeline = new AttachmentTimeline(frames, slotIndex);
|
|
@@ -11201,14 +10815,12 @@ var SkeletonJson = class {
|
|
|
11201
10815
|
for (let boneName in map.bones) {
|
|
11202
10816
|
let boneMap = map.bones[boneName];
|
|
11203
10817
|
let bone = skeletonData.findBone(boneName);
|
|
11204
|
-
if (!bone)
|
|
11205
|
-
throw new Error("Bone not found: " + boneName);
|
|
10818
|
+
if (!bone) throw new Error("Bone not found: " + boneName);
|
|
11206
10819
|
let boneIndex = bone.index;
|
|
11207
10820
|
for (let timelineName in boneMap) {
|
|
11208
10821
|
let timelineMap = boneMap[timelineName];
|
|
11209
10822
|
let frames = timelineMap.length;
|
|
11210
|
-
if (frames == 0)
|
|
11211
|
-
continue;
|
|
10823
|
+
if (frames == 0) continue;
|
|
11212
10824
|
if (timelineName === "rotate") {
|
|
11213
10825
|
timelines.push(readTimeline12(timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1));
|
|
11214
10826
|
} else if (timelineName === "translate") {
|
|
@@ -11253,11 +10865,9 @@ var SkeletonJson = class {
|
|
|
11253
10865
|
for (let constraintName in map.ik) {
|
|
11254
10866
|
let constraintMap = map.ik[constraintName];
|
|
11255
10867
|
let keyMap = constraintMap[0];
|
|
11256
|
-
if (!keyMap)
|
|
11257
|
-
continue;
|
|
10868
|
+
if (!keyMap) continue;
|
|
11258
10869
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
11259
|
-
if (!constraint)
|
|
11260
|
-
throw new Error("IK Constraint not found: " + constraintName);
|
|
10870
|
+
if (!constraint) throw new Error("IK Constraint not found: " + constraintName);
|
|
11261
10871
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
11262
10872
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
11263
10873
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -11290,11 +10900,9 @@ var SkeletonJson = class {
|
|
|
11290
10900
|
for (let constraintName in map.transform) {
|
|
11291
10901
|
let timelineMap = map.transform[constraintName];
|
|
11292
10902
|
let keyMap = timelineMap[0];
|
|
11293
|
-
if (!keyMap)
|
|
11294
|
-
continue;
|
|
10903
|
+
if (!keyMap) continue;
|
|
11295
10904
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
11296
|
-
if (!constraint)
|
|
11297
|
-
throw new Error("Transform constraint not found: " + constraintName);
|
|
10905
|
+
if (!constraint) throw new Error("Transform constraint not found: " + constraintName);
|
|
11298
10906
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
11299
10907
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
11300
10908
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -11343,14 +10951,12 @@ var SkeletonJson = class {
|
|
|
11343
10951
|
for (let constraintName in map.path) {
|
|
11344
10952
|
let constraintMap = map.path[constraintName];
|
|
11345
10953
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
11346
|
-
if (!constraint)
|
|
11347
|
-
throw new Error("Path constraint not found: " + constraintName);
|
|
10954
|
+
if (!constraint) throw new Error("Path constraint not found: " + constraintName);
|
|
11348
10955
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
11349
10956
|
for (let timelineName in constraintMap) {
|
|
11350
10957
|
let timelineMap = constraintMap[timelineName];
|
|
11351
10958
|
let keyMap = timelineMap[0];
|
|
11352
|
-
if (!keyMap)
|
|
11353
|
-
continue;
|
|
10959
|
+
if (!keyMap) continue;
|
|
11354
10960
|
let frames = timelineMap.length;
|
|
11355
10961
|
if (timelineName === "position") {
|
|
11356
10962
|
let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
@@ -11398,15 +11004,13 @@ var SkeletonJson = class {
|
|
|
11398
11004
|
let constraintIndex = -1;
|
|
11399
11005
|
if (constraintName.length > 0) {
|
|
11400
11006
|
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
11401
|
-
if (!constraint)
|
|
11402
|
-
throw new Error("Physics constraint not found: " + constraintName);
|
|
11007
|
+
if (!constraint) throw new Error("Physics constraint not found: " + constraintName);
|
|
11403
11008
|
constraintIndex = skeletonData.physicsConstraints.indexOf(constraint);
|
|
11404
11009
|
}
|
|
11405
11010
|
for (let timelineName in constraintMap) {
|
|
11406
11011
|
let timelineMap = constraintMap[timelineName];
|
|
11407
11012
|
let keyMap = timelineMap[0];
|
|
11408
|
-
if (!keyMap)
|
|
11409
|
-
continue;
|
|
11013
|
+
if (!keyMap) continue;
|
|
11410
11014
|
let frames = timelineMap.length;
|
|
11411
11015
|
if (timelineName == "reset") {
|
|
11412
11016
|
const timeline2 = new PhysicsConstraintResetTimeline(frames, constraintIndex);
|
|
@@ -11440,13 +11044,11 @@ var SkeletonJson = class {
|
|
|
11440
11044
|
for (let attachmentsName in map.attachments) {
|
|
11441
11045
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
11442
11046
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
11443
|
-
if (!skin)
|
|
11444
|
-
throw new Error("Skin not found: " + attachmentsName);
|
|
11047
|
+
if (!skin) throw new Error("Skin not found: " + attachmentsName);
|
|
11445
11048
|
for (let slotMapName in attachmentsMap) {
|
|
11446
11049
|
let slotMap = attachmentsMap[slotMapName];
|
|
11447
11050
|
let slot = skeletonData.findSlot(slotMapName);
|
|
11448
|
-
if (!slot)
|
|
11449
|
-
throw new Error("Slot not found: " + slotMapName);
|
|
11051
|
+
if (!slot) throw new Error("Slot not found: " + slotMapName);
|
|
11450
11052
|
let slotIndex = slot.index;
|
|
11451
11053
|
for (let attachmentMapName in slotMap) {
|
|
11452
11054
|
let attachmentMap = slotMap[attachmentMapName];
|
|
@@ -11454,8 +11056,7 @@ var SkeletonJson = class {
|
|
|
11454
11056
|
for (let timelineMapName in attachmentMap) {
|
|
11455
11057
|
let timelineMap = attachmentMap[timelineMapName];
|
|
11456
11058
|
let keyMap = timelineMap[0];
|
|
11457
|
-
if (!keyMap)
|
|
11458
|
-
continue;
|
|
11059
|
+
if (!keyMap) continue;
|
|
11459
11060
|
if (timelineMapName == "deform") {
|
|
11460
11061
|
let weighted = attachment.bones;
|
|
11461
11062
|
let vertices = attachment.vertices;
|
|
@@ -11488,8 +11089,7 @@ var SkeletonJson = class {
|
|
|
11488
11089
|
}
|
|
11489
11090
|
let time2 = getValue(nextMap, "time", 0);
|
|
11490
11091
|
let curve = keyMap.curve;
|
|
11491
|
-
if (curve)
|
|
11492
|
-
bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
|
|
11092
|
+
if (curve) bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
|
|
11493
11093
|
time = time2;
|
|
11494
11094
|
keyMap = nextMap;
|
|
11495
11095
|
}
|
|
@@ -11528,8 +11128,7 @@ var SkeletonJson = class {
|
|
|
11528
11128
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
11529
11129
|
let offsetMap = offsets[ii];
|
|
11530
11130
|
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
11531
|
-
if (!slot)
|
|
11532
|
-
throw new Error("Slot not found: " + slot);
|
|
11131
|
+
if (!slot) throw new Error("Slot not found: " + slot);
|
|
11533
11132
|
let slotIndex = slot.index;
|
|
11534
11133
|
while (originalIndex != slotIndex)
|
|
11535
11134
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
@@ -11538,8 +11137,7 @@ var SkeletonJson = class {
|
|
|
11538
11137
|
while (originalIndex < slotCount)
|
|
11539
11138
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
11540
11139
|
for (let ii = slotCount - 1; ii >= 0; ii--)
|
|
11541
|
-
if (drawOrder[ii] == -1)
|
|
11542
|
-
drawOrder[ii] = unchanged[--unchangedIndex];
|
|
11140
|
+
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
|
|
11543
11141
|
}
|
|
11544
11142
|
timeline.setFrame(frame, getValue(drawOrderMap, "time", 0), drawOrder);
|
|
11545
11143
|
}
|
|
@@ -11551,8 +11149,7 @@ var SkeletonJson = class {
|
|
|
11551
11149
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
11552
11150
|
let eventMap = map.events[i];
|
|
11553
11151
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
11554
|
-
if (!eventData)
|
|
11555
|
-
throw new Error("Event not found: " + eventMap.name);
|
|
11152
|
+
if (!eventData) throw new Error("Event not found: " + eventMap.name);
|
|
11556
11153
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
11557
11154
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
11558
11155
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|
|
@@ -11599,8 +11196,7 @@ function readTimeline12(keys, timeline, defaultValue, scale) {
|
|
|
11599
11196
|
}
|
|
11600
11197
|
let time2 = getValue(nextMap, "time", 0);
|
|
11601
11198
|
let value2 = getValue(nextMap, "value", defaultValue) * scale;
|
|
11602
|
-
if (keyMap.curve)
|
|
11603
|
-
bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
|
|
11199
|
+
if (keyMap.curve) bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
|
|
11604
11200
|
time = time2;
|
|
11605
11201
|
value = value2;
|
|
11606
11202
|
keyMap = nextMap;
|
|
@@ -11653,7 +11249,7 @@ function getValue(map, property, defaultValue) {
|
|
|
11653
11249
|
// spine-core/src/polyfills.ts
|
|
11654
11250
|
(() => {
|
|
11655
11251
|
if (typeof Math.fround === "undefined") {
|
|
11656
|
-
Math.fround = function(array) {
|
|
11252
|
+
Math.fround = /* @__PURE__ */ function(array) {
|
|
11657
11253
|
return function(x) {
|
|
11658
11254
|
return array[0] = x, array[0];
|
|
11659
11255
|
};
|
|
@@ -11686,7 +11282,7 @@ function bufferToUtf8String(buffer) {
|
|
|
11686
11282
|
throw new Error("Unsupported environment");
|
|
11687
11283
|
}
|
|
11688
11284
|
}
|
|
11689
|
-
var CanvasKitTexture = class extends Texture {
|
|
11285
|
+
var CanvasKitTexture = class _CanvasKitTexture extends Texture {
|
|
11690
11286
|
getImage() {
|
|
11691
11287
|
return this._image;
|
|
11692
11288
|
}
|
|
@@ -11707,11 +11303,9 @@ var CanvasKitTexture = class extends Texture {
|
|
|
11707
11303
|
}
|
|
11708
11304
|
static async fromFile(ck, path, readFile) {
|
|
11709
11305
|
const imgData = await readFile(path);
|
|
11710
|
-
if (!imgData)
|
|
11711
|
-
throw new Error(`Could not load image ${path}`);
|
|
11306
|
+
if (!imgData) throw new Error(`Could not load image ${path}`);
|
|
11712
11307
|
const image = ck.MakeImageFromEncoded(imgData);
|
|
11713
|
-
if (!image)
|
|
11714
|
-
throw new Error(`Could not load image ${path}`);
|
|
11308
|
+
if (!image) throw new Error(`Could not load image ${path}`);
|
|
11715
11309
|
const paintPerBlendMode = /* @__PURE__ */ new Map();
|
|
11716
11310
|
const shaders = [];
|
|
11717
11311
|
for (const blendMode of [
|
|
@@ -11732,7 +11326,7 @@ var CanvasKitTexture = class extends Texture {
|
|
|
11732
11326
|
paintPerBlendMode.set(blendMode, paint);
|
|
11733
11327
|
shaders.push(shader);
|
|
11734
11328
|
}
|
|
11735
|
-
return new
|
|
11329
|
+
return new _CanvasKitTexture({ shaders, paintPerBlendMode, image });
|
|
11736
11330
|
}
|
|
11737
11331
|
};
|
|
11738
11332
|
async function loadTextureAtlas(ck, atlasFile, readFile) {
|
|
@@ -11786,7 +11380,7 @@ var SkeletonDrawable = class {
|
|
|
11786
11380
|
this.skeleton.updateWorldTransform(physicsUpdate);
|
|
11787
11381
|
}
|
|
11788
11382
|
};
|
|
11789
|
-
var
|
|
11383
|
+
var SkeletonRenderer = class _SkeletonRenderer {
|
|
11790
11384
|
/**
|
|
11791
11385
|
* Creates a new skeleton renderer.
|
|
11792
11386
|
* @param ck the {@link CanvasKit} instance returned by `CanvasKitInit()`.
|
|
@@ -11797,6 +11391,7 @@ var _SkeletonRenderer = class {
|
|
|
11797
11391
|
clipper = new SkeletonClipping();
|
|
11798
11392
|
tempColor = new Color();
|
|
11799
11393
|
tempColor2 = new Color();
|
|
11394
|
+
static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
|
|
11800
11395
|
scratchPositions = Utils.newFloatArray(100);
|
|
11801
11396
|
scratchColors = Utils.newFloatArray(100);
|
|
11802
11397
|
scratchUVs = Utils.newFloatArray(100);
|
|
@@ -11806,8 +11401,7 @@ var _SkeletonRenderer = class {
|
|
|
11806
11401
|
* @param skeleton the skeleton or drawable to render.
|
|
11807
11402
|
*/
|
|
11808
11403
|
render(canvas, skeleton) {
|
|
11809
|
-
if (skeleton instanceof SkeletonDrawable)
|
|
11810
|
-
skeleton = skeleton.skeleton;
|
|
11404
|
+
if (skeleton instanceof SkeletonDrawable) skeleton = skeleton.skeleton;
|
|
11811
11405
|
let clipper = this.clipper;
|
|
11812
11406
|
let drawOrder = skeleton.drawOrder;
|
|
11813
11407
|
let skeletonColor = skeleton.color;
|
|
@@ -11912,8 +11506,6 @@ var _SkeletonRenderer = class {
|
|
|
11912
11506
|
clipper.clipEnd();
|
|
11913
11507
|
}
|
|
11914
11508
|
};
|
|
11915
|
-
var SkeletonRenderer = _SkeletonRenderer;
|
|
11916
|
-
__publicField(SkeletonRenderer, "QUAD_TRIANGLES", [0, 1, 2, 2, 3, 0]);
|
|
11917
11509
|
export {
|
|
11918
11510
|
AlphaTimeline,
|
|
11919
11511
|
Animation,
|