@esotericsoftware/spine-canvaskit 4.2.80 → 4.2.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/spine-canvaskit.min.mjs +2 -2
- package/dist/esm/spine-canvaskit.mjs +842 -1244
- package/dist/esm/spine-canvaskit.mjs.map +3 -3
- package/dist/iife/spine-canvaskit.js +845 -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,11 +3798,11 @@ var _AnimationState = class {
|
|
|
3933
3798
|
if (!last) {
|
|
3934
3799
|
this.setCurrent(trackIndex, entry, true);
|
|
3935
3800
|
this.queue.drain();
|
|
3801
|
+
if (delay < 0) delay = 0;
|
|
3936
3802
|
} else {
|
|
3937
3803
|
last.next = entry;
|
|
3938
3804
|
entry.previous = last;
|
|
3939
|
-
if (delay <= 0)
|
|
3940
|
-
delay += last.getTrackComplete() - entry.mixDuration;
|
|
3805
|
+
if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
|
|
3941
3806
|
}
|
|
3942
3807
|
entry.delay = delay;
|
|
3943
3808
|
return entry;
|
|
@@ -3975,8 +3840,7 @@ var _AnimationState = class {
|
|
|
3975
3840
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
3976
3841
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
3977
3842
|
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
3978
|
-
if (delay <= 0)
|
|
3979
|
-
entry.delay += entry.mixDuration - mixDuration;
|
|
3843
|
+
if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
|
|
3980
3844
|
entry.mixDuration = mixDuration;
|
|
3981
3845
|
entry.trackEnd = mixDuration;
|
|
3982
3846
|
return entry;
|
|
@@ -3988,15 +3852,13 @@ var _AnimationState = class {
|
|
|
3988
3852
|
this.queue.drainDisabled = true;
|
|
3989
3853
|
for (let i = 0, n = this.tracks.length; i < n; i++) {
|
|
3990
3854
|
let current = this.tracks[i];
|
|
3991
|
-
if (current)
|
|
3992
|
-
this.setEmptyAnimation(current.trackIndex, mixDuration);
|
|
3855
|
+
if (current) this.setEmptyAnimation(current.trackIndex, mixDuration);
|
|
3993
3856
|
}
|
|
3994
3857
|
this.queue.drainDisabled = oldDrainDisabled;
|
|
3995
3858
|
this.queue.drain();
|
|
3996
3859
|
}
|
|
3997
3860
|
expandToIndex(index) {
|
|
3998
|
-
if (index < this.tracks.length)
|
|
3999
|
-
return this.tracks[index];
|
|
3861
|
+
if (index < this.tracks.length) return this.tracks[index];
|
|
4000
3862
|
Utils.ensureArrayCapacity(this.tracks, index + 1, null);
|
|
4001
3863
|
this.tracks.length = index + 1;
|
|
4002
3864
|
return null;
|
|
@@ -4048,13 +3910,11 @@ var _AnimationState = class {
|
|
|
4048
3910
|
let tracks = this.tracks;
|
|
4049
3911
|
for (let i = 0, n = tracks.length; i < n; i++) {
|
|
4050
3912
|
let entry = tracks[i];
|
|
4051
|
-
if (!entry)
|
|
4052
|
-
continue;
|
|
3913
|
+
if (!entry) continue;
|
|
4053
3914
|
while (entry.mixingFrom)
|
|
4054
3915
|
entry = entry.mixingFrom;
|
|
4055
3916
|
do {
|
|
4056
|
-
if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
|
|
4057
|
-
this.computeHold(entry);
|
|
3917
|
+
if (!entry.mixingTo || entry.mixBlend != 3 /* add */) this.computeHold(entry);
|
|
4058
3918
|
entry = entry.mixingTo;
|
|
4059
3919
|
} while (entry);
|
|
4060
3920
|
}
|
|
@@ -4083,8 +3943,7 @@ var _AnimationState = class {
|
|
|
4083
3943
|
timelineMode[i] = FIRST;
|
|
4084
3944
|
} else {
|
|
4085
3945
|
for (let next = to.mixingTo; next; next = next.mixingTo) {
|
|
4086
|
-
if (next.animation.hasTimeline(ids))
|
|
4087
|
-
continue;
|
|
3946
|
+
if (next.animation.hasTimeline(ids)) continue;
|
|
4088
3947
|
if (entry.mixDuration > 0) {
|
|
4089
3948
|
timelineMode[i] = HOLD_MIX;
|
|
4090
3949
|
timelineHoldMix[i] = next;
|
|
@@ -4098,21 +3957,18 @@ var _AnimationState = class {
|
|
|
4098
3957
|
}
|
|
4099
3958
|
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
|
|
4100
3959
|
getCurrent(trackIndex) {
|
|
4101
|
-
if (trackIndex >= this.tracks.length)
|
|
4102
|
-
return null;
|
|
3960
|
+
if (trackIndex >= this.tracks.length) return null;
|
|
4103
3961
|
return this.tracks[trackIndex];
|
|
4104
3962
|
}
|
|
4105
3963
|
/** Adds a listener to receive events for all track entries. */
|
|
4106
3964
|
addListener(listener) {
|
|
4107
|
-
if (!listener)
|
|
4108
|
-
throw new Error("listener cannot be null.");
|
|
3965
|
+
if (!listener) throw new Error("listener cannot be null.");
|
|
4109
3966
|
this.listeners.push(listener);
|
|
4110
3967
|
}
|
|
4111
3968
|
/** Removes the listener added with {@link #addListener()}. */
|
|
4112
3969
|
removeListener(listener) {
|
|
4113
3970
|
let index = this.listeners.indexOf(listener);
|
|
4114
|
-
if (index >= 0)
|
|
4115
|
-
this.listeners.splice(index, 1);
|
|
3971
|
+
if (index >= 0) this.listeners.splice(index, 1);
|
|
4116
3972
|
}
|
|
4117
3973
|
/** Removes all listeners added with {@link #addListener()}. */
|
|
4118
3974
|
clearListeners() {
|
|
@@ -4125,8 +3981,6 @@ var _AnimationState = class {
|
|
|
4125
3981
|
this.queue.clear();
|
|
4126
3982
|
}
|
|
4127
3983
|
};
|
|
4128
|
-
var AnimationState = _AnimationState;
|
|
4129
|
-
__publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
|
|
4130
3984
|
var TrackEntry = class {
|
|
4131
3985
|
/** The animation to apply for this track entry. */
|
|
4132
3986
|
animation = null;
|
|
@@ -4260,8 +4114,12 @@ var TrackEntry = class {
|
|
|
4260
4114
|
}
|
|
4261
4115
|
setMixDurationWithDelay(mixDuration, delay) {
|
|
4262
4116
|
this._mixDuration = mixDuration;
|
|
4263
|
-
if (
|
|
4264
|
-
|
|
4117
|
+
if (delay <= 0) {
|
|
4118
|
+
if (this.previous != null)
|
|
4119
|
+
delay = Math.max(delay + this.previous.getTrackComplete() - mixDuration, 0);
|
|
4120
|
+
else
|
|
4121
|
+
delay = 0;
|
|
4122
|
+
}
|
|
4265
4123
|
this.delay = delay;
|
|
4266
4124
|
}
|
|
4267
4125
|
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
|
@@ -4291,8 +4149,7 @@ var TrackEntry = class {
|
|
|
4291
4149
|
getAnimationTime() {
|
|
4292
4150
|
if (this.loop) {
|
|
4293
4151
|
let duration = this.animationEnd - this.animationStart;
|
|
4294
|
-
if (duration == 0)
|
|
4295
|
-
return this.animationStart;
|
|
4152
|
+
if (duration == 0) return this.animationStart;
|
|
4296
4153
|
return this.trackTime % duration + this.animationStart;
|
|
4297
4154
|
}
|
|
4298
4155
|
return Math.min(this.trackTime + this.animationStart, this.animationEnd);
|
|
@@ -4320,10 +4177,8 @@ var TrackEntry = class {
|
|
|
4320
4177
|
getTrackComplete() {
|
|
4321
4178
|
let duration = this.animationEnd - this.animationStart;
|
|
4322
4179
|
if (duration != 0) {
|
|
4323
|
-
if (this.loop)
|
|
4324
|
-
|
|
4325
|
-
if (this.trackTime < duration)
|
|
4326
|
-
return duration;
|
|
4180
|
+
if (this.loop) return duration * (1 + (this.trackTime / duration | 0));
|
|
4181
|
+
if (this.trackTime < duration) return duration;
|
|
4327
4182
|
}
|
|
4328
4183
|
return this.trackTime;
|
|
4329
4184
|
}
|
|
@@ -4347,35 +4202,34 @@ var EventQueue = class {
|
|
|
4347
4202
|
this.animState = animState;
|
|
4348
4203
|
}
|
|
4349
4204
|
start(entry) {
|
|
4350
|
-
this.objects.push(
|
|
4205
|
+
this.objects.push(0 /* start */);
|
|
4351
4206
|
this.objects.push(entry);
|
|
4352
4207
|
this.animState.animationsChanged = true;
|
|
4353
4208
|
}
|
|
4354
4209
|
interrupt(entry) {
|
|
4355
|
-
this.objects.push(
|
|
4210
|
+
this.objects.push(1 /* interrupt */);
|
|
4356
4211
|
this.objects.push(entry);
|
|
4357
4212
|
}
|
|
4358
4213
|
end(entry) {
|
|
4359
|
-
this.objects.push(
|
|
4214
|
+
this.objects.push(2 /* end */);
|
|
4360
4215
|
this.objects.push(entry);
|
|
4361
4216
|
this.animState.animationsChanged = true;
|
|
4362
4217
|
}
|
|
4363
4218
|
dispose(entry) {
|
|
4364
|
-
this.objects.push(
|
|
4219
|
+
this.objects.push(3 /* dispose */);
|
|
4365
4220
|
this.objects.push(entry);
|
|
4366
4221
|
}
|
|
4367
4222
|
complete(entry) {
|
|
4368
|
-
this.objects.push(
|
|
4223
|
+
this.objects.push(4 /* complete */);
|
|
4369
4224
|
this.objects.push(entry);
|
|
4370
4225
|
}
|
|
4371
4226
|
event(entry, event) {
|
|
4372
|
-
this.objects.push(
|
|
4227
|
+
this.objects.push(5 /* event */);
|
|
4373
4228
|
this.objects.push(entry);
|
|
4374
4229
|
this.objects.push(event);
|
|
4375
4230
|
}
|
|
4376
4231
|
drain() {
|
|
4377
|
-
if (this.drainDisabled)
|
|
4378
|
-
return;
|
|
4232
|
+
if (this.drainDisabled) return;
|
|
4379
4233
|
this.drainDisabled = true;
|
|
4380
4234
|
let objects = this.objects;
|
|
4381
4235
|
let listeners = this.animState.listeners;
|
|
@@ -4383,59 +4237,48 @@ var EventQueue = class {
|
|
|
4383
4237
|
let type = objects[i];
|
|
4384
4238
|
let entry = objects[i + 1];
|
|
4385
4239
|
switch (type) {
|
|
4386
|
-
case
|
|
4387
|
-
if (entry.listener && entry.listener.start)
|
|
4388
|
-
entry.listener.start(entry);
|
|
4240
|
+
case 0 /* start */:
|
|
4241
|
+
if (entry.listener && entry.listener.start) entry.listener.start(entry);
|
|
4389
4242
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4390
4243
|
let listener = listeners[ii];
|
|
4391
|
-
if (listener.start)
|
|
4392
|
-
listener.start(entry);
|
|
4244
|
+
if (listener.start) listener.start(entry);
|
|
4393
4245
|
}
|
|
4394
4246
|
break;
|
|
4395
|
-
case
|
|
4396
|
-
if (entry.listener && entry.listener.interrupt)
|
|
4397
|
-
entry.listener.interrupt(entry);
|
|
4247
|
+
case 1 /* interrupt */:
|
|
4248
|
+
if (entry.listener && entry.listener.interrupt) entry.listener.interrupt(entry);
|
|
4398
4249
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4399
4250
|
let listener = listeners[ii];
|
|
4400
|
-
if (listener.interrupt)
|
|
4401
|
-
listener.interrupt(entry);
|
|
4251
|
+
if (listener.interrupt) listener.interrupt(entry);
|
|
4402
4252
|
}
|
|
4403
4253
|
break;
|
|
4404
|
-
case
|
|
4405
|
-
if (entry.listener && entry.listener.end)
|
|
4406
|
-
entry.listener.end(entry);
|
|
4254
|
+
case 2 /* end */:
|
|
4255
|
+
if (entry.listener && entry.listener.end) entry.listener.end(entry);
|
|
4407
4256
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4408
4257
|
let listener = listeners[ii];
|
|
4409
|
-
if (listener.end)
|
|
4410
|
-
listener.end(entry);
|
|
4258
|
+
if (listener.end) listener.end(entry);
|
|
4411
4259
|
}
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4260
|
+
// Fall through.
|
|
4261
|
+
case 3 /* dispose */:
|
|
4262
|
+
if (entry.listener && entry.listener.dispose) entry.listener.dispose(entry);
|
|
4415
4263
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4416
4264
|
let listener = listeners[ii];
|
|
4417
|
-
if (listener.dispose)
|
|
4418
|
-
listener.dispose(entry);
|
|
4265
|
+
if (listener.dispose) listener.dispose(entry);
|
|
4419
4266
|
}
|
|
4420
4267
|
this.animState.trackEntryPool.free(entry);
|
|
4421
4268
|
break;
|
|
4422
|
-
case
|
|
4423
|
-
if (entry.listener && entry.listener.complete)
|
|
4424
|
-
entry.listener.complete(entry);
|
|
4269
|
+
case 4 /* complete */:
|
|
4270
|
+
if (entry.listener && entry.listener.complete) entry.listener.complete(entry);
|
|
4425
4271
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4426
4272
|
let listener = listeners[ii];
|
|
4427
|
-
if (listener.complete)
|
|
4428
|
-
listener.complete(entry);
|
|
4273
|
+
if (listener.complete) listener.complete(entry);
|
|
4429
4274
|
}
|
|
4430
4275
|
break;
|
|
4431
|
-
case
|
|
4276
|
+
case 5 /* event */:
|
|
4432
4277
|
let event = objects[i++ + 2];
|
|
4433
|
-
if (entry.listener && entry.listener.event)
|
|
4434
|
-
entry.listener.event(entry, event);
|
|
4278
|
+
if (entry.listener && entry.listener.event) entry.listener.event(entry, event);
|
|
4435
4279
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4436
4280
|
let listener = listeners[ii];
|
|
4437
|
-
if (listener.event)
|
|
4438
|
-
listener.event(entry, event);
|
|
4281
|
+
if (listener.event) listener.event(entry, event);
|
|
4439
4282
|
}
|
|
4440
4283
|
break;
|
|
4441
4284
|
}
|
|
@@ -4486,8 +4329,7 @@ var AnimationStateData = class {
|
|
|
4486
4329
|
/** The mix duration to use when no mix duration has been defined between two animations. */
|
|
4487
4330
|
defaultMix = 0;
|
|
4488
4331
|
constructor(skeletonData) {
|
|
4489
|
-
if (!skeletonData)
|
|
4490
|
-
throw new Error("skeletonData cannot be null.");
|
|
4332
|
+
if (!skeletonData) throw new Error("skeletonData cannot be null.");
|
|
4491
4333
|
this.skeletonData = skeletonData;
|
|
4492
4334
|
}
|
|
4493
4335
|
/** Sets a mix duration by animation name.
|
|
@@ -4495,21 +4337,17 @@ var AnimationStateData = class {
|
|
|
4495
4337
|
* See {@link #setMixWith()}. */
|
|
4496
4338
|
setMix(fromName, toName, duration) {
|
|
4497
4339
|
let from = this.skeletonData.findAnimation(fromName);
|
|
4498
|
-
if (!from)
|
|
4499
|
-
throw new Error("Animation not found: " + fromName);
|
|
4340
|
+
if (!from) throw new Error("Animation not found: " + fromName);
|
|
4500
4341
|
let to = this.skeletonData.findAnimation(toName);
|
|
4501
|
-
if (!to)
|
|
4502
|
-
throw new Error("Animation not found: " + toName);
|
|
4342
|
+
if (!to) throw new Error("Animation not found: " + toName);
|
|
4503
4343
|
this.setMixWith(from, to, duration);
|
|
4504
4344
|
}
|
|
4505
4345
|
/** Sets the mix duration when changing from the specified animation to the other.
|
|
4506
4346
|
*
|
|
4507
4347
|
* See {@link TrackEntry#mixDuration}. */
|
|
4508
4348
|
setMixWith(from, to, duration) {
|
|
4509
|
-
if (!from)
|
|
4510
|
-
|
|
4511
|
-
if (!to)
|
|
4512
|
-
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.");
|
|
4513
4351
|
let key = from.name + "." + to.name;
|
|
4514
4352
|
this.animationToMixTime[key] = duration;
|
|
4515
4353
|
}
|
|
@@ -4523,13 +4361,13 @@ var AnimationStateData = class {
|
|
|
4523
4361
|
};
|
|
4524
4362
|
|
|
4525
4363
|
// spine-core/src/attachments/BoundingBoxAttachment.ts
|
|
4526
|
-
var BoundingBoxAttachment = class extends VertexAttachment {
|
|
4364
|
+
var BoundingBoxAttachment = class _BoundingBoxAttachment extends VertexAttachment {
|
|
4527
4365
|
color = new Color(1, 1, 1, 1);
|
|
4528
4366
|
constructor(name) {
|
|
4529
4367
|
super(name);
|
|
4530
4368
|
}
|
|
4531
4369
|
copy() {
|
|
4532
|
-
let copy = new
|
|
4370
|
+
let copy = new _BoundingBoxAttachment(this.name);
|
|
4533
4371
|
this.copyTo(copy);
|
|
4534
4372
|
copy.color.setFromColor(this.color);
|
|
4535
4373
|
return copy;
|
|
@@ -4537,7 +4375,7 @@ var BoundingBoxAttachment = class extends VertexAttachment {
|
|
|
4537
4375
|
};
|
|
4538
4376
|
|
|
4539
4377
|
// spine-core/src/attachments/ClippingAttachment.ts
|
|
4540
|
-
var ClippingAttachment = class extends VertexAttachment {
|
|
4378
|
+
var ClippingAttachment = class _ClippingAttachment extends VertexAttachment {
|
|
4541
4379
|
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
|
|
4542
4380
|
* the skeleton's rendering. */
|
|
4543
4381
|
endSlot = null;
|
|
@@ -4550,7 +4388,7 @@ var ClippingAttachment = class extends VertexAttachment {
|
|
|
4550
4388
|
super(name);
|
|
4551
4389
|
}
|
|
4552
4390
|
copy() {
|
|
4553
|
-
let copy = new
|
|
4391
|
+
let copy = new _ClippingAttachment(this.name);
|
|
4554
4392
|
this.copyTo(copy);
|
|
4555
4393
|
copy.endSlot = this.endSlot;
|
|
4556
4394
|
copy.color.setFromColor(this.color);
|
|
@@ -4626,10 +4464,8 @@ var TextureAtlas = class {
|
|
|
4626
4464
|
page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
|
|
4627
4465
|
};
|
|
4628
4466
|
pageFields["repeat"] = (page2) => {
|
|
4629
|
-
if (entry[1].indexOf("x") != -1)
|
|
4630
|
-
|
|
4631
|
-
if (entry[1].indexOf("y") != -1)
|
|
4632
|
-
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 */;
|
|
4633
4469
|
};
|
|
4634
4470
|
pageFields["pma"] = (page2) => {
|
|
4635
4471
|
page2.pma = entry[1] == "true";
|
|
@@ -4677,45 +4513,37 @@ var TextureAtlas = class {
|
|
|
4677
4513
|
while (line && line.trim().length == 0)
|
|
4678
4514
|
line = reader.readLine();
|
|
4679
4515
|
while (true) {
|
|
4680
|
-
if (!line || line.trim().length == 0)
|
|
4681
|
-
|
|
4682
|
-
if (reader.readEntry(entry, line) == 0)
|
|
4683
|
-
break;
|
|
4516
|
+
if (!line || line.trim().length == 0) break;
|
|
4517
|
+
if (reader.readEntry(entry, line) == 0) break;
|
|
4684
4518
|
line = reader.readLine();
|
|
4685
4519
|
}
|
|
4686
4520
|
let page = null;
|
|
4687
4521
|
let names = null;
|
|
4688
4522
|
let values = null;
|
|
4689
4523
|
while (true) {
|
|
4690
|
-
if (line === null)
|
|
4691
|
-
break;
|
|
4524
|
+
if (line === null) break;
|
|
4692
4525
|
if (line.trim().length == 0) {
|
|
4693
4526
|
page = null;
|
|
4694
4527
|
line = reader.readLine();
|
|
4695
4528
|
} else if (!page) {
|
|
4696
4529
|
page = new TextureAtlasPage(line.trim());
|
|
4697
4530
|
while (true) {
|
|
4698
|
-
if (reader.readEntry(entry, line = reader.readLine()) == 0)
|
|
4699
|
-
break;
|
|
4531
|
+
if (reader.readEntry(entry, line = reader.readLine()) == 0) break;
|
|
4700
4532
|
let field = pageFields[entry[0]];
|
|
4701
|
-
if (field)
|
|
4702
|
-
field(page);
|
|
4533
|
+
if (field) field(page);
|
|
4703
4534
|
}
|
|
4704
4535
|
this.pages.push(page);
|
|
4705
4536
|
} else {
|
|
4706
4537
|
let region = new TextureAtlasRegion(page, line);
|
|
4707
4538
|
while (true) {
|
|
4708
4539
|
let count = reader.readEntry(entry, line = reader.readLine());
|
|
4709
|
-
if (count == 0)
|
|
4710
|
-
break;
|
|
4540
|
+
if (count == 0) break;
|
|
4711
4541
|
let field = regionFields[entry[0]];
|
|
4712
4542
|
if (field)
|
|
4713
4543
|
field(region);
|
|
4714
4544
|
else {
|
|
4715
|
-
if (!names)
|
|
4716
|
-
|
|
4717
|
-
if (!values)
|
|
4718
|
-
values = [];
|
|
4545
|
+
if (!names) names = [];
|
|
4546
|
+
if (!values) values = [];
|
|
4719
4547
|
names.push(entry[0]);
|
|
4720
4548
|
let entryValues = [];
|
|
4721
4549
|
for (let i = 0; i < count; i++)
|
|
@@ -4776,14 +4604,11 @@ var TextureAtlasReader = class {
|
|
|
4776
4604
|
return this.lines[this.index++];
|
|
4777
4605
|
}
|
|
4778
4606
|
readEntry(entry, line) {
|
|
4779
|
-
if (!line)
|
|
4780
|
-
return 0;
|
|
4607
|
+
if (!line) return 0;
|
|
4781
4608
|
line = line.trim();
|
|
4782
|
-
if (line.length == 0)
|
|
4783
|
-
return 0;
|
|
4609
|
+
if (line.length == 0) return 0;
|
|
4784
4610
|
let colon = line.indexOf(":");
|
|
4785
|
-
if (colon == -1)
|
|
4786
|
-
return 0;
|
|
4611
|
+
if (colon == -1) return 0;
|
|
4787
4612
|
entry[0] = line.substr(0, colon).trim();
|
|
4788
4613
|
for (let i = 1, lastMatch = colon + 1; ; i++) {
|
|
4789
4614
|
let comma = line.indexOf(",", lastMatch);
|
|
@@ -4793,8 +4618,7 @@ var TextureAtlasReader = class {
|
|
|
4793
4618
|
}
|
|
4794
4619
|
entry[i] = line.substr(lastMatch, comma - lastMatch).trim();
|
|
4795
4620
|
lastMatch = comma + 1;
|
|
4796
|
-
if (i == 4)
|
|
4797
|
-
return 4;
|
|
4621
|
+
if (i == 4) return 4;
|
|
4798
4622
|
}
|
|
4799
4623
|
}
|
|
4800
4624
|
};
|
|
@@ -4842,7 +4666,7 @@ var TextureAtlasRegion = class extends TextureRegion {
|
|
|
4842
4666
|
};
|
|
4843
4667
|
|
|
4844
4668
|
// spine-core/src/attachments/MeshAttachment.ts
|
|
4845
|
-
var MeshAttachment = class extends VertexAttachment {
|
|
4669
|
+
var MeshAttachment = class _MeshAttachment extends VertexAttachment {
|
|
4846
4670
|
region = null;
|
|
4847
4671
|
/** The name of the texture region for this attachment. */
|
|
4848
4672
|
path;
|
|
@@ -4875,11 +4699,9 @@ var MeshAttachment = class extends VertexAttachment {
|
|
|
4875
4699
|
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
|
|
4876
4700
|
* the {@link #regionUVs} are changed. */
|
|
4877
4701
|
updateRegion() {
|
|
4878
|
-
if (!this.region)
|
|
4879
|
-
throw new Error("Region not set.");
|
|
4702
|
+
if (!this.region) throw new Error("Region not set.");
|
|
4880
4703
|
let regionUVs = this.regionUVs;
|
|
4881
|
-
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
4882
|
-
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
4704
|
+
if (!this.uvs || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
4883
4705
|
let uvs = this.uvs;
|
|
4884
4706
|
let n = this.uvs.length;
|
|
4885
4707
|
let u = this.region.u, v = this.region.v, width = 0, height = 0;
|
|
@@ -4954,9 +4776,8 @@ var MeshAttachment = class extends VertexAttachment {
|
|
|
4954
4776
|
}
|
|
4955
4777
|
}
|
|
4956
4778
|
copy() {
|
|
4957
|
-
if (this.parentMesh)
|
|
4958
|
-
|
|
4959
|
-
let copy = new MeshAttachment(this.name, this.path);
|
|
4779
|
+
if (this.parentMesh) return this.newLinkedMesh();
|
|
4780
|
+
let copy = new _MeshAttachment(this.name, this.path);
|
|
4960
4781
|
copy.region = this.region;
|
|
4961
4782
|
copy.color.setFromColor(this.color);
|
|
4962
4783
|
this.copyTo(copy);
|
|
@@ -4977,25 +4798,23 @@ var MeshAttachment = class extends VertexAttachment {
|
|
|
4977
4798
|
return copy;
|
|
4978
4799
|
}
|
|
4979
4800
|
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
|
|
4980
|
-
if (this.sequence != null)
|
|
4981
|
-
this.sequence.apply(slot, this);
|
|
4801
|
+
if (this.sequence != null) this.sequence.apply(slot, this);
|
|
4982
4802
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
4983
4803
|
}
|
|
4984
4804
|
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
|
|
4985
4805
|
newLinkedMesh() {
|
|
4986
|
-
let copy = new
|
|
4806
|
+
let copy = new _MeshAttachment(this.name, this.path);
|
|
4987
4807
|
copy.region = this.region;
|
|
4988
4808
|
copy.color.setFromColor(this.color);
|
|
4989
4809
|
copy.timelineAttachment = this.timelineAttachment;
|
|
4990
4810
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
4991
|
-
if (copy.region != null)
|
|
4992
|
-
copy.updateRegion();
|
|
4811
|
+
if (copy.region != null) copy.updateRegion();
|
|
4993
4812
|
return copy;
|
|
4994
4813
|
}
|
|
4995
4814
|
};
|
|
4996
4815
|
|
|
4997
4816
|
// spine-core/src/attachments/PathAttachment.ts
|
|
4998
|
-
var PathAttachment = class extends VertexAttachment {
|
|
4817
|
+
var PathAttachment = class _PathAttachment extends VertexAttachment {
|
|
4999
4818
|
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
|
5000
4819
|
lengths = [];
|
|
5001
4820
|
/** If true, the start and end knots are connected. */
|
|
@@ -5010,7 +4829,7 @@ var PathAttachment = class extends VertexAttachment {
|
|
|
5010
4829
|
super(name);
|
|
5011
4830
|
}
|
|
5012
4831
|
copy() {
|
|
5013
|
-
let copy = new
|
|
4832
|
+
let copy = new _PathAttachment(this.name);
|
|
5014
4833
|
this.copyTo(copy);
|
|
5015
4834
|
copy.lengths = new Array(this.lengths.length);
|
|
5016
4835
|
Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
|
@@ -5022,7 +4841,7 @@ var PathAttachment = class extends VertexAttachment {
|
|
|
5022
4841
|
};
|
|
5023
4842
|
|
|
5024
4843
|
// spine-core/src/attachments/PointAttachment.ts
|
|
5025
|
-
var PointAttachment = class extends VertexAttachment {
|
|
4844
|
+
var PointAttachment = class _PointAttachment extends VertexAttachment {
|
|
5026
4845
|
x = 0;
|
|
5027
4846
|
y = 0;
|
|
5028
4847
|
rotation = 0;
|
|
@@ -5044,7 +4863,7 @@ var PointAttachment = class extends VertexAttachment {
|
|
|
5044
4863
|
return MathUtils.atan2Deg(y, x);
|
|
5045
4864
|
}
|
|
5046
4865
|
copy() {
|
|
5047
|
-
let copy = new
|
|
4866
|
+
let copy = new _PointAttachment(this.name);
|
|
5048
4867
|
copy.x = this.x;
|
|
5049
4868
|
copy.y = this.y;
|
|
5050
4869
|
copy.rotation = this.rotation;
|
|
@@ -5054,7 +4873,7 @@ var PointAttachment = class extends VertexAttachment {
|
|
|
5054
4873
|
};
|
|
5055
4874
|
|
|
5056
4875
|
// spine-core/src/attachments/RegionAttachment.ts
|
|
5057
|
-
var
|
|
4876
|
+
var RegionAttachment = class _RegionAttachment extends Attachment {
|
|
5058
4877
|
/** The local x translation. */
|
|
5059
4878
|
x = 0;
|
|
5060
4879
|
/** The local y translation. */
|
|
@@ -5087,8 +4906,7 @@ var _RegionAttachment = class extends Attachment {
|
|
|
5087
4906
|
}
|
|
5088
4907
|
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
|
|
5089
4908
|
updateRegion() {
|
|
5090
|
-
if (!this.region)
|
|
5091
|
-
throw new Error("Region not set.");
|
|
4909
|
+
if (!this.region) throw new Error("Region not set.");
|
|
5092
4910
|
let region = this.region;
|
|
5093
4911
|
let uvs = this.uvs;
|
|
5094
4912
|
if (region == null) {
|
|
@@ -5201,40 +5019,39 @@ var _RegionAttachment = class extends Attachment {
|
|
|
5201
5019
|
copy.sequence = this.sequence != null ? this.sequence.copy() : null;
|
|
5202
5020
|
return copy;
|
|
5203
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;
|
|
5204
5054
|
};
|
|
5205
|
-
var RegionAttachment = _RegionAttachment;
|
|
5206
|
-
__publicField(RegionAttachment, "X1", 0);
|
|
5207
|
-
__publicField(RegionAttachment, "Y1", 1);
|
|
5208
|
-
__publicField(RegionAttachment, "C1R", 2);
|
|
5209
|
-
__publicField(RegionAttachment, "C1G", 3);
|
|
5210
|
-
__publicField(RegionAttachment, "C1B", 4);
|
|
5211
|
-
__publicField(RegionAttachment, "C1A", 5);
|
|
5212
|
-
__publicField(RegionAttachment, "U1", 6);
|
|
5213
|
-
__publicField(RegionAttachment, "V1", 7);
|
|
5214
|
-
__publicField(RegionAttachment, "X2", 8);
|
|
5215
|
-
__publicField(RegionAttachment, "Y2", 9);
|
|
5216
|
-
__publicField(RegionAttachment, "C2R", 10);
|
|
5217
|
-
__publicField(RegionAttachment, "C2G", 11);
|
|
5218
|
-
__publicField(RegionAttachment, "C2B", 12);
|
|
5219
|
-
__publicField(RegionAttachment, "C2A", 13);
|
|
5220
|
-
__publicField(RegionAttachment, "U2", 14);
|
|
5221
|
-
__publicField(RegionAttachment, "V2", 15);
|
|
5222
|
-
__publicField(RegionAttachment, "X3", 16);
|
|
5223
|
-
__publicField(RegionAttachment, "Y3", 17);
|
|
5224
|
-
__publicField(RegionAttachment, "C3R", 18);
|
|
5225
|
-
__publicField(RegionAttachment, "C3G", 19);
|
|
5226
|
-
__publicField(RegionAttachment, "C3B", 20);
|
|
5227
|
-
__publicField(RegionAttachment, "C3A", 21);
|
|
5228
|
-
__publicField(RegionAttachment, "U3", 22);
|
|
5229
|
-
__publicField(RegionAttachment, "V3", 23);
|
|
5230
|
-
__publicField(RegionAttachment, "X4", 24);
|
|
5231
|
-
__publicField(RegionAttachment, "Y4", 25);
|
|
5232
|
-
__publicField(RegionAttachment, "C4R", 26);
|
|
5233
|
-
__publicField(RegionAttachment, "C4G", 27);
|
|
5234
|
-
__publicField(RegionAttachment, "C4B", 28);
|
|
5235
|
-
__publicField(RegionAttachment, "C4A", 29);
|
|
5236
|
-
__publicField(RegionAttachment, "U4", 30);
|
|
5237
|
-
__publicField(RegionAttachment, "V4", 31);
|
|
5238
5055
|
|
|
5239
5056
|
// spine-core/src/AtlasAttachmentLoader.ts
|
|
5240
5057
|
var AtlasAttachmentLoader = class {
|
|
@@ -5247,8 +5064,7 @@ var AtlasAttachmentLoader = class {
|
|
|
5247
5064
|
for (let i = 0, n = regions.length; i < n; i++) {
|
|
5248
5065
|
let path = sequence.getPath(basePath, i);
|
|
5249
5066
|
let region = this.atlas.findRegion(path);
|
|
5250
|
-
if (region == null)
|
|
5251
|
-
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 + ")");
|
|
5252
5068
|
regions[i] = region;
|
|
5253
5069
|
}
|
|
5254
5070
|
}
|
|
@@ -5258,8 +5074,7 @@ var AtlasAttachmentLoader = class {
|
|
|
5258
5074
|
this.loadSequence(name, path, sequence);
|
|
5259
5075
|
} else {
|
|
5260
5076
|
let region = this.atlas.findRegion(path);
|
|
5261
|
-
if (!region)
|
|
5262
|
-
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 + ")");
|
|
5263
5078
|
attachment.region = region;
|
|
5264
5079
|
}
|
|
5265
5080
|
return attachment;
|
|
@@ -5270,8 +5085,7 @@ var AtlasAttachmentLoader = class {
|
|
|
5270
5085
|
this.loadSequence(name, path, sequence);
|
|
5271
5086
|
} else {
|
|
5272
5087
|
let region = this.atlas.findRegion(path);
|
|
5273
|
-
if (!region)
|
|
5274
|
-
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 + ")");
|
|
5275
5089
|
attachment.region = region;
|
|
5276
5090
|
}
|
|
5277
5091
|
return attachment;
|
|
@@ -5315,7 +5129,7 @@ var BoneData = class {
|
|
|
5315
5129
|
/** The local shearX. */
|
|
5316
5130
|
shearY = 0;
|
|
5317
5131
|
/** The transform mode for how parent world transforms affect this bone. */
|
|
5318
|
-
inherit =
|
|
5132
|
+
inherit = 0 /* Normal */;
|
|
5319
5133
|
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
|
|
5320
5134
|
* bone.
|
|
5321
5135
|
* @see Skin#bones */
|
|
@@ -5328,10 +5142,8 @@ var BoneData = class {
|
|
|
5328
5142
|
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
5329
5143
|
visible = false;
|
|
5330
5144
|
constructor(index, name, parent) {
|
|
5331
|
-
if (index < 0)
|
|
5332
|
-
|
|
5333
|
-
if (!name)
|
|
5334
|
-
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.");
|
|
5335
5147
|
this.index = index;
|
|
5336
5148
|
this.name = name;
|
|
5337
5149
|
this.parent = parent;
|
|
@@ -5401,10 +5213,8 @@ var Bone = class {
|
|
|
5401
5213
|
active = false;
|
|
5402
5214
|
/** @param parent May be null. */
|
|
5403
5215
|
constructor(data, skeleton, parent) {
|
|
5404
|
-
if (!data)
|
|
5405
|
-
|
|
5406
|
-
if (!skeleton)
|
|
5407
|
-
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.");
|
|
5408
5218
|
this.data = data;
|
|
5409
5219
|
this.skeleton = skeleton;
|
|
5410
5220
|
this.parent = parent;
|
|
@@ -5513,13 +5323,11 @@ var Bone = class {
|
|
|
5513
5323
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5514
5324
|
let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5515
5325
|
let s = Math.sqrt(za * za + zc * zc);
|
|
5516
|
-
if (s > 1e-5)
|
|
5517
|
-
s = 1 / s;
|
|
5326
|
+
if (s > 1e-5) s = 1 / s;
|
|
5518
5327
|
za *= s;
|
|
5519
5328
|
zc *= s;
|
|
5520
5329
|
s = Math.sqrt(za * za + zc * zc);
|
|
5521
|
-
if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5522
|
-
s = -s;
|
|
5330
|
+
if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
|
|
5523
5331
|
rotation = Math.PI / 2 + Math.atan2(zc, za);
|
|
5524
5332
|
const zb = Math.cos(rotation) * s;
|
|
5525
5333
|
const zd = Math.sin(rotation) * s;
|
|
@@ -5602,13 +5410,11 @@ var Bone = class {
|
|
|
5602
5410
|
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5603
5411
|
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5604
5412
|
let s = Math.sqrt(pa * pa + pc * pc);
|
|
5605
|
-
if (s > 1e-5)
|
|
5606
|
-
s = 1 / s;
|
|
5413
|
+
if (s > 1e-5) s = 1 / s;
|
|
5607
5414
|
pa *= s;
|
|
5608
5415
|
pc *= s;
|
|
5609
5416
|
s = Math.sqrt(pa * pa + pc * pc);
|
|
5610
|
-
if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5611
|
-
s = -s;
|
|
5417
|
+
if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
|
|
5612
5418
|
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
5613
5419
|
pb = Math.cos(r) * s;
|
|
5614
5420
|
pd = Math.sin(r) * s;
|
|
@@ -5670,14 +5476,12 @@ var Bone = class {
|
|
|
5670
5476
|
}
|
|
5671
5477
|
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
|
|
5672
5478
|
worldToParent(world) {
|
|
5673
|
-
if (world == null)
|
|
5674
|
-
throw new Error("world cannot be null.");
|
|
5479
|
+
if (world == null) throw new Error("world cannot be null.");
|
|
5675
5480
|
return this.parent == null ? world : this.parent.worldToLocal(world);
|
|
5676
5481
|
}
|
|
5677
5482
|
/** Transforms a point from the parent bone's coordinates to world coordinates. */
|
|
5678
5483
|
parentToWorld(world) {
|
|
5679
|
-
if (world == null)
|
|
5680
|
-
throw new Error("world cannot be null.");
|
|
5484
|
+
if (world == null) throw new Error("world cannot be null.");
|
|
5681
5485
|
return this.parent == null ? world : this.parent.localToWorld(world);
|
|
5682
5486
|
}
|
|
5683
5487
|
/** Transforms a world rotation to a local rotation. */
|
|
@@ -5721,6 +5525,8 @@ var AssetManagerBase = class {
|
|
|
5721
5525
|
textureLoader;
|
|
5722
5526
|
downloader;
|
|
5723
5527
|
assets = {};
|
|
5528
|
+
assetsRefCount = {};
|
|
5529
|
+
assetsLoaded = {};
|
|
5724
5530
|
errors = {};
|
|
5725
5531
|
toLoad = 0;
|
|
5726
5532
|
loaded = 0;
|
|
@@ -5737,24 +5543,21 @@ var AssetManagerBase = class {
|
|
|
5737
5543
|
this.toLoad--;
|
|
5738
5544
|
this.loaded++;
|
|
5739
5545
|
this.assets[path] = asset;
|
|
5740
|
-
|
|
5741
|
-
|
|
5546
|
+
this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
|
|
5547
|
+
if (callback) callback(path, asset);
|
|
5742
5548
|
}
|
|
5743
5549
|
error(callback, path, message) {
|
|
5744
5550
|
this.toLoad--;
|
|
5745
5551
|
this.loaded++;
|
|
5746
5552
|
this.errors[path] = message;
|
|
5747
|
-
if (callback)
|
|
5748
|
-
callback(path, message);
|
|
5553
|
+
if (callback) callback(path, message);
|
|
5749
5554
|
}
|
|
5750
5555
|
loadAll() {
|
|
5751
5556
|
let promise = new Promise((resolve, reject) => {
|
|
5752
5557
|
let check = () => {
|
|
5753
5558
|
if (this.isLoadingComplete()) {
|
|
5754
|
-
if (this.hasErrors())
|
|
5755
|
-
|
|
5756
|
-
else
|
|
5757
|
-
resolve(this);
|
|
5559
|
+
if (this.hasErrors()) reject(this.errors);
|
|
5560
|
+
else resolve(this);
|
|
5758
5561
|
return;
|
|
5759
5562
|
}
|
|
5760
5563
|
requestAnimationFrame(check);
|
|
@@ -5770,10 +5573,16 @@ var AssetManagerBase = class {
|
|
|
5770
5573
|
}, error = () => {
|
|
5771
5574
|
}) {
|
|
5772
5575
|
path = this.start(path);
|
|
5773
|
-
this.
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
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
|
+
});
|
|
5777
5586
|
});
|
|
5778
5587
|
}
|
|
5779
5588
|
loadText(path, success = () => {
|
|
@@ -5790,43 +5599,69 @@ var AssetManagerBase = class {
|
|
|
5790
5599
|
}, error = () => {
|
|
5791
5600
|
}) {
|
|
5792
5601
|
path = this.start(path);
|
|
5793
|
-
this.
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
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
|
+
});
|
|
5797
5612
|
});
|
|
5798
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
|
+
}
|
|
5799
5624
|
loadTexture(path, success = () => {
|
|
5800
5625
|
}, error = () => {
|
|
5801
5626
|
}) {
|
|
5802
5627
|
path = this.start(path);
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
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
|
+
});
|
|
5830
5665
|
}
|
|
5831
5666
|
loadTextureAtlas(path, success = () => {
|
|
5832
5667
|
}, error = () => {
|
|
@@ -5834,32 +5669,113 @@ var AssetManagerBase = class {
|
|
|
5834
5669
|
let index = path.lastIndexOf("/");
|
|
5835
5670
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
5836
5671
|
path = this.start(path);
|
|
5837
|
-
this.
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
(
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
if (
|
|
5848
|
-
|
|
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;
|
|
5849
5697
|
}
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
);
|
|
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);
|
|
5857
5704
|
}
|
|
5858
|
-
}
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
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
|
+
);
|
|
5863
5779
|
});
|
|
5864
5780
|
}
|
|
5865
5781
|
get(path) {
|
|
@@ -5868,26 +5784,27 @@ var AssetManagerBase = class {
|
|
|
5868
5784
|
require(path) {
|
|
5869
5785
|
path = this.pathPrefix + path;
|
|
5870
5786
|
let asset = this.assets[path];
|
|
5871
|
-
if (asset)
|
|
5872
|
-
return asset;
|
|
5787
|
+
if (asset) return asset;
|
|
5873
5788
|
let error = this.errors[path];
|
|
5874
5789
|
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
|
5875
5790
|
}
|
|
5876
5791
|
remove(path) {
|
|
5877
5792
|
path = this.pathPrefix + path;
|
|
5878
5793
|
let asset = this.assets[path];
|
|
5879
|
-
if (asset.dispose)
|
|
5880
|
-
asset.dispose();
|
|
5794
|
+
if (asset.dispose) asset.dispose();
|
|
5881
5795
|
delete this.assets[path];
|
|
5796
|
+
delete this.assetsRefCount[path];
|
|
5797
|
+
delete this.assetsLoaded[path];
|
|
5882
5798
|
return asset;
|
|
5883
5799
|
}
|
|
5884
5800
|
removeAll() {
|
|
5885
|
-
for (let
|
|
5886
|
-
let asset = this.assets[
|
|
5887
|
-
if (asset.dispose)
|
|
5888
|
-
asset.dispose();
|
|
5801
|
+
for (let path in this.assets) {
|
|
5802
|
+
let asset = this.assets[path];
|
|
5803
|
+
if (asset.dispose) asset.dispose();
|
|
5889
5804
|
}
|
|
5890
5805
|
this.assets = {};
|
|
5806
|
+
this.assetsLoaded = {};
|
|
5807
|
+
this.assetsRefCount = {};
|
|
5891
5808
|
}
|
|
5892
5809
|
isLoadingComplete() {
|
|
5893
5810
|
return this.toLoad == 0;
|
|
@@ -5901,6 +5818,12 @@ var AssetManagerBase = class {
|
|
|
5901
5818
|
dispose() {
|
|
5902
5819
|
this.removeAll();
|
|
5903
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
|
+
}
|
|
5904
5827
|
hasErrors() {
|
|
5905
5828
|
return Object.keys(this.errors).length > 0;
|
|
5906
5829
|
}
|
|
@@ -5937,18 +5860,16 @@ var Downloader = class {
|
|
|
5937
5860
|
throw new Error("Not a data URI.");
|
|
5938
5861
|
}
|
|
5939
5862
|
let base64Idx = dataUri.indexOf("base64,");
|
|
5940
|
-
if (base64Idx == -1)
|
|
5941
|
-
throw new Error("Not a binary data URI.");
|
|
5863
|
+
if (base64Idx == -1) throw new Error("Not a binary data URI.");
|
|
5942
5864
|
base64Idx += "base64,".length;
|
|
5943
5865
|
return this.base64ToUint8Array(dataUri.substr(base64Idx));
|
|
5944
5866
|
}
|
|
5945
5867
|
downloadText(url, success, error) {
|
|
5946
|
-
if (this.start(url, success, error))
|
|
5947
|
-
|
|
5948
|
-
if (
|
|
5868
|
+
if (this.start(url, success, error)) return;
|
|
5869
|
+
const rawDataUri = this.rawDataUris[url];
|
|
5870
|
+
if (rawDataUri && !rawDataUri.includes(".")) {
|
|
5949
5871
|
try {
|
|
5950
|
-
|
|
5951
|
-
this.finish(url, 200, this.dataUriToString(dataUri));
|
|
5872
|
+
this.finish(url, 200, this.dataUriToString(rawDataUri));
|
|
5952
5873
|
} catch (e) {
|
|
5953
5874
|
this.finish(url, 400, JSON.stringify(e));
|
|
5954
5875
|
}
|
|
@@ -5956,7 +5877,7 @@ var Downloader = class {
|
|
|
5956
5877
|
}
|
|
5957
5878
|
let request = new XMLHttpRequest();
|
|
5958
5879
|
request.overrideMimeType("text/html");
|
|
5959
|
-
request.open("GET", url, true);
|
|
5880
|
+
request.open("GET", rawDataUri ? rawDataUri : url, true);
|
|
5960
5881
|
let done = () => {
|
|
5961
5882
|
this.finish(url, request.status, request.responseText);
|
|
5962
5883
|
};
|
|
@@ -5970,19 +5891,18 @@ var Downloader = class {
|
|
|
5970
5891
|
}, error);
|
|
5971
5892
|
}
|
|
5972
5893
|
downloadBinary(url, success, error) {
|
|
5973
|
-
if (this.start(url, success, error))
|
|
5974
|
-
|
|
5975
|
-
if (
|
|
5894
|
+
if (this.start(url, success, error)) return;
|
|
5895
|
+
const rawDataUri = this.rawDataUris[url];
|
|
5896
|
+
if (rawDataUri && !rawDataUri.includes(".")) {
|
|
5976
5897
|
try {
|
|
5977
|
-
|
|
5978
|
-
this.finish(url, 200, this.dataUriToUint8Array(dataUri));
|
|
5898
|
+
this.finish(url, 200, this.dataUriToUint8Array(rawDataUri));
|
|
5979
5899
|
} catch (e) {
|
|
5980
5900
|
this.finish(url, 400, JSON.stringify(e));
|
|
5981
5901
|
}
|
|
5982
5902
|
return;
|
|
5983
5903
|
}
|
|
5984
5904
|
let request = new XMLHttpRequest();
|
|
5985
|
-
request.open("GET", url, true);
|
|
5905
|
+
request.open("GET", rawDataUri ? rawDataUri : url, true);
|
|
5986
5906
|
request.responseType = "arraybuffer";
|
|
5987
5907
|
let onerror = () => {
|
|
5988
5908
|
this.finish(url, request.status, request.response);
|
|
@@ -5999,8 +5919,7 @@ var Downloader = class {
|
|
|
5999
5919
|
start(url, success, error) {
|
|
6000
5920
|
let callbacks = this.callbacks[url];
|
|
6001
5921
|
try {
|
|
6002
|
-
if (callbacks)
|
|
6003
|
-
return true;
|
|
5922
|
+
if (callbacks) return true;
|
|
6004
5923
|
this.callbacks[url] = callbacks = [];
|
|
6005
5924
|
} finally {
|
|
6006
5925
|
callbacks.push(success, error);
|
|
@@ -6025,8 +5944,7 @@ var Event = class {
|
|
|
6025
5944
|
volume = 0;
|
|
6026
5945
|
balance = 0;
|
|
6027
5946
|
constructor(time, data) {
|
|
6028
|
-
if (!data)
|
|
6029
|
-
throw new Error("data cannot be null.");
|
|
5947
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6030
5948
|
this.time = time;
|
|
6031
5949
|
this.data = data;
|
|
6032
5950
|
}
|
|
@@ -6067,21 +5985,17 @@ var IkConstraint = class {
|
|
|
6067
5985
|
softness = 0;
|
|
6068
5986
|
active = false;
|
|
6069
5987
|
constructor(data, skeleton) {
|
|
6070
|
-
if (!data)
|
|
6071
|
-
|
|
6072
|
-
if (!skeleton)
|
|
6073
|
-
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.");
|
|
6074
5990
|
this.data = data;
|
|
6075
5991
|
this.bones = new Array();
|
|
6076
5992
|
for (let i = 0; i < data.bones.length; i++) {
|
|
6077
5993
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
6078
|
-
if (!bone)
|
|
6079
|
-
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}`);
|
|
6080
5995
|
this.bones.push(bone);
|
|
6081
5996
|
}
|
|
6082
5997
|
let target = skeleton.findBone(data.target.name);
|
|
6083
|
-
if (!target)
|
|
6084
|
-
throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
5998
|
+
if (!target) throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
6085
5999
|
this.target = target;
|
|
6086
6000
|
this.mix = data.mix;
|
|
6087
6001
|
this.softness = data.softness;
|
|
@@ -6101,8 +6015,7 @@ var IkConstraint = class {
|
|
|
6101
6015
|
this.stretch = data.stretch;
|
|
6102
6016
|
}
|
|
6103
6017
|
update(physics) {
|
|
6104
|
-
if (this.mix == 0)
|
|
6105
|
-
return;
|
|
6018
|
+
if (this.mix == 0) return;
|
|
6106
6019
|
let target = this.target;
|
|
6107
6020
|
let bones = this.bones;
|
|
6108
6021
|
switch (bones.length) {
|
|
@@ -6117,8 +6030,7 @@ var IkConstraint = class {
|
|
|
6117
6030
|
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
|
|
6118
6031
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
6119
6032
|
let p = bone.parent;
|
|
6120
|
-
if (!p)
|
|
6121
|
-
throw new Error("IK bone must have parent.");
|
|
6033
|
+
if (!p) throw new Error("IK bone must have parent.");
|
|
6122
6034
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
6123
6035
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
6124
6036
|
switch (bone.inherit) {
|
|
@@ -6133,6 +6045,7 @@ var IkConstraint = class {
|
|
|
6133
6045
|
pb = -sc * s * bone.skeleton.scaleX;
|
|
6134
6046
|
pd = sa * s * bone.skeleton.scaleY;
|
|
6135
6047
|
rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;
|
|
6048
|
+
// Fall through
|
|
6136
6049
|
default:
|
|
6137
6050
|
let x = targetX - p.worldX, y = targetY - p.worldY;
|
|
6138
6051
|
let d = pa * pd - pb * pc;
|
|
@@ -6145,8 +6058,7 @@ var IkConstraint = class {
|
|
|
6145
6058
|
}
|
|
6146
6059
|
}
|
|
6147
6060
|
rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
|
|
6148
|
-
if (bone.ascaleX < 0)
|
|
6149
|
-
rotationIK += 180;
|
|
6061
|
+
if (bone.ascaleX < 0) rotationIK += 180;
|
|
6150
6062
|
if (rotationIK > 180)
|
|
6151
6063
|
rotationIK -= 360;
|
|
6152
6064
|
else if (rotationIK < -180)
|
|
@@ -6165,8 +6077,7 @@ var IkConstraint = class {
|
|
|
6165
6077
|
if (compress && dd < b * b || stretch && dd > b * b) {
|
|
6166
6078
|
const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
|
|
6167
6079
|
sx *= s;
|
|
6168
|
-
if (uniform)
|
|
6169
|
-
sy *= s;
|
|
6080
|
+
if (uniform) sy *= s;
|
|
6170
6081
|
}
|
|
6171
6082
|
}
|
|
6172
6083
|
}
|
|
@@ -6183,8 +6094,7 @@ var IkConstraint = class {
|
|
|
6183
6094
|
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6184
6095
|
* @param child A direct descendant of the parent bone. */
|
|
6185
6096
|
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
6186
|
-
if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */)
|
|
6187
|
-
return;
|
|
6097
|
+
if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */) return;
|
|
6188
6098
|
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
6189
6099
|
let os1 = 0, os2 = 0, s2 = 0;
|
|
6190
6100
|
if (psx < 0) {
|
|
@@ -6216,8 +6126,7 @@ var IkConstraint = class {
|
|
|
6216
6126
|
cwy = c * cx + d * cy + parent.worldY;
|
|
6217
6127
|
}
|
|
6218
6128
|
let pp = parent.parent;
|
|
6219
|
-
if (!pp)
|
|
6220
|
-
throw new Error("IK parent must itself have a parent.");
|
|
6129
|
+
if (!pp) throw new Error("IK parent must itself have a parent.");
|
|
6221
6130
|
a = pp.a;
|
|
6222
6131
|
b = pp.b;
|
|
6223
6132
|
c = pp.c;
|
|
@@ -6259,8 +6168,7 @@ var IkConstraint = class {
|
|
|
6259
6168
|
if (stretch) {
|
|
6260
6169
|
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
|
6261
6170
|
sx *= a;
|
|
6262
|
-
if (uniform)
|
|
6263
|
-
sy *= a;
|
|
6171
|
+
if (uniform) sy *= a;
|
|
6264
6172
|
}
|
|
6265
6173
|
} else
|
|
6266
6174
|
a2 = Math.acos(cos) * bendDir;
|
|
@@ -6276,8 +6184,7 @@ var IkConstraint = class {
|
|
|
6276
6184
|
d = c1 * c1 - 4 * c2 * c;
|
|
6277
6185
|
if (d >= 0) {
|
|
6278
6186
|
let q = Math.sqrt(d);
|
|
6279
|
-
if (c1 < 0)
|
|
6280
|
-
q = -q;
|
|
6187
|
+
if (c1 < 0) q = -q;
|
|
6281
6188
|
q = -(c1 + q) * 0.5;
|
|
6282
6189
|
let r0 = q / c2, r1 = c / q;
|
|
6283
6190
|
let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
|
@@ -6346,10 +6253,8 @@ var IkConstraintData = class extends ConstraintData {
|
|
|
6346
6253
|
this._target = boneData;
|
|
6347
6254
|
}
|
|
6348
6255
|
get target() {
|
|
6349
|
-
if (!this._target)
|
|
6350
|
-
|
|
6351
|
-
else
|
|
6352
|
-
return this._target;
|
|
6256
|
+
if (!this._target) throw new Error("BoneData not set.");
|
|
6257
|
+
else return this._target;
|
|
6353
6258
|
}
|
|
6354
6259
|
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
6355
6260
|
bendDirection = 0;
|
|
@@ -6380,17 +6285,15 @@ var PathConstraintData = class extends ConstraintData {
|
|
|
6380
6285
|
this._target = slotData;
|
|
6381
6286
|
}
|
|
6382
6287
|
get target() {
|
|
6383
|
-
if (!this._target)
|
|
6384
|
-
|
|
6385
|
-
else
|
|
6386
|
-
return this._target;
|
|
6288
|
+
if (!this._target) throw new Error("SlotData not set.");
|
|
6289
|
+
else return this._target;
|
|
6387
6290
|
}
|
|
6388
6291
|
/** The mode for positioning the first bone on the path. */
|
|
6389
|
-
positionMode =
|
|
6292
|
+
positionMode = 0 /* Fixed */;
|
|
6390
6293
|
/** The mode for positioning the bones after the first bone on the path. */
|
|
6391
|
-
spacingMode =
|
|
6294
|
+
spacingMode = 1 /* Fixed */;
|
|
6392
6295
|
/** The mode for adjusting the rotation of the bones. */
|
|
6393
|
-
rotateMode =
|
|
6296
|
+
rotateMode = 1 /* Chain */;
|
|
6394
6297
|
/** An offset added to the constrained bone rotation. */
|
|
6395
6298
|
offsetRotation = 0;
|
|
6396
6299
|
/** The position along the path. */
|
|
@@ -6424,7 +6327,11 @@ var RotateMode = /* @__PURE__ */ ((RotateMode2) => {
|
|
|
6424
6327
|
})(RotateMode || {});
|
|
6425
6328
|
|
|
6426
6329
|
// spine-core/src/PathConstraint.ts
|
|
6427
|
-
var
|
|
6330
|
+
var PathConstraint = class _PathConstraint {
|
|
6331
|
+
static NONE = -1;
|
|
6332
|
+
static BEFORE = -2;
|
|
6333
|
+
static AFTER = -3;
|
|
6334
|
+
static epsilon = 1e-5;
|
|
6428
6335
|
/** The path constraint's setup pose data. */
|
|
6429
6336
|
data;
|
|
6430
6337
|
/** The bones that will be modified by this path constraint. */
|
|
@@ -6446,21 +6353,17 @@ var _PathConstraint = class {
|
|
|
6446
6353
|
segments = new Array();
|
|
6447
6354
|
active = false;
|
|
6448
6355
|
constructor(data, skeleton) {
|
|
6449
|
-
if (!data)
|
|
6450
|
-
|
|
6451
|
-
if (!skeleton)
|
|
6452
|
-
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.");
|
|
6453
6358
|
this.data = data;
|
|
6454
6359
|
this.bones = new Array();
|
|
6455
6360
|
for (let i = 0, n = data.bones.length; i < n; i++) {
|
|
6456
6361
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
6457
|
-
if (!bone)
|
|
6458
|
-
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}.`);
|
|
6459
6363
|
this.bones.push(bone);
|
|
6460
6364
|
}
|
|
6461
6365
|
let target = skeleton.findSlot(data.target.name);
|
|
6462
|
-
if (!target)
|
|
6463
|
-
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}`);
|
|
6464
6367
|
this.target = target;
|
|
6465
6368
|
this.position = data.position;
|
|
6466
6369
|
this.spacing = data.spacing;
|
|
@@ -6481,11 +6384,9 @@ var _PathConstraint = class {
|
|
|
6481
6384
|
}
|
|
6482
6385
|
update(physics) {
|
|
6483
6386
|
let attachment = this.target.getAttachment();
|
|
6484
|
-
if (!(attachment instanceof PathAttachment))
|
|
6485
|
-
return;
|
|
6387
|
+
if (!(attachment instanceof PathAttachment)) return;
|
|
6486
6388
|
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY;
|
|
6487
|
-
if (mixRotate == 0 && mixX == 0 && mixY == 0)
|
|
6488
|
-
return;
|
|
6389
|
+
if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
|
|
6489
6390
|
let data = this.data;
|
|
6490
6391
|
let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
|
|
6491
6392
|
let bones = this.bones;
|
|
@@ -6510,14 +6411,12 @@ var _PathConstraint = class {
|
|
|
6510
6411
|
let bone = bones[i];
|
|
6511
6412
|
let setupLength = bone.data.length;
|
|
6512
6413
|
if (setupLength < _PathConstraint.epsilon) {
|
|
6513
|
-
if (scale)
|
|
6514
|
-
lengths[i] = 0;
|
|
6414
|
+
if (scale) lengths[i] = 0;
|
|
6515
6415
|
spaces[++i] = spacing;
|
|
6516
6416
|
} else {
|
|
6517
6417
|
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6518
6418
|
let length = Math.sqrt(x * x + y * y);
|
|
6519
|
-
if (scale)
|
|
6520
|
-
lengths[i] = length;
|
|
6419
|
+
if (scale) lengths[i] = length;
|
|
6521
6420
|
spaces[++i] = length;
|
|
6522
6421
|
sum += length;
|
|
6523
6422
|
}
|
|
@@ -6534,14 +6433,12 @@ var _PathConstraint = class {
|
|
|
6534
6433
|
let bone = bones[i];
|
|
6535
6434
|
let setupLength = bone.data.length;
|
|
6536
6435
|
if (setupLength < _PathConstraint.epsilon) {
|
|
6537
|
-
if (scale)
|
|
6538
|
-
lengths[i] = 0;
|
|
6436
|
+
if (scale) lengths[i] = 0;
|
|
6539
6437
|
spaces[++i] = spacing;
|
|
6540
6438
|
} else {
|
|
6541
6439
|
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6542
6440
|
let length = Math.sqrt(x * x + y * y);
|
|
6543
|
-
if (scale)
|
|
6544
|
-
lengths[i] = length;
|
|
6441
|
+
if (scale) lengths[i] = length;
|
|
6545
6442
|
spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
|
|
6546
6443
|
}
|
|
6547
6444
|
}
|
|
@@ -6614,8 +6511,7 @@ var _PathConstraint = class {
|
|
|
6614
6511
|
let lengths = path.lengths;
|
|
6615
6512
|
curveCount -= closed2 ? 1 : 2;
|
|
6616
6513
|
let pathLength2 = lengths[curveCount];
|
|
6617
|
-
if (this.data.positionMode == 1 /* Percent */)
|
|
6618
|
-
position *= pathLength2;
|
|
6514
|
+
if (this.data.positionMode == 1 /* Percent */) position *= pathLength2;
|
|
6619
6515
|
let multiplier2;
|
|
6620
6516
|
switch (this.data.spacingMode) {
|
|
6621
6517
|
case 2 /* Percent */:
|
|
@@ -6634,8 +6530,7 @@ var _PathConstraint = class {
|
|
|
6634
6530
|
let p = position;
|
|
6635
6531
|
if (closed2) {
|
|
6636
6532
|
p %= pathLength2;
|
|
6637
|
-
if (p < 0)
|
|
6638
|
-
p += pathLength2;
|
|
6533
|
+
if (p < 0) p += pathLength2;
|
|
6639
6534
|
curve = 0;
|
|
6640
6535
|
} else if (p < 0) {
|
|
6641
6536
|
if (prevCurve != _PathConstraint.BEFORE) {
|
|
@@ -6654,8 +6549,7 @@ var _PathConstraint = class {
|
|
|
6654
6549
|
}
|
|
6655
6550
|
for (; ; curve++) {
|
|
6656
6551
|
let length = lengths[curve];
|
|
6657
|
-
if (p > length)
|
|
6658
|
-
continue;
|
|
6552
|
+
if (p > length) continue;
|
|
6659
6553
|
if (curve == 0)
|
|
6660
6554
|
p /= length;
|
|
6661
6555
|
else {
|
|
@@ -6737,8 +6631,7 @@ var _PathConstraint = class {
|
|
|
6737
6631
|
x1 = x2;
|
|
6738
6632
|
y1 = y2;
|
|
6739
6633
|
}
|
|
6740
|
-
if (this.data.positionMode == 1 /* Percent */)
|
|
6741
|
-
position *= pathLength;
|
|
6634
|
+
if (this.data.positionMode == 1 /* Percent */) position *= pathLength;
|
|
6742
6635
|
let multiplier;
|
|
6743
6636
|
switch (this.data.spacingMode) {
|
|
6744
6637
|
case 2 /* Percent */:
|
|
@@ -6758,8 +6651,7 @@ var _PathConstraint = class {
|
|
|
6758
6651
|
let p = position;
|
|
6759
6652
|
if (closed2) {
|
|
6760
6653
|
p %= pathLength;
|
|
6761
|
-
if (p < 0)
|
|
6762
|
-
p += pathLength;
|
|
6654
|
+
if (p < 0) p += pathLength;
|
|
6763
6655
|
curve = 0;
|
|
6764
6656
|
} else if (p < 0) {
|
|
6765
6657
|
this.addBeforePosition(p, world, 0, out, o);
|
|
@@ -6770,8 +6662,7 @@ var _PathConstraint = class {
|
|
|
6770
6662
|
}
|
|
6771
6663
|
for (; ; curve++) {
|
|
6772
6664
|
let length = curves[curve];
|
|
6773
|
-
if (p > length)
|
|
6774
|
-
continue;
|
|
6665
|
+
if (p > length) continue;
|
|
6775
6666
|
if (curve == 0)
|
|
6776
6667
|
p /= length;
|
|
6777
6668
|
else {
|
|
@@ -6822,8 +6713,7 @@ var _PathConstraint = class {
|
|
|
6822
6713
|
p *= curveLength;
|
|
6823
6714
|
for (; ; segment++) {
|
|
6824
6715
|
let length = segments[segment];
|
|
6825
|
-
if (p > length)
|
|
6826
|
-
continue;
|
|
6716
|
+
if (p > length) continue;
|
|
6827
6717
|
if (segment == 0)
|
|
6828
6718
|
p /= length;
|
|
6829
6719
|
else {
|
|
@@ -6868,11 +6758,6 @@ var _PathConstraint = class {
|
|
|
6868
6758
|
}
|
|
6869
6759
|
}
|
|
6870
6760
|
};
|
|
6871
|
-
var PathConstraint = _PathConstraint;
|
|
6872
|
-
__publicField(PathConstraint, "NONE", -1);
|
|
6873
|
-
__publicField(PathConstraint, "BEFORE", -2);
|
|
6874
|
-
__publicField(PathConstraint, "AFTER", -3);
|
|
6875
|
-
__publicField(PathConstraint, "epsilon", 1e-5);
|
|
6876
6761
|
|
|
6877
6762
|
// spine-core/src/PhysicsConstraint.ts
|
|
6878
6763
|
var PhysicsConstraint = class {
|
|
@@ -6883,10 +6768,8 @@ var PhysicsConstraint = class {
|
|
|
6883
6768
|
this._bone = bone;
|
|
6884
6769
|
}
|
|
6885
6770
|
get bone() {
|
|
6886
|
-
if (!this._bone)
|
|
6887
|
-
|
|
6888
|
-
else
|
|
6889
|
-
return this._bone;
|
|
6771
|
+
if (!this._bone) throw new Error("Bone not set.");
|
|
6772
|
+
else return this._bone;
|
|
6890
6773
|
}
|
|
6891
6774
|
inertia = 0;
|
|
6892
6775
|
strength = 0;
|
|
@@ -6955,8 +6838,7 @@ var PhysicsConstraint = class {
|
|
|
6955
6838
|
/** Applies the constraint to the constrained bones. */
|
|
6956
6839
|
update(physics) {
|
|
6957
6840
|
const mix = this.mix;
|
|
6958
|
-
if (mix == 0)
|
|
6959
|
-
return;
|
|
6841
|
+
if (mix == 0) return;
|
|
6960
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;
|
|
6961
6843
|
const bone = this.bone;
|
|
6962
6844
|
const l = bone.data.length;
|
|
@@ -6965,6 +6847,7 @@ var PhysicsConstraint = class {
|
|
|
6965
6847
|
return;
|
|
6966
6848
|
case 1 /* reset */:
|
|
6967
6849
|
this.reset();
|
|
6850
|
+
// Fall through.
|
|
6968
6851
|
case 2 /* update */:
|
|
6969
6852
|
const skeleton = this.skeleton;
|
|
6970
6853
|
const delta = Math.max(this.skeleton.time - this.lastTime, 0);
|
|
@@ -7007,10 +6890,8 @@ var PhysicsConstraint = class {
|
|
|
7007
6890
|
a -= t;
|
|
7008
6891
|
} while (a >= t);
|
|
7009
6892
|
}
|
|
7010
|
-
if (x)
|
|
7011
|
-
|
|
7012
|
-
if (y)
|
|
7013
|
-
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;
|
|
7014
6895
|
}
|
|
7015
6896
|
if (rotateOrShearX || scaleX) {
|
|
7016
6897
|
let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
|
|
@@ -7032,20 +6913,17 @@ var PhysicsConstraint = class {
|
|
|
7032
6913
|
s = Math.sin(r);
|
|
7033
6914
|
if (scaleX) {
|
|
7034
6915
|
r = l * bone.getWorldScaleX();
|
|
7035
|
-
if (r > 0)
|
|
7036
|
-
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
6916
|
+
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7037
6917
|
}
|
|
7038
6918
|
} else {
|
|
7039
6919
|
c = Math.cos(ca);
|
|
7040
6920
|
s = Math.sin(ca);
|
|
7041
6921
|
const r = l * bone.getWorldScaleX();
|
|
7042
|
-
if (r > 0)
|
|
7043
|
-
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
6922
|
+
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7044
6923
|
}
|
|
7045
6924
|
a = this.remaining;
|
|
7046
6925
|
if (a >= t) {
|
|
7047
|
-
if (d == -1)
|
|
7048
|
-
d = Math.pow(this.damping, 60 * t);
|
|
6926
|
+
if (d == -1) d = Math.pow(this.damping, 60 * t);
|
|
7049
6927
|
const m = this.massInverse * t, e = this.strength, w = this.wind, g = Skeleton.yDown ? -this.gravity : this.gravity, h = l / f;
|
|
7050
6928
|
while (true) {
|
|
7051
6929
|
a -= t;
|
|
@@ -7058,8 +6936,7 @@ var PhysicsConstraint = class {
|
|
|
7058
6936
|
this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
|
|
7059
6937
|
this.rotateOffset += this.rotateVelocity * t;
|
|
7060
6938
|
this.rotateVelocity *= d;
|
|
7061
|
-
if (a < t)
|
|
7062
|
-
break;
|
|
6939
|
+
if (a < t) break;
|
|
7063
6940
|
const r = this.rotateOffset * mr + ca;
|
|
7064
6941
|
c = Math.cos(r);
|
|
7065
6942
|
s = Math.sin(r);
|
|
@@ -7074,10 +6951,8 @@ var PhysicsConstraint = class {
|
|
|
7074
6951
|
this.cy = bone.worldY;
|
|
7075
6952
|
break;
|
|
7076
6953
|
case 3 /* pose */:
|
|
7077
|
-
if (x)
|
|
7078
|
-
|
|
7079
|
-
if (y)
|
|
7080
|
-
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;
|
|
7081
6956
|
}
|
|
7082
6957
|
if (rotateOrShearX) {
|
|
7083
6958
|
let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
|
|
@@ -7160,10 +7035,8 @@ var Slot = class {
|
|
|
7160
7035
|
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
|
|
7161
7036
|
deform = new Array();
|
|
7162
7037
|
constructor(data, bone) {
|
|
7163
|
-
if (!data)
|
|
7164
|
-
|
|
7165
|
-
if (!bone)
|
|
7166
|
-
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.");
|
|
7167
7040
|
this.data = data;
|
|
7168
7041
|
this.bone = bone;
|
|
7169
7042
|
this.color = new Color();
|
|
@@ -7182,8 +7055,7 @@ var Slot = class {
|
|
|
7182
7055
|
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
|
|
7183
7056
|
* specified attachment. */
|
|
7184
7057
|
setAttachment(attachment) {
|
|
7185
|
-
if (this.attachment == attachment)
|
|
7186
|
-
return;
|
|
7058
|
+
if (this.attachment == attachment) return;
|
|
7187
7059
|
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttachment != this.attachment.timelineAttachment) {
|
|
7188
7060
|
this.deform.length = 0;
|
|
7189
7061
|
}
|
|
@@ -7193,8 +7065,7 @@ var Slot = class {
|
|
|
7193
7065
|
/** Sets this slot to the setup pose. */
|
|
7194
7066
|
setToSetupPose() {
|
|
7195
7067
|
this.color.setFromColor(this.data.color);
|
|
7196
|
-
if (this.darkColor)
|
|
7197
|
-
this.darkColor.setFromColor(this.data.darkColor);
|
|
7068
|
+
if (this.darkColor) this.darkColor.setFromColor(this.data.darkColor);
|
|
7198
7069
|
if (!this.data.attachmentName)
|
|
7199
7070
|
this.attachment = null;
|
|
7200
7071
|
else {
|
|
@@ -7221,21 +7092,17 @@ var TransformConstraint = class {
|
|
|
7221
7092
|
temp = new Vector2();
|
|
7222
7093
|
active = false;
|
|
7223
7094
|
constructor(data, skeleton) {
|
|
7224
|
-
if (!data)
|
|
7225
|
-
|
|
7226
|
-
if (!skeleton)
|
|
7227
|
-
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.");
|
|
7228
7097
|
this.data = data;
|
|
7229
7098
|
this.bones = new Array();
|
|
7230
7099
|
for (let i = 0; i < data.bones.length; i++) {
|
|
7231
7100
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
7232
|
-
if (!bone)
|
|
7233
|
-
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}.`);
|
|
7234
7102
|
this.bones.push(bone);
|
|
7235
7103
|
}
|
|
7236
7104
|
let target = skeleton.findBone(data.target.name);
|
|
7237
|
-
if (!target)
|
|
7238
|
-
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}.`);
|
|
7239
7106
|
this.target = target;
|
|
7240
7107
|
this.mixRotate = data.mixRotate;
|
|
7241
7108
|
this.mixX = data.mixX;
|
|
@@ -7257,8 +7124,7 @@ var TransformConstraint = class {
|
|
|
7257
7124
|
this.mixShearY = data.mixShearY;
|
|
7258
7125
|
}
|
|
7259
7126
|
update(physics) {
|
|
7260
|
-
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
7261
|
-
return;
|
|
7127
|
+
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0) return;
|
|
7262
7128
|
if (this.data.local) {
|
|
7263
7129
|
if (this.data.relative)
|
|
7264
7130
|
this.applyRelativeLocal();
|
|
@@ -7304,15 +7170,13 @@ var TransformConstraint = class {
|
|
|
7304
7170
|
}
|
|
7305
7171
|
if (mixScaleX != 0) {
|
|
7306
7172
|
let s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
|
|
7307
|
-
if (s != 0)
|
|
7308
|
-
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;
|
|
7309
7174
|
bone.a *= s;
|
|
7310
7175
|
bone.c *= s;
|
|
7311
7176
|
}
|
|
7312
7177
|
if (mixScaleY != 0) {
|
|
7313
7178
|
let s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
|
|
7314
|
-
if (s != 0)
|
|
7315
|
-
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;
|
|
7316
7180
|
bone.b *= s;
|
|
7317
7181
|
bone.d *= s;
|
|
7318
7182
|
}
|
|
@@ -7394,8 +7258,7 @@ var TransformConstraint = class {
|
|
|
7394
7258
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7395
7259
|
let bone = bones[i];
|
|
7396
7260
|
let rotation = bone.arotation;
|
|
7397
|
-
if (mixRotate != 0)
|
|
7398
|
-
rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7261
|
+
if (mixRotate != 0) rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7399
7262
|
let x = bone.ax, y = bone.ay;
|
|
7400
7263
|
x += (target.ax - x + this.data.offsetX) * mixX;
|
|
7401
7264
|
y += (target.ay - y + this.data.offsetY) * mixY;
|
|
@@ -7405,8 +7268,7 @@ var TransformConstraint = class {
|
|
|
7405
7268
|
if (mixScaleY != 0 && scaleY != 0)
|
|
7406
7269
|
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
|
|
7407
7270
|
let shearY = bone.ashearY;
|
|
7408
|
-
if (mixShearY != 0)
|
|
7409
|
-
shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7271
|
+
if (mixShearY != 0) shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7410
7272
|
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
|
|
7411
7273
|
}
|
|
7412
7274
|
}
|
|
@@ -7428,7 +7290,9 @@ var TransformConstraint = class {
|
|
|
7428
7290
|
};
|
|
7429
7291
|
|
|
7430
7292
|
// spine-core/src/Skeleton.ts
|
|
7431
|
-
var
|
|
7293
|
+
var Skeleton = class _Skeleton {
|
|
7294
|
+
static quadTriangles = [0, 1, 2, 2, 3, 0];
|
|
7295
|
+
static yDown = false;
|
|
7432
7296
|
/** The skeleton's setup pose data. */
|
|
7433
7297
|
data;
|
|
7434
7298
|
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
@@ -7472,8 +7336,7 @@ var _Skeleton = class {
|
|
|
7472
7336
|
* See {@link #update(float)}. */
|
|
7473
7337
|
time = 0;
|
|
7474
7338
|
constructor(data) {
|
|
7475
|
-
if (!data)
|
|
7476
|
-
throw new Error("data cannot be null.");
|
|
7339
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7477
7340
|
this.data = data;
|
|
7478
7341
|
this.bones = new Array();
|
|
7479
7342
|
for (let i = 0; i < data.bones.length; i++) {
|
|
@@ -7584,8 +7447,7 @@ var _Skeleton = class {
|
|
|
7584
7447
|
}
|
|
7585
7448
|
sortIkConstraint(constraint) {
|
|
7586
7449
|
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7587
|
-
if (!constraint.active)
|
|
7588
|
-
return;
|
|
7450
|
+
if (!constraint.active) return;
|
|
7589
7451
|
let target = constraint.target;
|
|
7590
7452
|
this.sortBone(target);
|
|
7591
7453
|
let constrained = constraint.bones;
|
|
@@ -7604,20 +7466,17 @@ var _Skeleton = class {
|
|
|
7604
7466
|
}
|
|
7605
7467
|
sortPathConstraint(constraint) {
|
|
7606
7468
|
constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7607
|
-
if (!constraint.active)
|
|
7608
|
-
return;
|
|
7469
|
+
if (!constraint.active) return;
|
|
7609
7470
|
let slot = constraint.target;
|
|
7610
7471
|
let slotIndex = slot.data.index;
|
|
7611
7472
|
let slotBone = slot.bone;
|
|
7612
|
-
if (this.skin)
|
|
7613
|
-
this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
|
|
7473
|
+
if (this.skin) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
|
|
7614
7474
|
if (this.data.defaultSkin && this.data.defaultSkin != this.skin)
|
|
7615
7475
|
this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
|
|
7616
7476
|
for (let i = 0, n = this.data.skins.length; i < n; i++)
|
|
7617
7477
|
this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
|
|
7618
7478
|
let attachment = slot.getAttachment();
|
|
7619
|
-
if (attachment instanceof PathAttachment)
|
|
7620
|
-
this.sortPathConstraintAttachmentWith(attachment, slotBone);
|
|
7479
|
+
if (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);
|
|
7621
7480
|
let constrained = constraint.bones;
|
|
7622
7481
|
let boneCount = constrained.length;
|
|
7623
7482
|
for (let i = 0; i < boneCount; i++)
|
|
@@ -7630,8 +7489,7 @@ var _Skeleton = class {
|
|
|
7630
7489
|
}
|
|
7631
7490
|
sortTransformConstraint(constraint) {
|
|
7632
7491
|
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7633
|
-
if (!constraint.active)
|
|
7634
|
-
return;
|
|
7492
|
+
if (!constraint.active) return;
|
|
7635
7493
|
this.sortBone(constraint.target);
|
|
7636
7494
|
let constrained = constraint.bones;
|
|
7637
7495
|
let boneCount = constrained.length;
|
|
@@ -7654,15 +7512,13 @@ var _Skeleton = class {
|
|
|
7654
7512
|
}
|
|
7655
7513
|
sortPathConstraintAttachment(skin, slotIndex, slotBone) {
|
|
7656
7514
|
let attachments = skin.attachments[slotIndex];
|
|
7657
|
-
if (!attachments)
|
|
7658
|
-
return;
|
|
7515
|
+
if (!attachments) return;
|
|
7659
7516
|
for (let key in attachments) {
|
|
7660
7517
|
this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
|
|
7661
7518
|
}
|
|
7662
7519
|
}
|
|
7663
7520
|
sortPathConstraintAttachmentWith(attachment, slotBone) {
|
|
7664
|
-
if (!(attachment instanceof PathAttachment))
|
|
7665
|
-
return;
|
|
7521
|
+
if (!(attachment instanceof PathAttachment)) return;
|
|
7666
7522
|
let pathBones = attachment.bones;
|
|
7667
7523
|
if (!pathBones)
|
|
7668
7524
|
this.sortBone(slotBone);
|
|
@@ -7679,31 +7535,25 @@ var _Skeleton = class {
|
|
|
7679
7535
|
sortPhysicsConstraint(constraint) {
|
|
7680
7536
|
const bone = constraint.bone;
|
|
7681
7537
|
constraint.active = bone.active && (!constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7682
|
-
if (!constraint.active)
|
|
7683
|
-
return;
|
|
7538
|
+
if (!constraint.active) return;
|
|
7684
7539
|
this.sortBone(bone);
|
|
7685
7540
|
this._updateCache.push(constraint);
|
|
7686
7541
|
this.sortReset(bone.children);
|
|
7687
7542
|
bone.sorted = true;
|
|
7688
7543
|
}
|
|
7689
7544
|
sortBone(bone) {
|
|
7690
|
-
if (!bone)
|
|
7691
|
-
|
|
7692
|
-
if (bone.sorted)
|
|
7693
|
-
return;
|
|
7545
|
+
if (!bone) return;
|
|
7546
|
+
if (bone.sorted) return;
|
|
7694
7547
|
let parent = bone.parent;
|
|
7695
|
-
if (parent)
|
|
7696
|
-
this.sortBone(parent);
|
|
7548
|
+
if (parent) this.sortBone(parent);
|
|
7697
7549
|
bone.sorted = true;
|
|
7698
7550
|
this._updateCache.push(bone);
|
|
7699
7551
|
}
|
|
7700
7552
|
sortReset(bones) {
|
|
7701
7553
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7702
7554
|
let bone = bones[i];
|
|
7703
|
-
if (!bone.active)
|
|
7704
|
-
|
|
7705
|
-
if (bone.sorted)
|
|
7706
|
-
this.sortReset(bone.children);
|
|
7555
|
+
if (!bone.active) continue;
|
|
7556
|
+
if (bone.sorted) this.sortReset(bone.children);
|
|
7707
7557
|
bone.sorted = false;
|
|
7708
7558
|
}
|
|
7709
7559
|
}
|
|
@@ -7712,8 +7562,7 @@ var _Skeleton = class {
|
|
|
7712
7562
|
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7713
7563
|
* Runtimes Guide. */
|
|
7714
7564
|
updateWorldTransform(physics) {
|
|
7715
|
-
if (physics === void 0 || physics === null)
|
|
7716
|
-
throw new Error("physics is undefined");
|
|
7565
|
+
if (physics === void 0 || physics === null) throw new Error("physics is undefined");
|
|
7717
7566
|
let bones = this.bones;
|
|
7718
7567
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7719
7568
|
let bone = bones[i];
|
|
@@ -7730,8 +7579,7 @@ var _Skeleton = class {
|
|
|
7730
7579
|
updateCache[i].update(physics);
|
|
7731
7580
|
}
|
|
7732
7581
|
updateWorldTransformWith(physics, parent) {
|
|
7733
|
-
if (!parent)
|
|
7734
|
-
throw new Error("parent cannot be null.");
|
|
7582
|
+
if (!parent) throw new Error("parent cannot be null.");
|
|
7735
7583
|
let bones = this.bones;
|
|
7736
7584
|
for (let i = 1, n = bones.length; i < n; i++) {
|
|
7737
7585
|
let bone = bones[i];
|
|
@@ -7744,8 +7592,7 @@ var _Skeleton = class {
|
|
|
7744
7592
|
bone.ashearY = bone.shearY;
|
|
7745
7593
|
}
|
|
7746
7594
|
let rootBone = this.getRootBone();
|
|
7747
|
-
if (!rootBone)
|
|
7748
|
-
throw new Error("Root bone must not be null.");
|
|
7595
|
+
if (!rootBone) throw new Error("Root bone must not be null.");
|
|
7749
7596
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
7750
7597
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
7751
7598
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -7762,8 +7609,7 @@ var _Skeleton = class {
|
|
|
7762
7609
|
let updateCache = this._updateCache;
|
|
7763
7610
|
for (let i = 0, n = updateCache.length; i < n; i++) {
|
|
7764
7611
|
let updatable = updateCache[i];
|
|
7765
|
-
if (updatable != rootBone)
|
|
7766
|
-
updatable.update(physics);
|
|
7612
|
+
if (updatable != rootBone) updatable.update(physics);
|
|
7767
7613
|
}
|
|
7768
7614
|
}
|
|
7769
7615
|
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
@@ -7773,16 +7619,11 @@ var _Skeleton = class {
|
|
|
7773
7619
|
}
|
|
7774
7620
|
/** Sets the bones and constraints to their setup pose values. */
|
|
7775
7621
|
setBonesToSetupPose() {
|
|
7776
|
-
for (const bone of this.bones)
|
|
7777
|
-
|
|
7778
|
-
for (const constraint of this.
|
|
7779
|
-
|
|
7780
|
-
for (const constraint of this.
|
|
7781
|
-
constraint.setToSetupPose();
|
|
7782
|
-
for (const constraint of this.pathConstraints)
|
|
7783
|
-
constraint.setToSetupPose();
|
|
7784
|
-
for (const constraint of this.physicsConstraints)
|
|
7785
|
-
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();
|
|
7786
7627
|
}
|
|
7787
7628
|
/** Sets the slots and draw order to their setup pose values. */
|
|
7788
7629
|
setSlotsToSetupPose() {
|
|
@@ -7793,19 +7634,16 @@ var _Skeleton = class {
|
|
|
7793
7634
|
}
|
|
7794
7635
|
/** @returns May return null. */
|
|
7795
7636
|
getRootBone() {
|
|
7796
|
-
if (this.bones.length == 0)
|
|
7797
|
-
return null;
|
|
7637
|
+
if (this.bones.length == 0) return null;
|
|
7798
7638
|
return this.bones[0];
|
|
7799
7639
|
}
|
|
7800
7640
|
/** @returns May be null. */
|
|
7801
7641
|
findBone(boneName) {
|
|
7802
|
-
if (!boneName)
|
|
7803
|
-
throw new Error("boneName cannot be null.");
|
|
7642
|
+
if (!boneName) throw new Error("boneName cannot be null.");
|
|
7804
7643
|
let bones = this.bones;
|
|
7805
7644
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7806
7645
|
let bone = bones[i];
|
|
7807
|
-
if (bone.data.name == boneName)
|
|
7808
|
-
return bone;
|
|
7646
|
+
if (bone.data.name == boneName) return bone;
|
|
7809
7647
|
}
|
|
7810
7648
|
return null;
|
|
7811
7649
|
}
|
|
@@ -7813,13 +7651,11 @@ var _Skeleton = class {
|
|
|
7813
7651
|
* repeatedly.
|
|
7814
7652
|
* @returns May be null. */
|
|
7815
7653
|
findSlot(slotName) {
|
|
7816
|
-
if (!slotName)
|
|
7817
|
-
throw new Error("slotName cannot be null.");
|
|
7654
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
7818
7655
|
let slots = this.slots;
|
|
7819
7656
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
7820
7657
|
let slot = slots[i];
|
|
7821
|
-
if (slot.data.name == slotName)
|
|
7822
|
-
return slot;
|
|
7658
|
+
if (slot.data.name == slotName) return slot;
|
|
7823
7659
|
}
|
|
7824
7660
|
return null;
|
|
7825
7661
|
}
|
|
@@ -7828,8 +7664,7 @@ var _Skeleton = class {
|
|
|
7828
7664
|
* See {@link #setSkin()}. */
|
|
7829
7665
|
setSkinByName(skinName) {
|
|
7830
7666
|
let skin = this.data.findSkin(skinName);
|
|
7831
|
-
if (!skin)
|
|
7832
|
-
throw new Error("Skin not found: " + skinName);
|
|
7667
|
+
if (!skin) throw new Error("Skin not found: " + skinName);
|
|
7833
7668
|
this.setSkin(skin);
|
|
7834
7669
|
}
|
|
7835
7670
|
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
|
|
@@ -7843,8 +7678,7 @@ var _Skeleton = class {
|
|
|
7843
7678
|
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
|
|
7844
7679
|
* @param newSkin May be null. */
|
|
7845
7680
|
setSkin(newSkin) {
|
|
7846
|
-
if (newSkin == this.skin)
|
|
7847
|
-
return;
|
|
7681
|
+
if (newSkin == this.skin) return;
|
|
7848
7682
|
if (newSkin) {
|
|
7849
7683
|
if (this.skin)
|
|
7850
7684
|
newSkin.attachAll(this, this.skin);
|
|
@@ -7855,8 +7689,7 @@ var _Skeleton = class {
|
|
|
7855
7689
|
let name = slot.data.attachmentName;
|
|
7856
7690
|
if (name) {
|
|
7857
7691
|
let attachment = newSkin.getAttachment(i, name);
|
|
7858
|
-
if (attachment)
|
|
7859
|
-
slot.setAttachment(attachment);
|
|
7692
|
+
if (attachment) slot.setAttachment(attachment);
|
|
7860
7693
|
}
|
|
7861
7694
|
}
|
|
7862
7695
|
}
|
|
@@ -7871,8 +7704,7 @@ var _Skeleton = class {
|
|
|
7871
7704
|
* @returns May be null. */
|
|
7872
7705
|
getAttachmentByName(slotName, attachmentName) {
|
|
7873
7706
|
let slot = this.data.findSlot(slotName);
|
|
7874
|
-
if (!slot)
|
|
7875
|
-
throw new Error(`Can't find slot with name ${slotName}`);
|
|
7707
|
+
if (!slot) throw new Error(`Can't find slot with name ${slotName}`);
|
|
7876
7708
|
return this.getAttachment(slot.index, attachmentName);
|
|
7877
7709
|
}
|
|
7878
7710
|
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
|
|
@@ -7881,23 +7713,19 @@ var _Skeleton = class {
|
|
|
7881
7713
|
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
|
7882
7714
|
* @returns May be null. */
|
|
7883
7715
|
getAttachment(slotIndex, attachmentName) {
|
|
7884
|
-
if (!attachmentName)
|
|
7885
|
-
throw new Error("attachmentName cannot be null.");
|
|
7716
|
+
if (!attachmentName) throw new Error("attachmentName cannot be null.");
|
|
7886
7717
|
if (this.skin) {
|
|
7887
7718
|
let attachment = this.skin.getAttachment(slotIndex, attachmentName);
|
|
7888
|
-
if (attachment)
|
|
7889
|
-
return attachment;
|
|
7719
|
+
if (attachment) return attachment;
|
|
7890
7720
|
}
|
|
7891
|
-
if (this.data.defaultSkin)
|
|
7892
|
-
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
7721
|
+
if (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
7893
7722
|
return null;
|
|
7894
7723
|
}
|
|
7895
7724
|
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
|
7896
7725
|
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
|
7897
7726
|
* @param attachmentName May be null to clear the slot's attachment. */
|
|
7898
7727
|
setAttachment(slotName, attachmentName) {
|
|
7899
|
-
if (!slotName)
|
|
7900
|
-
throw new Error("slotName cannot be null.");
|
|
7728
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
7901
7729
|
let slots = this.slots;
|
|
7902
7730
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
7903
7731
|
let slot = slots[i];
|
|
@@ -7905,8 +7733,7 @@ var _Skeleton = class {
|
|
|
7905
7733
|
let attachment = null;
|
|
7906
7734
|
if (attachmentName) {
|
|
7907
7735
|
attachment = this.getAttachment(i, attachmentName);
|
|
7908
|
-
if (!attachment)
|
|
7909
|
-
throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
|
|
7736
|
+
if (!attachment) throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
|
|
7910
7737
|
}
|
|
7911
7738
|
slot.setAttachment(attachment);
|
|
7912
7739
|
return;
|
|
@@ -7918,31 +7745,27 @@ var _Skeleton = class {
|
|
|
7918
7745
|
* than to call it repeatedly.
|
|
7919
7746
|
* @return May be null. */
|
|
7920
7747
|
findIkConstraint(constraintName) {
|
|
7921
|
-
if (!constraintName)
|
|
7922
|
-
throw new Error("constraintName cannot be null.");
|
|
7748
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
7923
7749
|
return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7924
7750
|
}
|
|
7925
7751
|
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7926
7752
|
* this method than to call it repeatedly.
|
|
7927
7753
|
* @return May be null. */
|
|
7928
7754
|
findTransformConstraint(constraintName) {
|
|
7929
|
-
if (!constraintName)
|
|
7930
|
-
throw new Error("constraintName cannot be null.");
|
|
7755
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
7931
7756
|
return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7932
7757
|
}
|
|
7933
7758
|
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7934
7759
|
* than to call it repeatedly.
|
|
7935
7760
|
* @return May be null. */
|
|
7936
7761
|
findPathConstraint(constraintName) {
|
|
7937
|
-
if (!constraintName)
|
|
7938
|
-
throw new Error("constraintName cannot be null.");
|
|
7762
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
7939
7763
|
return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7940
7764
|
}
|
|
7941
7765
|
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
|
|
7942
7766
|
* method than to call it repeatedly. */
|
|
7943
7767
|
findPhysicsConstraint(constraintName) {
|
|
7944
|
-
if (constraintName == null)
|
|
7945
|
-
throw new Error("constraintName cannot be null.");
|
|
7768
|
+
if (constraintName == null) throw new Error("constraintName cannot be null.");
|
|
7946
7769
|
return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7947
7770
|
}
|
|
7948
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 }`.
|
|
@@ -7959,16 +7782,13 @@ var _Skeleton = class {
|
|
|
7959
7782
|
* @param temp Working memory to temporarily store attachments' computed world vertices.
|
|
7960
7783
|
* @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
|
|
7961
7784
|
getBounds(offset, size, temp = new Array(2), clipper = null) {
|
|
7962
|
-
if (!offset)
|
|
7963
|
-
|
|
7964
|
-
if (!size)
|
|
7965
|
-
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.");
|
|
7966
7787
|
let drawOrder = this.drawOrder;
|
|
7967
7788
|
let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
|
7968
7789
|
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
|
7969
7790
|
let slot = drawOrder[i];
|
|
7970
|
-
if (!slot.bone.active)
|
|
7971
|
-
continue;
|
|
7791
|
+
if (!slot.bone.active) continue;
|
|
7972
7792
|
let verticesLength = 0;
|
|
7973
7793
|
let vertices = null;
|
|
7974
7794
|
let triangles = null;
|
|
@@ -8002,11 +7822,9 @@ var _Skeleton = class {
|
|
|
8002
7822
|
maxY = Math.max(maxY, y);
|
|
8003
7823
|
}
|
|
8004
7824
|
}
|
|
8005
|
-
if (clipper != null)
|
|
8006
|
-
clipper.clipEndWithSlot(slot);
|
|
7825
|
+
if (clipper != null) clipper.clipEndWithSlot(slot);
|
|
8007
7826
|
}
|
|
8008
|
-
if (clipper != null)
|
|
8009
|
-
clipper.clipEnd();
|
|
7827
|
+
if (clipper != null) clipper.clipEnd();
|
|
8010
7828
|
offset.set(minX, minY);
|
|
8011
7829
|
size.set(maxX - minX, maxY - minY);
|
|
8012
7830
|
}
|
|
@@ -8026,9 +7844,6 @@ var _Skeleton = class {
|
|
|
8026
7844
|
physicsConstraints[i].rotate(x, y, degrees);
|
|
8027
7845
|
}
|
|
8028
7846
|
};
|
|
8029
|
-
var Skeleton = _Skeleton;
|
|
8030
|
-
__publicField(Skeleton, "quadTriangles", [0, 1, 2, 2, 3, 0]);
|
|
8031
|
-
__publicField(Skeleton, "yDown", false);
|
|
8032
7847
|
var Physics = /* @__PURE__ */ ((Physics2) => {
|
|
8033
7848
|
Physics2[Physics2["none"] = 0] = "none";
|
|
8034
7849
|
Physics2[Physics2["reset"] = 1] = "reset";
|
|
@@ -8045,10 +7860,8 @@ var PhysicsConstraintData = class extends ConstraintData {
|
|
|
8045
7860
|
this._bone = boneData;
|
|
8046
7861
|
}
|
|
8047
7862
|
get bone() {
|
|
8048
|
-
if (!this._bone)
|
|
8049
|
-
|
|
8050
|
-
else
|
|
8051
|
-
return this._bone;
|
|
7863
|
+
if (!this._bone) throw new Error("BoneData not set.");
|
|
7864
|
+
else return this._bone;
|
|
8052
7865
|
}
|
|
8053
7866
|
x = 0;
|
|
8054
7867
|
y = 0;
|
|
@@ -8131,13 +7944,11 @@ var SkeletonData = class {
|
|
|
8131
7944
|
* multiple times.
|
|
8132
7945
|
* @returns May be null. */
|
|
8133
7946
|
findBone(boneName) {
|
|
8134
|
-
if (!boneName)
|
|
8135
|
-
throw new Error("boneName cannot be null.");
|
|
7947
|
+
if (!boneName) throw new Error("boneName cannot be null.");
|
|
8136
7948
|
let bones = this.bones;
|
|
8137
7949
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
8138
7950
|
let bone = bones[i];
|
|
8139
|
-
if (bone.name == boneName)
|
|
8140
|
-
return bone;
|
|
7951
|
+
if (bone.name == boneName) return bone;
|
|
8141
7952
|
}
|
|
8142
7953
|
return null;
|
|
8143
7954
|
}
|
|
@@ -8145,13 +7956,11 @@ var SkeletonData = class {
|
|
|
8145
7956
|
* multiple times.
|
|
8146
7957
|
* @returns May be null. */
|
|
8147
7958
|
findSlot(slotName) {
|
|
8148
|
-
if (!slotName)
|
|
8149
|
-
throw new Error("slotName cannot be null.");
|
|
7959
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
8150
7960
|
let slots = this.slots;
|
|
8151
7961
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
8152
7962
|
let slot = slots[i];
|
|
8153
|
-
if (slot.name == slotName)
|
|
8154
|
-
return slot;
|
|
7963
|
+
if (slot.name == slotName) return slot;
|
|
8155
7964
|
}
|
|
8156
7965
|
return null;
|
|
8157
7966
|
}
|
|
@@ -8159,13 +7968,11 @@ var SkeletonData = class {
|
|
|
8159
7968
|
* multiple times.
|
|
8160
7969
|
* @returns May be null. */
|
|
8161
7970
|
findSkin(skinName) {
|
|
8162
|
-
if (!skinName)
|
|
8163
|
-
throw new Error("skinName cannot be null.");
|
|
7971
|
+
if (!skinName) throw new Error("skinName cannot be null.");
|
|
8164
7972
|
let skins = this.skins;
|
|
8165
7973
|
for (let i = 0, n = skins.length; i < n; i++) {
|
|
8166
7974
|
let skin = skins[i];
|
|
8167
|
-
if (skin.name == skinName)
|
|
8168
|
-
return skin;
|
|
7975
|
+
if (skin.name == skinName) return skin;
|
|
8169
7976
|
}
|
|
8170
7977
|
return null;
|
|
8171
7978
|
}
|
|
@@ -8173,13 +7980,11 @@ var SkeletonData = class {
|
|
|
8173
7980
|
* multiple times.
|
|
8174
7981
|
* @returns May be null. */
|
|
8175
7982
|
findEvent(eventDataName) {
|
|
8176
|
-
if (!eventDataName)
|
|
8177
|
-
throw new Error("eventDataName cannot be null.");
|
|
7983
|
+
if (!eventDataName) throw new Error("eventDataName cannot be null.");
|
|
8178
7984
|
let events = this.events;
|
|
8179
7985
|
for (let i = 0, n = events.length; i < n; i++) {
|
|
8180
7986
|
let event = events[i];
|
|
8181
|
-
if (event.name == eventDataName)
|
|
8182
|
-
return event;
|
|
7987
|
+
if (event.name == eventDataName) return event;
|
|
8183
7988
|
}
|
|
8184
7989
|
return null;
|
|
8185
7990
|
}
|
|
@@ -8187,13 +7992,11 @@ var SkeletonData = class {
|
|
|
8187
7992
|
* call it multiple times.
|
|
8188
7993
|
* @returns May be null. */
|
|
8189
7994
|
findAnimation(animationName) {
|
|
8190
|
-
if (!animationName)
|
|
8191
|
-
throw new Error("animationName cannot be null.");
|
|
7995
|
+
if (!animationName) throw new Error("animationName cannot be null.");
|
|
8192
7996
|
let animations = this.animations;
|
|
8193
7997
|
for (let i = 0, n = animations.length; i < n; i++) {
|
|
8194
7998
|
let animation = animations[i];
|
|
8195
|
-
if (animation.name == animationName)
|
|
8196
|
-
return animation;
|
|
7999
|
+
if (animation.name == animationName) return animation;
|
|
8197
8000
|
}
|
|
8198
8001
|
return null;
|
|
8199
8002
|
}
|
|
@@ -8201,13 +8004,11 @@ var SkeletonData = class {
|
|
|
8201
8004
|
* than to call it multiple times.
|
|
8202
8005
|
* @return May be null. */
|
|
8203
8006
|
findIkConstraint(constraintName) {
|
|
8204
|
-
if (!constraintName)
|
|
8205
|
-
throw new Error("constraintName cannot be null.");
|
|
8007
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8206
8008
|
const ikConstraints = this.ikConstraints;
|
|
8207
8009
|
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
|
8208
8010
|
const constraint = ikConstraints[i];
|
|
8209
|
-
if (constraint.name == constraintName)
|
|
8210
|
-
return constraint;
|
|
8011
|
+
if (constraint.name == constraintName) return constraint;
|
|
8211
8012
|
}
|
|
8212
8013
|
return null;
|
|
8213
8014
|
}
|
|
@@ -8215,13 +8016,11 @@ var SkeletonData = class {
|
|
|
8215
8016
|
* this method than to call it multiple times.
|
|
8216
8017
|
* @return May be null. */
|
|
8217
8018
|
findTransformConstraint(constraintName) {
|
|
8218
|
-
if (!constraintName)
|
|
8219
|
-
throw new Error("constraintName cannot be null.");
|
|
8019
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8220
8020
|
const transformConstraints = this.transformConstraints;
|
|
8221
8021
|
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
8222
8022
|
const constraint = transformConstraints[i];
|
|
8223
|
-
if (constraint.name == constraintName)
|
|
8224
|
-
return constraint;
|
|
8023
|
+
if (constraint.name == constraintName) return constraint;
|
|
8225
8024
|
}
|
|
8226
8025
|
return null;
|
|
8227
8026
|
}
|
|
@@ -8229,13 +8028,11 @@ var SkeletonData = class {
|
|
|
8229
8028
|
* than to call it multiple times.
|
|
8230
8029
|
* @return May be null. */
|
|
8231
8030
|
findPathConstraint(constraintName) {
|
|
8232
|
-
if (!constraintName)
|
|
8233
|
-
throw new Error("constraintName cannot be null.");
|
|
8031
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8234
8032
|
const pathConstraints = this.pathConstraints;
|
|
8235
8033
|
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
|
8236
8034
|
const constraint = pathConstraints[i];
|
|
8237
|
-
if (constraint.name == constraintName)
|
|
8238
|
-
return constraint;
|
|
8035
|
+
if (constraint.name == constraintName) return constraint;
|
|
8239
8036
|
}
|
|
8240
8037
|
return null;
|
|
8241
8038
|
}
|
|
@@ -8243,13 +8040,11 @@ var SkeletonData = class {
|
|
|
8243
8040
|
* than to call it multiple times.
|
|
8244
8041
|
* @return May be null. */
|
|
8245
8042
|
findPhysicsConstraint(constraintName) {
|
|
8246
|
-
if (!constraintName)
|
|
8247
|
-
throw new Error("constraintName cannot be null.");
|
|
8043
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8248
8044
|
const physicsConstraints = this.physicsConstraints;
|
|
8249
8045
|
for (let i = 0, n = physicsConstraints.length; i < n; i++) {
|
|
8250
8046
|
const constraint = physicsConstraints[i];
|
|
8251
|
-
if (constraint.name == constraintName)
|
|
8252
|
-
return constraint;
|
|
8047
|
+
if (constraint.name == constraintName) return constraint;
|
|
8253
8048
|
}
|
|
8254
8049
|
return null;
|
|
8255
8050
|
}
|
|
@@ -8273,19 +8068,15 @@ var Skin = class {
|
|
|
8273
8068
|
color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
|
|
8274
8069
|
// fe9e4fff
|
|
8275
8070
|
constructor(name) {
|
|
8276
|
-
if (!name)
|
|
8277
|
-
throw new Error("name cannot be null.");
|
|
8071
|
+
if (!name) throw new Error("name cannot be null.");
|
|
8278
8072
|
this.name = name;
|
|
8279
8073
|
}
|
|
8280
8074
|
/** Adds an attachment to the skin for the specified slot index and name. */
|
|
8281
8075
|
setAttachment(slotIndex, name, attachment) {
|
|
8282
|
-
if (!attachment)
|
|
8283
|
-
throw new Error("attachment cannot be null.");
|
|
8076
|
+
if (!attachment) throw new Error("attachment cannot be null.");
|
|
8284
8077
|
let attachments = this.attachments;
|
|
8285
|
-
if (slotIndex >= attachments.length)
|
|
8286
|
-
|
|
8287
|
-
if (!attachments[slotIndex])
|
|
8288
|
-
attachments[slotIndex] = {};
|
|
8078
|
+
if (slotIndex >= attachments.length) attachments.length = slotIndex + 1;
|
|
8079
|
+
if (!attachments[slotIndex]) attachments[slotIndex] = {};
|
|
8289
8080
|
attachments[slotIndex][name] = attachment;
|
|
8290
8081
|
}
|
|
8291
8082
|
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
|
@@ -8299,8 +8090,7 @@ var Skin = class {
|
|
|
8299
8090
|
break;
|
|
8300
8091
|
}
|
|
8301
8092
|
}
|
|
8302
|
-
if (!contained)
|
|
8303
|
-
this.bones.push(bone);
|
|
8093
|
+
if (!contained) this.bones.push(bone);
|
|
8304
8094
|
}
|
|
8305
8095
|
for (let i = 0; i < skin.constraints.length; i++) {
|
|
8306
8096
|
let constraint = skin.constraints[i];
|
|
@@ -8311,8 +8101,7 @@ var Skin = class {
|
|
|
8311
8101
|
break;
|
|
8312
8102
|
}
|
|
8313
8103
|
}
|
|
8314
|
-
if (!contained)
|
|
8315
|
-
this.constraints.push(constraint);
|
|
8104
|
+
if (!contained) this.constraints.push(constraint);
|
|
8316
8105
|
}
|
|
8317
8106
|
let attachments = skin.getAttachments();
|
|
8318
8107
|
for (let i = 0; i < attachments.length; i++) {
|
|
@@ -8332,8 +8121,7 @@ var Skin = class {
|
|
|
8332
8121
|
break;
|
|
8333
8122
|
}
|
|
8334
8123
|
}
|
|
8335
|
-
if (!contained)
|
|
8336
|
-
this.bones.push(bone);
|
|
8124
|
+
if (!contained) this.bones.push(bone);
|
|
8337
8125
|
}
|
|
8338
8126
|
for (let i = 0; i < skin.constraints.length; i++) {
|
|
8339
8127
|
let constraint = skin.constraints[i];
|
|
@@ -8344,14 +8132,12 @@ var Skin = class {
|
|
|
8344
8132
|
break;
|
|
8345
8133
|
}
|
|
8346
8134
|
}
|
|
8347
|
-
if (!contained)
|
|
8348
|
-
this.constraints.push(constraint);
|
|
8135
|
+
if (!contained) this.constraints.push(constraint);
|
|
8349
8136
|
}
|
|
8350
8137
|
let attachments = skin.getAttachments();
|
|
8351
8138
|
for (let i = 0; i < attachments.length; i++) {
|
|
8352
8139
|
var attachment = attachments[i];
|
|
8353
|
-
if (!attachment.attachment)
|
|
8354
|
-
continue;
|
|
8140
|
+
if (!attachment.attachment) continue;
|
|
8355
8141
|
if (attachment.attachment instanceof MeshAttachment) {
|
|
8356
8142
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
|
8357
8143
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
@@ -8369,8 +8155,7 @@ var Skin = class {
|
|
|
8369
8155
|
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
|
8370
8156
|
removeAttachment(slotIndex, name) {
|
|
8371
8157
|
let dictionary = this.attachments[slotIndex];
|
|
8372
|
-
if (dictionary)
|
|
8373
|
-
delete dictionary[name];
|
|
8158
|
+
if (dictionary) delete dictionary[name];
|
|
8374
8159
|
}
|
|
8375
8160
|
/** Returns all attachments in this skin. */
|
|
8376
8161
|
getAttachments() {
|
|
@@ -8380,8 +8165,7 @@ var Skin = class {
|
|
|
8380
8165
|
if (slotAttachments) {
|
|
8381
8166
|
for (let name in slotAttachments) {
|
|
8382
8167
|
let attachment = slotAttachments[name];
|
|
8383
|
-
if (attachment)
|
|
8384
|
-
entries.push(new SkinEntry(i, name, attachment));
|
|
8168
|
+
if (attachment) entries.push(new SkinEntry(i, name, attachment));
|
|
8385
8169
|
}
|
|
8386
8170
|
}
|
|
8387
8171
|
}
|
|
@@ -8393,8 +8177,7 @@ var Skin = class {
|
|
|
8393
8177
|
if (slotAttachments) {
|
|
8394
8178
|
for (let name in slotAttachments) {
|
|
8395
8179
|
let attachment = slotAttachments[name];
|
|
8396
|
-
if (attachment)
|
|
8397
|
-
attachments.push(new SkinEntry(slotIndex, name, attachment));
|
|
8180
|
+
if (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));
|
|
8398
8181
|
}
|
|
8399
8182
|
}
|
|
8400
8183
|
}
|
|
@@ -8416,8 +8199,7 @@ var Skin = class {
|
|
|
8416
8199
|
let skinAttachment = dictionary[key];
|
|
8417
8200
|
if (slotAttachment == skinAttachment) {
|
|
8418
8201
|
let attachment = this.getAttachment(slotIndex, key);
|
|
8419
|
-
if (attachment)
|
|
8420
|
-
slot.setAttachment(attachment);
|
|
8202
|
+
if (attachment) slot.setAttachment(attachment);
|
|
8421
8203
|
break;
|
|
8422
8204
|
}
|
|
8423
8205
|
}
|
|
@@ -8444,16 +8226,13 @@ var SlotData = class {
|
|
|
8444
8226
|
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
|
8445
8227
|
attachmentName = null;
|
|
8446
8228
|
/** The blend mode for drawing the slot's attachment. */
|
|
8447
|
-
blendMode =
|
|
8229
|
+
blendMode = 0 /* Normal */;
|
|
8448
8230
|
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
8449
8231
|
visible = true;
|
|
8450
8232
|
constructor(index, name, boneData) {
|
|
8451
|
-
if (index < 0)
|
|
8452
|
-
|
|
8453
|
-
if (!
|
|
8454
|
-
throw new Error("name cannot be null.");
|
|
8455
|
-
if (!boneData)
|
|
8456
|
-
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.");
|
|
8457
8236
|
this.index = index;
|
|
8458
8237
|
this.name = name;
|
|
8459
8238
|
this.boneData = boneData;
|
|
@@ -8477,10 +8256,8 @@ var TransformConstraintData = class extends ConstraintData {
|
|
|
8477
8256
|
this._target = boneData;
|
|
8478
8257
|
}
|
|
8479
8258
|
get target() {
|
|
8480
|
-
if (!this._target)
|
|
8481
|
-
|
|
8482
|
-
else
|
|
8483
|
-
return this._target;
|
|
8259
|
+
if (!this._target) throw new Error("BoneData not set.");
|
|
8260
|
+
else return this._target;
|
|
8484
8261
|
}
|
|
8485
8262
|
mixRotate = 0;
|
|
8486
8263
|
mixX = 0;
|
|
@@ -8543,15 +8320,13 @@ var SkeletonBinary = class {
|
|
|
8543
8320
|
n = input.readInt(true);
|
|
8544
8321
|
for (let i = 0; i < n; i++) {
|
|
8545
8322
|
let str = input.readString();
|
|
8546
|
-
if (!str)
|
|
8547
|
-
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.");
|
|
8548
8324
|
input.strings.push(str);
|
|
8549
8325
|
}
|
|
8550
8326
|
n = input.readInt(true);
|
|
8551
8327
|
for (let i = 0; i < n; i++) {
|
|
8552
8328
|
let name = input.readString();
|
|
8553
|
-
if (!name)
|
|
8554
|
-
throw new Error("Bone name must not be null.");
|
|
8329
|
+
if (!name) throw new Error("Bone name must not be null.");
|
|
8555
8330
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
8556
8331
|
let data = new BoneData(i, name, parent);
|
|
8557
8332
|
data.rotation = input.readFloat();
|
|
@@ -8574,25 +8349,21 @@ var SkeletonBinary = class {
|
|
|
8574
8349
|
n = input.readInt(true);
|
|
8575
8350
|
for (let i = 0; i < n; i++) {
|
|
8576
8351
|
let slotName = input.readString();
|
|
8577
|
-
if (!slotName)
|
|
8578
|
-
throw new Error("Slot name must not be null.");
|
|
8352
|
+
if (!slotName) throw new Error("Slot name must not be null.");
|
|
8579
8353
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
8580
8354
|
let data = new SlotData(i, slotName, boneData);
|
|
8581
8355
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
8582
8356
|
let darkColor = input.readInt32();
|
|
8583
|
-
if (darkColor != -1)
|
|
8584
|
-
Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
|
|
8357
|
+
if (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
|
|
8585
8358
|
data.attachmentName = input.readStringRef();
|
|
8586
8359
|
data.blendMode = input.readInt(true);
|
|
8587
|
-
if (nonessential)
|
|
8588
|
-
data.visible = input.readBoolean();
|
|
8360
|
+
if (nonessential) data.visible = input.readBoolean();
|
|
8589
8361
|
skeletonData.slots.push(data);
|
|
8590
8362
|
}
|
|
8591
8363
|
n = input.readInt(true);
|
|
8592
8364
|
for (let i = 0, nn; i < n; i++) {
|
|
8593
8365
|
let name = input.readString();
|
|
8594
|
-
if (!name)
|
|
8595
|
-
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.");
|
|
8596
8367
|
let data = new IkConstraintData(name);
|
|
8597
8368
|
data.order = input.readInt(true);
|
|
8598
8369
|
nn = input.readInt(true);
|
|
@@ -8605,17 +8376,14 @@ var SkeletonBinary = class {
|
|
|
8605
8376
|
data.compress = (flags & 4) != 0;
|
|
8606
8377
|
data.stretch = (flags & 8) != 0;
|
|
8607
8378
|
data.uniform = (flags & 16) != 0;
|
|
8608
|
-
if ((flags & 32) != 0)
|
|
8609
|
-
|
|
8610
|
-
if ((flags & 128) != 0)
|
|
8611
|
-
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;
|
|
8612
8381
|
skeletonData.ikConstraints.push(data);
|
|
8613
8382
|
}
|
|
8614
8383
|
n = input.readInt(true);
|
|
8615
8384
|
for (let i = 0, nn; i < n; i++) {
|
|
8616
8385
|
let name = input.readString();
|
|
8617
|
-
if (!name)
|
|
8618
|
-
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.");
|
|
8619
8387
|
let data = new TransformConstraintData(name);
|
|
8620
8388
|
data.order = input.readInt(true);
|
|
8621
8389
|
nn = input.readInt(true);
|
|
@@ -8626,38 +8394,25 @@ var SkeletonBinary = class {
|
|
|
8626
8394
|
data.skinRequired = (flags & 1) != 0;
|
|
8627
8395
|
data.local = (flags & 2) != 0;
|
|
8628
8396
|
data.relative = (flags & 4) != 0;
|
|
8629
|
-
if ((flags & 8) != 0)
|
|
8630
|
-
|
|
8631
|
-
if ((flags &
|
|
8632
|
-
|
|
8633
|
-
if ((flags &
|
|
8634
|
-
data.offsetY = input.readFloat() * scale;
|
|
8635
|
-
if ((flags & 64) != 0)
|
|
8636
|
-
data.offsetScaleX = input.readFloat();
|
|
8637
|
-
if ((flags & 128) != 0)
|
|
8638
|
-
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();
|
|
8639
8402
|
flags = input.readByte();
|
|
8640
|
-
if ((flags & 1) != 0)
|
|
8641
|
-
|
|
8642
|
-
if ((flags &
|
|
8643
|
-
|
|
8644
|
-
if ((flags &
|
|
8645
|
-
|
|
8646
|
-
if ((flags &
|
|
8647
|
-
data.mixY = input.readFloat();
|
|
8648
|
-
if ((flags & 16) != 0)
|
|
8649
|
-
data.mixScaleX = input.readFloat();
|
|
8650
|
-
if ((flags & 32) != 0)
|
|
8651
|
-
data.mixScaleY = input.readFloat();
|
|
8652
|
-
if ((flags & 64) != 0)
|
|
8653
|
-
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();
|
|
8654
8410
|
skeletonData.transformConstraints.push(data);
|
|
8655
8411
|
}
|
|
8656
8412
|
n = input.readInt(true);
|
|
8657
8413
|
for (let i = 0, nn; i < n; i++) {
|
|
8658
8414
|
let name = input.readString();
|
|
8659
|
-
if (!name)
|
|
8660
|
-
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.");
|
|
8661
8416
|
let data = new PathConstraintData(name);
|
|
8662
8417
|
data.order = input.readInt(true);
|
|
8663
8418
|
data.skinRequired = input.readBoolean();
|
|
@@ -8669,14 +8424,11 @@ var SkeletonBinary = class {
|
|
|
8669
8424
|
data.positionMode = flags & 1;
|
|
8670
8425
|
data.spacingMode = flags >> 1 & 3;
|
|
8671
8426
|
data.rotateMode = flags >> 3 & 3;
|
|
8672
|
-
if ((flags & 128) != 0)
|
|
8673
|
-
data.offsetRotation = input.readFloat();
|
|
8427
|
+
if ((flags & 128) != 0) data.offsetRotation = input.readFloat();
|
|
8674
8428
|
data.position = input.readFloat();
|
|
8675
|
-
if (data.positionMode == 0 /* Fixed */)
|
|
8676
|
-
data.position *= scale;
|
|
8429
|
+
if (data.positionMode == 0 /* Fixed */) data.position *= scale;
|
|
8677
8430
|
data.spacing = input.readFloat();
|
|
8678
|
-
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
8679
|
-
data.spacing *= scale;
|
|
8431
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
|
|
8680
8432
|
data.mixRotate = input.readFloat();
|
|
8681
8433
|
data.mixX = input.readFloat();
|
|
8682
8434
|
data.mixY = input.readFloat();
|
|
@@ -8685,23 +8437,17 @@ var SkeletonBinary = class {
|
|
|
8685
8437
|
n = input.readInt(true);
|
|
8686
8438
|
for (let i = 0, nn; i < n; i++) {
|
|
8687
8439
|
const name = input.readString();
|
|
8688
|
-
if (!name)
|
|
8689
|
-
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.");
|
|
8690
8441
|
const data = new PhysicsConstraintData(name);
|
|
8691
8442
|
data.order = input.readInt(true);
|
|
8692
8443
|
data.bone = skeletonData.bones[input.readInt(true)];
|
|
8693
8444
|
let flags = input.readByte();
|
|
8694
8445
|
data.skinRequired = (flags & 1) != 0;
|
|
8695
|
-
if ((flags & 2) != 0)
|
|
8696
|
-
|
|
8697
|
-
if ((flags &
|
|
8698
|
-
|
|
8699
|
-
if ((flags &
|
|
8700
|
-
data.rotate = input.readFloat();
|
|
8701
|
-
if ((flags & 16) != 0)
|
|
8702
|
-
data.scaleX = input.readFloat();
|
|
8703
|
-
if ((flags & 32) != 0)
|
|
8704
|
-
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();
|
|
8705
8451
|
data.limit = ((flags & 64) != 0 ? input.readFloat() : 5e3) * scale;
|
|
8706
8452
|
data.step = 1 / input.readUnsignedByte();
|
|
8707
8453
|
data.inertia = input.readFloat();
|
|
@@ -8711,20 +8457,13 @@ var SkeletonBinary = class {
|
|
|
8711
8457
|
data.wind = input.readFloat();
|
|
8712
8458
|
data.gravity = input.readFloat();
|
|
8713
8459
|
flags = input.readByte();
|
|
8714
|
-
if ((flags & 1) != 0)
|
|
8715
|
-
|
|
8716
|
-
if ((flags &
|
|
8717
|
-
|
|
8718
|
-
if ((flags &
|
|
8719
|
-
|
|
8720
|
-
if ((flags &
|
|
8721
|
-
data.massGlobal = true;
|
|
8722
|
-
if ((flags & 16) != 0)
|
|
8723
|
-
data.windGlobal = true;
|
|
8724
|
-
if ((flags & 32) != 0)
|
|
8725
|
-
data.gravityGlobal = true;
|
|
8726
|
-
if ((flags & 64) != 0)
|
|
8727
|
-
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;
|
|
8728
8467
|
data.mix = (flags & 128) != 0 ? input.readFloat() : 1;
|
|
8729
8468
|
skeletonData.physicsConstraints.push(data);
|
|
8730
8469
|
}
|
|
@@ -8738,8 +8477,7 @@ var SkeletonBinary = class {
|
|
|
8738
8477
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
8739
8478
|
for (; i < n; i++) {
|
|
8740
8479
|
let skin = this.readSkin(input, skeletonData, false, nonessential);
|
|
8741
|
-
if (!skin)
|
|
8742
|
-
throw new Error("readSkin() should not have returned null.");
|
|
8480
|
+
if (!skin) throw new Error("readSkin() should not have returned null.");
|
|
8743
8481
|
skeletonData.skins[i] = skin;
|
|
8744
8482
|
}
|
|
8745
8483
|
}
|
|
@@ -8747,22 +8485,18 @@ var SkeletonBinary = class {
|
|
|
8747
8485
|
for (let i = 0; i < n; i++) {
|
|
8748
8486
|
let linkedMesh = this.linkedMeshes[i];
|
|
8749
8487
|
const skin = skeletonData.skins[linkedMesh.skinIndex];
|
|
8750
|
-
if (!linkedMesh.parent)
|
|
8751
|
-
throw new Error("Linked mesh parent must not be null");
|
|
8488
|
+
if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null");
|
|
8752
8489
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8753
|
-
if (!parent)
|
|
8754
|
-
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8490
|
+
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8755
8491
|
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8756
8492
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8757
|
-
if (linkedMesh.mesh.region != null)
|
|
8758
|
-
linkedMesh.mesh.updateRegion();
|
|
8493
|
+
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
|
|
8759
8494
|
}
|
|
8760
8495
|
this.linkedMeshes.length = 0;
|
|
8761
8496
|
n = input.readInt(true);
|
|
8762
8497
|
for (let i = 0; i < n; i++) {
|
|
8763
8498
|
let eventName = input.readString();
|
|
8764
|
-
if (!eventName)
|
|
8765
|
-
throw new Error("Event data name must not be null");
|
|
8499
|
+
if (!eventName) throw new Error("Event data name must not be null");
|
|
8766
8500
|
let data = new EventData(eventName);
|
|
8767
8501
|
data.intValue = input.readInt(false);
|
|
8768
8502
|
data.floatValue = input.readFloat();
|
|
@@ -8777,8 +8511,7 @@ var SkeletonBinary = class {
|
|
|
8777
8511
|
n = input.readInt(true);
|
|
8778
8512
|
for (let i = 0; i < n; i++) {
|
|
8779
8513
|
let animationName = input.readString();
|
|
8780
|
-
if (!animationName)
|
|
8781
|
-
throw new Error("Animatio name must not be null.");
|
|
8514
|
+
if (!animationName) throw new Error("Animatio name must not be null.");
|
|
8782
8515
|
skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
|
|
8783
8516
|
}
|
|
8784
8517
|
return skeletonData;
|
|
@@ -8788,16 +8521,13 @@ var SkeletonBinary = class {
|
|
|
8788
8521
|
let slotCount = 0;
|
|
8789
8522
|
if (defaultSkin) {
|
|
8790
8523
|
slotCount = input.readInt(true);
|
|
8791
|
-
if (slotCount == 0)
|
|
8792
|
-
return null;
|
|
8524
|
+
if (slotCount == 0) return null;
|
|
8793
8525
|
skin = new Skin("default");
|
|
8794
8526
|
} else {
|
|
8795
8527
|
let skinName = input.readString();
|
|
8796
|
-
if (!skinName)
|
|
8797
|
-
throw new Error("Skin name must not be null.");
|
|
8528
|
+
if (!skinName) throw new Error("Skin name must not be null.");
|
|
8798
8529
|
skin = new Skin(skinName);
|
|
8799
|
-
if (nonessential)
|
|
8800
|
-
Color.rgba8888ToColor(skin.color, input.readInt32());
|
|
8530
|
+
if (nonessential) Color.rgba8888ToColor(skin.color, input.readInt32());
|
|
8801
8531
|
skin.bones.length = input.readInt(true);
|
|
8802
8532
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
8803
8533
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -8818,8 +8548,7 @@ var SkeletonBinary = class {
|
|
|
8818
8548
|
if (!name)
|
|
8819
8549
|
throw new Error("Attachment name must not be null");
|
|
8820
8550
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
8821
|
-
if (attachment)
|
|
8822
|
-
skin.setAttachment(slotIndex, name, attachment);
|
|
8551
|
+
if (attachment) skin.setAttachment(slotIndex, name, attachment);
|
|
8823
8552
|
}
|
|
8824
8553
|
}
|
|
8825
8554
|
return skin;
|
|
@@ -8828,10 +8557,10 @@ var SkeletonBinary = class {
|
|
|
8828
8557
|
let scale = this.scale;
|
|
8829
8558
|
let flags = input.readByte();
|
|
8830
8559
|
const name = (flags & 8) != 0 ? input.readStringRef() : attachmentName;
|
|
8831
|
-
if (!name)
|
|
8832
|
-
throw new Error("Attachment name must not be null");
|
|
8560
|
+
if (!name) throw new Error("Attachment name must not be null");
|
|
8833
8561
|
switch (flags & 7) {
|
|
8834
|
-
|
|
8562
|
+
// BUG?
|
|
8563
|
+
case 0 /* Region */: {
|
|
8835
8564
|
let path = (flags & 16) != 0 ? input.readStringRef() : null;
|
|
8836
8565
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
8837
8566
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
@@ -8842,11 +8571,9 @@ var SkeletonBinary = class {
|
|
|
8842
8571
|
let scaleY = input.readFloat();
|
|
8843
8572
|
let width = input.readFloat();
|
|
8844
8573
|
let height = input.readFloat();
|
|
8845
|
-
if (!path)
|
|
8846
|
-
path = name;
|
|
8574
|
+
if (!path) path = name;
|
|
8847
8575
|
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
8848
|
-
if (!region)
|
|
8849
|
-
return null;
|
|
8576
|
+
if (!region) return null;
|
|
8850
8577
|
region.path = path;
|
|
8851
8578
|
region.x = x * scale;
|
|
8852
8579
|
region.y = y * scale;
|
|
@@ -8857,24 +8584,21 @@ var SkeletonBinary = class {
|
|
|
8857
8584
|
region.height = height * scale;
|
|
8858
8585
|
Color.rgba8888ToColor(region.color, color);
|
|
8859
8586
|
region.sequence = sequence;
|
|
8860
|
-
if (sequence == null)
|
|
8861
|
-
region.updateRegion();
|
|
8587
|
+
if (sequence == null) region.updateRegion();
|
|
8862
8588
|
return region;
|
|
8863
8589
|
}
|
|
8864
|
-
case
|
|
8590
|
+
case 1 /* BoundingBox */: {
|
|
8865
8591
|
let vertices = this.readVertices(input, (flags & 16) != 0);
|
|
8866
8592
|
let color = nonessential ? input.readInt32() : 0;
|
|
8867
8593
|
let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
|
|
8868
|
-
if (!box)
|
|
8869
|
-
return null;
|
|
8594
|
+
if (!box) return null;
|
|
8870
8595
|
box.worldVerticesLength = vertices.length;
|
|
8871
8596
|
box.vertices = vertices.vertices;
|
|
8872
8597
|
box.bones = vertices.bones;
|
|
8873
|
-
if (nonessential)
|
|
8874
|
-
Color.rgba8888ToColor(box.color, color);
|
|
8598
|
+
if (nonessential) Color.rgba8888ToColor(box.color, color);
|
|
8875
8599
|
return box;
|
|
8876
8600
|
}
|
|
8877
|
-
case
|
|
8601
|
+
case 2 /* Mesh */: {
|
|
8878
8602
|
let path = (flags & 16) != 0 ? input.readStringRef() : name;
|
|
8879
8603
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
8880
8604
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
@@ -8889,11 +8613,9 @@ var SkeletonBinary = class {
|
|
|
8889
8613
|
width = input.readFloat();
|
|
8890
8614
|
height = input.readFloat();
|
|
8891
8615
|
}
|
|
8892
|
-
if (!path)
|
|
8893
|
-
path = name;
|
|
8616
|
+
if (!path) path = name;
|
|
8894
8617
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
8895
|
-
if (!mesh)
|
|
8896
|
-
return null;
|
|
8618
|
+
if (!mesh) return null;
|
|
8897
8619
|
mesh.path = path;
|
|
8898
8620
|
Color.rgba8888ToColor(mesh.color, color);
|
|
8899
8621
|
mesh.bones = vertices.bones;
|
|
@@ -8901,8 +8623,7 @@ var SkeletonBinary = class {
|
|
|
8901
8623
|
mesh.worldVerticesLength = vertices.length;
|
|
8902
8624
|
mesh.triangles = triangles;
|
|
8903
8625
|
mesh.regionUVs = uvs;
|
|
8904
|
-
if (sequence == null)
|
|
8905
|
-
mesh.updateRegion();
|
|
8626
|
+
if (sequence == null) mesh.updateRegion();
|
|
8906
8627
|
mesh.hullLength = hullLength << 1;
|
|
8907
8628
|
mesh.sequence = sequence;
|
|
8908
8629
|
if (nonessential) {
|
|
@@ -8912,10 +8633,9 @@ var SkeletonBinary = class {
|
|
|
8912
8633
|
}
|
|
8913
8634
|
return mesh;
|
|
8914
8635
|
}
|
|
8915
|
-
case
|
|
8636
|
+
case 3 /* LinkedMesh */: {
|
|
8916
8637
|
const path = (flags & 16) != 0 ? input.readStringRef() : name;
|
|
8917
|
-
if (path == null)
|
|
8918
|
-
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");
|
|
8919
8639
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
8920
8640
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
8921
8641
|
const inheritTimelines = (flags & 128) != 0;
|
|
@@ -8927,8 +8647,7 @@ var SkeletonBinary = class {
|
|
|
8927
8647
|
height = input.readFloat();
|
|
8928
8648
|
}
|
|
8929
8649
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
8930
|
-
if (!mesh)
|
|
8931
|
-
return null;
|
|
8650
|
+
if (!mesh) return null;
|
|
8932
8651
|
mesh.path = path;
|
|
8933
8652
|
Color.rgba8888ToColor(mesh.color, color);
|
|
8934
8653
|
mesh.sequence = sequence;
|
|
@@ -8939,7 +8658,7 @@ var SkeletonBinary = class {
|
|
|
8939
8658
|
this.linkedMeshes.push(new LinkedMesh(mesh, skinIndex, slotIndex, parent, inheritTimelines));
|
|
8940
8659
|
return mesh;
|
|
8941
8660
|
}
|
|
8942
|
-
case
|
|
8661
|
+
case 4 /* Path */: {
|
|
8943
8662
|
const closed2 = (flags & 16) != 0;
|
|
8944
8663
|
const constantSpeed = (flags & 32) != 0;
|
|
8945
8664
|
const vertices = this.readVertices(input, (flags & 64) != 0);
|
|
@@ -8948,46 +8667,40 @@ var SkeletonBinary = class {
|
|
|
8948
8667
|
lengths[i] = input.readFloat() * scale;
|
|
8949
8668
|
const color = nonessential ? input.readInt32() : 0;
|
|
8950
8669
|
const path = this.attachmentLoader.newPathAttachment(skin, name);
|
|
8951
|
-
if (!path)
|
|
8952
|
-
return null;
|
|
8670
|
+
if (!path) return null;
|
|
8953
8671
|
path.closed = closed2;
|
|
8954
8672
|
path.constantSpeed = constantSpeed;
|
|
8955
8673
|
path.worldVerticesLength = vertices.length;
|
|
8956
8674
|
path.vertices = vertices.vertices;
|
|
8957
8675
|
path.bones = vertices.bones;
|
|
8958
8676
|
path.lengths = lengths;
|
|
8959
|
-
if (nonessential)
|
|
8960
|
-
Color.rgba8888ToColor(path.color, color);
|
|
8677
|
+
if (nonessential) Color.rgba8888ToColor(path.color, color);
|
|
8961
8678
|
return path;
|
|
8962
8679
|
}
|
|
8963
|
-
case
|
|
8680
|
+
case 5 /* Point */: {
|
|
8964
8681
|
const rotation = input.readFloat();
|
|
8965
8682
|
const x = input.readFloat();
|
|
8966
8683
|
const y = input.readFloat();
|
|
8967
8684
|
const color = nonessential ? input.readInt32() : 0;
|
|
8968
8685
|
const point = this.attachmentLoader.newPointAttachment(skin, name);
|
|
8969
|
-
if (!point)
|
|
8970
|
-
return null;
|
|
8686
|
+
if (!point) return null;
|
|
8971
8687
|
point.x = x * scale;
|
|
8972
8688
|
point.y = y * scale;
|
|
8973
8689
|
point.rotation = rotation;
|
|
8974
|
-
if (nonessential)
|
|
8975
|
-
Color.rgba8888ToColor(point.color, color);
|
|
8690
|
+
if (nonessential) Color.rgba8888ToColor(point.color, color);
|
|
8976
8691
|
return point;
|
|
8977
8692
|
}
|
|
8978
|
-
case
|
|
8693
|
+
case 6 /* Clipping */: {
|
|
8979
8694
|
const endSlotIndex = input.readInt(true);
|
|
8980
8695
|
const vertices = this.readVertices(input, (flags & 16) != 0);
|
|
8981
8696
|
let color = nonessential ? input.readInt32() : 0;
|
|
8982
8697
|
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
|
|
8983
|
-
if (!clip)
|
|
8984
|
-
return null;
|
|
8698
|
+
if (!clip) return null;
|
|
8985
8699
|
clip.endSlot = skeletonData.slots[endSlotIndex];
|
|
8986
8700
|
clip.worldVerticesLength = vertices.length;
|
|
8987
8701
|
clip.vertices = vertices.vertices;
|
|
8988
8702
|
clip.bones = vertices.bones;
|
|
8989
|
-
if (nonessential)
|
|
8990
|
-
Color.rgba8888ToColor(clip.color, color);
|
|
8703
|
+
if (nonessential) Color.rgba8888ToColor(clip.color, color);
|
|
8991
8704
|
return clip;
|
|
8992
8705
|
}
|
|
8993
8706
|
}
|
|
@@ -9070,8 +8783,7 @@ var SkeletonBinary = class {
|
|
|
9070
8783
|
let a = input.readUnsignedByte() / 255;
|
|
9071
8784
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9072
8785
|
timeline.setFrame(frame, time, r, g, b, a);
|
|
9073
|
-
if (frame == frameLast)
|
|
9074
|
-
break;
|
|
8786
|
+
if (frame == frameLast) break;
|
|
9075
8787
|
let time2 = input.readFloat();
|
|
9076
8788
|
let r2 = input.readUnsignedByte() / 255;
|
|
9077
8789
|
let g2 = input.readUnsignedByte() / 255;
|
|
@@ -9105,8 +8817,7 @@ var SkeletonBinary = class {
|
|
|
9105
8817
|
let b = input.readUnsignedByte() / 255;
|
|
9106
8818
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9107
8819
|
timeline.setFrame(frame, time, r, g, b);
|
|
9108
|
-
if (frame == frameLast)
|
|
9109
|
-
break;
|
|
8820
|
+
if (frame == frameLast) break;
|
|
9110
8821
|
let time2 = input.readFloat();
|
|
9111
8822
|
let r2 = input.readUnsignedByte() / 255;
|
|
9112
8823
|
let g2 = input.readUnsignedByte() / 255;
|
|
@@ -9141,8 +8852,7 @@ var SkeletonBinary = class {
|
|
|
9141
8852
|
let b2 = input.readUnsignedByte() / 255;
|
|
9142
8853
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9143
8854
|
timeline.setFrame(frame, time, r, g, b, a, r2, g2, b2);
|
|
9144
|
-
if (frame == frameLast)
|
|
9145
|
-
break;
|
|
8855
|
+
if (frame == frameLast) break;
|
|
9146
8856
|
let time2 = input.readFloat();
|
|
9147
8857
|
let nr = input.readUnsignedByte() / 255;
|
|
9148
8858
|
let ng = input.readUnsignedByte() / 255;
|
|
@@ -9188,8 +8898,7 @@ var SkeletonBinary = class {
|
|
|
9188
8898
|
let b2 = input.readUnsignedByte() / 255;
|
|
9189
8899
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9190
8900
|
timeline.setFrame(frame, time, r, g, b, r2, g2, b2);
|
|
9191
|
-
if (frame == frameLast)
|
|
9192
|
-
break;
|
|
8901
|
+
if (frame == frameLast) break;
|
|
9193
8902
|
let time2 = input.readFloat();
|
|
9194
8903
|
let nr = input.readUnsignedByte() / 255;
|
|
9195
8904
|
let ng = input.readUnsignedByte() / 255;
|
|
@@ -9225,8 +8934,7 @@ var SkeletonBinary = class {
|
|
|
9225
8934
|
let time = input.readFloat(), a = input.readUnsignedByte() / 255;
|
|
9226
8935
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9227
8936
|
timeline.setFrame(frame, time, a);
|
|
9228
|
-
if (frame == frameLast)
|
|
9229
|
-
break;
|
|
8937
|
+
if (frame == frameLast) break;
|
|
9230
8938
|
let time2 = input.readFloat();
|
|
9231
8939
|
let a2 = input.readUnsignedByte() / 255;
|
|
9232
8940
|
switch (input.readByte()) {
|
|
@@ -9298,8 +9006,7 @@ var SkeletonBinary = class {
|
|
|
9298
9006
|
let softness = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
9299
9007
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9300
9008
|
timeline.setFrame(frame, time, mix, softness, (flags & 8) != 0 ? 1 : -1, (flags & 16) != 0, (flags & 32) != 0);
|
|
9301
|
-
if (frame == frameLast)
|
|
9302
|
-
break;
|
|
9009
|
+
if (frame == frameLast) break;
|
|
9303
9010
|
flags = input.readByte();
|
|
9304
9011
|
const time2 = input.readFloat(), mix2 = (flags & 1) != 0 ? (flags & 2) != 0 ? input.readFloat() : 1 : 0;
|
|
9305
9012
|
const softness2 = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
@@ -9321,8 +9028,7 @@ var SkeletonBinary = class {
|
|
|
9321
9028
|
let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat(), mixScaleX = input.readFloat(), mixScaleY = input.readFloat(), mixShearY = input.readFloat();
|
|
9322
9029
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9323
9030
|
timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
|
|
9324
|
-
if (frame == frameLast)
|
|
9325
|
-
break;
|
|
9031
|
+
if (frame == frameLast) break;
|
|
9326
9032
|
let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat(), mixScaleX2 = input.readFloat(), mixScaleY2 = input.readFloat(), mixShearY2 = input.readFloat();
|
|
9327
9033
|
switch (input.readByte()) {
|
|
9328
9034
|
case CURVE_STEPPED:
|
|
@@ -9371,8 +9077,7 @@ var SkeletonBinary = class {
|
|
|
9371
9077
|
let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat();
|
|
9372
9078
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9373
9079
|
timeline.setFrame(frame, time, mixRotate, mixX, mixY);
|
|
9374
|
-
if (frame == frameLast)
|
|
9375
|
-
break;
|
|
9080
|
+
if (frame == frameLast) break;
|
|
9376
9081
|
let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat();
|
|
9377
9082
|
switch (input.readByte()) {
|
|
9378
9083
|
case CURVE_STEPPED:
|
|
@@ -9434,8 +9139,7 @@ var SkeletonBinary = class {
|
|
|
9434
9139
|
let slotIndex = input.readInt(true);
|
|
9435
9140
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
9436
9141
|
let attachmentName = input.readStringRef();
|
|
9437
|
-
if (!attachmentName)
|
|
9438
|
-
throw new Error("attachmentName must not be null.");
|
|
9142
|
+
if (!attachmentName) throw new Error("attachmentName must not be null.");
|
|
9439
9143
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
9440
9144
|
let timelineType = input.readByte();
|
|
9441
9145
|
let frameCount = input.readInt(true);
|
|
@@ -9471,8 +9175,7 @@ var SkeletonBinary = class {
|
|
|
9471
9175
|
}
|
|
9472
9176
|
}
|
|
9473
9177
|
timeline.setFrame(frame, time, deform);
|
|
9474
|
-
if (frame == frameLast)
|
|
9475
|
-
break;
|
|
9178
|
+
if (frame == frameLast) break;
|
|
9476
9179
|
let time2 = input.readFloat();
|
|
9477
9180
|
switch (input.readByte()) {
|
|
9478
9181
|
case CURVE_STEPPED:
|
|
@@ -9527,8 +9230,7 @@ var SkeletonBinary = class {
|
|
|
9527
9230
|
while (originalIndex < slotCount)
|
|
9528
9231
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
9529
9232
|
for (let ii = slotCount - 1; ii >= 0; ii--)
|
|
9530
|
-
if (drawOrder[ii] == -1)
|
|
9531
|
-
drawOrder[ii] = unchanged[--unchangedIndex];
|
|
9233
|
+
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
|
|
9532
9234
|
timeline.setFrame(i, time, drawOrder);
|
|
9533
9235
|
}
|
|
9534
9236
|
timelines.push(timeline);
|
|
@@ -9543,8 +9245,7 @@ var SkeletonBinary = class {
|
|
|
9543
9245
|
event.intValue = input.readInt(false);
|
|
9544
9246
|
event.floatValue = input.readFloat();
|
|
9545
9247
|
event.stringValue = input.readString();
|
|
9546
|
-
if (event.stringValue == null)
|
|
9547
|
-
event.stringValue = eventData.stringValue;
|
|
9248
|
+
if (event.stringValue == null) event.stringValue = eventData.stringValue;
|
|
9548
9249
|
if (event.data.audioPath) {
|
|
9549
9250
|
event.volume = input.readFloat();
|
|
9550
9251
|
event.balance = input.readFloat();
|
|
@@ -9666,22 +9367,11 @@ var Vertices = class {
|
|
|
9666
9367
|
this.length = length;
|
|
9667
9368
|
}
|
|
9668
9369
|
};
|
|
9669
|
-
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
9670
|
-
AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
|
|
9671
|
-
AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
|
|
9672
|
-
AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
|
|
9673
|
-
AttachmentType2[AttachmentType2["LinkedMesh"] = 3] = "LinkedMesh";
|
|
9674
|
-
AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
|
|
9675
|
-
AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
|
|
9676
|
-
AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
|
|
9677
|
-
return AttachmentType2;
|
|
9678
|
-
})(AttachmentType || {});
|
|
9679
9370
|
function readTimeline1(input, timeline, scale) {
|
|
9680
9371
|
let time = input.readFloat(), value = input.readFloat() * scale;
|
|
9681
9372
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9682
9373
|
timeline.setFrame(frame, time, value);
|
|
9683
|
-
if (frame == frameLast)
|
|
9684
|
-
break;
|
|
9374
|
+
if (frame == frameLast) break;
|
|
9685
9375
|
let time2 = input.readFloat(), value2 = input.readFloat() * scale;
|
|
9686
9376
|
switch (input.readByte()) {
|
|
9687
9377
|
case CURVE_STEPPED:
|
|
@@ -9699,8 +9389,7 @@ function readTimeline2(input, timeline, scale) {
|
|
|
9699
9389
|
let time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
|
|
9700
9390
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9701
9391
|
timeline.setFrame(frame, time, value1, value2);
|
|
9702
|
-
if (frame == frameLast)
|
|
9703
|
-
break;
|
|
9392
|
+
if (frame == frameLast) break;
|
|
9704
9393
|
let time2 = input.readFloat(), nvalue1 = input.readFloat() * scale, nvalue2 = input.readFloat() * scale;
|
|
9705
9394
|
switch (input.readByte()) {
|
|
9706
9395
|
case CURVE_STEPPED:
|
|
@@ -9774,8 +9463,7 @@ var SkeletonBounds = class {
|
|
|
9774
9463
|
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
|
|
9775
9464
|
* SkeletonBounds AABB methods will always return true. */
|
|
9776
9465
|
update(skeleton, updateAabb) {
|
|
9777
|
-
if (!skeleton)
|
|
9778
|
-
throw new Error("skeleton cannot be null.");
|
|
9466
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
9779
9467
|
let boundingBoxes = this.boundingBoxes;
|
|
9780
9468
|
let polygons = this.polygons;
|
|
9781
9469
|
let polygonPool = this.polygonPool;
|
|
@@ -9786,8 +9474,7 @@ var SkeletonBounds = class {
|
|
|
9786
9474
|
polygons.length = 0;
|
|
9787
9475
|
for (let i = 0; i < slotCount; i++) {
|
|
9788
9476
|
let slot = slots[i];
|
|
9789
|
-
if (!slot.bone.active)
|
|
9790
|
-
continue;
|
|
9477
|
+
if (!slot.bone.active) continue;
|
|
9791
9478
|
let attachment = slot.getAttachment();
|
|
9792
9479
|
if (attachment instanceof BoundingBoxAttachment) {
|
|
9793
9480
|
let boundingBox = attachment;
|
|
@@ -9843,17 +9530,13 @@ var SkeletonBounds = class {
|
|
|
9843
9530
|
return false;
|
|
9844
9531
|
let m = (y2 - y1) / (x2 - x1);
|
|
9845
9532
|
let y = m * (minX - x1) + y1;
|
|
9846
|
-
if (y > minY && y < maxY)
|
|
9847
|
-
return true;
|
|
9533
|
+
if (y > minY && y < maxY) return true;
|
|
9848
9534
|
y = m * (maxX - x1) + y1;
|
|
9849
|
-
if (y > minY && y < maxY)
|
|
9850
|
-
return true;
|
|
9535
|
+
if (y > minY && y < maxY) return true;
|
|
9851
9536
|
let x = (minY - y1) / m + x1;
|
|
9852
|
-
if (x > minX && x < maxX)
|
|
9853
|
-
return true;
|
|
9537
|
+
if (x > minX && x < maxX) return true;
|
|
9854
9538
|
x = (maxY - y1) / m + x1;
|
|
9855
|
-
if (x > minX && x < maxX)
|
|
9856
|
-
return true;
|
|
9539
|
+
if (x > minX && x < maxX) return true;
|
|
9857
9540
|
return false;
|
|
9858
9541
|
}
|
|
9859
9542
|
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
|
@@ -9865,8 +9548,7 @@ var SkeletonBounds = class {
|
|
|
9865
9548
|
containsPoint(x, y) {
|
|
9866
9549
|
let polygons = this.polygons;
|
|
9867
9550
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
9868
|
-
if (this.containsPointPolygon(polygons[i], x, y))
|
|
9869
|
-
return this.boundingBoxes[i];
|
|
9551
|
+
if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i];
|
|
9870
9552
|
return null;
|
|
9871
9553
|
}
|
|
9872
9554
|
/** Returns true if the polygon contains the point. */
|
|
@@ -9880,8 +9562,7 @@ var SkeletonBounds = class {
|
|
|
9880
9562
|
let prevY = vertices[prevIndex + 1];
|
|
9881
9563
|
if (vertexY < y && prevY >= y || prevY < y && vertexY >= y) {
|
|
9882
9564
|
let vertexX = vertices[ii];
|
|
9883
|
-
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
|
|
9884
|
-
inside = !inside;
|
|
9565
|
+
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) inside = !inside;
|
|
9885
9566
|
}
|
|
9886
9567
|
prevIndex = ii;
|
|
9887
9568
|
}
|
|
@@ -9893,8 +9574,7 @@ var SkeletonBounds = class {
|
|
|
9893
9574
|
intersectsSegment(x1, y1, x2, y2) {
|
|
9894
9575
|
let polygons = this.polygons;
|
|
9895
9576
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
9896
|
-
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
|
|
9897
|
-
return this.boundingBoxes[i];
|
|
9577
|
+
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i];
|
|
9898
9578
|
return null;
|
|
9899
9579
|
}
|
|
9900
9580
|
/** Returns true if the polygon contains any part of the line segment. */
|
|
@@ -9912,8 +9592,7 @@ var SkeletonBounds = class {
|
|
|
9912
9592
|
let x = (det1 * width34 - width12 * det2) / det3;
|
|
9913
9593
|
if ((x >= x3 && x <= x4 || x >= x4 && x <= x3) && (x >= x1 && x <= x2 || x >= x2 && x <= x1)) {
|
|
9914
9594
|
let y = (det1 * height34 - height12 * det2) / det3;
|
|
9915
|
-
if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1))
|
|
9916
|
-
return true;
|
|
9595
|
+
if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1)) return true;
|
|
9917
9596
|
}
|
|
9918
9597
|
x3 = x4;
|
|
9919
9598
|
y3 = y4;
|
|
@@ -9922,8 +9601,7 @@ var SkeletonBounds = class {
|
|
|
9922
9601
|
}
|
|
9923
9602
|
/** Returns the polygon for the specified bounding box, or null. */
|
|
9924
9603
|
getPolygon(boundingBox) {
|
|
9925
|
-
if (!boundingBox)
|
|
9926
|
-
throw new Error("boundingBox cannot be null.");
|
|
9604
|
+
if (!boundingBox) throw new Error("boundingBox cannot be null.");
|
|
9927
9605
|
let index = this.boundingBoxes.indexOf(boundingBox);
|
|
9928
9606
|
return index == -1 ? null : this.polygons[index];
|
|
9929
9607
|
}
|
|
@@ -9938,7 +9616,7 @@ var SkeletonBounds = class {
|
|
|
9938
9616
|
};
|
|
9939
9617
|
|
|
9940
9618
|
// spine-core/src/Triangulator.ts
|
|
9941
|
-
var Triangulator = class {
|
|
9619
|
+
var Triangulator = class _Triangulator {
|
|
9942
9620
|
convexPolygons = new Array();
|
|
9943
9621
|
convexPolygonsIndices = new Array();
|
|
9944
9622
|
indicesArray = new Array();
|
|
@@ -9960,7 +9638,7 @@ var Triangulator = class {
|
|
|
9960
9638
|
let isConcave = this.isConcaveArray;
|
|
9961
9639
|
isConcave.length = 0;
|
|
9962
9640
|
for (let i = 0, n = vertexCount; i < n; ++i)
|
|
9963
|
-
isConcave[i] =
|
|
9641
|
+
isConcave[i] = _Triangulator.isConcave(i, vertexCount, vertices, indices);
|
|
9964
9642
|
let triangles = this.triangles;
|
|
9965
9643
|
triangles.length = 0;
|
|
9966
9644
|
while (vertexCount > 3) {
|
|
@@ -9973,14 +9651,12 @@ var Triangulator = class {
|
|
|
9973
9651
|
let p2x = vertices[p2], p2y = vertices[p2 + 1];
|
|
9974
9652
|
let p3x = vertices[p3], p3y = vertices[p3 + 1];
|
|
9975
9653
|
for (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
|
|
9976
|
-
if (!isConcave[ii])
|
|
9977
|
-
continue;
|
|
9654
|
+
if (!isConcave[ii]) continue;
|
|
9978
9655
|
let v = indices[ii] << 1;
|
|
9979
9656
|
let vx = vertices[v], vy = vertices[v + 1];
|
|
9980
|
-
if (
|
|
9981
|
-
if (
|
|
9982
|
-
if (
|
|
9983
|
-
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;
|
|
9984
9660
|
}
|
|
9985
9661
|
}
|
|
9986
9662
|
}
|
|
@@ -9988,8 +9664,7 @@ var Triangulator = class {
|
|
|
9988
9664
|
}
|
|
9989
9665
|
if (next == 0) {
|
|
9990
9666
|
do {
|
|
9991
|
-
if (!isConcave[i])
|
|
9992
|
-
break;
|
|
9667
|
+
if (!isConcave[i]) break;
|
|
9993
9668
|
i--;
|
|
9994
9669
|
} while (i > 0);
|
|
9995
9670
|
break;
|
|
@@ -10006,8 +9681,8 @@ var Triangulator = class {
|
|
|
10006
9681
|
vertexCount--;
|
|
10007
9682
|
let previousIndex = (vertexCount + i - 1) % vertexCount;
|
|
10008
9683
|
let nextIndex = i == vertexCount ? 0 : i;
|
|
10009
|
-
isConcave[previousIndex] =
|
|
10010
|
-
isConcave[nextIndex] =
|
|
9684
|
+
isConcave[previousIndex] = _Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
|
|
9685
|
+
isConcave[nextIndex] = _Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
|
|
10011
9686
|
}
|
|
10012
9687
|
if (vertexCount == 3) {
|
|
10013
9688
|
triangles.push(indices[2]);
|
|
@@ -10037,8 +9712,8 @@ var Triangulator = class {
|
|
|
10037
9712
|
let merged = false;
|
|
10038
9713
|
if (fanBaseIndex == t1) {
|
|
10039
9714
|
let o = polygon.length - 4;
|
|
10040
|
-
let winding1 =
|
|
10041
|
-
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]);
|
|
10042
9717
|
if (winding1 == lastWinding && winding2 == lastWinding) {
|
|
10043
9718
|
polygon.push(x3);
|
|
10044
9719
|
polygon.push(y3);
|
|
@@ -10067,7 +9742,7 @@ var Triangulator = class {
|
|
|
10067
9742
|
polygonIndices.push(t1);
|
|
10068
9743
|
polygonIndices.push(t2);
|
|
10069
9744
|
polygonIndices.push(t3);
|
|
10070
|
-
lastWinding =
|
|
9745
|
+
lastWinding = _Triangulator.winding(x1, y1, x2, y2, x3, y3);
|
|
10071
9746
|
fanBaseIndex = t1;
|
|
10072
9747
|
}
|
|
10073
9748
|
}
|
|
@@ -10077,8 +9752,7 @@ var Triangulator = class {
|
|
|
10077
9752
|
}
|
|
10078
9753
|
for (let i = 0, n = convexPolygons.length; i < n; i++) {
|
|
10079
9754
|
polygonIndices = convexPolygonsIndices[i];
|
|
10080
|
-
if (polygonIndices.length == 0)
|
|
10081
|
-
continue;
|
|
9755
|
+
if (polygonIndices.length == 0) continue;
|
|
10082
9756
|
let firstIndex = polygonIndices[0];
|
|
10083
9757
|
let lastIndex = polygonIndices[polygonIndices.length - 1];
|
|
10084
9758
|
polygon = convexPolygons[i];
|
|
@@ -10087,22 +9761,19 @@ var Triangulator = class {
|
|
|
10087
9761
|
let prevX = polygon[o + 2], prevY = polygon[o + 3];
|
|
10088
9762
|
let firstX = polygon[0], firstY = polygon[1];
|
|
10089
9763
|
let secondX = polygon[2], secondY = polygon[3];
|
|
10090
|
-
let winding =
|
|
9764
|
+
let winding = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
|
|
10091
9765
|
for (let ii = 0; ii < n; ii++) {
|
|
10092
|
-
if (ii == i)
|
|
10093
|
-
continue;
|
|
9766
|
+
if (ii == i) continue;
|
|
10094
9767
|
let otherIndices = convexPolygonsIndices[ii];
|
|
10095
|
-
if (otherIndices.length != 3)
|
|
10096
|
-
continue;
|
|
9768
|
+
if (otherIndices.length != 3) continue;
|
|
10097
9769
|
let otherFirstIndex = otherIndices[0];
|
|
10098
9770
|
let otherSecondIndex = otherIndices[1];
|
|
10099
9771
|
let otherLastIndex = otherIndices[2];
|
|
10100
9772
|
let otherPoly = convexPolygons[ii];
|
|
10101
9773
|
let x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
|
|
10102
|
-
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
|
|
10103
|
-
|
|
10104
|
-
let
|
|
10105
|
-
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);
|
|
10106
9777
|
if (winding1 == winding && winding2 == winding) {
|
|
10107
9778
|
otherPoly.length = 0;
|
|
10108
9779
|
otherIndices.length = 0;
|
|
@@ -10152,7 +9823,7 @@ var Triangulator = class {
|
|
|
10152
9823
|
};
|
|
10153
9824
|
|
|
10154
9825
|
// spine-core/src/SkeletonClipping.ts
|
|
10155
|
-
var SkeletonClipping = class {
|
|
9826
|
+
var SkeletonClipping = class _SkeletonClipping {
|
|
10156
9827
|
triangulator = new Triangulator();
|
|
10157
9828
|
clippingPolygon = new Array();
|
|
10158
9829
|
clipOutput = new Array();
|
|
@@ -10163,30 +9834,27 @@ var SkeletonClipping = class {
|
|
|
10163
9834
|
clipAttachment = null;
|
|
10164
9835
|
clippingPolygons = null;
|
|
10165
9836
|
clipStart(slot, clip) {
|
|
10166
|
-
if (this.clipAttachment)
|
|
10167
|
-
return 0;
|
|
9837
|
+
if (this.clipAttachment) return 0;
|
|
10168
9838
|
this.clipAttachment = clip;
|
|
10169
9839
|
let n = clip.worldVerticesLength;
|
|
10170
9840
|
let vertices = Utils.setArraySize(this.clippingPolygon, n);
|
|
10171
9841
|
clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
|
|
10172
9842
|
let clippingPolygon = this.clippingPolygon;
|
|
10173
|
-
|
|
9843
|
+
_SkeletonClipping.makeClockwise(clippingPolygon);
|
|
10174
9844
|
let clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
|
|
10175
9845
|
for (let i = 0, n2 = clippingPolygons.length; i < n2; i++) {
|
|
10176
9846
|
let polygon = clippingPolygons[i];
|
|
10177
|
-
|
|
9847
|
+
_SkeletonClipping.makeClockwise(polygon);
|
|
10178
9848
|
polygon.push(polygon[0]);
|
|
10179
9849
|
polygon.push(polygon[1]);
|
|
10180
9850
|
}
|
|
10181
9851
|
return clippingPolygons.length;
|
|
10182
9852
|
}
|
|
10183
9853
|
clipEndWithSlot(slot) {
|
|
10184
|
-
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data)
|
|
10185
|
-
this.clipEnd();
|
|
9854
|
+
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data) this.clipEnd();
|
|
10186
9855
|
}
|
|
10187
9856
|
clipEnd() {
|
|
10188
|
-
if (!this.clipAttachment)
|
|
10189
|
-
return;
|
|
9857
|
+
if (!this.clipAttachment) return;
|
|
10190
9858
|
this.clipAttachment = null;
|
|
10191
9859
|
this.clippingPolygons = null;
|
|
10192
9860
|
this.clippedVertices.length = 0;
|
|
@@ -10242,8 +9910,7 @@ var SkeletonClipping = class {
|
|
|
10242
9910
|
let s = clippedVertices.length;
|
|
10243
9911
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10244
9912
|
let clipOutputLength = clipOutput.length;
|
|
10245
|
-
if (clipOutputLength == 0)
|
|
10246
|
-
continue;
|
|
9913
|
+
if (clipOutputLength == 0) continue;
|
|
10247
9914
|
let clipOutputCount = clipOutputLength >> 1;
|
|
10248
9915
|
let clipOutputItems = this.clipOutput;
|
|
10249
9916
|
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
|
|
@@ -10303,8 +9970,7 @@ var SkeletonClipping = class {
|
|
|
10303
9970
|
let s = clippedVertices.length;
|
|
10304
9971
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10305
9972
|
let clipOutputLength = clipOutput.length;
|
|
10306
|
-
if (clipOutputLength == 0)
|
|
10307
|
-
continue;
|
|
9973
|
+
if (clipOutputLength == 0) continue;
|
|
10308
9974
|
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
|
10309
9975
|
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
|
10310
9976
|
let clipOutputCount = clipOutputLength >> 1;
|
|
@@ -10433,8 +10099,7 @@ var SkeletonClipping = class {
|
|
|
10433
10099
|
let s = clippedVertices.length;
|
|
10434
10100
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10435
10101
|
let clipOutputLength = clipOutput.length;
|
|
10436
|
-
if (clipOutputLength == 0)
|
|
10437
|
-
continue;
|
|
10102
|
+
if (clipOutputLength == 0) continue;
|
|
10438
10103
|
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
|
10439
10104
|
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
|
10440
10105
|
let clipOutputCount = clipOutputLength >> 1;
|
|
@@ -10557,8 +10222,7 @@ var SkeletonClipping = class {
|
|
|
10557
10222
|
}
|
|
10558
10223
|
output.push(output[0]);
|
|
10559
10224
|
output.push(output[1]);
|
|
10560
|
-
if (i == clippingVerticesLast)
|
|
10561
|
-
break;
|
|
10225
|
+
if (i == clippingVerticesLast) break;
|
|
10562
10226
|
let temp = output;
|
|
10563
10227
|
output = input;
|
|
10564
10228
|
output.length = 0;
|
|
@@ -10583,8 +10247,7 @@ var SkeletonClipping = class {
|
|
|
10583
10247
|
p2y = vertices[i + 3];
|
|
10584
10248
|
area += p1x * p2y - p2x * p1y;
|
|
10585
10249
|
}
|
|
10586
|
-
if (area < 0)
|
|
10587
|
-
return;
|
|
10250
|
+
if (area < 0) return;
|
|
10588
10251
|
for (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
|
|
10589
10252
|
let x = vertices[i], y = vertices[i + 1];
|
|
10590
10253
|
let other = lastX - i;
|
|
@@ -10630,8 +10293,7 @@ var SkeletonJson = class {
|
|
|
10630
10293
|
let boneMap = root.bones[i];
|
|
10631
10294
|
let parent = null;
|
|
10632
10295
|
let parentName = getValue(boneMap, "parent", null);
|
|
10633
|
-
if (parentName)
|
|
10634
|
-
parent = skeletonData.findBone(parentName);
|
|
10296
|
+
if (parentName) parent = skeletonData.findBone(parentName);
|
|
10635
10297
|
let data = new BoneData(skeletonData.bones.length, boneMap.name, parent);
|
|
10636
10298
|
data.length = getValue(boneMap, "length", 0) * scale;
|
|
10637
10299
|
data.x = getValue(boneMap, "x", 0) * scale;
|
|
@@ -10644,8 +10306,7 @@ var SkeletonJson = class {
|
|
|
10644
10306
|
data.inherit = Utils.enumValue(Inherit, getValue(boneMap, "inherit", "Normal"));
|
|
10645
10307
|
data.skinRequired = getValue(boneMap, "skin", false);
|
|
10646
10308
|
let color = getValue(boneMap, "color", null);
|
|
10647
|
-
if (color)
|
|
10648
|
-
data.color.setFromString(color);
|
|
10309
|
+
if (color) data.color.setFromString(color);
|
|
10649
10310
|
skeletonData.bones.push(data);
|
|
10650
10311
|
}
|
|
10651
10312
|
}
|
|
@@ -10654,15 +10315,12 @@ var SkeletonJson = class {
|
|
|
10654
10315
|
let slotMap = root.slots[i];
|
|
10655
10316
|
let slotName = slotMap.name;
|
|
10656
10317
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
10657
|
-
if (!boneData)
|
|
10658
|
-
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}`);
|
|
10659
10319
|
let data = new SlotData(skeletonData.slots.length, slotName, boneData);
|
|
10660
10320
|
let color = getValue(slotMap, "color", null);
|
|
10661
|
-
if (color)
|
|
10662
|
-
data.color.setFromString(color);
|
|
10321
|
+
if (color) data.color.setFromString(color);
|
|
10663
10322
|
let dark = getValue(slotMap, "dark", null);
|
|
10664
|
-
if (dark)
|
|
10665
|
-
data.darkColor = Color.fromString(dark);
|
|
10323
|
+
if (dark) data.darkColor = Color.fromString(dark);
|
|
10666
10324
|
data.attachmentName = getValue(slotMap, "attachment", null);
|
|
10667
10325
|
data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal"));
|
|
10668
10326
|
data.visible = getValue(slotMap, "visible", true);
|
|
@@ -10677,14 +10335,12 @@ var SkeletonJson = class {
|
|
|
10677
10335
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10678
10336
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10679
10337
|
let bone = skeletonData.findBone(constraintMap.bones[ii]);
|
|
10680
|
-
if (!bone)
|
|
10681
|
-
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}.`);
|
|
10682
10339
|
data.bones.push(bone);
|
|
10683
10340
|
}
|
|
10684
10341
|
let target = skeletonData.findBone(constraintMap.target);
|
|
10685
10342
|
;
|
|
10686
|
-
if (!target)
|
|
10687
|
-
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}.`);
|
|
10688
10344
|
data.target = target;
|
|
10689
10345
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
10690
10346
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
@@ -10704,14 +10360,12 @@ var SkeletonJson = class {
|
|
|
10704
10360
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10705
10361
|
let boneName = constraintMap.bones[ii];
|
|
10706
10362
|
let bone = skeletonData.findBone(boneName);
|
|
10707
|
-
if (!bone)
|
|
10708
|
-
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}.`);
|
|
10709
10364
|
data.bones.push(bone);
|
|
10710
10365
|
}
|
|
10711
10366
|
let targetName = constraintMap.target;
|
|
10712
10367
|
let target = skeletonData.findBone(targetName);
|
|
10713
|
-
if (!target)
|
|
10714
|
-
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}.`);
|
|
10715
10369
|
data.target = target;
|
|
10716
10370
|
data.local = getValue(constraintMap, "local", false);
|
|
10717
10371
|
data.relative = getValue(constraintMap, "relative", false);
|
|
@@ -10739,25 +10393,21 @@ var SkeletonJson = class {
|
|
|
10739
10393
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10740
10394
|
let boneName = constraintMap.bones[ii];
|
|
10741
10395
|
let bone = skeletonData.findBone(boneName);
|
|
10742
|
-
if (!bone)
|
|
10743
|
-
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}.`);
|
|
10744
10397
|
data.bones.push(bone);
|
|
10745
10398
|
}
|
|
10746
10399
|
let targetName = constraintMap.target;
|
|
10747
10400
|
let target = skeletonData.findSlot(targetName);
|
|
10748
|
-
if (!target)
|
|
10749
|
-
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}.`);
|
|
10750
10402
|
data.target = target;
|
|
10751
10403
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
10752
10404
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
10753
10405
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
10754
10406
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
10755
10407
|
data.position = getValue(constraintMap, "position", 0);
|
|
10756
|
-
if (data.positionMode == 0 /* Fixed */)
|
|
10757
|
-
data.position *= scale;
|
|
10408
|
+
if (data.positionMode == 0 /* Fixed */) data.position *= scale;
|
|
10758
10409
|
data.spacing = getValue(constraintMap, "spacing", 0);
|
|
10759
|
-
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
10760
|
-
data.spacing *= scale;
|
|
10410
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
|
|
10761
10411
|
data.mixRotate = getValue(constraintMap, "mixRotate", 1);
|
|
10762
10412
|
data.mixX = getValue(constraintMap, "mixX", 1);
|
|
10763
10413
|
data.mixY = getValue(constraintMap, "mixY", data.mixX);
|
|
@@ -10772,8 +10422,7 @@ var SkeletonJson = class {
|
|
|
10772
10422
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10773
10423
|
const boneName = constraintMap.bone;
|
|
10774
10424
|
const bone = skeletonData.findBone(boneName);
|
|
10775
|
-
if (bone == null)
|
|
10776
|
-
throw new Error("Physics bone not found: " + boneName);
|
|
10425
|
+
if (bone == null) throw new Error("Physics bone not found: " + boneName);
|
|
10777
10426
|
data.bone = bone;
|
|
10778
10427
|
data.x = getValue(constraintMap, "x", 0);
|
|
10779
10428
|
data.y = getValue(constraintMap, "y", 0);
|
|
@@ -10807,8 +10456,7 @@ var SkeletonJson = class {
|
|
|
10807
10456
|
for (let ii = 0; ii < skinMap.bones.length; ii++) {
|
|
10808
10457
|
let boneName = skinMap.bones[ii];
|
|
10809
10458
|
let bone = skeletonData.findBone(boneName);
|
|
10810
|
-
if (!bone)
|
|
10811
|
-
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}.`);
|
|
10812
10460
|
skin.bones.push(bone);
|
|
10813
10461
|
}
|
|
10814
10462
|
}
|
|
@@ -10816,8 +10464,7 @@ var SkeletonJson = class {
|
|
|
10816
10464
|
for (let ii = 0; ii < skinMap.ik.length; ii++) {
|
|
10817
10465
|
let constraintName = skinMap.ik[ii];
|
|
10818
10466
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
10819
|
-
if (!constraint)
|
|
10820
|
-
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}.`);
|
|
10821
10468
|
skin.constraints.push(constraint);
|
|
10822
10469
|
}
|
|
10823
10470
|
}
|
|
@@ -10825,8 +10472,7 @@ var SkeletonJson = class {
|
|
|
10825
10472
|
for (let ii = 0; ii < skinMap.transform.length; ii++) {
|
|
10826
10473
|
let constraintName = skinMap.transform[ii];
|
|
10827
10474
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
10828
|
-
if (!constraint)
|
|
10829
|
-
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}.`);
|
|
10830
10476
|
skin.constraints.push(constraint);
|
|
10831
10477
|
}
|
|
10832
10478
|
}
|
|
@@ -10834,8 +10480,7 @@ var SkeletonJson = class {
|
|
|
10834
10480
|
for (let ii = 0; ii < skinMap.path.length; ii++) {
|
|
10835
10481
|
let constraintName = skinMap.path[ii];
|
|
10836
10482
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
10837
|
-
if (!constraint)
|
|
10838
|
-
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}.`);
|
|
10839
10484
|
skin.constraints.push(constraint);
|
|
10840
10485
|
}
|
|
10841
10486
|
}
|
|
@@ -10843,39 +10488,32 @@ var SkeletonJson = class {
|
|
|
10843
10488
|
for (let ii = 0; ii < skinMap.physics.length; ii++) {
|
|
10844
10489
|
let constraintName = skinMap.physics[ii];
|
|
10845
10490
|
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
10846
|
-
if (!constraint)
|
|
10847
|
-
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}.`);
|
|
10848
10492
|
skin.constraints.push(constraint);
|
|
10849
10493
|
}
|
|
10850
10494
|
}
|
|
10851
10495
|
for (let slotName in skinMap.attachments) {
|
|
10852
10496
|
let slot = skeletonData.findSlot(slotName);
|
|
10853
|
-
if (!slot)
|
|
10854
|
-
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}.`);
|
|
10855
10498
|
let slotMap = skinMap.attachments[slotName];
|
|
10856
10499
|
for (let entryName in slotMap) {
|
|
10857
10500
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
10858
|
-
if (attachment)
|
|
10859
|
-
skin.setAttachment(slot.index, entryName, attachment);
|
|
10501
|
+
if (attachment) skin.setAttachment(slot.index, entryName, attachment);
|
|
10860
10502
|
}
|
|
10861
10503
|
}
|
|
10862
10504
|
skeletonData.skins.push(skin);
|
|
10863
|
-
if (skin.name == "default")
|
|
10864
|
-
skeletonData.defaultSkin = skin;
|
|
10505
|
+
if (skin.name == "default") skeletonData.defaultSkin = skin;
|
|
10865
10506
|
}
|
|
10866
10507
|
}
|
|
10867
10508
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
10868
10509
|
let linkedMesh = this.linkedMeshes[i];
|
|
10869
10510
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
10870
|
-
if (!skin)
|
|
10871
|
-
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
10511
|
+
if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
10872
10512
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
10873
|
-
if (!parent)
|
|
10874
|
-
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
10513
|
+
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
10875
10514
|
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
10876
10515
|
linkedMesh.mesh.setParentMesh(parent);
|
|
10877
|
-
if (linkedMesh.mesh.region != null)
|
|
10878
|
-
linkedMesh.mesh.updateRegion();
|
|
10516
|
+
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
|
|
10879
10517
|
}
|
|
10880
10518
|
this.linkedMeshes.length = 0;
|
|
10881
10519
|
if (root.events) {
|
|
@@ -10909,8 +10547,7 @@ var SkeletonJson = class {
|
|
|
10909
10547
|
let path = getValue(map, "path", name);
|
|
10910
10548
|
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
10911
10549
|
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
10912
|
-
if (!region)
|
|
10913
|
-
return null;
|
|
10550
|
+
if (!region) return null;
|
|
10914
10551
|
region.path = path;
|
|
10915
10552
|
region.x = getValue(map, "x", 0) * scale;
|
|
10916
10553
|
region.y = getValue(map, "y", 0) * scale;
|
|
@@ -10921,20 +10558,16 @@ var SkeletonJson = class {
|
|
|
10921
10558
|
region.height = map.height * scale;
|
|
10922
10559
|
region.sequence = sequence;
|
|
10923
10560
|
let color = getValue(map, "color", null);
|
|
10924
|
-
if (color)
|
|
10925
|
-
|
|
10926
|
-
if (region.region != null)
|
|
10927
|
-
region.updateRegion();
|
|
10561
|
+
if (color) region.color.setFromString(color);
|
|
10562
|
+
if (region.region != null) region.updateRegion();
|
|
10928
10563
|
return region;
|
|
10929
10564
|
}
|
|
10930
10565
|
case "boundingbox": {
|
|
10931
10566
|
let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
|
|
10932
|
-
if (!box)
|
|
10933
|
-
return null;
|
|
10567
|
+
if (!box) return null;
|
|
10934
10568
|
this.readVertices(map, box, map.vertexCount << 1);
|
|
10935
10569
|
let color = getValue(map, "color", null);
|
|
10936
|
-
if (color)
|
|
10937
|
-
box.color.setFromString(color);
|
|
10570
|
+
if (color) box.color.setFromString(color);
|
|
10938
10571
|
return box;
|
|
10939
10572
|
}
|
|
10940
10573
|
case "mesh":
|
|
@@ -10942,12 +10575,10 @@ var SkeletonJson = class {
|
|
|
10942
10575
|
let path = getValue(map, "path", name);
|
|
10943
10576
|
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
10944
10577
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
10945
|
-
if (!mesh)
|
|
10946
|
-
return null;
|
|
10578
|
+
if (!mesh) return null;
|
|
10947
10579
|
mesh.path = path;
|
|
10948
10580
|
let color = getValue(map, "color", null);
|
|
10949
|
-
if (color)
|
|
10950
|
-
mesh.color.setFromString(color);
|
|
10581
|
+
if (color) mesh.color.setFromString(color);
|
|
10951
10582
|
mesh.width = getValue(map, "width", 0) * scale;
|
|
10952
10583
|
mesh.height = getValue(map, "height", 0) * scale;
|
|
10953
10584
|
mesh.sequence = sequence;
|
|
@@ -10960,16 +10591,14 @@ var SkeletonJson = class {
|
|
|
10960
10591
|
this.readVertices(map, mesh, uvs.length);
|
|
10961
10592
|
mesh.triangles = map.triangles;
|
|
10962
10593
|
mesh.regionUVs = uvs;
|
|
10963
|
-
if (mesh.region != null)
|
|
10964
|
-
mesh.updateRegion();
|
|
10594
|
+
if (mesh.region != null) mesh.updateRegion();
|
|
10965
10595
|
mesh.edges = getValue(map, "edges", null);
|
|
10966
10596
|
mesh.hullLength = getValue(map, "hull", 0) * 2;
|
|
10967
10597
|
return mesh;
|
|
10968
10598
|
}
|
|
10969
10599
|
case "path": {
|
|
10970
10600
|
let path = this.attachmentLoader.newPathAttachment(skin, name);
|
|
10971
|
-
if (!path)
|
|
10972
|
-
return null;
|
|
10601
|
+
if (!path) return null;
|
|
10973
10602
|
path.closed = getValue(map, "closed", false);
|
|
10974
10603
|
path.constantSpeed = getValue(map, "constantSpeed", true);
|
|
10975
10604
|
let vertexCount = map.vertexCount;
|
|
@@ -10979,42 +10608,35 @@ var SkeletonJson = class {
|
|
|
10979
10608
|
lengths[i] = map.lengths[i] * scale;
|
|
10980
10609
|
path.lengths = lengths;
|
|
10981
10610
|
let color = getValue(map, "color", null);
|
|
10982
|
-
if (color)
|
|
10983
|
-
path.color.setFromString(color);
|
|
10611
|
+
if (color) path.color.setFromString(color);
|
|
10984
10612
|
return path;
|
|
10985
10613
|
}
|
|
10986
10614
|
case "point": {
|
|
10987
10615
|
let point = this.attachmentLoader.newPointAttachment(skin, name);
|
|
10988
|
-
if (!point)
|
|
10989
|
-
return null;
|
|
10616
|
+
if (!point) return null;
|
|
10990
10617
|
point.x = getValue(map, "x", 0) * scale;
|
|
10991
10618
|
point.y = getValue(map, "y", 0) * scale;
|
|
10992
10619
|
point.rotation = getValue(map, "rotation", 0);
|
|
10993
10620
|
let color = getValue(map, "color", null);
|
|
10994
|
-
if (color)
|
|
10995
|
-
point.color.setFromString(color);
|
|
10621
|
+
if (color) point.color.setFromString(color);
|
|
10996
10622
|
return point;
|
|
10997
10623
|
}
|
|
10998
10624
|
case "clipping": {
|
|
10999
10625
|
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
|
|
11000
|
-
if (!clip)
|
|
11001
|
-
return null;
|
|
10626
|
+
if (!clip) return null;
|
|
11002
10627
|
let end = getValue(map, "end", null);
|
|
11003
|
-
if (end)
|
|
11004
|
-
clip.endSlot = skeletonData.findSlot(end);
|
|
10628
|
+
if (end) clip.endSlot = skeletonData.findSlot(end);
|
|
11005
10629
|
let vertexCount = map.vertexCount;
|
|
11006
10630
|
this.readVertices(map, clip, vertexCount << 1);
|
|
11007
10631
|
let color = getValue(map, "color", null);
|
|
11008
|
-
if (color)
|
|
11009
|
-
clip.color.setFromString(color);
|
|
10632
|
+
if (color) clip.color.setFromString(color);
|
|
11010
10633
|
return clip;
|
|
11011
10634
|
}
|
|
11012
10635
|
}
|
|
11013
10636
|
return null;
|
|
11014
10637
|
}
|
|
11015
10638
|
readSequence(map) {
|
|
11016
|
-
if (map == null)
|
|
11017
|
-
return null;
|
|
10639
|
+
if (map == null) return null;
|
|
11018
10640
|
let sequence = new Sequence(getValue(map, "count", 0));
|
|
11019
10641
|
sequence.start = getValue(map, "start", 1);
|
|
11020
10642
|
sequence.digits = getValue(map, "digits", 0);
|
|
@@ -11056,13 +10678,11 @@ var SkeletonJson = class {
|
|
|
11056
10678
|
for (let slotName in map.slots) {
|
|
11057
10679
|
let slotMap = map.slots[slotName];
|
|
11058
10680
|
let slot = skeletonData.findSlot(slotName);
|
|
11059
|
-
if (!slot)
|
|
11060
|
-
throw new Error("Slot not found: " + slotName);
|
|
10681
|
+
if (!slot) throw new Error("Slot not found: " + slotName);
|
|
11061
10682
|
let slotIndex = slot.index;
|
|
11062
10683
|
for (let timelineName in slotMap) {
|
|
11063
10684
|
let timelineMap = slotMap[timelineName];
|
|
11064
|
-
if (!timelineMap)
|
|
11065
|
-
continue;
|
|
10685
|
+
if (!timelineMap) continue;
|
|
11066
10686
|
let frames = timelineMap.length;
|
|
11067
10687
|
if (timelineName == "attachment") {
|
|
11068
10688
|
let timeline = new AttachmentTimeline(frames, slotIndex);
|
|
@@ -11195,14 +10815,12 @@ var SkeletonJson = class {
|
|
|
11195
10815
|
for (let boneName in map.bones) {
|
|
11196
10816
|
let boneMap = map.bones[boneName];
|
|
11197
10817
|
let bone = skeletonData.findBone(boneName);
|
|
11198
|
-
if (!bone)
|
|
11199
|
-
throw new Error("Bone not found: " + boneName);
|
|
10818
|
+
if (!bone) throw new Error("Bone not found: " + boneName);
|
|
11200
10819
|
let boneIndex = bone.index;
|
|
11201
10820
|
for (let timelineName in boneMap) {
|
|
11202
10821
|
let timelineMap = boneMap[timelineName];
|
|
11203
10822
|
let frames = timelineMap.length;
|
|
11204
|
-
if (frames == 0)
|
|
11205
|
-
continue;
|
|
10823
|
+
if (frames == 0) continue;
|
|
11206
10824
|
if (timelineName === "rotate") {
|
|
11207
10825
|
timelines.push(readTimeline12(timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1));
|
|
11208
10826
|
} else if (timelineName === "translate") {
|
|
@@ -11247,11 +10865,9 @@ var SkeletonJson = class {
|
|
|
11247
10865
|
for (let constraintName in map.ik) {
|
|
11248
10866
|
let constraintMap = map.ik[constraintName];
|
|
11249
10867
|
let keyMap = constraintMap[0];
|
|
11250
|
-
if (!keyMap)
|
|
11251
|
-
continue;
|
|
10868
|
+
if (!keyMap) continue;
|
|
11252
10869
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
11253
|
-
if (!constraint)
|
|
11254
|
-
throw new Error("IK Constraint not found: " + constraintName);
|
|
10870
|
+
if (!constraint) throw new Error("IK Constraint not found: " + constraintName);
|
|
11255
10871
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
11256
10872
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
11257
10873
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -11284,11 +10900,9 @@ var SkeletonJson = class {
|
|
|
11284
10900
|
for (let constraintName in map.transform) {
|
|
11285
10901
|
let timelineMap = map.transform[constraintName];
|
|
11286
10902
|
let keyMap = timelineMap[0];
|
|
11287
|
-
if (!keyMap)
|
|
11288
|
-
continue;
|
|
10903
|
+
if (!keyMap) continue;
|
|
11289
10904
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
11290
|
-
if (!constraint)
|
|
11291
|
-
throw new Error("Transform constraint not found: " + constraintName);
|
|
10905
|
+
if (!constraint) throw new Error("Transform constraint not found: " + constraintName);
|
|
11292
10906
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
11293
10907
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
11294
10908
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -11337,14 +10951,12 @@ var SkeletonJson = class {
|
|
|
11337
10951
|
for (let constraintName in map.path) {
|
|
11338
10952
|
let constraintMap = map.path[constraintName];
|
|
11339
10953
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
11340
|
-
if (!constraint)
|
|
11341
|
-
throw new Error("Path constraint not found: " + constraintName);
|
|
10954
|
+
if (!constraint) throw new Error("Path constraint not found: " + constraintName);
|
|
11342
10955
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
11343
10956
|
for (let timelineName in constraintMap) {
|
|
11344
10957
|
let timelineMap = constraintMap[timelineName];
|
|
11345
10958
|
let keyMap = timelineMap[0];
|
|
11346
|
-
if (!keyMap)
|
|
11347
|
-
continue;
|
|
10959
|
+
if (!keyMap) continue;
|
|
11348
10960
|
let frames = timelineMap.length;
|
|
11349
10961
|
if (timelineName === "position") {
|
|
11350
10962
|
let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
@@ -11392,15 +11004,13 @@ var SkeletonJson = class {
|
|
|
11392
11004
|
let constraintIndex = -1;
|
|
11393
11005
|
if (constraintName.length > 0) {
|
|
11394
11006
|
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
11395
|
-
if (!constraint)
|
|
11396
|
-
throw new Error("Physics constraint not found: " + constraintName);
|
|
11007
|
+
if (!constraint) throw new Error("Physics constraint not found: " + constraintName);
|
|
11397
11008
|
constraintIndex = skeletonData.physicsConstraints.indexOf(constraint);
|
|
11398
11009
|
}
|
|
11399
11010
|
for (let timelineName in constraintMap) {
|
|
11400
11011
|
let timelineMap = constraintMap[timelineName];
|
|
11401
11012
|
let keyMap = timelineMap[0];
|
|
11402
|
-
if (!keyMap)
|
|
11403
|
-
continue;
|
|
11013
|
+
if (!keyMap) continue;
|
|
11404
11014
|
let frames = timelineMap.length;
|
|
11405
11015
|
if (timelineName == "reset") {
|
|
11406
11016
|
const timeline2 = new PhysicsConstraintResetTimeline(frames, constraintIndex);
|
|
@@ -11434,13 +11044,11 @@ var SkeletonJson = class {
|
|
|
11434
11044
|
for (let attachmentsName in map.attachments) {
|
|
11435
11045
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
11436
11046
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
11437
|
-
if (!skin)
|
|
11438
|
-
throw new Error("Skin not found: " + attachmentsName);
|
|
11047
|
+
if (!skin) throw new Error("Skin not found: " + attachmentsName);
|
|
11439
11048
|
for (let slotMapName in attachmentsMap) {
|
|
11440
11049
|
let slotMap = attachmentsMap[slotMapName];
|
|
11441
11050
|
let slot = skeletonData.findSlot(slotMapName);
|
|
11442
|
-
if (!slot)
|
|
11443
|
-
throw new Error("Slot not found: " + slotMapName);
|
|
11051
|
+
if (!slot) throw new Error("Slot not found: " + slotMapName);
|
|
11444
11052
|
let slotIndex = slot.index;
|
|
11445
11053
|
for (let attachmentMapName in slotMap) {
|
|
11446
11054
|
let attachmentMap = slotMap[attachmentMapName];
|
|
@@ -11448,8 +11056,7 @@ var SkeletonJson = class {
|
|
|
11448
11056
|
for (let timelineMapName in attachmentMap) {
|
|
11449
11057
|
let timelineMap = attachmentMap[timelineMapName];
|
|
11450
11058
|
let keyMap = timelineMap[0];
|
|
11451
|
-
if (!keyMap)
|
|
11452
|
-
continue;
|
|
11059
|
+
if (!keyMap) continue;
|
|
11453
11060
|
if (timelineMapName == "deform") {
|
|
11454
11061
|
let weighted = attachment.bones;
|
|
11455
11062
|
let vertices = attachment.vertices;
|
|
@@ -11482,8 +11089,7 @@ var SkeletonJson = class {
|
|
|
11482
11089
|
}
|
|
11483
11090
|
let time2 = getValue(nextMap, "time", 0);
|
|
11484
11091
|
let curve = keyMap.curve;
|
|
11485
|
-
if (curve)
|
|
11486
|
-
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);
|
|
11487
11093
|
time = time2;
|
|
11488
11094
|
keyMap = nextMap;
|
|
11489
11095
|
}
|
|
@@ -11522,8 +11128,7 @@ var SkeletonJson = class {
|
|
|
11522
11128
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
11523
11129
|
let offsetMap = offsets[ii];
|
|
11524
11130
|
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
11525
|
-
if (!slot)
|
|
11526
|
-
throw new Error("Slot not found: " + slot);
|
|
11131
|
+
if (!slot) throw new Error("Slot not found: " + slot);
|
|
11527
11132
|
let slotIndex = slot.index;
|
|
11528
11133
|
while (originalIndex != slotIndex)
|
|
11529
11134
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
@@ -11532,8 +11137,7 @@ var SkeletonJson = class {
|
|
|
11532
11137
|
while (originalIndex < slotCount)
|
|
11533
11138
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
11534
11139
|
for (let ii = slotCount - 1; ii >= 0; ii--)
|
|
11535
|
-
if (drawOrder[ii] == -1)
|
|
11536
|
-
drawOrder[ii] = unchanged[--unchangedIndex];
|
|
11140
|
+
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
|
|
11537
11141
|
}
|
|
11538
11142
|
timeline.setFrame(frame, getValue(drawOrderMap, "time", 0), drawOrder);
|
|
11539
11143
|
}
|
|
@@ -11545,8 +11149,7 @@ var SkeletonJson = class {
|
|
|
11545
11149
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
11546
11150
|
let eventMap = map.events[i];
|
|
11547
11151
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
11548
|
-
if (!eventData)
|
|
11549
|
-
throw new Error("Event not found: " + eventMap.name);
|
|
11152
|
+
if (!eventData) throw new Error("Event not found: " + eventMap.name);
|
|
11550
11153
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
11551
11154
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
11552
11155
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|
|
@@ -11593,8 +11196,7 @@ function readTimeline12(keys, timeline, defaultValue, scale) {
|
|
|
11593
11196
|
}
|
|
11594
11197
|
let time2 = getValue(nextMap, "time", 0);
|
|
11595
11198
|
let value2 = getValue(nextMap, "value", defaultValue) * scale;
|
|
11596
|
-
if (keyMap.curve)
|
|
11597
|
-
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);
|
|
11598
11200
|
time = time2;
|
|
11599
11201
|
value = value2;
|
|
11600
11202
|
keyMap = nextMap;
|
|
@@ -11647,7 +11249,7 @@ function getValue(map, property, defaultValue) {
|
|
|
11647
11249
|
// spine-core/src/polyfills.ts
|
|
11648
11250
|
(() => {
|
|
11649
11251
|
if (typeof Math.fround === "undefined") {
|
|
11650
|
-
Math.fround = function(array) {
|
|
11252
|
+
Math.fround = /* @__PURE__ */ function(array) {
|
|
11651
11253
|
return function(x) {
|
|
11652
11254
|
return array[0] = x, array[0];
|
|
11653
11255
|
};
|
|
@@ -11680,7 +11282,7 @@ function bufferToUtf8String(buffer) {
|
|
|
11680
11282
|
throw new Error("Unsupported environment");
|
|
11681
11283
|
}
|
|
11682
11284
|
}
|
|
11683
|
-
var CanvasKitTexture = class extends Texture {
|
|
11285
|
+
var CanvasKitTexture = class _CanvasKitTexture extends Texture {
|
|
11684
11286
|
getImage() {
|
|
11685
11287
|
return this._image;
|
|
11686
11288
|
}
|
|
@@ -11701,11 +11303,9 @@ var CanvasKitTexture = class extends Texture {
|
|
|
11701
11303
|
}
|
|
11702
11304
|
static async fromFile(ck, path, readFile) {
|
|
11703
11305
|
const imgData = await readFile(path);
|
|
11704
|
-
if (!imgData)
|
|
11705
|
-
throw new Error(`Could not load image ${path}`);
|
|
11306
|
+
if (!imgData) throw new Error(`Could not load image ${path}`);
|
|
11706
11307
|
const image = ck.MakeImageFromEncoded(imgData);
|
|
11707
|
-
if (!image)
|
|
11708
|
-
throw new Error(`Could not load image ${path}`);
|
|
11308
|
+
if (!image) throw new Error(`Could not load image ${path}`);
|
|
11709
11309
|
const paintPerBlendMode = /* @__PURE__ */ new Map();
|
|
11710
11310
|
const shaders = [];
|
|
11711
11311
|
for (const blendMode of [
|
|
@@ -11726,7 +11326,7 @@ var CanvasKitTexture = class extends Texture {
|
|
|
11726
11326
|
paintPerBlendMode.set(blendMode, paint);
|
|
11727
11327
|
shaders.push(shader);
|
|
11728
11328
|
}
|
|
11729
|
-
return new
|
|
11329
|
+
return new _CanvasKitTexture({ shaders, paintPerBlendMode, image });
|
|
11730
11330
|
}
|
|
11731
11331
|
};
|
|
11732
11332
|
async function loadTextureAtlas(ck, atlasFile, readFile) {
|
|
@@ -11780,7 +11380,7 @@ var SkeletonDrawable = class {
|
|
|
11780
11380
|
this.skeleton.updateWorldTransform(physicsUpdate);
|
|
11781
11381
|
}
|
|
11782
11382
|
};
|
|
11783
|
-
var
|
|
11383
|
+
var SkeletonRenderer = class _SkeletonRenderer {
|
|
11784
11384
|
/**
|
|
11785
11385
|
* Creates a new skeleton renderer.
|
|
11786
11386
|
* @param ck the {@link CanvasKit} instance returned by `CanvasKitInit()`.
|
|
@@ -11791,6 +11391,7 @@ var _SkeletonRenderer = class {
|
|
|
11791
11391
|
clipper = new SkeletonClipping();
|
|
11792
11392
|
tempColor = new Color();
|
|
11793
11393
|
tempColor2 = new Color();
|
|
11394
|
+
static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
|
|
11794
11395
|
scratchPositions = Utils.newFloatArray(100);
|
|
11795
11396
|
scratchColors = Utils.newFloatArray(100);
|
|
11796
11397
|
scratchUVs = Utils.newFloatArray(100);
|
|
@@ -11800,8 +11401,7 @@ var _SkeletonRenderer = class {
|
|
|
11800
11401
|
* @param skeleton the skeleton or drawable to render.
|
|
11801
11402
|
*/
|
|
11802
11403
|
render(canvas, skeleton) {
|
|
11803
|
-
if (skeleton instanceof SkeletonDrawable)
|
|
11804
|
-
skeleton = skeleton.skeleton;
|
|
11404
|
+
if (skeleton instanceof SkeletonDrawable) skeleton = skeleton.skeleton;
|
|
11805
11405
|
let clipper = this.clipper;
|
|
11806
11406
|
let drawOrder = skeleton.drawOrder;
|
|
11807
11407
|
let skeletonColor = skeleton.color;
|
|
@@ -11906,8 +11506,6 @@ var _SkeletonRenderer = class {
|
|
|
11906
11506
|
clipper.clipEnd();
|
|
11907
11507
|
}
|
|
11908
11508
|
};
|
|
11909
|
-
var SkeletonRenderer = _SkeletonRenderer;
|
|
11910
|
-
__publicField(SkeletonRenderer, "QUAD_TRIANGLES", [0, 1, 2, 2, 3, 0]);
|
|
11911
11509
|
export {
|
|
11912
11510
|
AlphaTimeline,
|
|
11913
11511
|
Animation,
|