@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
|
@@ -4,7 +4,6 @@ var spine = (() => {
|
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,14 +17,10 @@ var spine = (() => {
|
|
|
18
17
|
return to;
|
|
19
18
|
};
|
|
20
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var __publicField = (obj, key, value) => {
|
|
22
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
25
20
|
|
|
26
21
|
// spine-canvaskit/src/index.ts
|
|
27
|
-
var
|
|
28
|
-
__export(
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
29
24
|
AlphaTimeline: () => AlphaTimeline,
|
|
30
25
|
Animation: () => Animation,
|
|
31
26
|
AnimationState: () => AnimationState,
|
|
@@ -192,13 +187,18 @@ var spine = (() => {
|
|
|
192
187
|
this.size = 0;
|
|
193
188
|
}
|
|
194
189
|
};
|
|
195
|
-
var
|
|
190
|
+
var Color = class _Color {
|
|
196
191
|
constructor(r = 0, g = 0, b = 0, a = 0) {
|
|
197
192
|
this.r = r;
|
|
198
193
|
this.g = g;
|
|
199
194
|
this.b = b;
|
|
200
195
|
this.a = a;
|
|
201
196
|
}
|
|
197
|
+
static WHITE = new _Color(1, 1, 1, 1);
|
|
198
|
+
static RED = new _Color(1, 0, 0, 1);
|
|
199
|
+
static GREEN = new _Color(0, 1, 0, 1);
|
|
200
|
+
static BLUE = new _Color(0, 0, 1, 1);
|
|
201
|
+
static MAGENTA = new _Color(1, 0, 1, 1);
|
|
202
202
|
set(r, g, b, a) {
|
|
203
203
|
this.r = r;
|
|
204
204
|
this.g = g;
|
|
@@ -229,22 +229,14 @@ var spine = (() => {
|
|
|
229
229
|
return this.clamp();
|
|
230
230
|
}
|
|
231
231
|
clamp() {
|
|
232
|
-
if (this.r < 0)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
if (this.
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (this.b < 0)
|
|
241
|
-
this.b = 0;
|
|
242
|
-
else if (this.b > 1)
|
|
243
|
-
this.b = 1;
|
|
244
|
-
if (this.a < 0)
|
|
245
|
-
this.a = 0;
|
|
246
|
-
else if (this.a > 1)
|
|
247
|
-
this.a = 1;
|
|
232
|
+
if (this.r < 0) this.r = 0;
|
|
233
|
+
else if (this.r > 1) this.r = 1;
|
|
234
|
+
if (this.g < 0) this.g = 0;
|
|
235
|
+
else if (this.g > 1) this.g = 1;
|
|
236
|
+
if (this.b < 0) this.b = 0;
|
|
237
|
+
else if (this.b > 1) this.b = 1;
|
|
238
|
+
if (this.a < 0) this.a = 0;
|
|
239
|
+
else if (this.a > 1) this.a = 1;
|
|
248
240
|
return this;
|
|
249
241
|
}
|
|
250
242
|
static rgba8888ToColor(color, value) {
|
|
@@ -262,22 +254,21 @@ var spine = (() => {
|
|
|
262
254
|
const hex = (x) => ("0" + (x * 255).toString(16)).slice(-2);
|
|
263
255
|
return Number("0x" + hex(this.r) + hex(this.g) + hex(this.b));
|
|
264
256
|
}
|
|
265
|
-
static fromString(hex) {
|
|
266
|
-
return
|
|
257
|
+
static fromString(hex, color = new _Color()) {
|
|
258
|
+
return color.setFromString(hex);
|
|
267
259
|
}
|
|
268
260
|
};
|
|
269
|
-
var
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
261
|
+
var MathUtils = class _MathUtils {
|
|
262
|
+
static PI = 3.1415927;
|
|
263
|
+
static PI2 = _MathUtils.PI * 2;
|
|
264
|
+
static invPI2 = 1 / _MathUtils.PI2;
|
|
265
|
+
static radiansToDegrees = 180 / _MathUtils.PI;
|
|
266
|
+
static radDeg = _MathUtils.radiansToDegrees;
|
|
267
|
+
static degreesToRadians = _MathUtils.PI / 180;
|
|
268
|
+
static degRad = _MathUtils.degreesToRadians;
|
|
276
269
|
static clamp(value, min, max) {
|
|
277
|
-
if (value < min)
|
|
278
|
-
|
|
279
|
-
if (value > max)
|
|
280
|
-
return max;
|
|
270
|
+
if (value < min) return min;
|
|
271
|
+
if (value > max) return max;
|
|
281
272
|
return value;
|
|
282
273
|
}
|
|
283
274
|
static cosDeg(degrees) {
|
|
@@ -305,22 +296,13 @@ var spine = (() => {
|
|
|
305
296
|
static randomTriangularWith(min, max, mode) {
|
|
306
297
|
let u = Math.random();
|
|
307
298
|
let d = max - min;
|
|
308
|
-
if (u <= (mode - min) / d)
|
|
309
|
-
return min + Math.sqrt(u * d * (mode - min));
|
|
299
|
+
if (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min));
|
|
310
300
|
return max - Math.sqrt((1 - u) * d * (max - mode));
|
|
311
301
|
}
|
|
312
302
|
static isPowerOfTwo(value) {
|
|
313
303
|
return value && (value & value - 1) === 0;
|
|
314
304
|
}
|
|
315
305
|
};
|
|
316
|
-
var MathUtils = _MathUtils;
|
|
317
|
-
__publicField(MathUtils, "PI", 3.1415927);
|
|
318
|
-
__publicField(MathUtils, "PI2", _MathUtils.PI * 2);
|
|
319
|
-
__publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
|
|
320
|
-
__publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
|
|
321
|
-
__publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
|
|
322
|
-
__publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
|
|
323
|
-
__publicField(MathUtils, "degRad", _MathUtils.degreesToRadians);
|
|
324
306
|
var Interpolation = class {
|
|
325
307
|
apply(start, end, a) {
|
|
326
308
|
return start + (end - start) * this.applyInternal(a);
|
|
@@ -333,8 +315,7 @@ var spine = (() => {
|
|
|
333
315
|
this.power = power;
|
|
334
316
|
}
|
|
335
317
|
applyInternal(a) {
|
|
336
|
-
if (a <= 0.5)
|
|
337
|
-
return Math.pow(a * 2, this.power) / 2;
|
|
318
|
+
if (a <= 0.5) return Math.pow(a * 2, this.power) / 2;
|
|
338
319
|
return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;
|
|
339
320
|
}
|
|
340
321
|
};
|
|
@@ -346,7 +327,8 @@ var spine = (() => {
|
|
|
346
327
|
return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;
|
|
347
328
|
}
|
|
348
329
|
};
|
|
349
|
-
var
|
|
330
|
+
var Utils = class _Utils {
|
|
331
|
+
static SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== "undefined";
|
|
350
332
|
static arrayCopy(source, sourceStart, dest, destStart, numElements) {
|
|
351
333
|
for (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {
|
|
352
334
|
dest[j] = source[i];
|
|
@@ -358,24 +340,20 @@ var spine = (() => {
|
|
|
358
340
|
}
|
|
359
341
|
static setArraySize(array, size, value = 0) {
|
|
360
342
|
let oldSize = array.length;
|
|
361
|
-
if (oldSize == size)
|
|
362
|
-
return array;
|
|
343
|
+
if (oldSize == size) return array;
|
|
363
344
|
array.length = size;
|
|
364
345
|
if (oldSize < size) {
|
|
365
|
-
for (let i = oldSize; i < size; i++)
|
|
366
|
-
array[i] = value;
|
|
346
|
+
for (let i = oldSize; i < size; i++) array[i] = value;
|
|
367
347
|
}
|
|
368
348
|
return array;
|
|
369
349
|
}
|
|
370
350
|
static ensureArrayCapacity(array, size, value = 0) {
|
|
371
|
-
if (array.length >= size)
|
|
372
|
-
return array;
|
|
351
|
+
if (array.length >= size) return array;
|
|
373
352
|
return _Utils.setArraySize(array, size, value);
|
|
374
353
|
}
|
|
375
354
|
static newArray(size, defaultValue) {
|
|
376
355
|
let array = new Array(size);
|
|
377
|
-
for (let i = 0; i < size; i++)
|
|
378
|
-
array[i] = defaultValue;
|
|
356
|
+
for (let i = 0; i < size; i++) array[i] = defaultValue;
|
|
379
357
|
return array;
|
|
380
358
|
}
|
|
381
359
|
static newFloatArray(size) {
|
|
@@ -383,8 +361,7 @@ var spine = (() => {
|
|
|
383
361
|
return new Float32Array(size);
|
|
384
362
|
else {
|
|
385
363
|
let array = new Array(size);
|
|
386
|
-
for (let i = 0; i < array.length; i++)
|
|
387
|
-
array[i] = 0;
|
|
364
|
+
for (let i = 0; i < array.length; i++) array[i] = 0;
|
|
388
365
|
return array;
|
|
389
366
|
}
|
|
390
367
|
}
|
|
@@ -393,8 +370,7 @@ var spine = (() => {
|
|
|
393
370
|
return new Int16Array(size);
|
|
394
371
|
else {
|
|
395
372
|
let array = new Array(size);
|
|
396
|
-
for (let i = 0; i < array.length; i++)
|
|
397
|
-
array[i] = 0;
|
|
373
|
+
for (let i = 0; i < array.length; i++) array[i] = 0;
|
|
398
374
|
return array;
|
|
399
375
|
}
|
|
400
376
|
}
|
|
@@ -409,16 +385,13 @@ var spine = (() => {
|
|
|
409
385
|
}
|
|
410
386
|
static contains(array, element, identity = true) {
|
|
411
387
|
for (var i = 0; i < array.length; i++)
|
|
412
|
-
if (array[i] == element)
|
|
413
|
-
return true;
|
|
388
|
+
if (array[i] == element) return true;
|
|
414
389
|
return false;
|
|
415
390
|
}
|
|
416
391
|
static enumValue(type, name) {
|
|
417
392
|
return type[name[0].toUpperCase() + name.slice(1)];
|
|
418
393
|
}
|
|
419
394
|
};
|
|
420
|
-
var Utils = _Utils;
|
|
421
|
-
__publicField(Utils, "SUPPORTS_TYPED_ARRAYS", typeof Float32Array !== "undefined");
|
|
422
395
|
var DebugUtils = class {
|
|
423
396
|
static logBones(skeleton) {
|
|
424
397
|
for (let i = 0; i < skeleton.bones.length; i++) {
|
|
@@ -437,8 +410,7 @@ var spine = (() => {
|
|
|
437
410
|
return this.items.length > 0 ? this.items.pop() : this.instantiator();
|
|
438
411
|
}
|
|
439
412
|
free(item) {
|
|
440
|
-
if (item.reset)
|
|
441
|
-
item.reset();
|
|
413
|
+
if (item.reset) item.reset();
|
|
442
414
|
this.items.push(item);
|
|
443
415
|
}
|
|
444
416
|
freeAll(items) {
|
|
@@ -486,8 +458,7 @@ var spine = (() => {
|
|
|
486
458
|
this.delta = now - this.lastTime;
|
|
487
459
|
this.frameTime += this.delta;
|
|
488
460
|
this.totalTime += this.delta;
|
|
489
|
-
if (this.delta > this.maxDelta)
|
|
490
|
-
this.delta = this.maxDelta;
|
|
461
|
+
if (this.delta > this.maxDelta) this.delta = this.maxDelta;
|
|
491
462
|
this.lastTime = now;
|
|
492
463
|
this.frameCount++;
|
|
493
464
|
if (this.frameTime > 1) {
|
|
@@ -510,11 +481,9 @@ var spine = (() => {
|
|
|
510
481
|
return this.addedValues >= this.values.length;
|
|
511
482
|
}
|
|
512
483
|
addValue(value) {
|
|
513
|
-
if (this.addedValues < this.values.length)
|
|
514
|
-
this.addedValues++;
|
|
484
|
+
if (this.addedValues < this.values.length) this.addedValues++;
|
|
515
485
|
this.values[this.lastValue++] = value;
|
|
516
|
-
if (this.lastValue > this.values.length - 1)
|
|
517
|
-
this.lastValue = 0;
|
|
486
|
+
if (this.lastValue > this.values.length - 1) this.lastValue = 0;
|
|
518
487
|
this.dirty = true;
|
|
519
488
|
}
|
|
520
489
|
getMean() {
|
|
@@ -536,12 +505,12 @@ var spine = (() => {
|
|
|
536
505
|
var Attachment = class {
|
|
537
506
|
name;
|
|
538
507
|
constructor(name) {
|
|
539
|
-
if (!name)
|
|
540
|
-
throw new Error("name cannot be null.");
|
|
508
|
+
if (!name) throw new Error("name cannot be null.");
|
|
541
509
|
this.name = name;
|
|
542
510
|
}
|
|
543
511
|
};
|
|
544
|
-
var
|
|
512
|
+
var VertexAttachment = class _VertexAttachment extends Attachment {
|
|
513
|
+
static nextID = 0;
|
|
545
514
|
/** The unique ID for this attachment. */
|
|
546
515
|
id = _VertexAttachment.nextID++;
|
|
547
516
|
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
|
|
@@ -579,8 +548,7 @@ var spine = (() => {
|
|
|
579
548
|
let vertices = this.vertices;
|
|
580
549
|
let bones = this.bones;
|
|
581
550
|
if (!bones) {
|
|
582
|
-
if (deformArray.length > 0)
|
|
583
|
-
vertices = deformArray;
|
|
551
|
+
if (deformArray.length > 0) vertices = deformArray;
|
|
584
552
|
let bone = slot.bone;
|
|
585
553
|
let x = bone.worldX;
|
|
586
554
|
let y = bone.worldY;
|
|
@@ -645,11 +613,10 @@ var spine = (() => {
|
|
|
645
613
|
attachment.timelineAttachment = this.timelineAttachment;
|
|
646
614
|
}
|
|
647
615
|
};
|
|
648
|
-
var VertexAttachment = _VertexAttachment;
|
|
649
|
-
__publicField(VertexAttachment, "nextID", 0);
|
|
650
616
|
|
|
651
617
|
// spine-core/src/attachments/Sequence.ts
|
|
652
|
-
var
|
|
618
|
+
var Sequence = class _Sequence {
|
|
619
|
+
static _nextID = 0;
|
|
653
620
|
id = _Sequence.nextID();
|
|
654
621
|
regions;
|
|
655
622
|
start = 0;
|
|
@@ -669,10 +636,8 @@ var spine = (() => {
|
|
|
669
636
|
}
|
|
670
637
|
apply(slot, attachment) {
|
|
671
638
|
let index = slot.sequenceIndex;
|
|
672
|
-
if (index == -1)
|
|
673
|
-
|
|
674
|
-
if (index >= this.regions.length)
|
|
675
|
-
index = this.regions.length - 1;
|
|
639
|
+
if (index == -1) index = this.setupIndex;
|
|
640
|
+
if (index >= this.regions.length) index = this.regions.length - 1;
|
|
676
641
|
let region = this.regions[index];
|
|
677
642
|
if (attachment.region != region) {
|
|
678
643
|
attachment.region = region;
|
|
@@ -691,8 +656,6 @@ var spine = (() => {
|
|
|
691
656
|
return _Sequence._nextID++;
|
|
692
657
|
}
|
|
693
658
|
};
|
|
694
|
-
var Sequence = _Sequence;
|
|
695
|
-
__publicField(Sequence, "_nextID", 0);
|
|
696
659
|
var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
|
|
697
660
|
SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
|
|
698
661
|
SequenceMode2[SequenceMode2["once"] = 1] = "once";
|
|
@@ -722,15 +685,13 @@ var spine = (() => {
|
|
|
722
685
|
/** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
|
|
723
686
|
duration;
|
|
724
687
|
constructor(name, timelines, duration) {
|
|
725
|
-
if (!name)
|
|
726
|
-
throw new Error("name cannot be null.");
|
|
688
|
+
if (!name) throw new Error("name cannot be null.");
|
|
727
689
|
this.name = name;
|
|
728
690
|
this.setTimelines(timelines);
|
|
729
691
|
this.duration = duration;
|
|
730
692
|
}
|
|
731
693
|
setTimelines(timelines) {
|
|
732
|
-
if (!timelines)
|
|
733
|
-
throw new Error("timelines cannot be null.");
|
|
694
|
+
if (!timelines) throw new Error("timelines cannot be null.");
|
|
734
695
|
this.timelines = timelines;
|
|
735
696
|
this.timelineIds.clear();
|
|
736
697
|
for (var i = 0; i < timelines.length; i++)
|
|
@@ -738,8 +699,7 @@ var spine = (() => {
|
|
|
738
699
|
}
|
|
739
700
|
hasTimeline(ids) {
|
|
740
701
|
for (let i = 0; i < ids.length; i++)
|
|
741
|
-
if (this.timelineIds.contains(ids[i]))
|
|
742
|
-
return true;
|
|
702
|
+
if (this.timelineIds.contains(ids[i])) return true;
|
|
743
703
|
return false;
|
|
744
704
|
}
|
|
745
705
|
/** Applies all the animation's timelines to the specified skeleton.
|
|
@@ -748,12 +708,10 @@ var spine = (() => {
|
|
|
748
708
|
* @param loop If true, the animation repeats after {@link #getDuration()}.
|
|
749
709
|
* @param events May be null to ignore fired events. */
|
|
750
710
|
apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
|
751
|
-
if (!skeleton)
|
|
752
|
-
throw new Error("skeleton cannot be null.");
|
|
711
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
753
712
|
if (loop && this.duration != 0) {
|
|
754
713
|
time %= this.duration;
|
|
755
|
-
if (lastTime > 0)
|
|
756
|
-
lastTime %= this.duration;
|
|
714
|
+
if (lastTime > 0) lastTime %= this.duration;
|
|
757
715
|
}
|
|
758
716
|
let timelines = this.timelines;
|
|
759
717
|
for (let i = 0, n = timelines.length; i < n; i++)
|
|
@@ -825,15 +783,13 @@ var spine = (() => {
|
|
|
825
783
|
static search1(frames, time) {
|
|
826
784
|
let n = frames.length;
|
|
827
785
|
for (let i = 1; i < n; i++)
|
|
828
|
-
if (frames[i] > time)
|
|
829
|
-
return i - 1;
|
|
786
|
+
if (frames[i] > time) return i - 1;
|
|
830
787
|
return n - 1;
|
|
831
788
|
}
|
|
832
789
|
static search(frames, time, step) {
|
|
833
790
|
let n = frames.length;
|
|
834
791
|
for (let i = step; i < n; i += step)
|
|
835
|
-
if (frames[i] > time)
|
|
836
|
-
return i - step;
|
|
792
|
+
if (frames[i] > time) return i - step;
|
|
837
793
|
return n - step;
|
|
838
794
|
}
|
|
839
795
|
};
|
|
@@ -883,8 +839,7 @@ var spine = (() => {
|
|
|
883
839
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
884
840
|
let curves = this.curves;
|
|
885
841
|
let i = this.getFrameCount() + bezier * 18;
|
|
886
|
-
if (value == 0)
|
|
887
|
-
curves[frame] = 2 + i;
|
|
842
|
+
if (value == 0) curves[frame] = 2 + i;
|
|
888
843
|
let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = (value1 - cy1 * 2 + cy2) * 0.03;
|
|
889
844
|
let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = ((cy1 - cy2) * 3 - value1 + value2) * 6e-3;
|
|
890
845
|
let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
|
|
@@ -1010,8 +965,7 @@ var spine = (() => {
|
|
|
1010
965
|
return current;
|
|
1011
966
|
}
|
|
1012
967
|
let value = this.getCurveValue(time);
|
|
1013
|
-
if (blend == 0 /* setup */)
|
|
1014
|
-
return setup + (value - setup) * alpha;
|
|
968
|
+
if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
|
|
1015
969
|
return current + (value - current) * alpha;
|
|
1016
970
|
}
|
|
1017
971
|
getAbsoluteValue2(time, alpha, blend, current, setup, value) {
|
|
@@ -1024,8 +978,7 @@ var spine = (() => {
|
|
|
1024
978
|
}
|
|
1025
979
|
return current;
|
|
1026
980
|
}
|
|
1027
|
-
if (blend == 0 /* setup */)
|
|
1028
|
-
return setup + (value - setup) * alpha;
|
|
981
|
+
if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
|
|
1029
982
|
return current + (value - current) * alpha;
|
|
1030
983
|
}
|
|
1031
984
|
getScaleValue(time, alpha, blend, direction, current, setup) {
|
|
@@ -1041,8 +994,7 @@ var spine = (() => {
|
|
|
1041
994
|
}
|
|
1042
995
|
let value = this.getCurveValue(time) * setup;
|
|
1043
996
|
if (alpha == 1) {
|
|
1044
|
-
if (blend == 3 /* add */)
|
|
1045
|
-
return current + value - setup;
|
|
997
|
+
if (blend == 3 /* add */) return current + value - setup;
|
|
1046
998
|
return value;
|
|
1047
999
|
}
|
|
1048
1000
|
if (direction == 1 /* mixOut */) {
|
|
@@ -1101,8 +1053,7 @@ var spine = (() => {
|
|
|
1101
1053
|
}
|
|
1102
1054
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1103
1055
|
let bone = skeleton.bones[this.boneIndex];
|
|
1104
|
-
if (bone.active)
|
|
1105
|
-
bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
|
|
1056
|
+
if (bone.active) bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
|
|
1106
1057
|
}
|
|
1107
1058
|
};
|
|
1108
1059
|
var TranslateTimeline = class extends CurveTimeline2 {
|
|
@@ -1118,8 +1069,7 @@ var spine = (() => {
|
|
|
1118
1069
|
}
|
|
1119
1070
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1120
1071
|
let bone = skeleton.bones[this.boneIndex];
|
|
1121
|
-
if (!bone.active)
|
|
1122
|
-
return;
|
|
1072
|
+
if (!bone.active) return;
|
|
1123
1073
|
let frames = this.frames;
|
|
1124
1074
|
if (time < frames[0]) {
|
|
1125
1075
|
switch (blend) {
|
|
@@ -1218,8 +1168,7 @@ var spine = (() => {
|
|
|
1218
1168
|
}
|
|
1219
1169
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1220
1170
|
let bone = skeleton.bones[this.boneIndex];
|
|
1221
|
-
if (bone.active)
|
|
1222
|
-
bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
|
|
1171
|
+
if (bone.active) bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
|
|
1223
1172
|
}
|
|
1224
1173
|
};
|
|
1225
1174
|
var TranslateYTimeline = class extends CurveTimeline1 {
|
|
@@ -1230,8 +1179,7 @@ var spine = (() => {
|
|
|
1230
1179
|
}
|
|
1231
1180
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1232
1181
|
let bone = skeleton.bones[this.boneIndex];
|
|
1233
|
-
if (bone.active)
|
|
1234
|
-
bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
|
|
1182
|
+
if (bone.active) bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
|
|
1235
1183
|
}
|
|
1236
1184
|
};
|
|
1237
1185
|
var ScaleTimeline = class extends CurveTimeline2 {
|
|
@@ -1247,8 +1195,7 @@ var spine = (() => {
|
|
|
1247
1195
|
}
|
|
1248
1196
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1249
1197
|
let bone = skeleton.bones[this.boneIndex];
|
|
1250
|
-
if (!bone.active)
|
|
1251
|
-
return;
|
|
1198
|
+
if (!bone.active) return;
|
|
1252
1199
|
let frames = this.frames;
|
|
1253
1200
|
if (time < frames[0]) {
|
|
1254
1201
|
switch (blend) {
|
|
@@ -1385,8 +1332,7 @@ var spine = (() => {
|
|
|
1385
1332
|
}
|
|
1386
1333
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1387
1334
|
let bone = skeleton.bones[this.boneIndex];
|
|
1388
|
-
if (bone.active)
|
|
1389
|
-
bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
|
|
1335
|
+
if (bone.active) bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
|
|
1390
1336
|
}
|
|
1391
1337
|
};
|
|
1392
1338
|
var ScaleYTimeline = class extends CurveTimeline1 {
|
|
@@ -1397,8 +1343,7 @@ var spine = (() => {
|
|
|
1397
1343
|
}
|
|
1398
1344
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1399
1345
|
let bone = skeleton.bones[this.boneIndex];
|
|
1400
|
-
if (bone.active)
|
|
1401
|
-
bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
|
|
1346
|
+
if (bone.active) bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
|
|
1402
1347
|
}
|
|
1403
1348
|
};
|
|
1404
1349
|
var ShearTimeline = class extends CurveTimeline2 {
|
|
@@ -1414,8 +1359,7 @@ var spine = (() => {
|
|
|
1414
1359
|
}
|
|
1415
1360
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1416
1361
|
let bone = skeleton.bones[this.boneIndex];
|
|
1417
|
-
if (!bone.active)
|
|
1418
|
-
return;
|
|
1362
|
+
if (!bone.active) return;
|
|
1419
1363
|
let frames = this.frames;
|
|
1420
1364
|
if (time < frames[0]) {
|
|
1421
1365
|
switch (blend) {
|
|
@@ -1514,8 +1458,7 @@ var spine = (() => {
|
|
|
1514
1458
|
}
|
|
1515
1459
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1516
1460
|
let bone = skeleton.bones[this.boneIndex];
|
|
1517
|
-
if (bone.active)
|
|
1518
|
-
bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
|
|
1461
|
+
if (bone.active) bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
|
|
1519
1462
|
}
|
|
1520
1463
|
};
|
|
1521
1464
|
var ShearYTimeline = class extends CurveTimeline1 {
|
|
@@ -1526,8 +1469,7 @@ var spine = (() => {
|
|
|
1526
1469
|
}
|
|
1527
1470
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1528
1471
|
let bone = skeleton.bones[this.boneIndex];
|
|
1529
|
-
if (bone.active)
|
|
1530
|
-
bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
|
|
1472
|
+
if (bone.active) bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
|
|
1531
1473
|
}
|
|
1532
1474
|
};
|
|
1533
1475
|
var InheritTimeline = class extends Timeline {
|
|
@@ -1552,17 +1494,14 @@ var spine = (() => {
|
|
|
1552
1494
|
}
|
|
1553
1495
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1554
1496
|
let bone = skeleton.bones[this.boneIndex];
|
|
1555
|
-
if (!bone.active)
|
|
1556
|
-
return;
|
|
1497
|
+
if (!bone.active) return;
|
|
1557
1498
|
if (direction == 1 /* mixOut */) {
|
|
1558
|
-
if (blend == 0 /* setup */)
|
|
1559
|
-
bone.inherit = bone.data.inherit;
|
|
1499
|
+
if (blend == 0 /* setup */) bone.inherit = bone.data.inherit;
|
|
1560
1500
|
return;
|
|
1561
1501
|
}
|
|
1562
1502
|
let frames = this.frames;
|
|
1563
1503
|
if (time < frames[0]) {
|
|
1564
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
1565
|
-
bone.inherit = bone.data.inherit;
|
|
1504
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) bone.inherit = bone.data.inherit;
|
|
1566
1505
|
return;
|
|
1567
1506
|
}
|
|
1568
1507
|
bone.inherit = this.frames[
|
|
@@ -1611,8 +1550,7 @@ var spine = (() => {
|
|
|
1611
1550
|
}
|
|
1612
1551
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1613
1552
|
let slot = skeleton.slots[this.slotIndex];
|
|
1614
|
-
if (!slot.bone.active)
|
|
1615
|
-
return;
|
|
1553
|
+
if (!slot.bone.active) return;
|
|
1616
1554
|
let frames = this.frames;
|
|
1617
1555
|
let color = slot.color;
|
|
1618
1556
|
if (time < frames[0]) {
|
|
@@ -1733,8 +1671,7 @@ var spine = (() => {
|
|
|
1733
1671
|
if (alpha == 1)
|
|
1734
1672
|
color.set(r, g, b, a);
|
|
1735
1673
|
else {
|
|
1736
|
-
if (blend == 0 /* setup */)
|
|
1737
|
-
color.setFromColor(slot.data.color);
|
|
1674
|
+
if (blend == 0 /* setup */) color.setFromColor(slot.data.color);
|
|
1738
1675
|
color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
|
|
1739
1676
|
}
|
|
1740
1677
|
}
|
|
@@ -1769,8 +1706,7 @@ var spine = (() => {
|
|
|
1769
1706
|
}
|
|
1770
1707
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1771
1708
|
let slot = skeleton.slots[this.slotIndex];
|
|
1772
|
-
if (!slot.bone.active)
|
|
1773
|
-
return;
|
|
1709
|
+
if (!slot.bone.active) return;
|
|
1774
1710
|
let frames = this.frames;
|
|
1775
1711
|
let color = slot.color;
|
|
1776
1712
|
if (time < frames[0]) {
|
|
@@ -1890,8 +1826,7 @@ var spine = (() => {
|
|
|
1890
1826
|
}
|
|
1891
1827
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1892
1828
|
let slot = skeleton.slots[this.slotIndex];
|
|
1893
|
-
if (!slot.bone.active)
|
|
1894
|
-
return;
|
|
1829
|
+
if (!slot.bone.active) return;
|
|
1895
1830
|
let color = slot.color;
|
|
1896
1831
|
if (time < this.frames[0]) {
|
|
1897
1832
|
let setup = slot.data.color;
|
|
@@ -1908,8 +1843,7 @@ var spine = (() => {
|
|
|
1908
1843
|
if (alpha == 1)
|
|
1909
1844
|
color.a = a;
|
|
1910
1845
|
else {
|
|
1911
|
-
if (blend == 0 /* setup */)
|
|
1912
|
-
color.a = slot.data.color.a;
|
|
1846
|
+
if (blend == 0 /* setup */) color.a = slot.data.color.a;
|
|
1913
1847
|
color.a += (a - color.a) * alpha;
|
|
1914
1848
|
}
|
|
1915
1849
|
}
|
|
@@ -1962,8 +1896,7 @@ var spine = (() => {
|
|
|
1962
1896
|
}
|
|
1963
1897
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1964
1898
|
let slot = skeleton.slots[this.slotIndex];
|
|
1965
|
-
if (!slot.bone.active)
|
|
1966
|
-
return;
|
|
1899
|
+
if (!slot.bone.active) return;
|
|
1967
1900
|
let frames = this.frames;
|
|
1968
1901
|
let light = slot.color, dark = slot.darkColor;
|
|
1969
1902
|
if (time < frames[0]) {
|
|
@@ -2204,8 +2137,7 @@ var spine = (() => {
|
|
|
2204
2137
|
}
|
|
2205
2138
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
2206
2139
|
let slot = skeleton.slots[this.slotIndex];
|
|
2207
|
-
if (!slot.bone.active)
|
|
2208
|
-
return;
|
|
2140
|
+
if (!slot.bone.active) return;
|
|
2209
2141
|
let frames = this.frames;
|
|
2210
2142
|
let light = slot.color, dark = slot.darkColor;
|
|
2211
2143
|
if (time < frames[0]) {
|
|
@@ -2413,16 +2345,13 @@ var spine = (() => {
|
|
|
2413
2345
|
}
|
|
2414
2346
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
2415
2347
|
let slot = skeleton.slots[this.slotIndex];
|
|
2416
|
-
if (!slot.bone.active)
|
|
2417
|
-
return;
|
|
2348
|
+
if (!slot.bone.active) return;
|
|
2418
2349
|
if (direction == 1 /* mixOut */) {
|
|
2419
|
-
if (blend == 0 /* setup */)
|
|
2420
|
-
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2350
|
+
if (blend == 0 /* setup */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2421
2351
|
return;
|
|
2422
2352
|
}
|
|
2423
2353
|
if (time < this.frames[0]) {
|
|
2424
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2425
|
-
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2354
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2426
2355
|
return;
|
|
2427
2356
|
}
|
|
2428
2357
|
this.setAttachment(skeleton, slot, this.attachmentNames[Timeline.search1(this.frames, time)]);
|
|
@@ -2459,8 +2388,7 @@ var spine = (() => {
|
|
|
2459
2388
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
2460
2389
|
let curves = this.curves;
|
|
2461
2390
|
let i = this.getFrameCount() + bezier * 18;
|
|
2462
|
-
if (value == 0)
|
|
2463
|
-
curves[frame] = 2 + i;
|
|
2391
|
+
if (value == 0) curves[frame] = 2 + i;
|
|
2464
2392
|
let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = cy2 * 0.03 - cy1 * 0.06;
|
|
2465
2393
|
let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = (cy1 - cy2 + 0.33333333) * 0.018;
|
|
2466
2394
|
let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
|
|
@@ -2504,16 +2432,12 @@ var spine = (() => {
|
|
|
2504
2432
|
}
|
|
2505
2433
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2506
2434
|
let slot = skeleton.slots[this.slotIndex];
|
|
2507
|
-
if (!slot.bone.active)
|
|
2508
|
-
return;
|
|
2435
|
+
if (!slot.bone.active) return;
|
|
2509
2436
|
let slotAttachment = slot.getAttachment();
|
|
2510
|
-
if (!slotAttachment)
|
|
2511
|
-
|
|
2512
|
-
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment)
|
|
2513
|
-
return;
|
|
2437
|
+
if (!slotAttachment) return;
|
|
2438
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment) return;
|
|
2514
2439
|
let deform = slot.deform;
|
|
2515
|
-
if (deform.length == 0)
|
|
2516
|
-
blend = 0 /* setup */;
|
|
2440
|
+
if (deform.length == 0) blend = 0 /* setup */;
|
|
2517
2441
|
let vertices = this.vertices;
|
|
2518
2442
|
let vertexCount = vertices[0].length;
|
|
2519
2443
|
let frames = this.frames;
|
|
@@ -2660,7 +2584,8 @@ var spine = (() => {
|
|
|
2660
2584
|
}
|
|
2661
2585
|
}
|
|
2662
2586
|
};
|
|
2663
|
-
var
|
|
2587
|
+
var EventTimeline = class _EventTimeline extends Timeline {
|
|
2588
|
+
static propertyIds = ["" + Property.event];
|
|
2664
2589
|
/** The event for each key frame. */
|
|
2665
2590
|
events;
|
|
2666
2591
|
constructor(frameCount) {
|
|
@@ -2677,8 +2602,7 @@ var spine = (() => {
|
|
|
2677
2602
|
}
|
|
2678
2603
|
/** Fires events for frames > `lastTime` and <= `time`. */
|
|
2679
2604
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2680
|
-
if (!firedEvents)
|
|
2681
|
-
return;
|
|
2605
|
+
if (!firedEvents) return;
|
|
2682
2606
|
let frames = this.frames;
|
|
2683
2607
|
let frameCount = this.frames.length;
|
|
2684
2608
|
if (lastTime > time) {
|
|
@@ -2686,8 +2610,7 @@ var spine = (() => {
|
|
|
2686
2610
|
lastTime = -1;
|
|
2687
2611
|
} else if (lastTime >= frames[frameCount - 1])
|
|
2688
2612
|
return;
|
|
2689
|
-
if (time < frames[0])
|
|
2690
|
-
return;
|
|
2613
|
+
if (time < frames[0]) return;
|
|
2691
2614
|
let i = 0;
|
|
2692
2615
|
if (lastTime < frames[0])
|
|
2693
2616
|
i = 0;
|
|
@@ -2695,8 +2618,7 @@ var spine = (() => {
|
|
|
2695
2618
|
i = Timeline.search1(frames, lastTime) + 1;
|
|
2696
2619
|
let frameTime = frames[i];
|
|
2697
2620
|
while (i > 0) {
|
|
2698
|
-
if (frames[i - 1] != frameTime)
|
|
2699
|
-
break;
|
|
2621
|
+
if (frames[i - 1] != frameTime) break;
|
|
2700
2622
|
i--;
|
|
2701
2623
|
}
|
|
2702
2624
|
}
|
|
@@ -2704,9 +2626,8 @@ var spine = (() => {
|
|
|
2704
2626
|
firedEvents.push(this.events[i]);
|
|
2705
2627
|
}
|
|
2706
2628
|
};
|
|
2707
|
-
var
|
|
2708
|
-
|
|
2709
|
-
var _DrawOrderTimeline = class extends Timeline {
|
|
2629
|
+
var DrawOrderTimeline = class _DrawOrderTimeline extends Timeline {
|
|
2630
|
+
static propertyIds = ["" + Property.drawOrder];
|
|
2710
2631
|
/** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
|
|
2711
2632
|
drawOrders;
|
|
2712
2633
|
constructor(frameCount) {
|
|
@@ -2725,13 +2646,11 @@ var spine = (() => {
|
|
|
2725
2646
|
}
|
|
2726
2647
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2727
2648
|
if (direction == 1 /* mixOut */) {
|
|
2728
|
-
if (blend == 0 /* setup */)
|
|
2729
|
-
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2649
|
+
if (blend == 0 /* setup */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2730
2650
|
return;
|
|
2731
2651
|
}
|
|
2732
2652
|
if (time < this.frames[0]) {
|
|
2733
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2734
|
-
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2653
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2735
2654
|
return;
|
|
2736
2655
|
}
|
|
2737
2656
|
let idx = Timeline.search1(this.frames, time);
|
|
@@ -2746,8 +2665,6 @@ var spine = (() => {
|
|
|
2746
2665
|
}
|
|
2747
2666
|
}
|
|
2748
2667
|
};
|
|
2749
|
-
var DrawOrderTimeline = _DrawOrderTimeline;
|
|
2750
|
-
__publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
|
|
2751
2668
|
var IkConstraintTimeline = class extends CurveTimeline {
|
|
2752
2669
|
/** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is applied */
|
|
2753
2670
|
constraintIndex = 0;
|
|
@@ -2787,8 +2704,7 @@ var spine = (() => {
|
|
|
2787
2704
|
}
|
|
2788
2705
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2789
2706
|
let constraint = skeleton.ikConstraints[this.constraintIndex];
|
|
2790
|
-
if (!constraint.active)
|
|
2791
|
-
return;
|
|
2707
|
+
if (!constraint.active) return;
|
|
2792
2708
|
let frames = this.frames;
|
|
2793
2709
|
if (time < frames[0]) {
|
|
2794
2710
|
switch (blend) {
|
|
@@ -2954,8 +2870,7 @@ var spine = (() => {
|
|
|
2954
2870
|
}
|
|
2955
2871
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2956
2872
|
let constraint = skeleton.transformConstraints[this.constraintIndex];
|
|
2957
|
-
if (!constraint.active)
|
|
2958
|
-
return;
|
|
2873
|
+
if (!constraint.active) return;
|
|
2959
2874
|
let frames = this.frames;
|
|
2960
2875
|
if (time < frames[0]) {
|
|
2961
2876
|
let data = constraint.data;
|
|
@@ -3193,8 +3108,7 @@ var spine = (() => {
|
|
|
3193
3108
|
}
|
|
3194
3109
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3195
3110
|
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3196
|
-
if (!constraint.active)
|
|
3197
|
-
return;
|
|
3111
|
+
if (!constraint.active) return;
|
|
3198
3112
|
let frames = this.frames;
|
|
3199
3113
|
if (time < frames[0]) {
|
|
3200
3114
|
switch (blend) {
|
|
@@ -3318,8 +3232,7 @@ var spine = (() => {
|
|
|
3318
3232
|
}
|
|
3319
3233
|
} else {
|
|
3320
3234
|
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3321
|
-
if (constraint.active)
|
|
3322
|
-
this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
|
|
3235
|
+
if (constraint.active) this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
|
|
3323
3236
|
}
|
|
3324
3237
|
}
|
|
3325
3238
|
};
|
|
@@ -3442,7 +3355,8 @@ var spine = (() => {
|
|
|
3442
3355
|
return constraint.mixGlobal;
|
|
3443
3356
|
}
|
|
3444
3357
|
};
|
|
3445
|
-
var
|
|
3358
|
+
var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
|
|
3359
|
+
static propertyIds = [Property.physicsConstraintReset.toString()];
|
|
3446
3360
|
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
|
|
3447
3361
|
* applied, or -1 if all physics constraints in the skeleton will be reset. */
|
|
3448
3362
|
constraintIndex;
|
|
@@ -3464,8 +3378,7 @@ var spine = (() => {
|
|
|
3464
3378
|
let constraint;
|
|
3465
3379
|
if (this.constraintIndex != -1) {
|
|
3466
3380
|
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3467
|
-
if (!constraint.active)
|
|
3468
|
-
return;
|
|
3381
|
+
if (!constraint.active) return;
|
|
3469
3382
|
}
|
|
3470
3383
|
const frames = this.frames;
|
|
3471
3384
|
if (lastTime > time) {
|
|
@@ -3473,23 +3386,22 @@ var spine = (() => {
|
|
|
3473
3386
|
lastTime = -1;
|
|
3474
3387
|
} else if (lastTime >= frames[frames.length - 1])
|
|
3475
3388
|
return;
|
|
3476
|
-
if (time < frames[0])
|
|
3477
|
-
return;
|
|
3389
|
+
if (time < frames[0]) return;
|
|
3478
3390
|
if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
|
|
3479
3391
|
if (constraint != null)
|
|
3480
3392
|
constraint.reset();
|
|
3481
3393
|
else {
|
|
3482
3394
|
for (const constraint2 of skeleton.physicsConstraints) {
|
|
3483
|
-
if (constraint2.active)
|
|
3484
|
-
constraint2.reset();
|
|
3395
|
+
if (constraint2.active) constraint2.reset();
|
|
3485
3396
|
}
|
|
3486
3397
|
}
|
|
3487
3398
|
}
|
|
3488
3399
|
}
|
|
3489
3400
|
};
|
|
3490
|
-
var
|
|
3491
|
-
|
|
3492
|
-
|
|
3401
|
+
var SequenceTimeline = class _SequenceTimeline extends Timeline {
|
|
3402
|
+
static ENTRIES = 3;
|
|
3403
|
+
static MODE = 1;
|
|
3404
|
+
static DELAY = 2;
|
|
3493
3405
|
slotIndex;
|
|
3494
3406
|
attachment;
|
|
3495
3407
|
constructor(frameCount, slotIndex, attachment) {
|
|
@@ -3520,31 +3432,26 @@ var spine = (() => {
|
|
|
3520
3432
|
}
|
|
3521
3433
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
3522
3434
|
let slot = skeleton.slots[this.slotIndex];
|
|
3523
|
-
if (!slot.bone.active)
|
|
3524
|
-
return;
|
|
3435
|
+
if (!slot.bone.active) return;
|
|
3525
3436
|
let slotAttachment = slot.attachment;
|
|
3526
3437
|
let attachment = this.attachment;
|
|
3527
3438
|
if (slotAttachment != attachment) {
|
|
3528
|
-
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment)
|
|
3529
|
-
return;
|
|
3439
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment) return;
|
|
3530
3440
|
}
|
|
3531
3441
|
if (direction == 1 /* mixOut */) {
|
|
3532
|
-
if (blend == 0 /* setup */)
|
|
3533
|
-
slot.sequenceIndex = -1;
|
|
3442
|
+
if (blend == 0 /* setup */) slot.sequenceIndex = -1;
|
|
3534
3443
|
return;
|
|
3535
3444
|
}
|
|
3536
3445
|
let frames = this.frames;
|
|
3537
3446
|
if (time < frames[0]) {
|
|
3538
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
3539
|
-
slot.sequenceIndex = -1;
|
|
3447
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) slot.sequenceIndex = -1;
|
|
3540
3448
|
return;
|
|
3541
3449
|
}
|
|
3542
3450
|
let i = Timeline.search(frames, time, _SequenceTimeline.ENTRIES);
|
|
3543
3451
|
let before = frames[i];
|
|
3544
3452
|
let modeAndIndex = frames[i + _SequenceTimeline.MODE];
|
|
3545
3453
|
let delay = frames[i + _SequenceTimeline.DELAY];
|
|
3546
|
-
if (!this.attachment.sequence)
|
|
3547
|
-
return;
|
|
3454
|
+
if (!this.attachment.sequence) return;
|
|
3548
3455
|
let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
|
|
3549
3456
|
let mode = SequenceModeValues[modeAndIndex & 15];
|
|
3550
3457
|
if (mode != 0 /* hold */) {
|
|
@@ -3559,8 +3466,7 @@ var spine = (() => {
|
|
|
3559
3466
|
case 3 /* pingpong */: {
|
|
3560
3467
|
let n = (count << 1) - 2;
|
|
3561
3468
|
index = n == 0 ? 0 : index % n;
|
|
3562
|
-
if (index >= count)
|
|
3563
|
-
index = n - index;
|
|
3469
|
+
if (index >= count) index = n - index;
|
|
3564
3470
|
break;
|
|
3565
3471
|
}
|
|
3566
3472
|
case 4 /* onceReverse */:
|
|
@@ -3572,21 +3478,17 @@ var spine = (() => {
|
|
|
3572
3478
|
case 6 /* pingpongReverse */: {
|
|
3573
3479
|
let n = (count << 1) - 2;
|
|
3574
3480
|
index = n == 0 ? 0 : (index + count - 1) % n;
|
|
3575
|
-
if (index >= count)
|
|
3576
|
-
index = n - index;
|
|
3481
|
+
if (index >= count) index = n - index;
|
|
3577
3482
|
}
|
|
3578
3483
|
}
|
|
3579
3484
|
}
|
|
3580
3485
|
slot.sequenceIndex = index;
|
|
3581
3486
|
}
|
|
3582
3487
|
};
|
|
3583
|
-
var SequenceTimeline = _SequenceTimeline;
|
|
3584
|
-
__publicField(SequenceTimeline, "ENTRIES", 3);
|
|
3585
|
-
__publicField(SequenceTimeline, "MODE", 1);
|
|
3586
|
-
__publicField(SequenceTimeline, "DELAY", 2);
|
|
3587
3488
|
|
|
3588
3489
|
// spine-core/src/AnimationState.ts
|
|
3589
|
-
var
|
|
3490
|
+
var AnimationState = class _AnimationState {
|
|
3491
|
+
static _emptyAnimation = new Animation("<empty>", [], 0);
|
|
3590
3492
|
static emptyAnimation() {
|
|
3591
3493
|
return _AnimationState._emptyAnimation;
|
|
3592
3494
|
}
|
|
@@ -3615,15 +3517,13 @@ var spine = (() => {
|
|
|
3615
3517
|
let tracks = this.tracks;
|
|
3616
3518
|
for (let i = 0, n = tracks.length; i < n; i++) {
|
|
3617
3519
|
let current = tracks[i];
|
|
3618
|
-
if (!current)
|
|
3619
|
-
continue;
|
|
3520
|
+
if (!current) continue;
|
|
3620
3521
|
current.animationLast = current.nextAnimationLast;
|
|
3621
3522
|
current.trackLast = current.nextTrackLast;
|
|
3622
3523
|
let currentDelta = delta * current.timeScale;
|
|
3623
3524
|
if (current.delay > 0) {
|
|
3624
3525
|
current.delay -= currentDelta;
|
|
3625
|
-
if (current.delay > 0)
|
|
3626
|
-
continue;
|
|
3526
|
+
if (current.delay > 0) continue;
|
|
3627
3527
|
currentDelta = -current.delay;
|
|
3628
3528
|
current.delay = 0;
|
|
3629
3529
|
}
|
|
@@ -3650,8 +3550,7 @@ var spine = (() => {
|
|
|
3650
3550
|
if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
|
|
3651
3551
|
let from = current.mixingFrom;
|
|
3652
3552
|
current.mixingFrom = null;
|
|
3653
|
-
if (from)
|
|
3654
|
-
from.mixingTo = null;
|
|
3553
|
+
if (from) from.mixingTo = null;
|
|
3655
3554
|
while (from) {
|
|
3656
3555
|
this.queue.end(from);
|
|
3657
3556
|
from = from.mixingFrom;
|
|
@@ -3664,16 +3563,14 @@ var spine = (() => {
|
|
|
3664
3563
|
/** Returns true when all mixing from entries are complete. */
|
|
3665
3564
|
updateMixingFrom(to, delta) {
|
|
3666
3565
|
let from = to.mixingFrom;
|
|
3667
|
-
if (!from)
|
|
3668
|
-
return true;
|
|
3566
|
+
if (!from) return true;
|
|
3669
3567
|
let finished = this.updateMixingFrom(from, delta);
|
|
3670
3568
|
from.animationLast = from.nextAnimationLast;
|
|
3671
3569
|
from.trackLast = from.nextTrackLast;
|
|
3672
3570
|
if (to.nextTrackLast != -1 && to.mixTime >= to.mixDuration) {
|
|
3673
3571
|
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
|
3674
3572
|
to.mixingFrom = from.mixingFrom;
|
|
3675
|
-
if (from.mixingFrom != null)
|
|
3676
|
-
from.mixingFrom.mixingTo = to;
|
|
3573
|
+
if (from.mixingFrom != null) from.mixingFrom.mixingTo = to;
|
|
3677
3574
|
to.interruptAlpha = from.interruptAlpha;
|
|
3678
3575
|
this.queue.end(from);
|
|
3679
3576
|
}
|
|
@@ -3687,17 +3584,14 @@ var spine = (() => {
|
|
|
3687
3584
|
* animation state can be applied to multiple skeletons to pose them identically.
|
|
3688
3585
|
* @returns True if any animations were applied. */
|
|
3689
3586
|
apply(skeleton) {
|
|
3690
|
-
if (!skeleton)
|
|
3691
|
-
|
|
3692
|
-
if (this.animationsChanged)
|
|
3693
|
-
this._animationsChanged();
|
|
3587
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
3588
|
+
if (this.animationsChanged) this._animationsChanged();
|
|
3694
3589
|
let events = this.events;
|
|
3695
3590
|
let tracks = this.tracks;
|
|
3696
3591
|
let applied = false;
|
|
3697
3592
|
for (let i2 = 0, n2 = tracks.length; i2 < n2; i2++) {
|
|
3698
3593
|
let current = tracks[i2];
|
|
3699
|
-
if (!current || current.delay > 0)
|
|
3700
|
-
continue;
|
|
3594
|
+
if (!current || current.delay > 0) continue;
|
|
3701
3595
|
applied = true;
|
|
3702
3596
|
let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
|
|
3703
3597
|
let alpha = current.alpha;
|
|
@@ -3715,8 +3609,7 @@ var spine = (() => {
|
|
|
3715
3609
|
let timelines = current.animation.timelines;
|
|
3716
3610
|
let timelineCount = timelines.length;
|
|
3717
3611
|
if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
|
|
3718
|
-
if (i2 == 0)
|
|
3719
|
-
attachments = true;
|
|
3612
|
+
if (i2 == 0) attachments = true;
|
|
3720
3613
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
3721
3614
|
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3722
3615
|
var timeline = timelines[ii];
|
|
@@ -3729,8 +3622,7 @@ var spine = (() => {
|
|
|
3729
3622
|
let timelineMode = current.timelineMode;
|
|
3730
3623
|
let shortestRotation = current.shortestRotation;
|
|
3731
3624
|
let firstFrame = !shortestRotation && current.timelinesRotation.length != timelineCount << 1;
|
|
3732
|
-
if (firstFrame)
|
|
3733
|
-
current.timelinesRotation.length = timelineCount << 1;
|
|
3625
|
+
if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
|
|
3734
3626
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
3735
3627
|
let timeline2 = timelines[ii];
|
|
3736
3628
|
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
|
|
@@ -3764,19 +3656,15 @@ var spine = (() => {
|
|
|
3764
3656
|
}
|
|
3765
3657
|
applyMixingFrom(to, skeleton, blend) {
|
|
3766
3658
|
let from = to.mixingFrom;
|
|
3767
|
-
if (from.mixingFrom)
|
|
3768
|
-
this.applyMixingFrom(from, skeleton, blend);
|
|
3659
|
+
if (from.mixingFrom) this.applyMixingFrom(from, skeleton, blend);
|
|
3769
3660
|
let mix = 0;
|
|
3770
3661
|
if (to.mixDuration == 0) {
|
|
3771
3662
|
mix = 1;
|
|
3772
|
-
if (blend == 1 /* first */)
|
|
3773
|
-
blend = 0 /* setup */;
|
|
3663
|
+
if (blend == 1 /* first */) blend = 0 /* setup */;
|
|
3774
3664
|
} else {
|
|
3775
3665
|
mix = to.mixTime / to.mixDuration;
|
|
3776
|
-
if (mix > 1)
|
|
3777
|
-
|
|
3778
|
-
if (blend != 1 /* first */)
|
|
3779
|
-
blend = from.mixBlend;
|
|
3666
|
+
if (mix > 1) mix = 1;
|
|
3667
|
+
if (blend != 1 /* first */) blend = from.mixBlend;
|
|
3780
3668
|
}
|
|
3781
3669
|
let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
|
|
3782
3670
|
let timelines = from.animation.timelines;
|
|
@@ -3796,8 +3684,7 @@ var spine = (() => {
|
|
|
3796
3684
|
let timelineHoldMix = from.timelineHoldMix;
|
|
3797
3685
|
let shortestRotation = from.shortestRotation;
|
|
3798
3686
|
let firstFrame = !shortestRotation && from.timelinesRotation.length != timelineCount << 1;
|
|
3799
|
-
if (firstFrame)
|
|
3800
|
-
from.timelinesRotation.length = timelineCount << 1;
|
|
3687
|
+
if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
|
|
3801
3688
|
from.totalAlpha = 0;
|
|
3802
3689
|
for (let i = 0; i < timelineCount; i++) {
|
|
3803
3690
|
let timeline = timelines[i];
|
|
@@ -3806,8 +3693,7 @@ var spine = (() => {
|
|
|
3806
3693
|
let alpha = 0;
|
|
3807
3694
|
switch (timelineMode[i]) {
|
|
3808
3695
|
case SUBSEQUENT:
|
|
3809
|
-
if (!drawOrder && timeline instanceof DrawOrderTimeline)
|
|
3810
|
-
continue;
|
|
3696
|
+
if (!drawOrder && timeline instanceof DrawOrderTimeline) continue;
|
|
3811
3697
|
timelineBlend = blend;
|
|
3812
3698
|
alpha = alphaMix;
|
|
3813
3699
|
break;
|
|
@@ -3842,8 +3728,7 @@ var spine = (() => {
|
|
|
3842
3728
|
}
|
|
3843
3729
|
}
|
|
3844
3730
|
}
|
|
3845
|
-
if (to.mixDuration > 0)
|
|
3846
|
-
this.queueEvents(from, animationTime);
|
|
3731
|
+
if (to.mixDuration > 0) this.queueEvents(from, animationTime);
|
|
3847
3732
|
this.events.length = 0;
|
|
3848
3733
|
from.nextAnimationLast = animationTime;
|
|
3849
3734
|
from.nextTrackLast = from.trackTime;
|
|
@@ -3851,31 +3736,26 @@ var spine = (() => {
|
|
|
3851
3736
|
}
|
|
3852
3737
|
applyAttachmentTimeline(timeline, skeleton, time, blend, attachments) {
|
|
3853
3738
|
var slot = skeleton.slots[timeline.slotIndex];
|
|
3854
|
-
if (!slot.bone.active)
|
|
3855
|
-
return;
|
|
3739
|
+
if (!slot.bone.active) return;
|
|
3856
3740
|
if (time < timeline.frames[0]) {
|
|
3857
3741
|
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
3858
3742
|
this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
|
3859
3743
|
} else
|
|
3860
3744
|
this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
|
|
3861
|
-
if (slot.attachmentState <= this.unkeyedState)
|
|
3862
|
-
slot.attachmentState = this.unkeyedState + SETUP;
|
|
3745
|
+
if (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + SETUP;
|
|
3863
3746
|
}
|
|
3864
3747
|
setAttachment(skeleton, slot, attachmentName, attachments) {
|
|
3865
3748
|
slot.setAttachment(!attachmentName ? null : skeleton.getAttachment(slot.data.index, attachmentName));
|
|
3866
|
-
if (attachments)
|
|
3867
|
-
slot.attachmentState = this.unkeyedState + CURRENT;
|
|
3749
|
+
if (attachments) slot.attachmentState = this.unkeyedState + CURRENT;
|
|
3868
3750
|
}
|
|
3869
3751
|
applyRotateTimeline(timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame) {
|
|
3870
|
-
if (firstFrame)
|
|
3871
|
-
timelinesRotation[i] = 0;
|
|
3752
|
+
if (firstFrame) timelinesRotation[i] = 0;
|
|
3872
3753
|
if (alpha == 1) {
|
|
3873
3754
|
timeline.apply(skeleton, 0, time, null, 1, blend, 0 /* mixIn */);
|
|
3874
3755
|
return;
|
|
3875
3756
|
}
|
|
3876
3757
|
let bone = skeleton.bones[timeline.boneIndex];
|
|
3877
|
-
if (!bone.active)
|
|
3878
|
-
return;
|
|
3758
|
+
if (!bone.active) return;
|
|
3879
3759
|
let frames = timeline.frames;
|
|
3880
3760
|
let r1 = 0, r2 = 0;
|
|
3881
3761
|
if (time < frames[0]) {
|
|
@@ -3917,8 +3797,7 @@ var spine = (() => {
|
|
|
3917
3797
|
else
|
|
3918
3798
|
dir = current;
|
|
3919
3799
|
}
|
|
3920
|
-
if (dir != current)
|
|
3921
|
-
total += 360 * MathUtils.signum(lastTotal);
|
|
3800
|
+
if (dir != current) total += 360 * MathUtils.signum(lastTotal);
|
|
3922
3801
|
timelinesRotation[i] = total;
|
|
3923
3802
|
}
|
|
3924
3803
|
timelinesRotation[i + 1] = diff;
|
|
@@ -3932,10 +3811,8 @@ var spine = (() => {
|
|
|
3932
3811
|
let i = 0, n = events.length;
|
|
3933
3812
|
for (; i < n; i++) {
|
|
3934
3813
|
let event = events[i];
|
|
3935
|
-
if (event.time < trackLastWrapped)
|
|
3936
|
-
|
|
3937
|
-
if (event.time > animationEnd)
|
|
3938
|
-
continue;
|
|
3814
|
+
if (event.time < trackLastWrapped) break;
|
|
3815
|
+
if (event.time > animationEnd) continue;
|
|
3939
3816
|
this.queue.event(entry, event);
|
|
3940
3817
|
}
|
|
3941
3818
|
let complete = false;
|
|
@@ -3948,12 +3825,10 @@ var spine = (() => {
|
|
|
3948
3825
|
}
|
|
3949
3826
|
} else
|
|
3950
3827
|
complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
|
|
3951
|
-
if (complete)
|
|
3952
|
-
this.queue.complete(entry);
|
|
3828
|
+
if (complete) this.queue.complete(entry);
|
|
3953
3829
|
for (; i < n; i++) {
|
|
3954
3830
|
let event = events[i];
|
|
3955
|
-
if (event.time < animationStart)
|
|
3956
|
-
continue;
|
|
3831
|
+
if (event.time < animationStart) continue;
|
|
3957
3832
|
this.queue.event(entry, event);
|
|
3958
3833
|
}
|
|
3959
3834
|
}
|
|
@@ -3975,18 +3850,15 @@ var spine = (() => {
|
|
|
3975
3850
|
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3976
3851
|
* rather than leaving them in their current pose. */
|
|
3977
3852
|
clearTrack(trackIndex) {
|
|
3978
|
-
if (trackIndex >= this.tracks.length)
|
|
3979
|
-
return;
|
|
3853
|
+
if (trackIndex >= this.tracks.length) return;
|
|
3980
3854
|
let current = this.tracks[trackIndex];
|
|
3981
|
-
if (!current)
|
|
3982
|
-
return;
|
|
3855
|
+
if (!current) return;
|
|
3983
3856
|
this.queue.end(current);
|
|
3984
3857
|
this.clearNext(current);
|
|
3985
3858
|
let entry = current;
|
|
3986
3859
|
while (true) {
|
|
3987
3860
|
let from = entry.mixingFrom;
|
|
3988
|
-
if (!from)
|
|
3989
|
-
break;
|
|
3861
|
+
if (!from) break;
|
|
3990
3862
|
this.queue.end(from);
|
|
3991
3863
|
entry.mixingFrom = null;
|
|
3992
3864
|
entry.mixingTo = null;
|
|
@@ -4000,8 +3872,7 @@ var spine = (() => {
|
|
|
4000
3872
|
this.tracks[index] = current;
|
|
4001
3873
|
current.previous = null;
|
|
4002
3874
|
if (from) {
|
|
4003
|
-
if (interrupt)
|
|
4004
|
-
this.queue.interrupt(from);
|
|
3875
|
+
if (interrupt) this.queue.interrupt(from);
|
|
4005
3876
|
current.mixingFrom = from;
|
|
4006
3877
|
from.mixingTo = current;
|
|
4007
3878
|
current.mixTime = 0;
|
|
@@ -4016,8 +3887,7 @@ var spine = (() => {
|
|
|
4016
3887
|
* See {@link #setAnimationWith()}. */
|
|
4017
3888
|
setAnimation(trackIndex, animationName, loop = false) {
|
|
4018
3889
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
4019
|
-
if (!animation)
|
|
4020
|
-
throw new Error("Animation not found: " + animationName);
|
|
3890
|
+
if (!animation) throw new Error("Animation not found: " + animationName);
|
|
4021
3891
|
return this.setAnimationWith(trackIndex, animation, loop);
|
|
4022
3892
|
}
|
|
4023
3893
|
/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
|
|
@@ -4027,8 +3897,7 @@ var spine = (() => {
|
|
|
4027
3897
|
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
4028
3898
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
4029
3899
|
setAnimationWith(trackIndex, animation, loop = false) {
|
|
4030
|
-
if (!animation)
|
|
4031
|
-
throw new Error("animation cannot be null.");
|
|
3900
|
+
if (!animation) throw new Error("animation cannot be null.");
|
|
4032
3901
|
let interrupt = true;
|
|
4033
3902
|
let current = this.expandToIndex(trackIndex);
|
|
4034
3903
|
if (current) {
|
|
@@ -4052,8 +3921,7 @@ var spine = (() => {
|
|
|
4052
3921
|
* See {@link #addAnimationWith()}. */
|
|
4053
3922
|
addAnimation(trackIndex, animationName, loop = false, delay = 0) {
|
|
4054
3923
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
4055
|
-
if (!animation)
|
|
4056
|
-
throw new Error("Animation not found: " + animationName);
|
|
3924
|
+
if (!animation) throw new Error("Animation not found: " + animationName);
|
|
4057
3925
|
return this.addAnimationWith(trackIndex, animation, loop, delay);
|
|
4058
3926
|
}
|
|
4059
3927
|
/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
|
|
@@ -4065,8 +3933,7 @@ var spine = (() => {
|
|
|
4065
3933
|
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
4066
3934
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
4067
3935
|
addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
|
|
4068
|
-
if (!animation)
|
|
4069
|
-
throw new Error("animation cannot be null.");
|
|
3936
|
+
if (!animation) throw new Error("animation cannot be null.");
|
|
4070
3937
|
let last = this.expandToIndex(trackIndex);
|
|
4071
3938
|
if (last) {
|
|
4072
3939
|
while (last.next)
|
|
@@ -4076,11 +3943,11 @@ var spine = (() => {
|
|
|
4076
3943
|
if (!last) {
|
|
4077
3944
|
this.setCurrent(trackIndex, entry, true);
|
|
4078
3945
|
this.queue.drain();
|
|
3946
|
+
if (delay < 0) delay = 0;
|
|
4079
3947
|
} else {
|
|
4080
3948
|
last.next = entry;
|
|
4081
3949
|
entry.previous = last;
|
|
4082
|
-
if (delay <= 0)
|
|
4083
|
-
delay += last.getTrackComplete() - entry.mixDuration;
|
|
3950
|
+
if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
|
|
4084
3951
|
}
|
|
4085
3952
|
entry.delay = delay;
|
|
4086
3953
|
return entry;
|
|
@@ -4118,8 +3985,7 @@ var spine = (() => {
|
|
|
4118
3985
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
4119
3986
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
4120
3987
|
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
4121
|
-
if (delay <= 0)
|
|
4122
|
-
entry.delay += entry.mixDuration - mixDuration;
|
|
3988
|
+
if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
|
|
4123
3989
|
entry.mixDuration = mixDuration;
|
|
4124
3990
|
entry.trackEnd = mixDuration;
|
|
4125
3991
|
return entry;
|
|
@@ -4131,15 +3997,13 @@ var spine = (() => {
|
|
|
4131
3997
|
this.queue.drainDisabled = true;
|
|
4132
3998
|
for (let i = 0, n = this.tracks.length; i < n; i++) {
|
|
4133
3999
|
let current = this.tracks[i];
|
|
4134
|
-
if (current)
|
|
4135
|
-
this.setEmptyAnimation(current.trackIndex, mixDuration);
|
|
4000
|
+
if (current) this.setEmptyAnimation(current.trackIndex, mixDuration);
|
|
4136
4001
|
}
|
|
4137
4002
|
this.queue.drainDisabled = oldDrainDisabled;
|
|
4138
4003
|
this.queue.drain();
|
|
4139
4004
|
}
|
|
4140
4005
|
expandToIndex(index) {
|
|
4141
|
-
if (index < this.tracks.length)
|
|
4142
|
-
return this.tracks[index];
|
|
4006
|
+
if (index < this.tracks.length) return this.tracks[index];
|
|
4143
4007
|
Utils.ensureArrayCapacity(this.tracks, index + 1, null);
|
|
4144
4008
|
this.tracks.length = index + 1;
|
|
4145
4009
|
return null;
|
|
@@ -4191,13 +4055,11 @@ var spine = (() => {
|
|
|
4191
4055
|
let tracks = this.tracks;
|
|
4192
4056
|
for (let i = 0, n = tracks.length; i < n; i++) {
|
|
4193
4057
|
let entry = tracks[i];
|
|
4194
|
-
if (!entry)
|
|
4195
|
-
continue;
|
|
4058
|
+
if (!entry) continue;
|
|
4196
4059
|
while (entry.mixingFrom)
|
|
4197
4060
|
entry = entry.mixingFrom;
|
|
4198
4061
|
do {
|
|
4199
|
-
if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
|
|
4200
|
-
this.computeHold(entry);
|
|
4062
|
+
if (!entry.mixingTo || entry.mixBlend != 3 /* add */) this.computeHold(entry);
|
|
4201
4063
|
entry = entry.mixingTo;
|
|
4202
4064
|
} while (entry);
|
|
4203
4065
|
}
|
|
@@ -4226,8 +4088,7 @@ var spine = (() => {
|
|
|
4226
4088
|
timelineMode[i] = FIRST;
|
|
4227
4089
|
} else {
|
|
4228
4090
|
for (let next = to.mixingTo; next; next = next.mixingTo) {
|
|
4229
|
-
if (next.animation.hasTimeline(ids))
|
|
4230
|
-
continue;
|
|
4091
|
+
if (next.animation.hasTimeline(ids)) continue;
|
|
4231
4092
|
if (entry.mixDuration > 0) {
|
|
4232
4093
|
timelineMode[i] = HOLD_MIX;
|
|
4233
4094
|
timelineHoldMix[i] = next;
|
|
@@ -4241,21 +4102,18 @@ var spine = (() => {
|
|
|
4241
4102
|
}
|
|
4242
4103
|
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
|
|
4243
4104
|
getCurrent(trackIndex) {
|
|
4244
|
-
if (trackIndex >= this.tracks.length)
|
|
4245
|
-
return null;
|
|
4105
|
+
if (trackIndex >= this.tracks.length) return null;
|
|
4246
4106
|
return this.tracks[trackIndex];
|
|
4247
4107
|
}
|
|
4248
4108
|
/** Adds a listener to receive events for all track entries. */
|
|
4249
4109
|
addListener(listener) {
|
|
4250
|
-
if (!listener)
|
|
4251
|
-
throw new Error("listener cannot be null.");
|
|
4110
|
+
if (!listener) throw new Error("listener cannot be null.");
|
|
4252
4111
|
this.listeners.push(listener);
|
|
4253
4112
|
}
|
|
4254
4113
|
/** Removes the listener added with {@link #addListener()}. */
|
|
4255
4114
|
removeListener(listener) {
|
|
4256
4115
|
let index = this.listeners.indexOf(listener);
|
|
4257
|
-
if (index >= 0)
|
|
4258
|
-
this.listeners.splice(index, 1);
|
|
4116
|
+
if (index >= 0) this.listeners.splice(index, 1);
|
|
4259
4117
|
}
|
|
4260
4118
|
/** Removes all listeners added with {@link #addListener()}. */
|
|
4261
4119
|
clearListeners() {
|
|
@@ -4268,8 +4126,6 @@ var spine = (() => {
|
|
|
4268
4126
|
this.queue.clear();
|
|
4269
4127
|
}
|
|
4270
4128
|
};
|
|
4271
|
-
var AnimationState = _AnimationState;
|
|
4272
|
-
__publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
|
|
4273
4129
|
var TrackEntry = class {
|
|
4274
4130
|
/** The animation to apply for this track entry. */
|
|
4275
4131
|
animation = null;
|
|
@@ -4403,8 +4259,12 @@ var spine = (() => {
|
|
|
4403
4259
|
}
|
|
4404
4260
|
setMixDurationWithDelay(mixDuration, delay) {
|
|
4405
4261
|
this._mixDuration = mixDuration;
|
|
4406
|
-
if (
|
|
4407
|
-
|
|
4262
|
+
if (delay <= 0) {
|
|
4263
|
+
if (this.previous != null)
|
|
4264
|
+
delay = Math.max(delay + this.previous.getTrackComplete() - mixDuration, 0);
|
|
4265
|
+
else
|
|
4266
|
+
delay = 0;
|
|
4267
|
+
}
|
|
4408
4268
|
this.delay = delay;
|
|
4409
4269
|
}
|
|
4410
4270
|
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
|
@@ -4434,8 +4294,7 @@ var spine = (() => {
|
|
|
4434
4294
|
getAnimationTime() {
|
|
4435
4295
|
if (this.loop) {
|
|
4436
4296
|
let duration = this.animationEnd - this.animationStart;
|
|
4437
|
-
if (duration == 0)
|
|
4438
|
-
return this.animationStart;
|
|
4297
|
+
if (duration == 0) return this.animationStart;
|
|
4439
4298
|
return this.trackTime % duration + this.animationStart;
|
|
4440
4299
|
}
|
|
4441
4300
|
return Math.min(this.trackTime + this.animationStart, this.animationEnd);
|
|
@@ -4463,10 +4322,8 @@ var spine = (() => {
|
|
|
4463
4322
|
getTrackComplete() {
|
|
4464
4323
|
let duration = this.animationEnd - this.animationStart;
|
|
4465
4324
|
if (duration != 0) {
|
|
4466
|
-
if (this.loop)
|
|
4467
|
-
|
|
4468
|
-
if (this.trackTime < duration)
|
|
4469
|
-
return duration;
|
|
4325
|
+
if (this.loop) return duration * (1 + (this.trackTime / duration | 0));
|
|
4326
|
+
if (this.trackTime < duration) return duration;
|
|
4470
4327
|
}
|
|
4471
4328
|
return this.trackTime;
|
|
4472
4329
|
}
|
|
@@ -4490,35 +4347,34 @@ var spine = (() => {
|
|
|
4490
4347
|
this.animState = animState;
|
|
4491
4348
|
}
|
|
4492
4349
|
start(entry) {
|
|
4493
|
-
this.objects.push(
|
|
4350
|
+
this.objects.push(0 /* start */);
|
|
4494
4351
|
this.objects.push(entry);
|
|
4495
4352
|
this.animState.animationsChanged = true;
|
|
4496
4353
|
}
|
|
4497
4354
|
interrupt(entry) {
|
|
4498
|
-
this.objects.push(
|
|
4355
|
+
this.objects.push(1 /* interrupt */);
|
|
4499
4356
|
this.objects.push(entry);
|
|
4500
4357
|
}
|
|
4501
4358
|
end(entry) {
|
|
4502
|
-
this.objects.push(
|
|
4359
|
+
this.objects.push(2 /* end */);
|
|
4503
4360
|
this.objects.push(entry);
|
|
4504
4361
|
this.animState.animationsChanged = true;
|
|
4505
4362
|
}
|
|
4506
4363
|
dispose(entry) {
|
|
4507
|
-
this.objects.push(
|
|
4364
|
+
this.objects.push(3 /* dispose */);
|
|
4508
4365
|
this.objects.push(entry);
|
|
4509
4366
|
}
|
|
4510
4367
|
complete(entry) {
|
|
4511
|
-
this.objects.push(
|
|
4368
|
+
this.objects.push(4 /* complete */);
|
|
4512
4369
|
this.objects.push(entry);
|
|
4513
4370
|
}
|
|
4514
4371
|
event(entry, event) {
|
|
4515
|
-
this.objects.push(
|
|
4372
|
+
this.objects.push(5 /* event */);
|
|
4516
4373
|
this.objects.push(entry);
|
|
4517
4374
|
this.objects.push(event);
|
|
4518
4375
|
}
|
|
4519
4376
|
drain() {
|
|
4520
|
-
if (this.drainDisabled)
|
|
4521
|
-
return;
|
|
4377
|
+
if (this.drainDisabled) return;
|
|
4522
4378
|
this.drainDisabled = true;
|
|
4523
4379
|
let objects = this.objects;
|
|
4524
4380
|
let listeners = this.animState.listeners;
|
|
@@ -4526,59 +4382,48 @@ var spine = (() => {
|
|
|
4526
4382
|
let type = objects[i];
|
|
4527
4383
|
let entry = objects[i + 1];
|
|
4528
4384
|
switch (type) {
|
|
4529
|
-
case
|
|
4530
|
-
if (entry.listener && entry.listener.start)
|
|
4531
|
-
entry.listener.start(entry);
|
|
4385
|
+
case 0 /* start */:
|
|
4386
|
+
if (entry.listener && entry.listener.start) entry.listener.start(entry);
|
|
4532
4387
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4533
4388
|
let listener = listeners[ii];
|
|
4534
|
-
if (listener.start)
|
|
4535
|
-
listener.start(entry);
|
|
4389
|
+
if (listener.start) listener.start(entry);
|
|
4536
4390
|
}
|
|
4537
4391
|
break;
|
|
4538
|
-
case
|
|
4539
|
-
if (entry.listener && entry.listener.interrupt)
|
|
4540
|
-
entry.listener.interrupt(entry);
|
|
4392
|
+
case 1 /* interrupt */:
|
|
4393
|
+
if (entry.listener && entry.listener.interrupt) entry.listener.interrupt(entry);
|
|
4541
4394
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4542
4395
|
let listener = listeners[ii];
|
|
4543
|
-
if (listener.interrupt)
|
|
4544
|
-
listener.interrupt(entry);
|
|
4396
|
+
if (listener.interrupt) listener.interrupt(entry);
|
|
4545
4397
|
}
|
|
4546
4398
|
break;
|
|
4547
|
-
case
|
|
4548
|
-
if (entry.listener && entry.listener.end)
|
|
4549
|
-
entry.listener.end(entry);
|
|
4399
|
+
case 2 /* end */:
|
|
4400
|
+
if (entry.listener && entry.listener.end) entry.listener.end(entry);
|
|
4550
4401
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4551
4402
|
let listener = listeners[ii];
|
|
4552
|
-
if (listener.end)
|
|
4553
|
-
listener.end(entry);
|
|
4403
|
+
if (listener.end) listener.end(entry);
|
|
4554
4404
|
}
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4405
|
+
// Fall through.
|
|
4406
|
+
case 3 /* dispose */:
|
|
4407
|
+
if (entry.listener && entry.listener.dispose) entry.listener.dispose(entry);
|
|
4558
4408
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4559
4409
|
let listener = listeners[ii];
|
|
4560
|
-
if (listener.dispose)
|
|
4561
|
-
listener.dispose(entry);
|
|
4410
|
+
if (listener.dispose) listener.dispose(entry);
|
|
4562
4411
|
}
|
|
4563
4412
|
this.animState.trackEntryPool.free(entry);
|
|
4564
4413
|
break;
|
|
4565
|
-
case
|
|
4566
|
-
if (entry.listener && entry.listener.complete)
|
|
4567
|
-
entry.listener.complete(entry);
|
|
4414
|
+
case 4 /* complete */:
|
|
4415
|
+
if (entry.listener && entry.listener.complete) entry.listener.complete(entry);
|
|
4568
4416
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4569
4417
|
let listener = listeners[ii];
|
|
4570
|
-
if (listener.complete)
|
|
4571
|
-
listener.complete(entry);
|
|
4418
|
+
if (listener.complete) listener.complete(entry);
|
|
4572
4419
|
}
|
|
4573
4420
|
break;
|
|
4574
|
-
case
|
|
4421
|
+
case 5 /* event */:
|
|
4575
4422
|
let event = objects[i++ + 2];
|
|
4576
|
-
if (entry.listener && entry.listener.event)
|
|
4577
|
-
entry.listener.event(entry, event);
|
|
4423
|
+
if (entry.listener && entry.listener.event) entry.listener.event(entry, event);
|
|
4578
4424
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4579
4425
|
let listener = listeners[ii];
|
|
4580
|
-
if (listener.event)
|
|
4581
|
-
listener.event(entry, event);
|
|
4426
|
+
if (listener.event) listener.event(entry, event);
|
|
4582
4427
|
}
|
|
4583
4428
|
break;
|
|
4584
4429
|
}
|
|
@@ -4629,8 +4474,7 @@ var spine = (() => {
|
|
|
4629
4474
|
/** The mix duration to use when no mix duration has been defined between two animations. */
|
|
4630
4475
|
defaultMix = 0;
|
|
4631
4476
|
constructor(skeletonData) {
|
|
4632
|
-
if (!skeletonData)
|
|
4633
|
-
throw new Error("skeletonData cannot be null.");
|
|
4477
|
+
if (!skeletonData) throw new Error("skeletonData cannot be null.");
|
|
4634
4478
|
this.skeletonData = skeletonData;
|
|
4635
4479
|
}
|
|
4636
4480
|
/** Sets a mix duration by animation name.
|
|
@@ -4638,21 +4482,17 @@ var spine = (() => {
|
|
|
4638
4482
|
* See {@link #setMixWith()}. */
|
|
4639
4483
|
setMix(fromName, toName, duration) {
|
|
4640
4484
|
let from = this.skeletonData.findAnimation(fromName);
|
|
4641
|
-
if (!from)
|
|
4642
|
-
throw new Error("Animation not found: " + fromName);
|
|
4485
|
+
if (!from) throw new Error("Animation not found: " + fromName);
|
|
4643
4486
|
let to = this.skeletonData.findAnimation(toName);
|
|
4644
|
-
if (!to)
|
|
4645
|
-
throw new Error("Animation not found: " + toName);
|
|
4487
|
+
if (!to) throw new Error("Animation not found: " + toName);
|
|
4646
4488
|
this.setMixWith(from, to, duration);
|
|
4647
4489
|
}
|
|
4648
4490
|
/** Sets the mix duration when changing from the specified animation to the other.
|
|
4649
4491
|
*
|
|
4650
4492
|
* See {@link TrackEntry#mixDuration}. */
|
|
4651
4493
|
setMixWith(from, to, duration) {
|
|
4652
|
-
if (!from)
|
|
4653
|
-
|
|
4654
|
-
if (!to)
|
|
4655
|
-
throw new Error("to cannot be null.");
|
|
4494
|
+
if (!from) throw new Error("from cannot be null.");
|
|
4495
|
+
if (!to) throw new Error("to cannot be null.");
|
|
4656
4496
|
let key = from.name + "." + to.name;
|
|
4657
4497
|
this.animationToMixTime[key] = duration;
|
|
4658
4498
|
}
|
|
@@ -4666,13 +4506,13 @@ var spine = (() => {
|
|
|
4666
4506
|
};
|
|
4667
4507
|
|
|
4668
4508
|
// spine-core/src/attachments/BoundingBoxAttachment.ts
|
|
4669
|
-
var BoundingBoxAttachment = class extends VertexAttachment {
|
|
4509
|
+
var BoundingBoxAttachment = class _BoundingBoxAttachment extends VertexAttachment {
|
|
4670
4510
|
color = new Color(1, 1, 1, 1);
|
|
4671
4511
|
constructor(name) {
|
|
4672
4512
|
super(name);
|
|
4673
4513
|
}
|
|
4674
4514
|
copy() {
|
|
4675
|
-
let copy = new
|
|
4515
|
+
let copy = new _BoundingBoxAttachment(this.name);
|
|
4676
4516
|
this.copyTo(copy);
|
|
4677
4517
|
copy.color.setFromColor(this.color);
|
|
4678
4518
|
return copy;
|
|
@@ -4680,7 +4520,7 @@ var spine = (() => {
|
|
|
4680
4520
|
};
|
|
4681
4521
|
|
|
4682
4522
|
// spine-core/src/attachments/ClippingAttachment.ts
|
|
4683
|
-
var ClippingAttachment = class extends VertexAttachment {
|
|
4523
|
+
var ClippingAttachment = class _ClippingAttachment extends VertexAttachment {
|
|
4684
4524
|
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
|
|
4685
4525
|
* the skeleton's rendering. */
|
|
4686
4526
|
endSlot = null;
|
|
@@ -4693,7 +4533,7 @@ var spine = (() => {
|
|
|
4693
4533
|
super(name);
|
|
4694
4534
|
}
|
|
4695
4535
|
copy() {
|
|
4696
|
-
let copy = new
|
|
4536
|
+
let copy = new _ClippingAttachment(this.name);
|
|
4697
4537
|
this.copyTo(copy);
|
|
4698
4538
|
copy.endSlot = this.endSlot;
|
|
4699
4539
|
copy.color.setFromColor(this.color);
|
|
@@ -4769,10 +4609,8 @@ var spine = (() => {
|
|
|
4769
4609
|
page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
|
|
4770
4610
|
};
|
|
4771
4611
|
pageFields["repeat"] = (page2) => {
|
|
4772
|
-
if (entry[1].indexOf("x") != -1)
|
|
4773
|
-
|
|
4774
|
-
if (entry[1].indexOf("y") != -1)
|
|
4775
|
-
page2.vWrap = 10497 /* Repeat */;
|
|
4612
|
+
if (entry[1].indexOf("x") != -1) page2.uWrap = 10497 /* Repeat */;
|
|
4613
|
+
if (entry[1].indexOf("y") != -1) page2.vWrap = 10497 /* Repeat */;
|
|
4776
4614
|
};
|
|
4777
4615
|
pageFields["pma"] = (page2) => {
|
|
4778
4616
|
page2.pma = entry[1] == "true";
|
|
@@ -4820,45 +4658,37 @@ var spine = (() => {
|
|
|
4820
4658
|
while (line && line.trim().length == 0)
|
|
4821
4659
|
line = reader.readLine();
|
|
4822
4660
|
while (true) {
|
|
4823
|
-
if (!line || line.trim().length == 0)
|
|
4824
|
-
|
|
4825
|
-
if (reader.readEntry(entry, line) == 0)
|
|
4826
|
-
break;
|
|
4661
|
+
if (!line || line.trim().length == 0) break;
|
|
4662
|
+
if (reader.readEntry(entry, line) == 0) break;
|
|
4827
4663
|
line = reader.readLine();
|
|
4828
4664
|
}
|
|
4829
4665
|
let page = null;
|
|
4830
4666
|
let names = null;
|
|
4831
4667
|
let values = null;
|
|
4832
4668
|
while (true) {
|
|
4833
|
-
if (line === null)
|
|
4834
|
-
break;
|
|
4669
|
+
if (line === null) break;
|
|
4835
4670
|
if (line.trim().length == 0) {
|
|
4836
4671
|
page = null;
|
|
4837
4672
|
line = reader.readLine();
|
|
4838
4673
|
} else if (!page) {
|
|
4839
4674
|
page = new TextureAtlasPage(line.trim());
|
|
4840
4675
|
while (true) {
|
|
4841
|
-
if (reader.readEntry(entry, line = reader.readLine()) == 0)
|
|
4842
|
-
break;
|
|
4676
|
+
if (reader.readEntry(entry, line = reader.readLine()) == 0) break;
|
|
4843
4677
|
let field = pageFields[entry[0]];
|
|
4844
|
-
if (field)
|
|
4845
|
-
field(page);
|
|
4678
|
+
if (field) field(page);
|
|
4846
4679
|
}
|
|
4847
4680
|
this.pages.push(page);
|
|
4848
4681
|
} else {
|
|
4849
4682
|
let region = new TextureAtlasRegion(page, line);
|
|
4850
4683
|
while (true) {
|
|
4851
4684
|
let count = reader.readEntry(entry, line = reader.readLine());
|
|
4852
|
-
if (count == 0)
|
|
4853
|
-
break;
|
|
4685
|
+
if (count == 0) break;
|
|
4854
4686
|
let field = regionFields[entry[0]];
|
|
4855
4687
|
if (field)
|
|
4856
4688
|
field(region);
|
|
4857
4689
|
else {
|
|
4858
|
-
if (!names)
|
|
4859
|
-
|
|
4860
|
-
if (!values)
|
|
4861
|
-
values = [];
|
|
4690
|
+
if (!names) names = [];
|
|
4691
|
+
if (!values) values = [];
|
|
4862
4692
|
names.push(entry[0]);
|
|
4863
4693
|
let entryValues = [];
|
|
4864
4694
|
for (let i = 0; i < count; i++)
|
|
@@ -4919,14 +4749,11 @@ var spine = (() => {
|
|
|
4919
4749
|
return this.lines[this.index++];
|
|
4920
4750
|
}
|
|
4921
4751
|
readEntry(entry, line) {
|
|
4922
|
-
if (!line)
|
|
4923
|
-
return 0;
|
|
4752
|
+
if (!line) return 0;
|
|
4924
4753
|
line = line.trim();
|
|
4925
|
-
if (line.length == 0)
|
|
4926
|
-
return 0;
|
|
4754
|
+
if (line.length == 0) return 0;
|
|
4927
4755
|
let colon = line.indexOf(":");
|
|
4928
|
-
if (colon == -1)
|
|
4929
|
-
return 0;
|
|
4756
|
+
if (colon == -1) return 0;
|
|
4930
4757
|
entry[0] = line.substr(0, colon).trim();
|
|
4931
4758
|
for (let i = 1, lastMatch = colon + 1; ; i++) {
|
|
4932
4759
|
let comma = line.indexOf(",", lastMatch);
|
|
@@ -4936,8 +4763,7 @@ var spine = (() => {
|
|
|
4936
4763
|
}
|
|
4937
4764
|
entry[i] = line.substr(lastMatch, comma - lastMatch).trim();
|
|
4938
4765
|
lastMatch = comma + 1;
|
|
4939
|
-
if (i == 4)
|
|
4940
|
-
return 4;
|
|
4766
|
+
if (i == 4) return 4;
|
|
4941
4767
|
}
|
|
4942
4768
|
}
|
|
4943
4769
|
};
|
|
@@ -4985,7 +4811,7 @@ var spine = (() => {
|
|
|
4985
4811
|
};
|
|
4986
4812
|
|
|
4987
4813
|
// spine-core/src/attachments/MeshAttachment.ts
|
|
4988
|
-
var MeshAttachment = class extends VertexAttachment {
|
|
4814
|
+
var MeshAttachment = class _MeshAttachment extends VertexAttachment {
|
|
4989
4815
|
region = null;
|
|
4990
4816
|
/** The name of the texture region for this attachment. */
|
|
4991
4817
|
path;
|
|
@@ -5018,11 +4844,9 @@ var spine = (() => {
|
|
|
5018
4844
|
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
|
|
5019
4845
|
* the {@link #regionUVs} are changed. */
|
|
5020
4846
|
updateRegion() {
|
|
5021
|
-
if (!this.region)
|
|
5022
|
-
throw new Error("Region not set.");
|
|
4847
|
+
if (!this.region) throw new Error("Region not set.");
|
|
5023
4848
|
let regionUVs = this.regionUVs;
|
|
5024
|
-
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
5025
|
-
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
4849
|
+
if (!this.uvs || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
5026
4850
|
let uvs = this.uvs;
|
|
5027
4851
|
let n = this.uvs.length;
|
|
5028
4852
|
let u = this.region.u, v = this.region.v, width = 0, height = 0;
|
|
@@ -5097,9 +4921,8 @@ var spine = (() => {
|
|
|
5097
4921
|
}
|
|
5098
4922
|
}
|
|
5099
4923
|
copy() {
|
|
5100
|
-
if (this.parentMesh)
|
|
5101
|
-
|
|
5102
|
-
let copy = new MeshAttachment(this.name, this.path);
|
|
4924
|
+
if (this.parentMesh) return this.newLinkedMesh();
|
|
4925
|
+
let copy = new _MeshAttachment(this.name, this.path);
|
|
5103
4926
|
copy.region = this.region;
|
|
5104
4927
|
copy.color.setFromColor(this.color);
|
|
5105
4928
|
this.copyTo(copy);
|
|
@@ -5120,25 +4943,23 @@ var spine = (() => {
|
|
|
5120
4943
|
return copy;
|
|
5121
4944
|
}
|
|
5122
4945
|
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
|
|
5123
|
-
if (this.sequence != null)
|
|
5124
|
-
this.sequence.apply(slot, this);
|
|
4946
|
+
if (this.sequence != null) this.sequence.apply(slot, this);
|
|
5125
4947
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
5126
4948
|
}
|
|
5127
4949
|
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
|
|
5128
4950
|
newLinkedMesh() {
|
|
5129
|
-
let copy = new
|
|
4951
|
+
let copy = new _MeshAttachment(this.name, this.path);
|
|
5130
4952
|
copy.region = this.region;
|
|
5131
4953
|
copy.color.setFromColor(this.color);
|
|
5132
4954
|
copy.timelineAttachment = this.timelineAttachment;
|
|
5133
4955
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
5134
|
-
if (copy.region != null)
|
|
5135
|
-
copy.updateRegion();
|
|
4956
|
+
if (copy.region != null) copy.updateRegion();
|
|
5136
4957
|
return copy;
|
|
5137
4958
|
}
|
|
5138
4959
|
};
|
|
5139
4960
|
|
|
5140
4961
|
// spine-core/src/attachments/PathAttachment.ts
|
|
5141
|
-
var PathAttachment = class extends VertexAttachment {
|
|
4962
|
+
var PathAttachment = class _PathAttachment extends VertexAttachment {
|
|
5142
4963
|
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
|
5143
4964
|
lengths = [];
|
|
5144
4965
|
/** If true, the start and end knots are connected. */
|
|
@@ -5153,7 +4974,7 @@ var spine = (() => {
|
|
|
5153
4974
|
super(name);
|
|
5154
4975
|
}
|
|
5155
4976
|
copy() {
|
|
5156
|
-
let copy = new
|
|
4977
|
+
let copy = new _PathAttachment(this.name);
|
|
5157
4978
|
this.copyTo(copy);
|
|
5158
4979
|
copy.lengths = new Array(this.lengths.length);
|
|
5159
4980
|
Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
|
@@ -5165,7 +4986,7 @@ var spine = (() => {
|
|
|
5165
4986
|
};
|
|
5166
4987
|
|
|
5167
4988
|
// spine-core/src/attachments/PointAttachment.ts
|
|
5168
|
-
var PointAttachment = class extends VertexAttachment {
|
|
4989
|
+
var PointAttachment = class _PointAttachment extends VertexAttachment {
|
|
5169
4990
|
x = 0;
|
|
5170
4991
|
y = 0;
|
|
5171
4992
|
rotation = 0;
|
|
@@ -5187,7 +5008,7 @@ var spine = (() => {
|
|
|
5187
5008
|
return MathUtils.atan2Deg(y, x);
|
|
5188
5009
|
}
|
|
5189
5010
|
copy() {
|
|
5190
|
-
let copy = new
|
|
5011
|
+
let copy = new _PointAttachment(this.name);
|
|
5191
5012
|
copy.x = this.x;
|
|
5192
5013
|
copy.y = this.y;
|
|
5193
5014
|
copy.rotation = this.rotation;
|
|
@@ -5197,7 +5018,7 @@ var spine = (() => {
|
|
|
5197
5018
|
};
|
|
5198
5019
|
|
|
5199
5020
|
// spine-core/src/attachments/RegionAttachment.ts
|
|
5200
|
-
var
|
|
5021
|
+
var RegionAttachment = class _RegionAttachment extends Attachment {
|
|
5201
5022
|
/** The local x translation. */
|
|
5202
5023
|
x = 0;
|
|
5203
5024
|
/** The local y translation. */
|
|
@@ -5230,8 +5051,7 @@ var spine = (() => {
|
|
|
5230
5051
|
}
|
|
5231
5052
|
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
|
|
5232
5053
|
updateRegion() {
|
|
5233
|
-
if (!this.region)
|
|
5234
|
-
throw new Error("Region not set.");
|
|
5054
|
+
if (!this.region) throw new Error("Region not set.");
|
|
5235
5055
|
let region = this.region;
|
|
5236
5056
|
let uvs = this.uvs;
|
|
5237
5057
|
if (region == null) {
|
|
@@ -5344,40 +5164,39 @@ var spine = (() => {
|
|
|
5344
5164
|
copy.sequence = this.sequence != null ? this.sequence.copy() : null;
|
|
5345
5165
|
return copy;
|
|
5346
5166
|
}
|
|
5167
|
+
static X1 = 0;
|
|
5168
|
+
static Y1 = 1;
|
|
5169
|
+
static C1R = 2;
|
|
5170
|
+
static C1G = 3;
|
|
5171
|
+
static C1B = 4;
|
|
5172
|
+
static C1A = 5;
|
|
5173
|
+
static U1 = 6;
|
|
5174
|
+
static V1 = 7;
|
|
5175
|
+
static X2 = 8;
|
|
5176
|
+
static Y2 = 9;
|
|
5177
|
+
static C2R = 10;
|
|
5178
|
+
static C2G = 11;
|
|
5179
|
+
static C2B = 12;
|
|
5180
|
+
static C2A = 13;
|
|
5181
|
+
static U2 = 14;
|
|
5182
|
+
static V2 = 15;
|
|
5183
|
+
static X3 = 16;
|
|
5184
|
+
static Y3 = 17;
|
|
5185
|
+
static C3R = 18;
|
|
5186
|
+
static C3G = 19;
|
|
5187
|
+
static C3B = 20;
|
|
5188
|
+
static C3A = 21;
|
|
5189
|
+
static U3 = 22;
|
|
5190
|
+
static V3 = 23;
|
|
5191
|
+
static X4 = 24;
|
|
5192
|
+
static Y4 = 25;
|
|
5193
|
+
static C4R = 26;
|
|
5194
|
+
static C4G = 27;
|
|
5195
|
+
static C4B = 28;
|
|
5196
|
+
static C4A = 29;
|
|
5197
|
+
static U4 = 30;
|
|
5198
|
+
static V4 = 31;
|
|
5347
5199
|
};
|
|
5348
|
-
var RegionAttachment = _RegionAttachment;
|
|
5349
|
-
__publicField(RegionAttachment, "X1", 0);
|
|
5350
|
-
__publicField(RegionAttachment, "Y1", 1);
|
|
5351
|
-
__publicField(RegionAttachment, "C1R", 2);
|
|
5352
|
-
__publicField(RegionAttachment, "C1G", 3);
|
|
5353
|
-
__publicField(RegionAttachment, "C1B", 4);
|
|
5354
|
-
__publicField(RegionAttachment, "C1A", 5);
|
|
5355
|
-
__publicField(RegionAttachment, "U1", 6);
|
|
5356
|
-
__publicField(RegionAttachment, "V1", 7);
|
|
5357
|
-
__publicField(RegionAttachment, "X2", 8);
|
|
5358
|
-
__publicField(RegionAttachment, "Y2", 9);
|
|
5359
|
-
__publicField(RegionAttachment, "C2R", 10);
|
|
5360
|
-
__publicField(RegionAttachment, "C2G", 11);
|
|
5361
|
-
__publicField(RegionAttachment, "C2B", 12);
|
|
5362
|
-
__publicField(RegionAttachment, "C2A", 13);
|
|
5363
|
-
__publicField(RegionAttachment, "U2", 14);
|
|
5364
|
-
__publicField(RegionAttachment, "V2", 15);
|
|
5365
|
-
__publicField(RegionAttachment, "X3", 16);
|
|
5366
|
-
__publicField(RegionAttachment, "Y3", 17);
|
|
5367
|
-
__publicField(RegionAttachment, "C3R", 18);
|
|
5368
|
-
__publicField(RegionAttachment, "C3G", 19);
|
|
5369
|
-
__publicField(RegionAttachment, "C3B", 20);
|
|
5370
|
-
__publicField(RegionAttachment, "C3A", 21);
|
|
5371
|
-
__publicField(RegionAttachment, "U3", 22);
|
|
5372
|
-
__publicField(RegionAttachment, "V3", 23);
|
|
5373
|
-
__publicField(RegionAttachment, "X4", 24);
|
|
5374
|
-
__publicField(RegionAttachment, "Y4", 25);
|
|
5375
|
-
__publicField(RegionAttachment, "C4R", 26);
|
|
5376
|
-
__publicField(RegionAttachment, "C4G", 27);
|
|
5377
|
-
__publicField(RegionAttachment, "C4B", 28);
|
|
5378
|
-
__publicField(RegionAttachment, "C4A", 29);
|
|
5379
|
-
__publicField(RegionAttachment, "U4", 30);
|
|
5380
|
-
__publicField(RegionAttachment, "V4", 31);
|
|
5381
5200
|
|
|
5382
5201
|
// spine-core/src/AtlasAttachmentLoader.ts
|
|
5383
5202
|
var AtlasAttachmentLoader = class {
|
|
@@ -5390,8 +5209,7 @@ var spine = (() => {
|
|
|
5390
5209
|
for (let i = 0, n = regions.length; i < n; i++) {
|
|
5391
5210
|
let path = sequence.getPath(basePath, i);
|
|
5392
5211
|
let region = this.atlas.findRegion(path);
|
|
5393
|
-
if (region == null)
|
|
5394
|
-
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
5212
|
+
if (region == null) throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
5395
5213
|
regions[i] = region;
|
|
5396
5214
|
}
|
|
5397
5215
|
}
|
|
@@ -5401,8 +5219,7 @@ var spine = (() => {
|
|
|
5401
5219
|
this.loadSequence(name, path, sequence);
|
|
5402
5220
|
} else {
|
|
5403
5221
|
let region = this.atlas.findRegion(path);
|
|
5404
|
-
if (!region)
|
|
5405
|
-
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
5222
|
+
if (!region) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
5406
5223
|
attachment.region = region;
|
|
5407
5224
|
}
|
|
5408
5225
|
return attachment;
|
|
@@ -5413,8 +5230,7 @@ var spine = (() => {
|
|
|
5413
5230
|
this.loadSequence(name, path, sequence);
|
|
5414
5231
|
} else {
|
|
5415
5232
|
let region = this.atlas.findRegion(path);
|
|
5416
|
-
if (!region)
|
|
5417
|
-
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
5233
|
+
if (!region) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
5418
5234
|
attachment.region = region;
|
|
5419
5235
|
}
|
|
5420
5236
|
return attachment;
|
|
@@ -5458,7 +5274,7 @@ var spine = (() => {
|
|
|
5458
5274
|
/** The local shearX. */
|
|
5459
5275
|
shearY = 0;
|
|
5460
5276
|
/** The transform mode for how parent world transforms affect this bone. */
|
|
5461
|
-
inherit =
|
|
5277
|
+
inherit = 0 /* Normal */;
|
|
5462
5278
|
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
|
|
5463
5279
|
* bone.
|
|
5464
5280
|
* @see Skin#bones */
|
|
@@ -5471,10 +5287,8 @@ var spine = (() => {
|
|
|
5471
5287
|
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
5472
5288
|
visible = false;
|
|
5473
5289
|
constructor(index, name, parent) {
|
|
5474
|
-
if (index < 0)
|
|
5475
|
-
|
|
5476
|
-
if (!name)
|
|
5477
|
-
throw new Error("name cannot be null.");
|
|
5290
|
+
if (index < 0) throw new Error("index must be >= 0.");
|
|
5291
|
+
if (!name) throw new Error("name cannot be null.");
|
|
5478
5292
|
this.index = index;
|
|
5479
5293
|
this.name = name;
|
|
5480
5294
|
this.parent = parent;
|
|
@@ -5544,10 +5358,8 @@ var spine = (() => {
|
|
|
5544
5358
|
active = false;
|
|
5545
5359
|
/** @param parent May be null. */
|
|
5546
5360
|
constructor(data, skeleton, parent) {
|
|
5547
|
-
if (!data)
|
|
5548
|
-
|
|
5549
|
-
if (!skeleton)
|
|
5550
|
-
throw new Error("skeleton cannot be null.");
|
|
5361
|
+
if (!data) throw new Error("data cannot be null.");
|
|
5362
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
5551
5363
|
this.data = data;
|
|
5552
5364
|
this.skeleton = skeleton;
|
|
5553
5365
|
this.parent = parent;
|
|
@@ -5656,13 +5468,11 @@ var spine = (() => {
|
|
|
5656
5468
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5657
5469
|
let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5658
5470
|
let s = Math.sqrt(za * za + zc * zc);
|
|
5659
|
-
if (s > 1e-5)
|
|
5660
|
-
s = 1 / s;
|
|
5471
|
+
if (s > 1e-5) s = 1 / s;
|
|
5661
5472
|
za *= s;
|
|
5662
5473
|
zc *= s;
|
|
5663
5474
|
s = Math.sqrt(za * za + zc * zc);
|
|
5664
|
-
if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5665
|
-
s = -s;
|
|
5475
|
+
if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
|
|
5666
5476
|
rotation = Math.PI / 2 + Math.atan2(zc, za);
|
|
5667
5477
|
const zb = Math.cos(rotation) * s;
|
|
5668
5478
|
const zd = Math.sin(rotation) * s;
|
|
@@ -5745,13 +5555,11 @@ var spine = (() => {
|
|
|
5745
5555
|
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5746
5556
|
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5747
5557
|
let s = Math.sqrt(pa * pa + pc * pc);
|
|
5748
|
-
if (s > 1e-5)
|
|
5749
|
-
s = 1 / s;
|
|
5558
|
+
if (s > 1e-5) s = 1 / s;
|
|
5750
5559
|
pa *= s;
|
|
5751
5560
|
pc *= s;
|
|
5752
5561
|
s = Math.sqrt(pa * pa + pc * pc);
|
|
5753
|
-
if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5754
|
-
s = -s;
|
|
5562
|
+
if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
|
|
5755
5563
|
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
5756
5564
|
pb = Math.cos(r) * s;
|
|
5757
5565
|
pd = Math.sin(r) * s;
|
|
@@ -5813,14 +5621,12 @@ var spine = (() => {
|
|
|
5813
5621
|
}
|
|
5814
5622
|
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
|
|
5815
5623
|
worldToParent(world) {
|
|
5816
|
-
if (world == null)
|
|
5817
|
-
throw new Error("world cannot be null.");
|
|
5624
|
+
if (world == null) throw new Error("world cannot be null.");
|
|
5818
5625
|
return this.parent == null ? world : this.parent.worldToLocal(world);
|
|
5819
5626
|
}
|
|
5820
5627
|
/** Transforms a point from the parent bone's coordinates to world coordinates. */
|
|
5821
5628
|
parentToWorld(world) {
|
|
5822
|
-
if (world == null)
|
|
5823
|
-
throw new Error("world cannot be null.");
|
|
5629
|
+
if (world == null) throw new Error("world cannot be null.");
|
|
5824
5630
|
return this.parent == null ? world : this.parent.localToWorld(world);
|
|
5825
5631
|
}
|
|
5826
5632
|
/** Transforms a world rotation to a local rotation. */
|
|
@@ -5864,6 +5670,8 @@ var spine = (() => {
|
|
|
5864
5670
|
textureLoader;
|
|
5865
5671
|
downloader;
|
|
5866
5672
|
assets = {};
|
|
5673
|
+
assetsRefCount = {};
|
|
5674
|
+
assetsLoaded = {};
|
|
5867
5675
|
errors = {};
|
|
5868
5676
|
toLoad = 0;
|
|
5869
5677
|
loaded = 0;
|
|
@@ -5880,24 +5688,21 @@ var spine = (() => {
|
|
|
5880
5688
|
this.toLoad--;
|
|
5881
5689
|
this.loaded++;
|
|
5882
5690
|
this.assets[path] = asset;
|
|
5883
|
-
|
|
5884
|
-
|
|
5691
|
+
this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
|
|
5692
|
+
if (callback) callback(path, asset);
|
|
5885
5693
|
}
|
|
5886
5694
|
error(callback, path, message) {
|
|
5887
5695
|
this.toLoad--;
|
|
5888
5696
|
this.loaded++;
|
|
5889
5697
|
this.errors[path] = message;
|
|
5890
|
-
if (callback)
|
|
5891
|
-
callback(path, message);
|
|
5698
|
+
if (callback) callback(path, message);
|
|
5892
5699
|
}
|
|
5893
5700
|
loadAll() {
|
|
5894
5701
|
let promise = new Promise((resolve, reject) => {
|
|
5895
5702
|
let check = () => {
|
|
5896
5703
|
if (this.isLoadingComplete()) {
|
|
5897
|
-
if (this.hasErrors())
|
|
5898
|
-
|
|
5899
|
-
else
|
|
5900
|
-
resolve(this);
|
|
5704
|
+
if (this.hasErrors()) reject(this.errors);
|
|
5705
|
+
else resolve(this);
|
|
5901
5706
|
return;
|
|
5902
5707
|
}
|
|
5903
5708
|
requestAnimationFrame(check);
|
|
@@ -5913,10 +5718,16 @@ var spine = (() => {
|
|
|
5913
5718
|
}, error = () => {
|
|
5914
5719
|
}) {
|
|
5915
5720
|
path = this.start(path);
|
|
5916
|
-
this.
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5721
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5722
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5723
|
+
this.downloader.downloadBinary(path, (data) => {
|
|
5724
|
+
this.success(success, path, data);
|
|
5725
|
+
resolve(data);
|
|
5726
|
+
}, (status, responseText) => {
|
|
5727
|
+
const errorMsg = `Couldn't load binary ${path}: status ${status}, ${responseText}`;
|
|
5728
|
+
this.error(error, path, errorMsg);
|
|
5729
|
+
reject(errorMsg);
|
|
5730
|
+
});
|
|
5920
5731
|
});
|
|
5921
5732
|
}
|
|
5922
5733
|
loadText(path, success = () => {
|
|
@@ -5933,43 +5744,69 @@ var spine = (() => {
|
|
|
5933
5744
|
}, error = () => {
|
|
5934
5745
|
}) {
|
|
5935
5746
|
path = this.start(path);
|
|
5936
|
-
this.
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5747
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5748
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5749
|
+
this.downloader.downloadJson(path, (data) => {
|
|
5750
|
+
this.success(success, path, data);
|
|
5751
|
+
resolve(data);
|
|
5752
|
+
}, (status, responseText) => {
|
|
5753
|
+
const errorMsg = `Couldn't load JSON ${path}: status ${status}, ${responseText}`;
|
|
5754
|
+
this.error(error, path, errorMsg);
|
|
5755
|
+
reject(errorMsg);
|
|
5756
|
+
});
|
|
5940
5757
|
});
|
|
5941
5758
|
}
|
|
5759
|
+
reuseAssets(path, success = () => {
|
|
5760
|
+
}, error = () => {
|
|
5761
|
+
}) {
|
|
5762
|
+
const loadedStatus = this.assetsLoaded[path];
|
|
5763
|
+
const alreadyExistsOrLoading = loadedStatus !== void 0;
|
|
5764
|
+
if (alreadyExistsOrLoading) {
|
|
5765
|
+
loadedStatus.then((data) => this.success(success, path, data)).catch((errorMsg) => this.error(error, path, errorMsg));
|
|
5766
|
+
}
|
|
5767
|
+
return alreadyExistsOrLoading;
|
|
5768
|
+
}
|
|
5942
5769
|
loadTexture(path, success = () => {
|
|
5943
5770
|
}, error = () => {
|
|
5944
5771
|
}) {
|
|
5945
5772
|
path = this.start(path);
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5773
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5774
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5775
|
+
let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
|
|
5776
|
+
let isWebWorker = !isBrowser;
|
|
5777
|
+
if (isWebWorker) {
|
|
5778
|
+
fetch(path, { mode: "cors" }).then((response) => {
|
|
5779
|
+
if (response.ok) return response.blob();
|
|
5780
|
+
const errorMsg = `Couldn't load image: ${path}`;
|
|
5781
|
+
this.error(error, path, `Couldn't load image: ${path}`);
|
|
5782
|
+
reject(errorMsg);
|
|
5783
|
+
}).then((blob) => {
|
|
5784
|
+
return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
|
|
5785
|
+
}).then((bitmap) => {
|
|
5786
|
+
if (bitmap) {
|
|
5787
|
+
const texture = this.textureLoader(bitmap);
|
|
5788
|
+
this.success(success, path, texture);
|
|
5789
|
+
resolve(texture);
|
|
5790
|
+
}
|
|
5791
|
+
;
|
|
5792
|
+
});
|
|
5793
|
+
} else {
|
|
5794
|
+
let image = new Image();
|
|
5795
|
+
image.crossOrigin = "anonymous";
|
|
5796
|
+
image.onload = () => {
|
|
5797
|
+
const texture = this.textureLoader(image);
|
|
5798
|
+
this.success(success, path, texture);
|
|
5799
|
+
resolve(texture);
|
|
5800
|
+
};
|
|
5801
|
+
image.onerror = () => {
|
|
5802
|
+
const errorMsg = `Couldn't load image: ${path}`;
|
|
5803
|
+
this.error(error, path, errorMsg);
|
|
5804
|
+
reject(errorMsg);
|
|
5805
|
+
};
|
|
5806
|
+
if (this.downloader.rawDataUris[path]) path = this.downloader.rawDataUris[path];
|
|
5807
|
+
image.src = path;
|
|
5808
|
+
}
|
|
5809
|
+
});
|
|
5973
5810
|
}
|
|
5974
5811
|
loadTextureAtlas(path, success = () => {
|
|
5975
5812
|
}, error = () => {
|
|
@@ -5977,32 +5814,113 @@ var spine = (() => {
|
|
|
5977
5814
|
let index = path.lastIndexOf("/");
|
|
5978
5815
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
5979
5816
|
path = this.start(path);
|
|
5980
|
-
this.
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
(
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
if (
|
|
5991
|
-
|
|
5817
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5818
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5819
|
+
this.downloader.downloadText(path, (atlasText) => {
|
|
5820
|
+
try {
|
|
5821
|
+
let atlas = new TextureAtlas(atlasText);
|
|
5822
|
+
let toLoad = atlas.pages.length, abort = false;
|
|
5823
|
+
for (let page of atlas.pages) {
|
|
5824
|
+
this.loadTexture(
|
|
5825
|
+
!fileAlias ? parent + page.name : fileAlias[page.name],
|
|
5826
|
+
(imagePath, texture) => {
|
|
5827
|
+
if (!abort) {
|
|
5828
|
+
page.setTexture(texture);
|
|
5829
|
+
if (--toLoad == 0) {
|
|
5830
|
+
this.success(success, path, atlas);
|
|
5831
|
+
resolve(atlas);
|
|
5832
|
+
}
|
|
5833
|
+
}
|
|
5834
|
+
},
|
|
5835
|
+
(imagePath, message) => {
|
|
5836
|
+
if (!abort) {
|
|
5837
|
+
const errorMsg = `Couldn't load texture atlas ${path} page image: ${imagePath}`;
|
|
5838
|
+
this.error(error, path, errorMsg);
|
|
5839
|
+
reject(errorMsg);
|
|
5840
|
+
}
|
|
5841
|
+
abort = true;
|
|
5992
5842
|
}
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
);
|
|
5843
|
+
);
|
|
5844
|
+
}
|
|
5845
|
+
} catch (e) {
|
|
5846
|
+
const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
|
|
5847
|
+
this.error(error, path, errorMsg);
|
|
5848
|
+
reject(errorMsg);
|
|
6000
5849
|
}
|
|
6001
|
-
}
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
5850
|
+
}, (status, responseText) => {
|
|
5851
|
+
const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
|
|
5852
|
+
this.error(error, path, errorMsg);
|
|
5853
|
+
reject(errorMsg);
|
|
5854
|
+
});
|
|
5855
|
+
});
|
|
5856
|
+
}
|
|
5857
|
+
loadTextureAtlasButNoTextures(path, success = () => {
|
|
5858
|
+
}, error = () => {
|
|
5859
|
+
}, fileAlias) {
|
|
5860
|
+
path = this.start(path);
|
|
5861
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5862
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5863
|
+
this.downloader.downloadText(path, (atlasText) => {
|
|
5864
|
+
try {
|
|
5865
|
+
const atlas = new TextureAtlas(atlasText);
|
|
5866
|
+
this.success(success, path, atlas);
|
|
5867
|
+
resolve(atlas);
|
|
5868
|
+
} catch (e) {
|
|
5869
|
+
const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
|
|
5870
|
+
this.error(error, path, errorMsg);
|
|
5871
|
+
reject(errorMsg);
|
|
5872
|
+
}
|
|
5873
|
+
}, (status, responseText) => {
|
|
5874
|
+
const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
|
|
5875
|
+
this.error(error, path, errorMsg);
|
|
5876
|
+
reject(errorMsg);
|
|
5877
|
+
});
|
|
5878
|
+
});
|
|
5879
|
+
}
|
|
5880
|
+
// Promisified versions of load function
|
|
5881
|
+
async loadBinaryAsync(path) {
|
|
5882
|
+
return new Promise((resolve, reject) => {
|
|
5883
|
+
this.loadBinary(
|
|
5884
|
+
path,
|
|
5885
|
+
(_, binary) => resolve(binary),
|
|
5886
|
+
(_, message) => reject(message)
|
|
5887
|
+
);
|
|
5888
|
+
});
|
|
5889
|
+
}
|
|
5890
|
+
async loadJsonAsync(path) {
|
|
5891
|
+
return new Promise((resolve, reject) => {
|
|
5892
|
+
this.loadJson(
|
|
5893
|
+
path,
|
|
5894
|
+
(_, object) => resolve(object),
|
|
5895
|
+
(_, message) => reject(message)
|
|
5896
|
+
);
|
|
5897
|
+
});
|
|
5898
|
+
}
|
|
5899
|
+
async loadTextureAsync(path) {
|
|
5900
|
+
return new Promise((resolve, reject) => {
|
|
5901
|
+
this.loadTexture(
|
|
5902
|
+
path,
|
|
5903
|
+
(_, texture) => resolve(texture),
|
|
5904
|
+
(_, message) => reject(message)
|
|
5905
|
+
);
|
|
5906
|
+
});
|
|
5907
|
+
}
|
|
5908
|
+
async loadTextureAtlasAsync(path) {
|
|
5909
|
+
return new Promise((resolve, reject) => {
|
|
5910
|
+
this.loadTextureAtlas(
|
|
5911
|
+
path,
|
|
5912
|
+
(_, atlas) => resolve(atlas),
|
|
5913
|
+
(_, message) => reject(message)
|
|
5914
|
+
);
|
|
5915
|
+
});
|
|
5916
|
+
}
|
|
5917
|
+
async loadTextureAtlasButNoTexturesAsync(path) {
|
|
5918
|
+
return new Promise((resolve, reject) => {
|
|
5919
|
+
this.loadTextureAtlasButNoTextures(
|
|
5920
|
+
path,
|
|
5921
|
+
(_, atlas) => resolve(atlas),
|
|
5922
|
+
(_, message) => reject(message)
|
|
5923
|
+
);
|
|
6006
5924
|
});
|
|
6007
5925
|
}
|
|
6008
5926
|
get(path) {
|
|
@@ -6011,26 +5929,27 @@ var spine = (() => {
|
|
|
6011
5929
|
require(path) {
|
|
6012
5930
|
path = this.pathPrefix + path;
|
|
6013
5931
|
let asset = this.assets[path];
|
|
6014
|
-
if (asset)
|
|
6015
|
-
return asset;
|
|
5932
|
+
if (asset) return asset;
|
|
6016
5933
|
let error = this.errors[path];
|
|
6017
5934
|
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
|
6018
5935
|
}
|
|
6019
5936
|
remove(path) {
|
|
6020
5937
|
path = this.pathPrefix + path;
|
|
6021
5938
|
let asset = this.assets[path];
|
|
6022
|
-
if (asset.dispose)
|
|
6023
|
-
asset.dispose();
|
|
5939
|
+
if (asset.dispose) asset.dispose();
|
|
6024
5940
|
delete this.assets[path];
|
|
5941
|
+
delete this.assetsRefCount[path];
|
|
5942
|
+
delete this.assetsLoaded[path];
|
|
6025
5943
|
return asset;
|
|
6026
5944
|
}
|
|
6027
5945
|
removeAll() {
|
|
6028
|
-
for (let
|
|
6029
|
-
let asset = this.assets[
|
|
6030
|
-
if (asset.dispose)
|
|
6031
|
-
asset.dispose();
|
|
5946
|
+
for (let path in this.assets) {
|
|
5947
|
+
let asset = this.assets[path];
|
|
5948
|
+
if (asset.dispose) asset.dispose();
|
|
6032
5949
|
}
|
|
6033
5950
|
this.assets = {};
|
|
5951
|
+
this.assetsLoaded = {};
|
|
5952
|
+
this.assetsRefCount = {};
|
|
6034
5953
|
}
|
|
6035
5954
|
isLoadingComplete() {
|
|
6036
5955
|
return this.toLoad == 0;
|
|
@@ -6044,6 +5963,12 @@ var spine = (() => {
|
|
|
6044
5963
|
dispose() {
|
|
6045
5964
|
this.removeAll();
|
|
6046
5965
|
}
|
|
5966
|
+
// dispose asset only if it's not used by others
|
|
5967
|
+
disposeAsset(path) {
|
|
5968
|
+
if (--this.assetsRefCount[path] === 0) {
|
|
5969
|
+
this.remove(path);
|
|
5970
|
+
}
|
|
5971
|
+
}
|
|
6047
5972
|
hasErrors() {
|
|
6048
5973
|
return Object.keys(this.errors).length > 0;
|
|
6049
5974
|
}
|
|
@@ -6080,18 +6005,16 @@ var spine = (() => {
|
|
|
6080
6005
|
throw new Error("Not a data URI.");
|
|
6081
6006
|
}
|
|
6082
6007
|
let base64Idx = dataUri.indexOf("base64,");
|
|
6083
|
-
if (base64Idx == -1)
|
|
6084
|
-
throw new Error("Not a binary data URI.");
|
|
6008
|
+
if (base64Idx == -1) throw new Error("Not a binary data URI.");
|
|
6085
6009
|
base64Idx += "base64,".length;
|
|
6086
6010
|
return this.base64ToUint8Array(dataUri.substr(base64Idx));
|
|
6087
6011
|
}
|
|
6088
6012
|
downloadText(url, success, error) {
|
|
6089
|
-
if (this.start(url, success, error))
|
|
6090
|
-
|
|
6091
|
-
if (
|
|
6013
|
+
if (this.start(url, success, error)) return;
|
|
6014
|
+
const rawDataUri = this.rawDataUris[url];
|
|
6015
|
+
if (rawDataUri && !rawDataUri.includes(".")) {
|
|
6092
6016
|
try {
|
|
6093
|
-
|
|
6094
|
-
this.finish(url, 200, this.dataUriToString(dataUri));
|
|
6017
|
+
this.finish(url, 200, this.dataUriToString(rawDataUri));
|
|
6095
6018
|
} catch (e) {
|
|
6096
6019
|
this.finish(url, 400, JSON.stringify(e));
|
|
6097
6020
|
}
|
|
@@ -6099,7 +6022,7 @@ var spine = (() => {
|
|
|
6099
6022
|
}
|
|
6100
6023
|
let request = new XMLHttpRequest();
|
|
6101
6024
|
request.overrideMimeType("text/html");
|
|
6102
|
-
request.open("GET", url, true);
|
|
6025
|
+
request.open("GET", rawDataUri ? rawDataUri : url, true);
|
|
6103
6026
|
let done = () => {
|
|
6104
6027
|
this.finish(url, request.status, request.responseText);
|
|
6105
6028
|
};
|
|
@@ -6113,19 +6036,18 @@ var spine = (() => {
|
|
|
6113
6036
|
}, error);
|
|
6114
6037
|
}
|
|
6115
6038
|
downloadBinary(url, success, error) {
|
|
6116
|
-
if (this.start(url, success, error))
|
|
6117
|
-
|
|
6118
|
-
if (
|
|
6039
|
+
if (this.start(url, success, error)) return;
|
|
6040
|
+
const rawDataUri = this.rawDataUris[url];
|
|
6041
|
+
if (rawDataUri && !rawDataUri.includes(".")) {
|
|
6119
6042
|
try {
|
|
6120
|
-
|
|
6121
|
-
this.finish(url, 200, this.dataUriToUint8Array(dataUri));
|
|
6043
|
+
this.finish(url, 200, this.dataUriToUint8Array(rawDataUri));
|
|
6122
6044
|
} catch (e) {
|
|
6123
6045
|
this.finish(url, 400, JSON.stringify(e));
|
|
6124
6046
|
}
|
|
6125
6047
|
return;
|
|
6126
6048
|
}
|
|
6127
6049
|
let request = new XMLHttpRequest();
|
|
6128
|
-
request.open("GET", url, true);
|
|
6050
|
+
request.open("GET", rawDataUri ? rawDataUri : url, true);
|
|
6129
6051
|
request.responseType = "arraybuffer";
|
|
6130
6052
|
let onerror = () => {
|
|
6131
6053
|
this.finish(url, request.status, request.response);
|
|
@@ -6142,8 +6064,7 @@ var spine = (() => {
|
|
|
6142
6064
|
start(url, success, error) {
|
|
6143
6065
|
let callbacks = this.callbacks[url];
|
|
6144
6066
|
try {
|
|
6145
|
-
if (callbacks)
|
|
6146
|
-
return true;
|
|
6067
|
+
if (callbacks) return true;
|
|
6147
6068
|
this.callbacks[url] = callbacks = [];
|
|
6148
6069
|
} finally {
|
|
6149
6070
|
callbacks.push(success, error);
|
|
@@ -6168,8 +6089,7 @@ var spine = (() => {
|
|
|
6168
6089
|
volume = 0;
|
|
6169
6090
|
balance = 0;
|
|
6170
6091
|
constructor(time, data) {
|
|
6171
|
-
if (!data)
|
|
6172
|
-
throw new Error("data cannot be null.");
|
|
6092
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6173
6093
|
this.time = time;
|
|
6174
6094
|
this.data = data;
|
|
6175
6095
|
}
|
|
@@ -6210,21 +6130,17 @@ var spine = (() => {
|
|
|
6210
6130
|
softness = 0;
|
|
6211
6131
|
active = false;
|
|
6212
6132
|
constructor(data, skeleton) {
|
|
6213
|
-
if (!data)
|
|
6214
|
-
|
|
6215
|
-
if (!skeleton)
|
|
6216
|
-
throw new Error("skeleton cannot be null.");
|
|
6133
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6134
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
6217
6135
|
this.data = data;
|
|
6218
6136
|
this.bones = new Array();
|
|
6219
6137
|
for (let i = 0; i < data.bones.length; i++) {
|
|
6220
6138
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
6221
|
-
if (!bone)
|
|
6222
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
6139
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
6223
6140
|
this.bones.push(bone);
|
|
6224
6141
|
}
|
|
6225
6142
|
let target = skeleton.findBone(data.target.name);
|
|
6226
|
-
if (!target)
|
|
6227
|
-
throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
6143
|
+
if (!target) throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
6228
6144
|
this.target = target;
|
|
6229
6145
|
this.mix = data.mix;
|
|
6230
6146
|
this.softness = data.softness;
|
|
@@ -6244,8 +6160,7 @@ var spine = (() => {
|
|
|
6244
6160
|
this.stretch = data.stretch;
|
|
6245
6161
|
}
|
|
6246
6162
|
update(physics) {
|
|
6247
|
-
if (this.mix == 0)
|
|
6248
|
-
return;
|
|
6163
|
+
if (this.mix == 0) return;
|
|
6249
6164
|
let target = this.target;
|
|
6250
6165
|
let bones = this.bones;
|
|
6251
6166
|
switch (bones.length) {
|
|
@@ -6260,8 +6175,7 @@ var spine = (() => {
|
|
|
6260
6175
|
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
|
|
6261
6176
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
6262
6177
|
let p = bone.parent;
|
|
6263
|
-
if (!p)
|
|
6264
|
-
throw new Error("IK bone must have parent.");
|
|
6178
|
+
if (!p) throw new Error("IK bone must have parent.");
|
|
6265
6179
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
6266
6180
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
6267
6181
|
switch (bone.inherit) {
|
|
@@ -6276,6 +6190,7 @@ var spine = (() => {
|
|
|
6276
6190
|
pb = -sc * s * bone.skeleton.scaleX;
|
|
6277
6191
|
pd = sa * s * bone.skeleton.scaleY;
|
|
6278
6192
|
rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;
|
|
6193
|
+
// Fall through
|
|
6279
6194
|
default:
|
|
6280
6195
|
let x = targetX - p.worldX, y = targetY - p.worldY;
|
|
6281
6196
|
let d = pa * pd - pb * pc;
|
|
@@ -6288,8 +6203,7 @@ var spine = (() => {
|
|
|
6288
6203
|
}
|
|
6289
6204
|
}
|
|
6290
6205
|
rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
|
|
6291
|
-
if (bone.ascaleX < 0)
|
|
6292
|
-
rotationIK += 180;
|
|
6206
|
+
if (bone.ascaleX < 0) rotationIK += 180;
|
|
6293
6207
|
if (rotationIK > 180)
|
|
6294
6208
|
rotationIK -= 360;
|
|
6295
6209
|
else if (rotationIK < -180)
|
|
@@ -6308,8 +6222,7 @@ var spine = (() => {
|
|
|
6308
6222
|
if (compress && dd < b * b || stretch && dd > b * b) {
|
|
6309
6223
|
const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
|
|
6310
6224
|
sx *= s;
|
|
6311
|
-
if (uniform)
|
|
6312
|
-
sy *= s;
|
|
6225
|
+
if (uniform) sy *= s;
|
|
6313
6226
|
}
|
|
6314
6227
|
}
|
|
6315
6228
|
}
|
|
@@ -6326,8 +6239,7 @@ var spine = (() => {
|
|
|
6326
6239
|
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6327
6240
|
* @param child A direct descendant of the parent bone. */
|
|
6328
6241
|
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
6329
|
-
if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */)
|
|
6330
|
-
return;
|
|
6242
|
+
if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */) return;
|
|
6331
6243
|
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
6332
6244
|
let os1 = 0, os2 = 0, s2 = 0;
|
|
6333
6245
|
if (psx < 0) {
|
|
@@ -6359,8 +6271,7 @@ var spine = (() => {
|
|
|
6359
6271
|
cwy = c * cx + d * cy + parent.worldY;
|
|
6360
6272
|
}
|
|
6361
6273
|
let pp = parent.parent;
|
|
6362
|
-
if (!pp)
|
|
6363
|
-
throw new Error("IK parent must itself have a parent.");
|
|
6274
|
+
if (!pp) throw new Error("IK parent must itself have a parent.");
|
|
6364
6275
|
a = pp.a;
|
|
6365
6276
|
b = pp.b;
|
|
6366
6277
|
c = pp.c;
|
|
@@ -6402,8 +6313,7 @@ var spine = (() => {
|
|
|
6402
6313
|
if (stretch) {
|
|
6403
6314
|
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
|
6404
6315
|
sx *= a;
|
|
6405
|
-
if (uniform)
|
|
6406
|
-
sy *= a;
|
|
6316
|
+
if (uniform) sy *= a;
|
|
6407
6317
|
}
|
|
6408
6318
|
} else
|
|
6409
6319
|
a2 = Math.acos(cos) * bendDir;
|
|
@@ -6419,8 +6329,7 @@ var spine = (() => {
|
|
|
6419
6329
|
d = c1 * c1 - 4 * c2 * c;
|
|
6420
6330
|
if (d >= 0) {
|
|
6421
6331
|
let q = Math.sqrt(d);
|
|
6422
|
-
if (c1 < 0)
|
|
6423
|
-
q = -q;
|
|
6332
|
+
if (c1 < 0) q = -q;
|
|
6424
6333
|
q = -(c1 + q) * 0.5;
|
|
6425
6334
|
let r0 = q / c2, r1 = c / q;
|
|
6426
6335
|
let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
|
@@ -6489,10 +6398,8 @@ var spine = (() => {
|
|
|
6489
6398
|
this._target = boneData;
|
|
6490
6399
|
}
|
|
6491
6400
|
get target() {
|
|
6492
|
-
if (!this._target)
|
|
6493
|
-
|
|
6494
|
-
else
|
|
6495
|
-
return this._target;
|
|
6401
|
+
if (!this._target) throw new Error("BoneData not set.");
|
|
6402
|
+
else return this._target;
|
|
6496
6403
|
}
|
|
6497
6404
|
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
6498
6405
|
bendDirection = 0;
|
|
@@ -6523,17 +6430,15 @@ var spine = (() => {
|
|
|
6523
6430
|
this._target = slotData;
|
|
6524
6431
|
}
|
|
6525
6432
|
get target() {
|
|
6526
|
-
if (!this._target)
|
|
6527
|
-
|
|
6528
|
-
else
|
|
6529
|
-
return this._target;
|
|
6433
|
+
if (!this._target) throw new Error("SlotData not set.");
|
|
6434
|
+
else return this._target;
|
|
6530
6435
|
}
|
|
6531
6436
|
/** The mode for positioning the first bone on the path. */
|
|
6532
|
-
positionMode =
|
|
6437
|
+
positionMode = 0 /* Fixed */;
|
|
6533
6438
|
/** The mode for positioning the bones after the first bone on the path. */
|
|
6534
|
-
spacingMode =
|
|
6439
|
+
spacingMode = 1 /* Fixed */;
|
|
6535
6440
|
/** The mode for adjusting the rotation of the bones. */
|
|
6536
|
-
rotateMode =
|
|
6441
|
+
rotateMode = 1 /* Chain */;
|
|
6537
6442
|
/** An offset added to the constrained bone rotation. */
|
|
6538
6443
|
offsetRotation = 0;
|
|
6539
6444
|
/** The position along the path. */
|
|
@@ -6567,7 +6472,11 @@ var spine = (() => {
|
|
|
6567
6472
|
})(RotateMode || {});
|
|
6568
6473
|
|
|
6569
6474
|
// spine-core/src/PathConstraint.ts
|
|
6570
|
-
var
|
|
6475
|
+
var PathConstraint = class _PathConstraint {
|
|
6476
|
+
static NONE = -1;
|
|
6477
|
+
static BEFORE = -2;
|
|
6478
|
+
static AFTER = -3;
|
|
6479
|
+
static epsilon = 1e-5;
|
|
6571
6480
|
/** The path constraint's setup pose data. */
|
|
6572
6481
|
data;
|
|
6573
6482
|
/** The bones that will be modified by this path constraint. */
|
|
@@ -6589,21 +6498,17 @@ var spine = (() => {
|
|
|
6589
6498
|
segments = new Array();
|
|
6590
6499
|
active = false;
|
|
6591
6500
|
constructor(data, skeleton) {
|
|
6592
|
-
if (!data)
|
|
6593
|
-
|
|
6594
|
-
if (!skeleton)
|
|
6595
|
-
throw new Error("skeleton cannot be null.");
|
|
6501
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6502
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
6596
6503
|
this.data = data;
|
|
6597
6504
|
this.bones = new Array();
|
|
6598
6505
|
for (let i = 0, n = data.bones.length; i < n; i++) {
|
|
6599
6506
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
6600
|
-
if (!bone)
|
|
6601
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
6507
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
6602
6508
|
this.bones.push(bone);
|
|
6603
6509
|
}
|
|
6604
6510
|
let target = skeleton.findSlot(data.target.name);
|
|
6605
|
-
if (!target)
|
|
6606
|
-
throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
6511
|
+
if (!target) throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
6607
6512
|
this.target = target;
|
|
6608
6513
|
this.position = data.position;
|
|
6609
6514
|
this.spacing = data.spacing;
|
|
@@ -6624,11 +6529,9 @@ var spine = (() => {
|
|
|
6624
6529
|
}
|
|
6625
6530
|
update(physics) {
|
|
6626
6531
|
let attachment = this.target.getAttachment();
|
|
6627
|
-
if (!(attachment instanceof PathAttachment))
|
|
6628
|
-
return;
|
|
6532
|
+
if (!(attachment instanceof PathAttachment)) return;
|
|
6629
6533
|
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY;
|
|
6630
|
-
if (mixRotate == 0 && mixX == 0 && mixY == 0)
|
|
6631
|
-
return;
|
|
6534
|
+
if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
|
|
6632
6535
|
let data = this.data;
|
|
6633
6536
|
let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
|
|
6634
6537
|
let bones = this.bones;
|
|
@@ -6653,14 +6556,12 @@ var spine = (() => {
|
|
|
6653
6556
|
let bone = bones[i];
|
|
6654
6557
|
let setupLength = bone.data.length;
|
|
6655
6558
|
if (setupLength < _PathConstraint.epsilon) {
|
|
6656
|
-
if (scale)
|
|
6657
|
-
lengths[i] = 0;
|
|
6559
|
+
if (scale) lengths[i] = 0;
|
|
6658
6560
|
spaces[++i] = spacing;
|
|
6659
6561
|
} else {
|
|
6660
6562
|
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6661
6563
|
let length = Math.sqrt(x * x + y * y);
|
|
6662
|
-
if (scale)
|
|
6663
|
-
lengths[i] = length;
|
|
6564
|
+
if (scale) lengths[i] = length;
|
|
6664
6565
|
spaces[++i] = length;
|
|
6665
6566
|
sum += length;
|
|
6666
6567
|
}
|
|
@@ -6677,14 +6578,12 @@ var spine = (() => {
|
|
|
6677
6578
|
let bone = bones[i];
|
|
6678
6579
|
let setupLength = bone.data.length;
|
|
6679
6580
|
if (setupLength < _PathConstraint.epsilon) {
|
|
6680
|
-
if (scale)
|
|
6681
|
-
lengths[i] = 0;
|
|
6581
|
+
if (scale) lengths[i] = 0;
|
|
6682
6582
|
spaces[++i] = spacing;
|
|
6683
6583
|
} else {
|
|
6684
6584
|
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6685
6585
|
let length = Math.sqrt(x * x + y * y);
|
|
6686
|
-
if (scale)
|
|
6687
|
-
lengths[i] = length;
|
|
6586
|
+
if (scale) lengths[i] = length;
|
|
6688
6587
|
spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
|
|
6689
6588
|
}
|
|
6690
6589
|
}
|
|
@@ -6757,8 +6656,7 @@ var spine = (() => {
|
|
|
6757
6656
|
let lengths = path.lengths;
|
|
6758
6657
|
curveCount -= closed2 ? 1 : 2;
|
|
6759
6658
|
let pathLength2 = lengths[curveCount];
|
|
6760
|
-
if (this.data.positionMode == 1 /* Percent */)
|
|
6761
|
-
position *= pathLength2;
|
|
6659
|
+
if (this.data.positionMode == 1 /* Percent */) position *= pathLength2;
|
|
6762
6660
|
let multiplier2;
|
|
6763
6661
|
switch (this.data.spacingMode) {
|
|
6764
6662
|
case 2 /* Percent */:
|
|
@@ -6777,8 +6675,7 @@ var spine = (() => {
|
|
|
6777
6675
|
let p = position;
|
|
6778
6676
|
if (closed2) {
|
|
6779
6677
|
p %= pathLength2;
|
|
6780
|
-
if (p < 0)
|
|
6781
|
-
p += pathLength2;
|
|
6678
|
+
if (p < 0) p += pathLength2;
|
|
6782
6679
|
curve = 0;
|
|
6783
6680
|
} else if (p < 0) {
|
|
6784
6681
|
if (prevCurve != _PathConstraint.BEFORE) {
|
|
@@ -6797,8 +6694,7 @@ var spine = (() => {
|
|
|
6797
6694
|
}
|
|
6798
6695
|
for (; ; curve++) {
|
|
6799
6696
|
let length = lengths[curve];
|
|
6800
|
-
if (p > length)
|
|
6801
|
-
continue;
|
|
6697
|
+
if (p > length) continue;
|
|
6802
6698
|
if (curve == 0)
|
|
6803
6699
|
p /= length;
|
|
6804
6700
|
else {
|
|
@@ -6880,8 +6776,7 @@ var spine = (() => {
|
|
|
6880
6776
|
x1 = x2;
|
|
6881
6777
|
y1 = y2;
|
|
6882
6778
|
}
|
|
6883
|
-
if (this.data.positionMode == 1 /* Percent */)
|
|
6884
|
-
position *= pathLength;
|
|
6779
|
+
if (this.data.positionMode == 1 /* Percent */) position *= pathLength;
|
|
6885
6780
|
let multiplier;
|
|
6886
6781
|
switch (this.data.spacingMode) {
|
|
6887
6782
|
case 2 /* Percent */:
|
|
@@ -6901,8 +6796,7 @@ var spine = (() => {
|
|
|
6901
6796
|
let p = position;
|
|
6902
6797
|
if (closed2) {
|
|
6903
6798
|
p %= pathLength;
|
|
6904
|
-
if (p < 0)
|
|
6905
|
-
p += pathLength;
|
|
6799
|
+
if (p < 0) p += pathLength;
|
|
6906
6800
|
curve = 0;
|
|
6907
6801
|
} else if (p < 0) {
|
|
6908
6802
|
this.addBeforePosition(p, world, 0, out, o);
|
|
@@ -6913,8 +6807,7 @@ var spine = (() => {
|
|
|
6913
6807
|
}
|
|
6914
6808
|
for (; ; curve++) {
|
|
6915
6809
|
let length = curves[curve];
|
|
6916
|
-
if (p > length)
|
|
6917
|
-
continue;
|
|
6810
|
+
if (p > length) continue;
|
|
6918
6811
|
if (curve == 0)
|
|
6919
6812
|
p /= length;
|
|
6920
6813
|
else {
|
|
@@ -6965,8 +6858,7 @@ var spine = (() => {
|
|
|
6965
6858
|
p *= curveLength;
|
|
6966
6859
|
for (; ; segment++) {
|
|
6967
6860
|
let length = segments[segment];
|
|
6968
|
-
if (p > length)
|
|
6969
|
-
continue;
|
|
6861
|
+
if (p > length) continue;
|
|
6970
6862
|
if (segment == 0)
|
|
6971
6863
|
p /= length;
|
|
6972
6864
|
else {
|
|
@@ -7011,11 +6903,6 @@ var spine = (() => {
|
|
|
7011
6903
|
}
|
|
7012
6904
|
}
|
|
7013
6905
|
};
|
|
7014
|
-
var PathConstraint = _PathConstraint;
|
|
7015
|
-
__publicField(PathConstraint, "NONE", -1);
|
|
7016
|
-
__publicField(PathConstraint, "BEFORE", -2);
|
|
7017
|
-
__publicField(PathConstraint, "AFTER", -3);
|
|
7018
|
-
__publicField(PathConstraint, "epsilon", 1e-5);
|
|
7019
6906
|
|
|
7020
6907
|
// spine-core/src/PhysicsConstraint.ts
|
|
7021
6908
|
var PhysicsConstraint = class {
|
|
@@ -7026,10 +6913,8 @@ var spine = (() => {
|
|
|
7026
6913
|
this._bone = bone;
|
|
7027
6914
|
}
|
|
7028
6915
|
get bone() {
|
|
7029
|
-
if (!this._bone)
|
|
7030
|
-
|
|
7031
|
-
else
|
|
7032
|
-
return this._bone;
|
|
6916
|
+
if (!this._bone) throw new Error("Bone not set.");
|
|
6917
|
+
else return this._bone;
|
|
7033
6918
|
}
|
|
7034
6919
|
inertia = 0;
|
|
7035
6920
|
strength = 0;
|
|
@@ -7098,8 +6983,7 @@ var spine = (() => {
|
|
|
7098
6983
|
/** Applies the constraint to the constrained bones. */
|
|
7099
6984
|
update(physics) {
|
|
7100
6985
|
const mix = this.mix;
|
|
7101
|
-
if (mix == 0)
|
|
7102
|
-
return;
|
|
6986
|
+
if (mix == 0) return;
|
|
7103
6987
|
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;
|
|
7104
6988
|
const bone = this.bone;
|
|
7105
6989
|
const l = bone.data.length;
|
|
@@ -7108,6 +6992,7 @@ var spine = (() => {
|
|
|
7108
6992
|
return;
|
|
7109
6993
|
case 1 /* reset */:
|
|
7110
6994
|
this.reset();
|
|
6995
|
+
// Fall through.
|
|
7111
6996
|
case 2 /* update */:
|
|
7112
6997
|
const skeleton = this.skeleton;
|
|
7113
6998
|
const delta = Math.max(this.skeleton.time - this.lastTime, 0);
|
|
@@ -7150,10 +7035,8 @@ var spine = (() => {
|
|
|
7150
7035
|
a -= t;
|
|
7151
7036
|
} while (a >= t);
|
|
7152
7037
|
}
|
|
7153
|
-
if (x)
|
|
7154
|
-
|
|
7155
|
-
if (y)
|
|
7156
|
-
bone.worldY += this.yOffset * mix * this.data.y;
|
|
7038
|
+
if (x) bone.worldX += this.xOffset * mix * this.data.x;
|
|
7039
|
+
if (y) bone.worldY += this.yOffset * mix * this.data.y;
|
|
7157
7040
|
}
|
|
7158
7041
|
if (rotateOrShearX || scaleX) {
|
|
7159
7042
|
let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
|
|
@@ -7175,20 +7058,17 @@ var spine = (() => {
|
|
|
7175
7058
|
s = Math.sin(r);
|
|
7176
7059
|
if (scaleX) {
|
|
7177
7060
|
r = l * bone.getWorldScaleX();
|
|
7178
|
-
if (r > 0)
|
|
7179
|
-
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7061
|
+
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7180
7062
|
}
|
|
7181
7063
|
} else {
|
|
7182
7064
|
c = Math.cos(ca);
|
|
7183
7065
|
s = Math.sin(ca);
|
|
7184
7066
|
const r = l * bone.getWorldScaleX();
|
|
7185
|
-
if (r > 0)
|
|
7186
|
-
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7067
|
+
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7187
7068
|
}
|
|
7188
7069
|
a = this.remaining;
|
|
7189
7070
|
if (a >= t) {
|
|
7190
|
-
if (d == -1)
|
|
7191
|
-
d = Math.pow(this.damping, 60 * t);
|
|
7071
|
+
if (d == -1) d = Math.pow(this.damping, 60 * t);
|
|
7192
7072
|
const m = this.massInverse * t, e = this.strength, w = this.wind, g = Skeleton.yDown ? -this.gravity : this.gravity, h = l / f;
|
|
7193
7073
|
while (true) {
|
|
7194
7074
|
a -= t;
|
|
@@ -7201,8 +7081,7 @@ var spine = (() => {
|
|
|
7201
7081
|
this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
|
|
7202
7082
|
this.rotateOffset += this.rotateVelocity * t;
|
|
7203
7083
|
this.rotateVelocity *= d;
|
|
7204
|
-
if (a < t)
|
|
7205
|
-
break;
|
|
7084
|
+
if (a < t) break;
|
|
7206
7085
|
const r = this.rotateOffset * mr + ca;
|
|
7207
7086
|
c = Math.cos(r);
|
|
7208
7087
|
s = Math.sin(r);
|
|
@@ -7217,10 +7096,8 @@ var spine = (() => {
|
|
|
7217
7096
|
this.cy = bone.worldY;
|
|
7218
7097
|
break;
|
|
7219
7098
|
case 3 /* pose */:
|
|
7220
|
-
if (x)
|
|
7221
|
-
|
|
7222
|
-
if (y)
|
|
7223
|
-
bone.worldY += this.yOffset * mix * this.data.y;
|
|
7099
|
+
if (x) bone.worldX += this.xOffset * mix * this.data.x;
|
|
7100
|
+
if (y) bone.worldY += this.yOffset * mix * this.data.y;
|
|
7224
7101
|
}
|
|
7225
7102
|
if (rotateOrShearX) {
|
|
7226
7103
|
let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
|
|
@@ -7303,10 +7180,8 @@ var spine = (() => {
|
|
|
7303
7180
|
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
|
|
7304
7181
|
deform = new Array();
|
|
7305
7182
|
constructor(data, bone) {
|
|
7306
|
-
if (!data)
|
|
7307
|
-
|
|
7308
|
-
if (!bone)
|
|
7309
|
-
throw new Error("bone cannot be null.");
|
|
7183
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7184
|
+
if (!bone) throw new Error("bone cannot be null.");
|
|
7310
7185
|
this.data = data;
|
|
7311
7186
|
this.bone = bone;
|
|
7312
7187
|
this.color = new Color();
|
|
@@ -7325,8 +7200,7 @@ var spine = (() => {
|
|
|
7325
7200
|
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
|
|
7326
7201
|
* specified attachment. */
|
|
7327
7202
|
setAttachment(attachment) {
|
|
7328
|
-
if (this.attachment == attachment)
|
|
7329
|
-
return;
|
|
7203
|
+
if (this.attachment == attachment) return;
|
|
7330
7204
|
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttachment != this.attachment.timelineAttachment) {
|
|
7331
7205
|
this.deform.length = 0;
|
|
7332
7206
|
}
|
|
@@ -7336,8 +7210,7 @@ var spine = (() => {
|
|
|
7336
7210
|
/** Sets this slot to the setup pose. */
|
|
7337
7211
|
setToSetupPose() {
|
|
7338
7212
|
this.color.setFromColor(this.data.color);
|
|
7339
|
-
if (this.darkColor)
|
|
7340
|
-
this.darkColor.setFromColor(this.data.darkColor);
|
|
7213
|
+
if (this.darkColor) this.darkColor.setFromColor(this.data.darkColor);
|
|
7341
7214
|
if (!this.data.attachmentName)
|
|
7342
7215
|
this.attachment = null;
|
|
7343
7216
|
else {
|
|
@@ -7364,21 +7237,17 @@ var spine = (() => {
|
|
|
7364
7237
|
temp = new Vector2();
|
|
7365
7238
|
active = false;
|
|
7366
7239
|
constructor(data, skeleton) {
|
|
7367
|
-
if (!data)
|
|
7368
|
-
|
|
7369
|
-
if (!skeleton)
|
|
7370
|
-
throw new Error("skeleton cannot be null.");
|
|
7240
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7241
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
7371
7242
|
this.data = data;
|
|
7372
7243
|
this.bones = new Array();
|
|
7373
7244
|
for (let i = 0; i < data.bones.length; i++) {
|
|
7374
7245
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
7375
|
-
if (!bone)
|
|
7376
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
7246
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
7377
7247
|
this.bones.push(bone);
|
|
7378
7248
|
}
|
|
7379
7249
|
let target = skeleton.findBone(data.target.name);
|
|
7380
|
-
if (!target)
|
|
7381
|
-
throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
7250
|
+
if (!target) throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
7382
7251
|
this.target = target;
|
|
7383
7252
|
this.mixRotate = data.mixRotate;
|
|
7384
7253
|
this.mixX = data.mixX;
|
|
@@ -7400,8 +7269,7 @@ var spine = (() => {
|
|
|
7400
7269
|
this.mixShearY = data.mixShearY;
|
|
7401
7270
|
}
|
|
7402
7271
|
update(physics) {
|
|
7403
|
-
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
7404
|
-
return;
|
|
7272
|
+
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0) return;
|
|
7405
7273
|
if (this.data.local) {
|
|
7406
7274
|
if (this.data.relative)
|
|
7407
7275
|
this.applyRelativeLocal();
|
|
@@ -7447,15 +7315,13 @@ var spine = (() => {
|
|
|
7447
7315
|
}
|
|
7448
7316
|
if (mixScaleX != 0) {
|
|
7449
7317
|
let s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
|
|
7450
|
-
if (s != 0)
|
|
7451
|
-
s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
|
|
7318
|
+
if (s != 0) s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
|
|
7452
7319
|
bone.a *= s;
|
|
7453
7320
|
bone.c *= s;
|
|
7454
7321
|
}
|
|
7455
7322
|
if (mixScaleY != 0) {
|
|
7456
7323
|
let s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
|
|
7457
|
-
if (s != 0)
|
|
7458
|
-
s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
|
|
7324
|
+
if (s != 0) s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
|
|
7459
7325
|
bone.b *= s;
|
|
7460
7326
|
bone.d *= s;
|
|
7461
7327
|
}
|
|
@@ -7537,8 +7403,7 @@ var spine = (() => {
|
|
|
7537
7403
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7538
7404
|
let bone = bones[i];
|
|
7539
7405
|
let rotation = bone.arotation;
|
|
7540
|
-
if (mixRotate != 0)
|
|
7541
|
-
rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7406
|
+
if (mixRotate != 0) rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7542
7407
|
let x = bone.ax, y = bone.ay;
|
|
7543
7408
|
x += (target.ax - x + this.data.offsetX) * mixX;
|
|
7544
7409
|
y += (target.ay - y + this.data.offsetY) * mixY;
|
|
@@ -7548,8 +7413,7 @@ var spine = (() => {
|
|
|
7548
7413
|
if (mixScaleY != 0 && scaleY != 0)
|
|
7549
7414
|
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
|
|
7550
7415
|
let shearY = bone.ashearY;
|
|
7551
|
-
if (mixShearY != 0)
|
|
7552
|
-
shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7416
|
+
if (mixShearY != 0) shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7553
7417
|
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
|
|
7554
7418
|
}
|
|
7555
7419
|
}
|
|
@@ -7571,7 +7435,9 @@ var spine = (() => {
|
|
|
7571
7435
|
};
|
|
7572
7436
|
|
|
7573
7437
|
// spine-core/src/Skeleton.ts
|
|
7574
|
-
var
|
|
7438
|
+
var Skeleton = class _Skeleton {
|
|
7439
|
+
static quadTriangles = [0, 1, 2, 2, 3, 0];
|
|
7440
|
+
static yDown = false;
|
|
7575
7441
|
/** The skeleton's setup pose data. */
|
|
7576
7442
|
data;
|
|
7577
7443
|
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
@@ -7615,8 +7481,7 @@ var spine = (() => {
|
|
|
7615
7481
|
* See {@link #update(float)}. */
|
|
7616
7482
|
time = 0;
|
|
7617
7483
|
constructor(data) {
|
|
7618
|
-
if (!data)
|
|
7619
|
-
throw new Error("data cannot be null.");
|
|
7484
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7620
7485
|
this.data = data;
|
|
7621
7486
|
this.bones = new Array();
|
|
7622
7487
|
for (let i = 0; i < data.bones.length; i++) {
|
|
@@ -7727,8 +7592,7 @@ var spine = (() => {
|
|
|
7727
7592
|
}
|
|
7728
7593
|
sortIkConstraint(constraint) {
|
|
7729
7594
|
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7730
|
-
if (!constraint.active)
|
|
7731
|
-
return;
|
|
7595
|
+
if (!constraint.active) return;
|
|
7732
7596
|
let target = constraint.target;
|
|
7733
7597
|
this.sortBone(target);
|
|
7734
7598
|
let constrained = constraint.bones;
|
|
@@ -7747,20 +7611,17 @@ var spine = (() => {
|
|
|
7747
7611
|
}
|
|
7748
7612
|
sortPathConstraint(constraint) {
|
|
7749
7613
|
constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7750
|
-
if (!constraint.active)
|
|
7751
|
-
return;
|
|
7614
|
+
if (!constraint.active) return;
|
|
7752
7615
|
let slot = constraint.target;
|
|
7753
7616
|
let slotIndex = slot.data.index;
|
|
7754
7617
|
let slotBone = slot.bone;
|
|
7755
|
-
if (this.skin)
|
|
7756
|
-
this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
|
|
7618
|
+
if (this.skin) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
|
|
7757
7619
|
if (this.data.defaultSkin && this.data.defaultSkin != this.skin)
|
|
7758
7620
|
this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
|
|
7759
7621
|
for (let i = 0, n = this.data.skins.length; i < n; i++)
|
|
7760
7622
|
this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
|
|
7761
7623
|
let attachment = slot.getAttachment();
|
|
7762
|
-
if (attachment instanceof PathAttachment)
|
|
7763
|
-
this.sortPathConstraintAttachmentWith(attachment, slotBone);
|
|
7624
|
+
if (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);
|
|
7764
7625
|
let constrained = constraint.bones;
|
|
7765
7626
|
let boneCount = constrained.length;
|
|
7766
7627
|
for (let i = 0; i < boneCount; i++)
|
|
@@ -7773,8 +7634,7 @@ var spine = (() => {
|
|
|
7773
7634
|
}
|
|
7774
7635
|
sortTransformConstraint(constraint) {
|
|
7775
7636
|
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7776
|
-
if (!constraint.active)
|
|
7777
|
-
return;
|
|
7637
|
+
if (!constraint.active) return;
|
|
7778
7638
|
this.sortBone(constraint.target);
|
|
7779
7639
|
let constrained = constraint.bones;
|
|
7780
7640
|
let boneCount = constrained.length;
|
|
@@ -7797,15 +7657,13 @@ var spine = (() => {
|
|
|
7797
7657
|
}
|
|
7798
7658
|
sortPathConstraintAttachment(skin, slotIndex, slotBone) {
|
|
7799
7659
|
let attachments = skin.attachments[slotIndex];
|
|
7800
|
-
if (!attachments)
|
|
7801
|
-
return;
|
|
7660
|
+
if (!attachments) return;
|
|
7802
7661
|
for (let key in attachments) {
|
|
7803
7662
|
this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
|
|
7804
7663
|
}
|
|
7805
7664
|
}
|
|
7806
7665
|
sortPathConstraintAttachmentWith(attachment, slotBone) {
|
|
7807
|
-
if (!(attachment instanceof PathAttachment))
|
|
7808
|
-
return;
|
|
7666
|
+
if (!(attachment instanceof PathAttachment)) return;
|
|
7809
7667
|
let pathBones = attachment.bones;
|
|
7810
7668
|
if (!pathBones)
|
|
7811
7669
|
this.sortBone(slotBone);
|
|
@@ -7822,31 +7680,25 @@ var spine = (() => {
|
|
|
7822
7680
|
sortPhysicsConstraint(constraint) {
|
|
7823
7681
|
const bone = constraint.bone;
|
|
7824
7682
|
constraint.active = bone.active && (!constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7825
|
-
if (!constraint.active)
|
|
7826
|
-
return;
|
|
7683
|
+
if (!constraint.active) return;
|
|
7827
7684
|
this.sortBone(bone);
|
|
7828
7685
|
this._updateCache.push(constraint);
|
|
7829
7686
|
this.sortReset(bone.children);
|
|
7830
7687
|
bone.sorted = true;
|
|
7831
7688
|
}
|
|
7832
7689
|
sortBone(bone) {
|
|
7833
|
-
if (!bone)
|
|
7834
|
-
|
|
7835
|
-
if (bone.sorted)
|
|
7836
|
-
return;
|
|
7690
|
+
if (!bone) return;
|
|
7691
|
+
if (bone.sorted) return;
|
|
7837
7692
|
let parent = bone.parent;
|
|
7838
|
-
if (parent)
|
|
7839
|
-
this.sortBone(parent);
|
|
7693
|
+
if (parent) this.sortBone(parent);
|
|
7840
7694
|
bone.sorted = true;
|
|
7841
7695
|
this._updateCache.push(bone);
|
|
7842
7696
|
}
|
|
7843
7697
|
sortReset(bones) {
|
|
7844
7698
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7845
7699
|
let bone = bones[i];
|
|
7846
|
-
if (!bone.active)
|
|
7847
|
-
|
|
7848
|
-
if (bone.sorted)
|
|
7849
|
-
this.sortReset(bone.children);
|
|
7700
|
+
if (!bone.active) continue;
|
|
7701
|
+
if (bone.sorted) this.sortReset(bone.children);
|
|
7850
7702
|
bone.sorted = false;
|
|
7851
7703
|
}
|
|
7852
7704
|
}
|
|
@@ -7855,8 +7707,7 @@ var spine = (() => {
|
|
|
7855
7707
|
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7856
7708
|
* Runtimes Guide. */
|
|
7857
7709
|
updateWorldTransform(physics) {
|
|
7858
|
-
if (physics === void 0 || physics === null)
|
|
7859
|
-
throw new Error("physics is undefined");
|
|
7710
|
+
if (physics === void 0 || physics === null) throw new Error("physics is undefined");
|
|
7860
7711
|
let bones = this.bones;
|
|
7861
7712
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7862
7713
|
let bone = bones[i];
|
|
@@ -7873,8 +7724,7 @@ var spine = (() => {
|
|
|
7873
7724
|
updateCache[i].update(physics);
|
|
7874
7725
|
}
|
|
7875
7726
|
updateWorldTransformWith(physics, parent) {
|
|
7876
|
-
if (!parent)
|
|
7877
|
-
throw new Error("parent cannot be null.");
|
|
7727
|
+
if (!parent) throw new Error("parent cannot be null.");
|
|
7878
7728
|
let bones = this.bones;
|
|
7879
7729
|
for (let i = 1, n = bones.length; i < n; i++) {
|
|
7880
7730
|
let bone = bones[i];
|
|
@@ -7887,8 +7737,7 @@ var spine = (() => {
|
|
|
7887
7737
|
bone.ashearY = bone.shearY;
|
|
7888
7738
|
}
|
|
7889
7739
|
let rootBone = this.getRootBone();
|
|
7890
|
-
if (!rootBone)
|
|
7891
|
-
throw new Error("Root bone must not be null.");
|
|
7740
|
+
if (!rootBone) throw new Error("Root bone must not be null.");
|
|
7892
7741
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
7893
7742
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
7894
7743
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -7905,8 +7754,7 @@ var spine = (() => {
|
|
|
7905
7754
|
let updateCache = this._updateCache;
|
|
7906
7755
|
for (let i = 0, n = updateCache.length; i < n; i++) {
|
|
7907
7756
|
let updatable = updateCache[i];
|
|
7908
|
-
if (updatable != rootBone)
|
|
7909
|
-
updatable.update(physics);
|
|
7757
|
+
if (updatable != rootBone) updatable.update(physics);
|
|
7910
7758
|
}
|
|
7911
7759
|
}
|
|
7912
7760
|
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
@@ -7916,16 +7764,11 @@ var spine = (() => {
|
|
|
7916
7764
|
}
|
|
7917
7765
|
/** Sets the bones and constraints to their setup pose values. */
|
|
7918
7766
|
setBonesToSetupPose() {
|
|
7919
|
-
for (const bone of this.bones)
|
|
7920
|
-
|
|
7921
|
-
for (const constraint of this.
|
|
7922
|
-
|
|
7923
|
-
for (const constraint of this.
|
|
7924
|
-
constraint.setToSetupPose();
|
|
7925
|
-
for (const constraint of this.pathConstraints)
|
|
7926
|
-
constraint.setToSetupPose();
|
|
7927
|
-
for (const constraint of this.physicsConstraints)
|
|
7928
|
-
constraint.setToSetupPose();
|
|
7767
|
+
for (const bone of this.bones) bone.setToSetupPose();
|
|
7768
|
+
for (const constraint of this.ikConstraints) constraint.setToSetupPose();
|
|
7769
|
+
for (const constraint of this.transformConstraints) constraint.setToSetupPose();
|
|
7770
|
+
for (const constraint of this.pathConstraints) constraint.setToSetupPose();
|
|
7771
|
+
for (const constraint of this.physicsConstraints) constraint.setToSetupPose();
|
|
7929
7772
|
}
|
|
7930
7773
|
/** Sets the slots and draw order to their setup pose values. */
|
|
7931
7774
|
setSlotsToSetupPose() {
|
|
@@ -7936,19 +7779,16 @@ var spine = (() => {
|
|
|
7936
7779
|
}
|
|
7937
7780
|
/** @returns May return null. */
|
|
7938
7781
|
getRootBone() {
|
|
7939
|
-
if (this.bones.length == 0)
|
|
7940
|
-
return null;
|
|
7782
|
+
if (this.bones.length == 0) return null;
|
|
7941
7783
|
return this.bones[0];
|
|
7942
7784
|
}
|
|
7943
7785
|
/** @returns May be null. */
|
|
7944
7786
|
findBone(boneName) {
|
|
7945
|
-
if (!boneName)
|
|
7946
|
-
throw new Error("boneName cannot be null.");
|
|
7787
|
+
if (!boneName) throw new Error("boneName cannot be null.");
|
|
7947
7788
|
let bones = this.bones;
|
|
7948
7789
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7949
7790
|
let bone = bones[i];
|
|
7950
|
-
if (bone.data.name == boneName)
|
|
7951
|
-
return bone;
|
|
7791
|
+
if (bone.data.name == boneName) return bone;
|
|
7952
7792
|
}
|
|
7953
7793
|
return null;
|
|
7954
7794
|
}
|
|
@@ -7956,13 +7796,11 @@ var spine = (() => {
|
|
|
7956
7796
|
* repeatedly.
|
|
7957
7797
|
* @returns May be null. */
|
|
7958
7798
|
findSlot(slotName) {
|
|
7959
|
-
if (!slotName)
|
|
7960
|
-
throw new Error("slotName cannot be null.");
|
|
7799
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
7961
7800
|
let slots = this.slots;
|
|
7962
7801
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
7963
7802
|
let slot = slots[i];
|
|
7964
|
-
if (slot.data.name == slotName)
|
|
7965
|
-
return slot;
|
|
7803
|
+
if (slot.data.name == slotName) return slot;
|
|
7966
7804
|
}
|
|
7967
7805
|
return null;
|
|
7968
7806
|
}
|
|
@@ -7971,8 +7809,7 @@ var spine = (() => {
|
|
|
7971
7809
|
* See {@link #setSkin()}. */
|
|
7972
7810
|
setSkinByName(skinName) {
|
|
7973
7811
|
let skin = this.data.findSkin(skinName);
|
|
7974
|
-
if (!skin)
|
|
7975
|
-
throw new Error("Skin not found: " + skinName);
|
|
7812
|
+
if (!skin) throw new Error("Skin not found: " + skinName);
|
|
7976
7813
|
this.setSkin(skin);
|
|
7977
7814
|
}
|
|
7978
7815
|
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
|
|
@@ -7986,8 +7823,7 @@ var spine = (() => {
|
|
|
7986
7823
|
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
|
|
7987
7824
|
* @param newSkin May be null. */
|
|
7988
7825
|
setSkin(newSkin) {
|
|
7989
|
-
if (newSkin == this.skin)
|
|
7990
|
-
return;
|
|
7826
|
+
if (newSkin == this.skin) return;
|
|
7991
7827
|
if (newSkin) {
|
|
7992
7828
|
if (this.skin)
|
|
7993
7829
|
newSkin.attachAll(this, this.skin);
|
|
@@ -7998,8 +7834,7 @@ var spine = (() => {
|
|
|
7998
7834
|
let name = slot.data.attachmentName;
|
|
7999
7835
|
if (name) {
|
|
8000
7836
|
let attachment = newSkin.getAttachment(i, name);
|
|
8001
|
-
if (attachment)
|
|
8002
|
-
slot.setAttachment(attachment);
|
|
7837
|
+
if (attachment) slot.setAttachment(attachment);
|
|
8003
7838
|
}
|
|
8004
7839
|
}
|
|
8005
7840
|
}
|
|
@@ -8014,8 +7849,7 @@ var spine = (() => {
|
|
|
8014
7849
|
* @returns May be null. */
|
|
8015
7850
|
getAttachmentByName(slotName, attachmentName) {
|
|
8016
7851
|
let slot = this.data.findSlot(slotName);
|
|
8017
|
-
if (!slot)
|
|
8018
|
-
throw new Error(`Can't find slot with name ${slotName}`);
|
|
7852
|
+
if (!slot) throw new Error(`Can't find slot with name ${slotName}`);
|
|
8019
7853
|
return this.getAttachment(slot.index, attachmentName);
|
|
8020
7854
|
}
|
|
8021
7855
|
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
|
|
@@ -8024,23 +7858,19 @@ var spine = (() => {
|
|
|
8024
7858
|
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
|
8025
7859
|
* @returns May be null. */
|
|
8026
7860
|
getAttachment(slotIndex, attachmentName) {
|
|
8027
|
-
if (!attachmentName)
|
|
8028
|
-
throw new Error("attachmentName cannot be null.");
|
|
7861
|
+
if (!attachmentName) throw new Error("attachmentName cannot be null.");
|
|
8029
7862
|
if (this.skin) {
|
|
8030
7863
|
let attachment = this.skin.getAttachment(slotIndex, attachmentName);
|
|
8031
|
-
if (attachment)
|
|
8032
|
-
return attachment;
|
|
7864
|
+
if (attachment) return attachment;
|
|
8033
7865
|
}
|
|
8034
|
-
if (this.data.defaultSkin)
|
|
8035
|
-
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
7866
|
+
if (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
8036
7867
|
return null;
|
|
8037
7868
|
}
|
|
8038
7869
|
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
|
8039
7870
|
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
|
8040
7871
|
* @param attachmentName May be null to clear the slot's attachment. */
|
|
8041
7872
|
setAttachment(slotName, attachmentName) {
|
|
8042
|
-
if (!slotName)
|
|
8043
|
-
throw new Error("slotName cannot be null.");
|
|
7873
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
8044
7874
|
let slots = this.slots;
|
|
8045
7875
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
8046
7876
|
let slot = slots[i];
|
|
@@ -8048,8 +7878,7 @@ var spine = (() => {
|
|
|
8048
7878
|
let attachment = null;
|
|
8049
7879
|
if (attachmentName) {
|
|
8050
7880
|
attachment = this.getAttachment(i, attachmentName);
|
|
8051
|
-
if (!attachment)
|
|
8052
|
-
throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
|
|
7881
|
+
if (!attachment) throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
|
|
8053
7882
|
}
|
|
8054
7883
|
slot.setAttachment(attachment);
|
|
8055
7884
|
return;
|
|
@@ -8061,31 +7890,27 @@ var spine = (() => {
|
|
|
8061
7890
|
* than to call it repeatedly.
|
|
8062
7891
|
* @return May be null. */
|
|
8063
7892
|
findIkConstraint(constraintName) {
|
|
8064
|
-
if (!constraintName)
|
|
8065
|
-
throw new Error("constraintName cannot be null.");
|
|
7893
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8066
7894
|
return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8067
7895
|
}
|
|
8068
7896
|
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
8069
7897
|
* this method than to call it repeatedly.
|
|
8070
7898
|
* @return May be null. */
|
|
8071
7899
|
findTransformConstraint(constraintName) {
|
|
8072
|
-
if (!constraintName)
|
|
8073
|
-
throw new Error("constraintName cannot be null.");
|
|
7900
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8074
7901
|
return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8075
7902
|
}
|
|
8076
7903
|
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
8077
7904
|
* than to call it repeatedly.
|
|
8078
7905
|
* @return May be null. */
|
|
8079
7906
|
findPathConstraint(constraintName) {
|
|
8080
|
-
if (!constraintName)
|
|
8081
|
-
throw new Error("constraintName cannot be null.");
|
|
7907
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8082
7908
|
return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8083
7909
|
}
|
|
8084
7910
|
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
|
|
8085
7911
|
* method than to call it repeatedly. */
|
|
8086
7912
|
findPhysicsConstraint(constraintName) {
|
|
8087
|
-
if (constraintName == null)
|
|
8088
|
-
throw new Error("constraintName cannot be null.");
|
|
7913
|
+
if (constraintName == null) throw new Error("constraintName cannot be null.");
|
|
8089
7914
|
return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8090
7915
|
}
|
|
8091
7916
|
/** 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 }`.
|
|
@@ -8102,16 +7927,13 @@ var spine = (() => {
|
|
|
8102
7927
|
* @param temp Working memory to temporarily store attachments' computed world vertices.
|
|
8103
7928
|
* @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
|
|
8104
7929
|
getBounds(offset, size, temp = new Array(2), clipper = null) {
|
|
8105
|
-
if (!offset)
|
|
8106
|
-
|
|
8107
|
-
if (!size)
|
|
8108
|
-
throw new Error("size cannot be null.");
|
|
7930
|
+
if (!offset) throw new Error("offset cannot be null.");
|
|
7931
|
+
if (!size) throw new Error("size cannot be null.");
|
|
8109
7932
|
let drawOrder = this.drawOrder;
|
|
8110
7933
|
let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
|
8111
7934
|
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
|
8112
7935
|
let slot = drawOrder[i];
|
|
8113
|
-
if (!slot.bone.active)
|
|
8114
|
-
continue;
|
|
7936
|
+
if (!slot.bone.active) continue;
|
|
8115
7937
|
let verticesLength = 0;
|
|
8116
7938
|
let vertices = null;
|
|
8117
7939
|
let triangles = null;
|
|
@@ -8145,11 +7967,9 @@ var spine = (() => {
|
|
|
8145
7967
|
maxY = Math.max(maxY, y);
|
|
8146
7968
|
}
|
|
8147
7969
|
}
|
|
8148
|
-
if (clipper != null)
|
|
8149
|
-
clipper.clipEndWithSlot(slot);
|
|
7970
|
+
if (clipper != null) clipper.clipEndWithSlot(slot);
|
|
8150
7971
|
}
|
|
8151
|
-
if (clipper != null)
|
|
8152
|
-
clipper.clipEnd();
|
|
7972
|
+
if (clipper != null) clipper.clipEnd();
|
|
8153
7973
|
offset.set(minX, minY);
|
|
8154
7974
|
size.set(maxX - minX, maxY - minY);
|
|
8155
7975
|
}
|
|
@@ -8169,9 +7989,6 @@ var spine = (() => {
|
|
|
8169
7989
|
physicsConstraints[i].rotate(x, y, degrees);
|
|
8170
7990
|
}
|
|
8171
7991
|
};
|
|
8172
|
-
var Skeleton = _Skeleton;
|
|
8173
|
-
__publicField(Skeleton, "quadTriangles", [0, 1, 2, 2, 3, 0]);
|
|
8174
|
-
__publicField(Skeleton, "yDown", false);
|
|
8175
7992
|
var Physics = /* @__PURE__ */ ((Physics2) => {
|
|
8176
7993
|
Physics2[Physics2["none"] = 0] = "none";
|
|
8177
7994
|
Physics2[Physics2["reset"] = 1] = "reset";
|
|
@@ -8188,10 +8005,8 @@ var spine = (() => {
|
|
|
8188
8005
|
this._bone = boneData;
|
|
8189
8006
|
}
|
|
8190
8007
|
get bone() {
|
|
8191
|
-
if (!this._bone)
|
|
8192
|
-
|
|
8193
|
-
else
|
|
8194
|
-
return this._bone;
|
|
8008
|
+
if (!this._bone) throw new Error("BoneData not set.");
|
|
8009
|
+
else return this._bone;
|
|
8195
8010
|
}
|
|
8196
8011
|
x = 0;
|
|
8197
8012
|
y = 0;
|
|
@@ -8274,13 +8089,11 @@ var spine = (() => {
|
|
|
8274
8089
|
* multiple times.
|
|
8275
8090
|
* @returns May be null. */
|
|
8276
8091
|
findBone(boneName) {
|
|
8277
|
-
if (!boneName)
|
|
8278
|
-
throw new Error("boneName cannot be null.");
|
|
8092
|
+
if (!boneName) throw new Error("boneName cannot be null.");
|
|
8279
8093
|
let bones = this.bones;
|
|
8280
8094
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
8281
8095
|
let bone = bones[i];
|
|
8282
|
-
if (bone.name == boneName)
|
|
8283
|
-
return bone;
|
|
8096
|
+
if (bone.name == boneName) return bone;
|
|
8284
8097
|
}
|
|
8285
8098
|
return null;
|
|
8286
8099
|
}
|
|
@@ -8288,13 +8101,11 @@ var spine = (() => {
|
|
|
8288
8101
|
* multiple times.
|
|
8289
8102
|
* @returns May be null. */
|
|
8290
8103
|
findSlot(slotName) {
|
|
8291
|
-
if (!slotName)
|
|
8292
|
-
throw new Error("slotName cannot be null.");
|
|
8104
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
8293
8105
|
let slots = this.slots;
|
|
8294
8106
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
8295
8107
|
let slot = slots[i];
|
|
8296
|
-
if (slot.name == slotName)
|
|
8297
|
-
return slot;
|
|
8108
|
+
if (slot.name == slotName) return slot;
|
|
8298
8109
|
}
|
|
8299
8110
|
return null;
|
|
8300
8111
|
}
|
|
@@ -8302,13 +8113,11 @@ var spine = (() => {
|
|
|
8302
8113
|
* multiple times.
|
|
8303
8114
|
* @returns May be null. */
|
|
8304
8115
|
findSkin(skinName) {
|
|
8305
|
-
if (!skinName)
|
|
8306
|
-
throw new Error("skinName cannot be null.");
|
|
8116
|
+
if (!skinName) throw new Error("skinName cannot be null.");
|
|
8307
8117
|
let skins = this.skins;
|
|
8308
8118
|
for (let i = 0, n = skins.length; i < n; i++) {
|
|
8309
8119
|
let skin = skins[i];
|
|
8310
|
-
if (skin.name == skinName)
|
|
8311
|
-
return skin;
|
|
8120
|
+
if (skin.name == skinName) return skin;
|
|
8312
8121
|
}
|
|
8313
8122
|
return null;
|
|
8314
8123
|
}
|
|
@@ -8316,13 +8125,11 @@ var spine = (() => {
|
|
|
8316
8125
|
* multiple times.
|
|
8317
8126
|
* @returns May be null. */
|
|
8318
8127
|
findEvent(eventDataName) {
|
|
8319
|
-
if (!eventDataName)
|
|
8320
|
-
throw new Error("eventDataName cannot be null.");
|
|
8128
|
+
if (!eventDataName) throw new Error("eventDataName cannot be null.");
|
|
8321
8129
|
let events = this.events;
|
|
8322
8130
|
for (let i = 0, n = events.length; i < n; i++) {
|
|
8323
8131
|
let event = events[i];
|
|
8324
|
-
if (event.name == eventDataName)
|
|
8325
|
-
return event;
|
|
8132
|
+
if (event.name == eventDataName) return event;
|
|
8326
8133
|
}
|
|
8327
8134
|
return null;
|
|
8328
8135
|
}
|
|
@@ -8330,13 +8137,11 @@ var spine = (() => {
|
|
|
8330
8137
|
* call it multiple times.
|
|
8331
8138
|
* @returns May be null. */
|
|
8332
8139
|
findAnimation(animationName) {
|
|
8333
|
-
if (!animationName)
|
|
8334
|
-
throw new Error("animationName cannot be null.");
|
|
8140
|
+
if (!animationName) throw new Error("animationName cannot be null.");
|
|
8335
8141
|
let animations = this.animations;
|
|
8336
8142
|
for (let i = 0, n = animations.length; i < n; i++) {
|
|
8337
8143
|
let animation = animations[i];
|
|
8338
|
-
if (animation.name == animationName)
|
|
8339
|
-
return animation;
|
|
8144
|
+
if (animation.name == animationName) return animation;
|
|
8340
8145
|
}
|
|
8341
8146
|
return null;
|
|
8342
8147
|
}
|
|
@@ -8344,13 +8149,11 @@ var spine = (() => {
|
|
|
8344
8149
|
* than to call it multiple times.
|
|
8345
8150
|
* @return May be null. */
|
|
8346
8151
|
findIkConstraint(constraintName) {
|
|
8347
|
-
if (!constraintName)
|
|
8348
|
-
throw new Error("constraintName cannot be null.");
|
|
8152
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8349
8153
|
const ikConstraints = this.ikConstraints;
|
|
8350
8154
|
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
|
8351
8155
|
const constraint = ikConstraints[i];
|
|
8352
|
-
if (constraint.name == constraintName)
|
|
8353
|
-
return constraint;
|
|
8156
|
+
if (constraint.name == constraintName) return constraint;
|
|
8354
8157
|
}
|
|
8355
8158
|
return null;
|
|
8356
8159
|
}
|
|
@@ -8358,13 +8161,11 @@ var spine = (() => {
|
|
|
8358
8161
|
* this method than to call it multiple times.
|
|
8359
8162
|
* @return May be null. */
|
|
8360
8163
|
findTransformConstraint(constraintName) {
|
|
8361
|
-
if (!constraintName)
|
|
8362
|
-
throw new Error("constraintName cannot be null.");
|
|
8164
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8363
8165
|
const transformConstraints = this.transformConstraints;
|
|
8364
8166
|
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
8365
8167
|
const constraint = transformConstraints[i];
|
|
8366
|
-
if (constraint.name == constraintName)
|
|
8367
|
-
return constraint;
|
|
8168
|
+
if (constraint.name == constraintName) return constraint;
|
|
8368
8169
|
}
|
|
8369
8170
|
return null;
|
|
8370
8171
|
}
|
|
@@ -8372,13 +8173,11 @@ var spine = (() => {
|
|
|
8372
8173
|
* than to call it multiple times.
|
|
8373
8174
|
* @return May be null. */
|
|
8374
8175
|
findPathConstraint(constraintName) {
|
|
8375
|
-
if (!constraintName)
|
|
8376
|
-
throw new Error("constraintName cannot be null.");
|
|
8176
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8377
8177
|
const pathConstraints = this.pathConstraints;
|
|
8378
8178
|
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
|
8379
8179
|
const constraint = pathConstraints[i];
|
|
8380
|
-
if (constraint.name == constraintName)
|
|
8381
|
-
return constraint;
|
|
8180
|
+
if (constraint.name == constraintName) return constraint;
|
|
8382
8181
|
}
|
|
8383
8182
|
return null;
|
|
8384
8183
|
}
|
|
@@ -8386,13 +8185,11 @@ var spine = (() => {
|
|
|
8386
8185
|
* than to call it multiple times.
|
|
8387
8186
|
* @return May be null. */
|
|
8388
8187
|
findPhysicsConstraint(constraintName) {
|
|
8389
|
-
if (!constraintName)
|
|
8390
|
-
throw new Error("constraintName cannot be null.");
|
|
8188
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8391
8189
|
const physicsConstraints = this.physicsConstraints;
|
|
8392
8190
|
for (let i = 0, n = physicsConstraints.length; i < n; i++) {
|
|
8393
8191
|
const constraint = physicsConstraints[i];
|
|
8394
|
-
if (constraint.name == constraintName)
|
|
8395
|
-
return constraint;
|
|
8192
|
+
if (constraint.name == constraintName) return constraint;
|
|
8396
8193
|
}
|
|
8397
8194
|
return null;
|
|
8398
8195
|
}
|
|
@@ -8416,19 +8213,15 @@ var spine = (() => {
|
|
|
8416
8213
|
color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
|
|
8417
8214
|
// fe9e4fff
|
|
8418
8215
|
constructor(name) {
|
|
8419
|
-
if (!name)
|
|
8420
|
-
throw new Error("name cannot be null.");
|
|
8216
|
+
if (!name) throw new Error("name cannot be null.");
|
|
8421
8217
|
this.name = name;
|
|
8422
8218
|
}
|
|
8423
8219
|
/** Adds an attachment to the skin for the specified slot index and name. */
|
|
8424
8220
|
setAttachment(slotIndex, name, attachment) {
|
|
8425
|
-
if (!attachment)
|
|
8426
|
-
throw new Error("attachment cannot be null.");
|
|
8221
|
+
if (!attachment) throw new Error("attachment cannot be null.");
|
|
8427
8222
|
let attachments = this.attachments;
|
|
8428
|
-
if (slotIndex >= attachments.length)
|
|
8429
|
-
|
|
8430
|
-
if (!attachments[slotIndex])
|
|
8431
|
-
attachments[slotIndex] = {};
|
|
8223
|
+
if (slotIndex >= attachments.length) attachments.length = slotIndex + 1;
|
|
8224
|
+
if (!attachments[slotIndex]) attachments[slotIndex] = {};
|
|
8432
8225
|
attachments[slotIndex][name] = attachment;
|
|
8433
8226
|
}
|
|
8434
8227
|
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
|
@@ -8442,8 +8235,7 @@ var spine = (() => {
|
|
|
8442
8235
|
break;
|
|
8443
8236
|
}
|
|
8444
8237
|
}
|
|
8445
|
-
if (!contained)
|
|
8446
|
-
this.bones.push(bone);
|
|
8238
|
+
if (!contained) this.bones.push(bone);
|
|
8447
8239
|
}
|
|
8448
8240
|
for (let i = 0; i < skin.constraints.length; i++) {
|
|
8449
8241
|
let constraint = skin.constraints[i];
|
|
@@ -8454,8 +8246,7 @@ var spine = (() => {
|
|
|
8454
8246
|
break;
|
|
8455
8247
|
}
|
|
8456
8248
|
}
|
|
8457
|
-
if (!contained)
|
|
8458
|
-
this.constraints.push(constraint);
|
|
8249
|
+
if (!contained) this.constraints.push(constraint);
|
|
8459
8250
|
}
|
|
8460
8251
|
let attachments = skin.getAttachments();
|
|
8461
8252
|
for (let i = 0; i < attachments.length; i++) {
|
|
@@ -8475,8 +8266,7 @@ var spine = (() => {
|
|
|
8475
8266
|
break;
|
|
8476
8267
|
}
|
|
8477
8268
|
}
|
|
8478
|
-
if (!contained)
|
|
8479
|
-
this.bones.push(bone);
|
|
8269
|
+
if (!contained) this.bones.push(bone);
|
|
8480
8270
|
}
|
|
8481
8271
|
for (let i = 0; i < skin.constraints.length; i++) {
|
|
8482
8272
|
let constraint = skin.constraints[i];
|
|
@@ -8487,14 +8277,12 @@ var spine = (() => {
|
|
|
8487
8277
|
break;
|
|
8488
8278
|
}
|
|
8489
8279
|
}
|
|
8490
|
-
if (!contained)
|
|
8491
|
-
this.constraints.push(constraint);
|
|
8280
|
+
if (!contained) this.constraints.push(constraint);
|
|
8492
8281
|
}
|
|
8493
8282
|
let attachments = skin.getAttachments();
|
|
8494
8283
|
for (let i = 0; i < attachments.length; i++) {
|
|
8495
8284
|
var attachment = attachments[i];
|
|
8496
|
-
if (!attachment.attachment)
|
|
8497
|
-
continue;
|
|
8285
|
+
if (!attachment.attachment) continue;
|
|
8498
8286
|
if (attachment.attachment instanceof MeshAttachment) {
|
|
8499
8287
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
|
8500
8288
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
@@ -8512,8 +8300,7 @@ var spine = (() => {
|
|
|
8512
8300
|
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
|
8513
8301
|
removeAttachment(slotIndex, name) {
|
|
8514
8302
|
let dictionary = this.attachments[slotIndex];
|
|
8515
|
-
if (dictionary)
|
|
8516
|
-
delete dictionary[name];
|
|
8303
|
+
if (dictionary) delete dictionary[name];
|
|
8517
8304
|
}
|
|
8518
8305
|
/** Returns all attachments in this skin. */
|
|
8519
8306
|
getAttachments() {
|
|
@@ -8523,8 +8310,7 @@ var spine = (() => {
|
|
|
8523
8310
|
if (slotAttachments) {
|
|
8524
8311
|
for (let name in slotAttachments) {
|
|
8525
8312
|
let attachment = slotAttachments[name];
|
|
8526
|
-
if (attachment)
|
|
8527
|
-
entries.push(new SkinEntry(i, name, attachment));
|
|
8313
|
+
if (attachment) entries.push(new SkinEntry(i, name, attachment));
|
|
8528
8314
|
}
|
|
8529
8315
|
}
|
|
8530
8316
|
}
|
|
@@ -8536,8 +8322,7 @@ var spine = (() => {
|
|
|
8536
8322
|
if (slotAttachments) {
|
|
8537
8323
|
for (let name in slotAttachments) {
|
|
8538
8324
|
let attachment = slotAttachments[name];
|
|
8539
|
-
if (attachment)
|
|
8540
|
-
attachments.push(new SkinEntry(slotIndex, name, attachment));
|
|
8325
|
+
if (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));
|
|
8541
8326
|
}
|
|
8542
8327
|
}
|
|
8543
8328
|
}
|
|
@@ -8559,8 +8344,7 @@ var spine = (() => {
|
|
|
8559
8344
|
let skinAttachment = dictionary[key];
|
|
8560
8345
|
if (slotAttachment == skinAttachment) {
|
|
8561
8346
|
let attachment = this.getAttachment(slotIndex, key);
|
|
8562
|
-
if (attachment)
|
|
8563
|
-
slot.setAttachment(attachment);
|
|
8347
|
+
if (attachment) slot.setAttachment(attachment);
|
|
8564
8348
|
break;
|
|
8565
8349
|
}
|
|
8566
8350
|
}
|
|
@@ -8587,16 +8371,13 @@ var spine = (() => {
|
|
|
8587
8371
|
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
|
8588
8372
|
attachmentName = null;
|
|
8589
8373
|
/** The blend mode for drawing the slot's attachment. */
|
|
8590
|
-
blendMode =
|
|
8374
|
+
blendMode = 0 /* Normal */;
|
|
8591
8375
|
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
8592
8376
|
visible = true;
|
|
8593
8377
|
constructor(index, name, boneData) {
|
|
8594
|
-
if (index < 0)
|
|
8595
|
-
|
|
8596
|
-
if (!
|
|
8597
|
-
throw new Error("name cannot be null.");
|
|
8598
|
-
if (!boneData)
|
|
8599
|
-
throw new Error("boneData cannot be null.");
|
|
8378
|
+
if (index < 0) throw new Error("index must be >= 0.");
|
|
8379
|
+
if (!name) throw new Error("name cannot be null.");
|
|
8380
|
+
if (!boneData) throw new Error("boneData cannot be null.");
|
|
8600
8381
|
this.index = index;
|
|
8601
8382
|
this.name = name;
|
|
8602
8383
|
this.boneData = boneData;
|
|
@@ -8620,10 +8401,8 @@ var spine = (() => {
|
|
|
8620
8401
|
this._target = boneData;
|
|
8621
8402
|
}
|
|
8622
8403
|
get target() {
|
|
8623
|
-
if (!this._target)
|
|
8624
|
-
|
|
8625
|
-
else
|
|
8626
|
-
return this._target;
|
|
8404
|
+
if (!this._target) throw new Error("BoneData not set.");
|
|
8405
|
+
else return this._target;
|
|
8627
8406
|
}
|
|
8628
8407
|
mixRotate = 0;
|
|
8629
8408
|
mixX = 0;
|
|
@@ -8686,15 +8465,13 @@ var spine = (() => {
|
|
|
8686
8465
|
n = input.readInt(true);
|
|
8687
8466
|
for (let i = 0; i < n; i++) {
|
|
8688
8467
|
let str = input.readString();
|
|
8689
|
-
if (!str)
|
|
8690
|
-
throw new Error("String in string table must not be null.");
|
|
8468
|
+
if (!str) throw new Error("String in string table must not be null.");
|
|
8691
8469
|
input.strings.push(str);
|
|
8692
8470
|
}
|
|
8693
8471
|
n = input.readInt(true);
|
|
8694
8472
|
for (let i = 0; i < n; i++) {
|
|
8695
8473
|
let name = input.readString();
|
|
8696
|
-
if (!name)
|
|
8697
|
-
throw new Error("Bone name must not be null.");
|
|
8474
|
+
if (!name) throw new Error("Bone name must not be null.");
|
|
8698
8475
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
8699
8476
|
let data = new BoneData(i, name, parent);
|
|
8700
8477
|
data.rotation = input.readFloat();
|
|
@@ -8717,25 +8494,21 @@ var spine = (() => {
|
|
|
8717
8494
|
n = input.readInt(true);
|
|
8718
8495
|
for (let i = 0; i < n; i++) {
|
|
8719
8496
|
let slotName = input.readString();
|
|
8720
|
-
if (!slotName)
|
|
8721
|
-
throw new Error("Slot name must not be null.");
|
|
8497
|
+
if (!slotName) throw new Error("Slot name must not be null.");
|
|
8722
8498
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
8723
8499
|
let data = new SlotData(i, slotName, boneData);
|
|
8724
8500
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
8725
8501
|
let darkColor = input.readInt32();
|
|
8726
|
-
if (darkColor != -1)
|
|
8727
|
-
Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
|
|
8502
|
+
if (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
|
|
8728
8503
|
data.attachmentName = input.readStringRef();
|
|
8729
8504
|
data.blendMode = input.readInt(true);
|
|
8730
|
-
if (nonessential)
|
|
8731
|
-
data.visible = input.readBoolean();
|
|
8505
|
+
if (nonessential) data.visible = input.readBoolean();
|
|
8732
8506
|
skeletonData.slots.push(data);
|
|
8733
8507
|
}
|
|
8734
8508
|
n = input.readInt(true);
|
|
8735
8509
|
for (let i = 0, nn; i < n; i++) {
|
|
8736
8510
|
let name = input.readString();
|
|
8737
|
-
if (!name)
|
|
8738
|
-
throw new Error("IK constraint data name must not be null.");
|
|
8511
|
+
if (!name) throw new Error("IK constraint data name must not be null.");
|
|
8739
8512
|
let data = new IkConstraintData(name);
|
|
8740
8513
|
data.order = input.readInt(true);
|
|
8741
8514
|
nn = input.readInt(true);
|
|
@@ -8748,17 +8521,14 @@ var spine = (() => {
|
|
|
8748
8521
|
data.compress = (flags & 4) != 0;
|
|
8749
8522
|
data.stretch = (flags & 8) != 0;
|
|
8750
8523
|
data.uniform = (flags & 16) != 0;
|
|
8751
|
-
if ((flags & 32) != 0)
|
|
8752
|
-
|
|
8753
|
-
if ((flags & 128) != 0)
|
|
8754
|
-
data.softness = input.readFloat() * scale;
|
|
8524
|
+
if ((flags & 32) != 0) data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
|
|
8525
|
+
if ((flags & 128) != 0) data.softness = input.readFloat() * scale;
|
|
8755
8526
|
skeletonData.ikConstraints.push(data);
|
|
8756
8527
|
}
|
|
8757
8528
|
n = input.readInt(true);
|
|
8758
8529
|
for (let i = 0, nn; i < n; i++) {
|
|
8759
8530
|
let name = input.readString();
|
|
8760
|
-
if (!name)
|
|
8761
|
-
throw new Error("Transform constraint data name must not be null.");
|
|
8531
|
+
if (!name) throw new Error("Transform constraint data name must not be null.");
|
|
8762
8532
|
let data = new TransformConstraintData(name);
|
|
8763
8533
|
data.order = input.readInt(true);
|
|
8764
8534
|
nn = input.readInt(true);
|
|
@@ -8769,38 +8539,25 @@ var spine = (() => {
|
|
|
8769
8539
|
data.skinRequired = (flags & 1) != 0;
|
|
8770
8540
|
data.local = (flags & 2) != 0;
|
|
8771
8541
|
data.relative = (flags & 4) != 0;
|
|
8772
|
-
if ((flags & 8) != 0)
|
|
8773
|
-
|
|
8774
|
-
if ((flags &
|
|
8775
|
-
|
|
8776
|
-
if ((flags &
|
|
8777
|
-
data.offsetY = input.readFloat() * scale;
|
|
8778
|
-
if ((flags & 64) != 0)
|
|
8779
|
-
data.offsetScaleX = input.readFloat();
|
|
8780
|
-
if ((flags & 128) != 0)
|
|
8781
|
-
data.offsetScaleY = input.readFloat();
|
|
8542
|
+
if ((flags & 8) != 0) data.offsetRotation = input.readFloat();
|
|
8543
|
+
if ((flags & 16) != 0) data.offsetX = input.readFloat() * scale;
|
|
8544
|
+
if ((flags & 32) != 0) data.offsetY = input.readFloat() * scale;
|
|
8545
|
+
if ((flags & 64) != 0) data.offsetScaleX = input.readFloat();
|
|
8546
|
+
if ((flags & 128) != 0) data.offsetScaleY = input.readFloat();
|
|
8782
8547
|
flags = input.readByte();
|
|
8783
|
-
if ((flags & 1) != 0)
|
|
8784
|
-
|
|
8785
|
-
if ((flags &
|
|
8786
|
-
|
|
8787
|
-
if ((flags &
|
|
8788
|
-
|
|
8789
|
-
if ((flags &
|
|
8790
|
-
data.mixY = input.readFloat();
|
|
8791
|
-
if ((flags & 16) != 0)
|
|
8792
|
-
data.mixScaleX = input.readFloat();
|
|
8793
|
-
if ((flags & 32) != 0)
|
|
8794
|
-
data.mixScaleY = input.readFloat();
|
|
8795
|
-
if ((flags & 64) != 0)
|
|
8796
|
-
data.mixShearY = input.readFloat();
|
|
8548
|
+
if ((flags & 1) != 0) data.offsetShearY = input.readFloat();
|
|
8549
|
+
if ((flags & 2) != 0) data.mixRotate = input.readFloat();
|
|
8550
|
+
if ((flags & 4) != 0) data.mixX = input.readFloat();
|
|
8551
|
+
if ((flags & 8) != 0) data.mixY = input.readFloat();
|
|
8552
|
+
if ((flags & 16) != 0) data.mixScaleX = input.readFloat();
|
|
8553
|
+
if ((flags & 32) != 0) data.mixScaleY = input.readFloat();
|
|
8554
|
+
if ((flags & 64) != 0) data.mixShearY = input.readFloat();
|
|
8797
8555
|
skeletonData.transformConstraints.push(data);
|
|
8798
8556
|
}
|
|
8799
8557
|
n = input.readInt(true);
|
|
8800
8558
|
for (let i = 0, nn; i < n; i++) {
|
|
8801
8559
|
let name = input.readString();
|
|
8802
|
-
if (!name)
|
|
8803
|
-
throw new Error("Path constraint data name must not be null.");
|
|
8560
|
+
if (!name) throw new Error("Path constraint data name must not be null.");
|
|
8804
8561
|
let data = new PathConstraintData(name);
|
|
8805
8562
|
data.order = input.readInt(true);
|
|
8806
8563
|
data.skinRequired = input.readBoolean();
|
|
@@ -8812,14 +8569,11 @@ var spine = (() => {
|
|
|
8812
8569
|
data.positionMode = flags & 1;
|
|
8813
8570
|
data.spacingMode = flags >> 1 & 3;
|
|
8814
8571
|
data.rotateMode = flags >> 3 & 3;
|
|
8815
|
-
if ((flags & 128) != 0)
|
|
8816
|
-
data.offsetRotation = input.readFloat();
|
|
8572
|
+
if ((flags & 128) != 0) data.offsetRotation = input.readFloat();
|
|
8817
8573
|
data.position = input.readFloat();
|
|
8818
|
-
if (data.positionMode == 0 /* Fixed */)
|
|
8819
|
-
data.position *= scale;
|
|
8574
|
+
if (data.positionMode == 0 /* Fixed */) data.position *= scale;
|
|
8820
8575
|
data.spacing = input.readFloat();
|
|
8821
|
-
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
8822
|
-
data.spacing *= scale;
|
|
8576
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
|
|
8823
8577
|
data.mixRotate = input.readFloat();
|
|
8824
8578
|
data.mixX = input.readFloat();
|
|
8825
8579
|
data.mixY = input.readFloat();
|
|
@@ -8828,23 +8582,17 @@ var spine = (() => {
|
|
|
8828
8582
|
n = input.readInt(true);
|
|
8829
8583
|
for (let i = 0, nn; i < n; i++) {
|
|
8830
8584
|
const name = input.readString();
|
|
8831
|
-
if (!name)
|
|
8832
|
-
throw new Error("Physics constraint data name must not be null.");
|
|
8585
|
+
if (!name) throw new Error("Physics constraint data name must not be null.");
|
|
8833
8586
|
const data = new PhysicsConstraintData(name);
|
|
8834
8587
|
data.order = input.readInt(true);
|
|
8835
8588
|
data.bone = skeletonData.bones[input.readInt(true)];
|
|
8836
8589
|
let flags = input.readByte();
|
|
8837
8590
|
data.skinRequired = (flags & 1) != 0;
|
|
8838
|
-
if ((flags & 2) != 0)
|
|
8839
|
-
|
|
8840
|
-
if ((flags &
|
|
8841
|
-
|
|
8842
|
-
if ((flags &
|
|
8843
|
-
data.rotate = input.readFloat();
|
|
8844
|
-
if ((flags & 16) != 0)
|
|
8845
|
-
data.scaleX = input.readFloat();
|
|
8846
|
-
if ((flags & 32) != 0)
|
|
8847
|
-
data.shearX = input.readFloat();
|
|
8591
|
+
if ((flags & 2) != 0) data.x = input.readFloat();
|
|
8592
|
+
if ((flags & 4) != 0) data.y = input.readFloat();
|
|
8593
|
+
if ((flags & 8) != 0) data.rotate = input.readFloat();
|
|
8594
|
+
if ((flags & 16) != 0) data.scaleX = input.readFloat();
|
|
8595
|
+
if ((flags & 32) != 0) data.shearX = input.readFloat();
|
|
8848
8596
|
data.limit = ((flags & 64) != 0 ? input.readFloat() : 5e3) * scale;
|
|
8849
8597
|
data.step = 1 / input.readUnsignedByte();
|
|
8850
8598
|
data.inertia = input.readFloat();
|
|
@@ -8854,20 +8602,13 @@ var spine = (() => {
|
|
|
8854
8602
|
data.wind = input.readFloat();
|
|
8855
8603
|
data.gravity = input.readFloat();
|
|
8856
8604
|
flags = input.readByte();
|
|
8857
|
-
if ((flags & 1) != 0)
|
|
8858
|
-
|
|
8859
|
-
if ((flags &
|
|
8860
|
-
|
|
8861
|
-
if ((flags &
|
|
8862
|
-
|
|
8863
|
-
if ((flags &
|
|
8864
|
-
data.massGlobal = true;
|
|
8865
|
-
if ((flags & 16) != 0)
|
|
8866
|
-
data.windGlobal = true;
|
|
8867
|
-
if ((flags & 32) != 0)
|
|
8868
|
-
data.gravityGlobal = true;
|
|
8869
|
-
if ((flags & 64) != 0)
|
|
8870
|
-
data.mixGlobal = true;
|
|
8605
|
+
if ((flags & 1) != 0) data.inertiaGlobal = true;
|
|
8606
|
+
if ((flags & 2) != 0) data.strengthGlobal = true;
|
|
8607
|
+
if ((flags & 4) != 0) data.dampingGlobal = true;
|
|
8608
|
+
if ((flags & 8) != 0) data.massGlobal = true;
|
|
8609
|
+
if ((flags & 16) != 0) data.windGlobal = true;
|
|
8610
|
+
if ((flags & 32) != 0) data.gravityGlobal = true;
|
|
8611
|
+
if ((flags & 64) != 0) data.mixGlobal = true;
|
|
8871
8612
|
data.mix = (flags & 128) != 0 ? input.readFloat() : 1;
|
|
8872
8613
|
skeletonData.physicsConstraints.push(data);
|
|
8873
8614
|
}
|
|
@@ -8881,8 +8622,7 @@ var spine = (() => {
|
|
|
8881
8622
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
8882
8623
|
for (; i < n; i++) {
|
|
8883
8624
|
let skin = this.readSkin(input, skeletonData, false, nonessential);
|
|
8884
|
-
if (!skin)
|
|
8885
|
-
throw new Error("readSkin() should not have returned null.");
|
|
8625
|
+
if (!skin) throw new Error("readSkin() should not have returned null.");
|
|
8886
8626
|
skeletonData.skins[i] = skin;
|
|
8887
8627
|
}
|
|
8888
8628
|
}
|
|
@@ -8890,22 +8630,18 @@ var spine = (() => {
|
|
|
8890
8630
|
for (let i = 0; i < n; i++) {
|
|
8891
8631
|
let linkedMesh = this.linkedMeshes[i];
|
|
8892
8632
|
const skin = skeletonData.skins[linkedMesh.skinIndex];
|
|
8893
|
-
if (!linkedMesh.parent)
|
|
8894
|
-
throw new Error("Linked mesh parent must not be null");
|
|
8633
|
+
if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null");
|
|
8895
8634
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8896
|
-
if (!parent)
|
|
8897
|
-
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8635
|
+
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8898
8636
|
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8899
8637
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8900
|
-
if (linkedMesh.mesh.region != null)
|
|
8901
|
-
linkedMesh.mesh.updateRegion();
|
|
8638
|
+
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
|
|
8902
8639
|
}
|
|
8903
8640
|
this.linkedMeshes.length = 0;
|
|
8904
8641
|
n = input.readInt(true);
|
|
8905
8642
|
for (let i = 0; i < n; i++) {
|
|
8906
8643
|
let eventName = input.readString();
|
|
8907
|
-
if (!eventName)
|
|
8908
|
-
throw new Error("Event data name must not be null");
|
|
8644
|
+
if (!eventName) throw new Error("Event data name must not be null");
|
|
8909
8645
|
let data = new EventData(eventName);
|
|
8910
8646
|
data.intValue = input.readInt(false);
|
|
8911
8647
|
data.floatValue = input.readFloat();
|
|
@@ -8920,8 +8656,7 @@ var spine = (() => {
|
|
|
8920
8656
|
n = input.readInt(true);
|
|
8921
8657
|
for (let i = 0; i < n; i++) {
|
|
8922
8658
|
let animationName = input.readString();
|
|
8923
|
-
if (!animationName)
|
|
8924
|
-
throw new Error("Animatio name must not be null.");
|
|
8659
|
+
if (!animationName) throw new Error("Animatio name must not be null.");
|
|
8925
8660
|
skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
|
|
8926
8661
|
}
|
|
8927
8662
|
return skeletonData;
|
|
@@ -8931,16 +8666,13 @@ var spine = (() => {
|
|
|
8931
8666
|
let slotCount = 0;
|
|
8932
8667
|
if (defaultSkin) {
|
|
8933
8668
|
slotCount = input.readInt(true);
|
|
8934
|
-
if (slotCount == 0)
|
|
8935
|
-
return null;
|
|
8669
|
+
if (slotCount == 0) return null;
|
|
8936
8670
|
skin = new Skin("default");
|
|
8937
8671
|
} else {
|
|
8938
8672
|
let skinName = input.readString();
|
|
8939
|
-
if (!skinName)
|
|
8940
|
-
throw new Error("Skin name must not be null.");
|
|
8673
|
+
if (!skinName) throw new Error("Skin name must not be null.");
|
|
8941
8674
|
skin = new Skin(skinName);
|
|
8942
|
-
if (nonessential)
|
|
8943
|
-
Color.rgba8888ToColor(skin.color, input.readInt32());
|
|
8675
|
+
if (nonessential) Color.rgba8888ToColor(skin.color, input.readInt32());
|
|
8944
8676
|
skin.bones.length = input.readInt(true);
|
|
8945
8677
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
8946
8678
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -8961,8 +8693,7 @@ var spine = (() => {
|
|
|
8961
8693
|
if (!name)
|
|
8962
8694
|
throw new Error("Attachment name must not be null");
|
|
8963
8695
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
8964
|
-
if (attachment)
|
|
8965
|
-
skin.setAttachment(slotIndex, name, attachment);
|
|
8696
|
+
if (attachment) skin.setAttachment(slotIndex, name, attachment);
|
|
8966
8697
|
}
|
|
8967
8698
|
}
|
|
8968
8699
|
return skin;
|
|
@@ -8971,10 +8702,10 @@ var spine = (() => {
|
|
|
8971
8702
|
let scale = this.scale;
|
|
8972
8703
|
let flags = input.readByte();
|
|
8973
8704
|
const name = (flags & 8) != 0 ? input.readStringRef() : attachmentName;
|
|
8974
|
-
if (!name)
|
|
8975
|
-
throw new Error("Attachment name must not be null");
|
|
8705
|
+
if (!name) throw new Error("Attachment name must not be null");
|
|
8976
8706
|
switch (flags & 7) {
|
|
8977
|
-
|
|
8707
|
+
// BUG?
|
|
8708
|
+
case 0 /* Region */: {
|
|
8978
8709
|
let path = (flags & 16) != 0 ? input.readStringRef() : null;
|
|
8979
8710
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
8980
8711
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
@@ -8985,11 +8716,9 @@ var spine = (() => {
|
|
|
8985
8716
|
let scaleY = input.readFloat();
|
|
8986
8717
|
let width = input.readFloat();
|
|
8987
8718
|
let height = input.readFloat();
|
|
8988
|
-
if (!path)
|
|
8989
|
-
path = name;
|
|
8719
|
+
if (!path) path = name;
|
|
8990
8720
|
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
8991
|
-
if (!region)
|
|
8992
|
-
return null;
|
|
8721
|
+
if (!region) return null;
|
|
8993
8722
|
region.path = path;
|
|
8994
8723
|
region.x = x * scale;
|
|
8995
8724
|
region.y = y * scale;
|
|
@@ -9000,24 +8729,21 @@ var spine = (() => {
|
|
|
9000
8729
|
region.height = height * scale;
|
|
9001
8730
|
Color.rgba8888ToColor(region.color, color);
|
|
9002
8731
|
region.sequence = sequence;
|
|
9003
|
-
if (sequence == null)
|
|
9004
|
-
region.updateRegion();
|
|
8732
|
+
if (sequence == null) region.updateRegion();
|
|
9005
8733
|
return region;
|
|
9006
8734
|
}
|
|
9007
|
-
case
|
|
8735
|
+
case 1 /* BoundingBox */: {
|
|
9008
8736
|
let vertices = this.readVertices(input, (flags & 16) != 0);
|
|
9009
8737
|
let color = nonessential ? input.readInt32() : 0;
|
|
9010
8738
|
let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
|
|
9011
|
-
if (!box)
|
|
9012
|
-
return null;
|
|
8739
|
+
if (!box) return null;
|
|
9013
8740
|
box.worldVerticesLength = vertices.length;
|
|
9014
8741
|
box.vertices = vertices.vertices;
|
|
9015
8742
|
box.bones = vertices.bones;
|
|
9016
|
-
if (nonessential)
|
|
9017
|
-
Color.rgba8888ToColor(box.color, color);
|
|
8743
|
+
if (nonessential) Color.rgba8888ToColor(box.color, color);
|
|
9018
8744
|
return box;
|
|
9019
8745
|
}
|
|
9020
|
-
case
|
|
8746
|
+
case 2 /* Mesh */: {
|
|
9021
8747
|
let path = (flags & 16) != 0 ? input.readStringRef() : name;
|
|
9022
8748
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
9023
8749
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
@@ -9032,11 +8758,9 @@ var spine = (() => {
|
|
|
9032
8758
|
width = input.readFloat();
|
|
9033
8759
|
height = input.readFloat();
|
|
9034
8760
|
}
|
|
9035
|
-
if (!path)
|
|
9036
|
-
path = name;
|
|
8761
|
+
if (!path) path = name;
|
|
9037
8762
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
9038
|
-
if (!mesh)
|
|
9039
|
-
return null;
|
|
8763
|
+
if (!mesh) return null;
|
|
9040
8764
|
mesh.path = path;
|
|
9041
8765
|
Color.rgba8888ToColor(mesh.color, color);
|
|
9042
8766
|
mesh.bones = vertices.bones;
|
|
@@ -9044,8 +8768,7 @@ var spine = (() => {
|
|
|
9044
8768
|
mesh.worldVerticesLength = vertices.length;
|
|
9045
8769
|
mesh.triangles = triangles;
|
|
9046
8770
|
mesh.regionUVs = uvs;
|
|
9047
|
-
if (sequence == null)
|
|
9048
|
-
mesh.updateRegion();
|
|
8771
|
+
if (sequence == null) mesh.updateRegion();
|
|
9049
8772
|
mesh.hullLength = hullLength << 1;
|
|
9050
8773
|
mesh.sequence = sequence;
|
|
9051
8774
|
if (nonessential) {
|
|
@@ -9055,10 +8778,9 @@ var spine = (() => {
|
|
|
9055
8778
|
}
|
|
9056
8779
|
return mesh;
|
|
9057
8780
|
}
|
|
9058
|
-
case
|
|
8781
|
+
case 3 /* LinkedMesh */: {
|
|
9059
8782
|
const path = (flags & 16) != 0 ? input.readStringRef() : name;
|
|
9060
|
-
if (path == null)
|
|
9061
|
-
throw new Error("Path of linked mesh must not be null");
|
|
8783
|
+
if (path == null) throw new Error("Path of linked mesh must not be null");
|
|
9062
8784
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
9063
8785
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
9064
8786
|
const inheritTimelines = (flags & 128) != 0;
|
|
@@ -9070,8 +8792,7 @@ var spine = (() => {
|
|
|
9070
8792
|
height = input.readFloat();
|
|
9071
8793
|
}
|
|
9072
8794
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
9073
|
-
if (!mesh)
|
|
9074
|
-
return null;
|
|
8795
|
+
if (!mesh) return null;
|
|
9075
8796
|
mesh.path = path;
|
|
9076
8797
|
Color.rgba8888ToColor(mesh.color, color);
|
|
9077
8798
|
mesh.sequence = sequence;
|
|
@@ -9082,7 +8803,7 @@ var spine = (() => {
|
|
|
9082
8803
|
this.linkedMeshes.push(new LinkedMesh(mesh, skinIndex, slotIndex, parent, inheritTimelines));
|
|
9083
8804
|
return mesh;
|
|
9084
8805
|
}
|
|
9085
|
-
case
|
|
8806
|
+
case 4 /* Path */: {
|
|
9086
8807
|
const closed2 = (flags & 16) != 0;
|
|
9087
8808
|
const constantSpeed = (flags & 32) != 0;
|
|
9088
8809
|
const vertices = this.readVertices(input, (flags & 64) != 0);
|
|
@@ -9091,46 +8812,40 @@ var spine = (() => {
|
|
|
9091
8812
|
lengths[i] = input.readFloat() * scale;
|
|
9092
8813
|
const color = nonessential ? input.readInt32() : 0;
|
|
9093
8814
|
const path = this.attachmentLoader.newPathAttachment(skin, name);
|
|
9094
|
-
if (!path)
|
|
9095
|
-
return null;
|
|
8815
|
+
if (!path) return null;
|
|
9096
8816
|
path.closed = closed2;
|
|
9097
8817
|
path.constantSpeed = constantSpeed;
|
|
9098
8818
|
path.worldVerticesLength = vertices.length;
|
|
9099
8819
|
path.vertices = vertices.vertices;
|
|
9100
8820
|
path.bones = vertices.bones;
|
|
9101
8821
|
path.lengths = lengths;
|
|
9102
|
-
if (nonessential)
|
|
9103
|
-
Color.rgba8888ToColor(path.color, color);
|
|
8822
|
+
if (nonessential) Color.rgba8888ToColor(path.color, color);
|
|
9104
8823
|
return path;
|
|
9105
8824
|
}
|
|
9106
|
-
case
|
|
8825
|
+
case 5 /* Point */: {
|
|
9107
8826
|
const rotation = input.readFloat();
|
|
9108
8827
|
const x = input.readFloat();
|
|
9109
8828
|
const y = input.readFloat();
|
|
9110
8829
|
const color = nonessential ? input.readInt32() : 0;
|
|
9111
8830
|
const point = this.attachmentLoader.newPointAttachment(skin, name);
|
|
9112
|
-
if (!point)
|
|
9113
|
-
return null;
|
|
8831
|
+
if (!point) return null;
|
|
9114
8832
|
point.x = x * scale;
|
|
9115
8833
|
point.y = y * scale;
|
|
9116
8834
|
point.rotation = rotation;
|
|
9117
|
-
if (nonessential)
|
|
9118
|
-
Color.rgba8888ToColor(point.color, color);
|
|
8835
|
+
if (nonessential) Color.rgba8888ToColor(point.color, color);
|
|
9119
8836
|
return point;
|
|
9120
8837
|
}
|
|
9121
|
-
case
|
|
8838
|
+
case 6 /* Clipping */: {
|
|
9122
8839
|
const endSlotIndex = input.readInt(true);
|
|
9123
8840
|
const vertices = this.readVertices(input, (flags & 16) != 0);
|
|
9124
8841
|
let color = nonessential ? input.readInt32() : 0;
|
|
9125
8842
|
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
|
|
9126
|
-
if (!clip)
|
|
9127
|
-
return null;
|
|
8843
|
+
if (!clip) return null;
|
|
9128
8844
|
clip.endSlot = skeletonData.slots[endSlotIndex];
|
|
9129
8845
|
clip.worldVerticesLength = vertices.length;
|
|
9130
8846
|
clip.vertices = vertices.vertices;
|
|
9131
8847
|
clip.bones = vertices.bones;
|
|
9132
|
-
if (nonessential)
|
|
9133
|
-
Color.rgba8888ToColor(clip.color, color);
|
|
8848
|
+
if (nonessential) Color.rgba8888ToColor(clip.color, color);
|
|
9134
8849
|
return clip;
|
|
9135
8850
|
}
|
|
9136
8851
|
}
|
|
@@ -9213,8 +8928,7 @@ var spine = (() => {
|
|
|
9213
8928
|
let a = input.readUnsignedByte() / 255;
|
|
9214
8929
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9215
8930
|
timeline.setFrame(frame, time, r, g, b, a);
|
|
9216
|
-
if (frame == frameLast)
|
|
9217
|
-
break;
|
|
8931
|
+
if (frame == frameLast) break;
|
|
9218
8932
|
let time2 = input.readFloat();
|
|
9219
8933
|
let r2 = input.readUnsignedByte() / 255;
|
|
9220
8934
|
let g2 = input.readUnsignedByte() / 255;
|
|
@@ -9248,8 +8962,7 @@ var spine = (() => {
|
|
|
9248
8962
|
let b = input.readUnsignedByte() / 255;
|
|
9249
8963
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9250
8964
|
timeline.setFrame(frame, time, r, g, b);
|
|
9251
|
-
if (frame == frameLast)
|
|
9252
|
-
break;
|
|
8965
|
+
if (frame == frameLast) break;
|
|
9253
8966
|
let time2 = input.readFloat();
|
|
9254
8967
|
let r2 = input.readUnsignedByte() / 255;
|
|
9255
8968
|
let g2 = input.readUnsignedByte() / 255;
|
|
@@ -9284,8 +8997,7 @@ var spine = (() => {
|
|
|
9284
8997
|
let b2 = input.readUnsignedByte() / 255;
|
|
9285
8998
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9286
8999
|
timeline.setFrame(frame, time, r, g, b, a, r2, g2, b2);
|
|
9287
|
-
if (frame == frameLast)
|
|
9288
|
-
break;
|
|
9000
|
+
if (frame == frameLast) break;
|
|
9289
9001
|
let time2 = input.readFloat();
|
|
9290
9002
|
let nr = input.readUnsignedByte() / 255;
|
|
9291
9003
|
let ng = input.readUnsignedByte() / 255;
|
|
@@ -9331,8 +9043,7 @@ var spine = (() => {
|
|
|
9331
9043
|
let b2 = input.readUnsignedByte() / 255;
|
|
9332
9044
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9333
9045
|
timeline.setFrame(frame, time, r, g, b, r2, g2, b2);
|
|
9334
|
-
if (frame == frameLast)
|
|
9335
|
-
break;
|
|
9046
|
+
if (frame == frameLast) break;
|
|
9336
9047
|
let time2 = input.readFloat();
|
|
9337
9048
|
let nr = input.readUnsignedByte() / 255;
|
|
9338
9049
|
let ng = input.readUnsignedByte() / 255;
|
|
@@ -9368,8 +9079,7 @@ var spine = (() => {
|
|
|
9368
9079
|
let time = input.readFloat(), a = input.readUnsignedByte() / 255;
|
|
9369
9080
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9370
9081
|
timeline.setFrame(frame, time, a);
|
|
9371
|
-
if (frame == frameLast)
|
|
9372
|
-
break;
|
|
9082
|
+
if (frame == frameLast) break;
|
|
9373
9083
|
let time2 = input.readFloat();
|
|
9374
9084
|
let a2 = input.readUnsignedByte() / 255;
|
|
9375
9085
|
switch (input.readByte()) {
|
|
@@ -9441,8 +9151,7 @@ var spine = (() => {
|
|
|
9441
9151
|
let softness = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
9442
9152
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9443
9153
|
timeline.setFrame(frame, time, mix, softness, (flags & 8) != 0 ? 1 : -1, (flags & 16) != 0, (flags & 32) != 0);
|
|
9444
|
-
if (frame == frameLast)
|
|
9445
|
-
break;
|
|
9154
|
+
if (frame == frameLast) break;
|
|
9446
9155
|
flags = input.readByte();
|
|
9447
9156
|
const time2 = input.readFloat(), mix2 = (flags & 1) != 0 ? (flags & 2) != 0 ? input.readFloat() : 1 : 0;
|
|
9448
9157
|
const softness2 = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
@@ -9464,8 +9173,7 @@ var spine = (() => {
|
|
|
9464
9173
|
let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat(), mixScaleX = input.readFloat(), mixScaleY = input.readFloat(), mixShearY = input.readFloat();
|
|
9465
9174
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9466
9175
|
timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
|
|
9467
|
-
if (frame == frameLast)
|
|
9468
|
-
break;
|
|
9176
|
+
if (frame == frameLast) break;
|
|
9469
9177
|
let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat(), mixScaleX2 = input.readFloat(), mixScaleY2 = input.readFloat(), mixShearY2 = input.readFloat();
|
|
9470
9178
|
switch (input.readByte()) {
|
|
9471
9179
|
case CURVE_STEPPED:
|
|
@@ -9514,8 +9222,7 @@ var spine = (() => {
|
|
|
9514
9222
|
let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat();
|
|
9515
9223
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9516
9224
|
timeline.setFrame(frame, time, mixRotate, mixX, mixY);
|
|
9517
|
-
if (frame == frameLast)
|
|
9518
|
-
break;
|
|
9225
|
+
if (frame == frameLast) break;
|
|
9519
9226
|
let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat();
|
|
9520
9227
|
switch (input.readByte()) {
|
|
9521
9228
|
case CURVE_STEPPED:
|
|
@@ -9577,8 +9284,7 @@ var spine = (() => {
|
|
|
9577
9284
|
let slotIndex = input.readInt(true);
|
|
9578
9285
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
9579
9286
|
let attachmentName = input.readStringRef();
|
|
9580
|
-
if (!attachmentName)
|
|
9581
|
-
throw new Error("attachmentName must not be null.");
|
|
9287
|
+
if (!attachmentName) throw new Error("attachmentName must not be null.");
|
|
9582
9288
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
9583
9289
|
let timelineType = input.readByte();
|
|
9584
9290
|
let frameCount = input.readInt(true);
|
|
@@ -9614,8 +9320,7 @@ var spine = (() => {
|
|
|
9614
9320
|
}
|
|
9615
9321
|
}
|
|
9616
9322
|
timeline.setFrame(frame, time, deform);
|
|
9617
|
-
if (frame == frameLast)
|
|
9618
|
-
break;
|
|
9323
|
+
if (frame == frameLast) break;
|
|
9619
9324
|
let time2 = input.readFloat();
|
|
9620
9325
|
switch (input.readByte()) {
|
|
9621
9326
|
case CURVE_STEPPED:
|
|
@@ -9670,8 +9375,7 @@ var spine = (() => {
|
|
|
9670
9375
|
while (originalIndex < slotCount)
|
|
9671
9376
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
9672
9377
|
for (let ii = slotCount - 1; ii >= 0; ii--)
|
|
9673
|
-
if (drawOrder[ii] == -1)
|
|
9674
|
-
drawOrder[ii] = unchanged[--unchangedIndex];
|
|
9378
|
+
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
|
|
9675
9379
|
timeline.setFrame(i, time, drawOrder);
|
|
9676
9380
|
}
|
|
9677
9381
|
timelines.push(timeline);
|
|
@@ -9686,8 +9390,7 @@ var spine = (() => {
|
|
|
9686
9390
|
event.intValue = input.readInt(false);
|
|
9687
9391
|
event.floatValue = input.readFloat();
|
|
9688
9392
|
event.stringValue = input.readString();
|
|
9689
|
-
if (event.stringValue == null)
|
|
9690
|
-
event.stringValue = eventData.stringValue;
|
|
9393
|
+
if (event.stringValue == null) event.stringValue = eventData.stringValue;
|
|
9691
9394
|
if (event.data.audioPath) {
|
|
9692
9395
|
event.volume = input.readFloat();
|
|
9693
9396
|
event.balance = input.readFloat();
|
|
@@ -9809,22 +9512,11 @@ var spine = (() => {
|
|
|
9809
9512
|
this.length = length;
|
|
9810
9513
|
}
|
|
9811
9514
|
};
|
|
9812
|
-
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
9813
|
-
AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
|
|
9814
|
-
AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
|
|
9815
|
-
AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
|
|
9816
|
-
AttachmentType2[AttachmentType2["LinkedMesh"] = 3] = "LinkedMesh";
|
|
9817
|
-
AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
|
|
9818
|
-
AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
|
|
9819
|
-
AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
|
|
9820
|
-
return AttachmentType2;
|
|
9821
|
-
})(AttachmentType || {});
|
|
9822
9515
|
function readTimeline1(input, timeline, scale) {
|
|
9823
9516
|
let time = input.readFloat(), value = input.readFloat() * scale;
|
|
9824
9517
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9825
9518
|
timeline.setFrame(frame, time, value);
|
|
9826
|
-
if (frame == frameLast)
|
|
9827
|
-
break;
|
|
9519
|
+
if (frame == frameLast) break;
|
|
9828
9520
|
let time2 = input.readFloat(), value2 = input.readFloat() * scale;
|
|
9829
9521
|
switch (input.readByte()) {
|
|
9830
9522
|
case CURVE_STEPPED:
|
|
@@ -9842,8 +9534,7 @@ var spine = (() => {
|
|
|
9842
9534
|
let time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
|
|
9843
9535
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9844
9536
|
timeline.setFrame(frame, time, value1, value2);
|
|
9845
|
-
if (frame == frameLast)
|
|
9846
|
-
break;
|
|
9537
|
+
if (frame == frameLast) break;
|
|
9847
9538
|
let time2 = input.readFloat(), nvalue1 = input.readFloat() * scale, nvalue2 = input.readFloat() * scale;
|
|
9848
9539
|
switch (input.readByte()) {
|
|
9849
9540
|
case CURVE_STEPPED:
|
|
@@ -9917,8 +9608,7 @@ var spine = (() => {
|
|
|
9917
9608
|
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
|
|
9918
9609
|
* SkeletonBounds AABB methods will always return true. */
|
|
9919
9610
|
update(skeleton, updateAabb) {
|
|
9920
|
-
if (!skeleton)
|
|
9921
|
-
throw new Error("skeleton cannot be null.");
|
|
9611
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
9922
9612
|
let boundingBoxes = this.boundingBoxes;
|
|
9923
9613
|
let polygons = this.polygons;
|
|
9924
9614
|
let polygonPool = this.polygonPool;
|
|
@@ -9929,8 +9619,7 @@ var spine = (() => {
|
|
|
9929
9619
|
polygons.length = 0;
|
|
9930
9620
|
for (let i = 0; i < slotCount; i++) {
|
|
9931
9621
|
let slot = slots[i];
|
|
9932
|
-
if (!slot.bone.active)
|
|
9933
|
-
continue;
|
|
9622
|
+
if (!slot.bone.active) continue;
|
|
9934
9623
|
let attachment = slot.getAttachment();
|
|
9935
9624
|
if (attachment instanceof BoundingBoxAttachment) {
|
|
9936
9625
|
let boundingBox = attachment;
|
|
@@ -9986,17 +9675,13 @@ var spine = (() => {
|
|
|
9986
9675
|
return false;
|
|
9987
9676
|
let m = (y2 - y1) / (x2 - x1);
|
|
9988
9677
|
let y = m * (minX - x1) + y1;
|
|
9989
|
-
if (y > minY && y < maxY)
|
|
9990
|
-
return true;
|
|
9678
|
+
if (y > minY && y < maxY) return true;
|
|
9991
9679
|
y = m * (maxX - x1) + y1;
|
|
9992
|
-
if (y > minY && y < maxY)
|
|
9993
|
-
return true;
|
|
9680
|
+
if (y > minY && y < maxY) return true;
|
|
9994
9681
|
let x = (minY - y1) / m + x1;
|
|
9995
|
-
if (x > minX && x < maxX)
|
|
9996
|
-
return true;
|
|
9682
|
+
if (x > minX && x < maxX) return true;
|
|
9997
9683
|
x = (maxY - y1) / m + x1;
|
|
9998
|
-
if (x > minX && x < maxX)
|
|
9999
|
-
return true;
|
|
9684
|
+
if (x > minX && x < maxX) return true;
|
|
10000
9685
|
return false;
|
|
10001
9686
|
}
|
|
10002
9687
|
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
|
@@ -10008,8 +9693,7 @@ var spine = (() => {
|
|
|
10008
9693
|
containsPoint(x, y) {
|
|
10009
9694
|
let polygons = this.polygons;
|
|
10010
9695
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
10011
|
-
if (this.containsPointPolygon(polygons[i], x, y))
|
|
10012
|
-
return this.boundingBoxes[i];
|
|
9696
|
+
if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i];
|
|
10013
9697
|
return null;
|
|
10014
9698
|
}
|
|
10015
9699
|
/** Returns true if the polygon contains the point. */
|
|
@@ -10023,8 +9707,7 @@ var spine = (() => {
|
|
|
10023
9707
|
let prevY = vertices[prevIndex + 1];
|
|
10024
9708
|
if (vertexY < y && prevY >= y || prevY < y && vertexY >= y) {
|
|
10025
9709
|
let vertexX = vertices[ii];
|
|
10026
|
-
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
|
|
10027
|
-
inside = !inside;
|
|
9710
|
+
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) inside = !inside;
|
|
10028
9711
|
}
|
|
10029
9712
|
prevIndex = ii;
|
|
10030
9713
|
}
|
|
@@ -10036,8 +9719,7 @@ var spine = (() => {
|
|
|
10036
9719
|
intersectsSegment(x1, y1, x2, y2) {
|
|
10037
9720
|
let polygons = this.polygons;
|
|
10038
9721
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
10039
|
-
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
|
|
10040
|
-
return this.boundingBoxes[i];
|
|
9722
|
+
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i];
|
|
10041
9723
|
return null;
|
|
10042
9724
|
}
|
|
10043
9725
|
/** Returns true if the polygon contains any part of the line segment. */
|
|
@@ -10055,8 +9737,7 @@ var spine = (() => {
|
|
|
10055
9737
|
let x = (det1 * width34 - width12 * det2) / det3;
|
|
10056
9738
|
if ((x >= x3 && x <= x4 || x >= x4 && x <= x3) && (x >= x1 && x <= x2 || x >= x2 && x <= x1)) {
|
|
10057
9739
|
let y = (det1 * height34 - height12 * det2) / det3;
|
|
10058
|
-
if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1))
|
|
10059
|
-
return true;
|
|
9740
|
+
if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1)) return true;
|
|
10060
9741
|
}
|
|
10061
9742
|
x3 = x4;
|
|
10062
9743
|
y3 = y4;
|
|
@@ -10065,8 +9746,7 @@ var spine = (() => {
|
|
|
10065
9746
|
}
|
|
10066
9747
|
/** Returns the polygon for the specified bounding box, or null. */
|
|
10067
9748
|
getPolygon(boundingBox) {
|
|
10068
|
-
if (!boundingBox)
|
|
10069
|
-
throw new Error("boundingBox cannot be null.");
|
|
9749
|
+
if (!boundingBox) throw new Error("boundingBox cannot be null.");
|
|
10070
9750
|
let index = this.boundingBoxes.indexOf(boundingBox);
|
|
10071
9751
|
return index == -1 ? null : this.polygons[index];
|
|
10072
9752
|
}
|
|
@@ -10081,7 +9761,7 @@ var spine = (() => {
|
|
|
10081
9761
|
};
|
|
10082
9762
|
|
|
10083
9763
|
// spine-core/src/Triangulator.ts
|
|
10084
|
-
var Triangulator = class {
|
|
9764
|
+
var Triangulator = class _Triangulator {
|
|
10085
9765
|
convexPolygons = new Array();
|
|
10086
9766
|
convexPolygonsIndices = new Array();
|
|
10087
9767
|
indicesArray = new Array();
|
|
@@ -10103,7 +9783,7 @@ var spine = (() => {
|
|
|
10103
9783
|
let isConcave = this.isConcaveArray;
|
|
10104
9784
|
isConcave.length = 0;
|
|
10105
9785
|
for (let i = 0, n = vertexCount; i < n; ++i)
|
|
10106
|
-
isConcave[i] =
|
|
9786
|
+
isConcave[i] = _Triangulator.isConcave(i, vertexCount, vertices, indices);
|
|
10107
9787
|
let triangles = this.triangles;
|
|
10108
9788
|
triangles.length = 0;
|
|
10109
9789
|
while (vertexCount > 3) {
|
|
@@ -10116,14 +9796,12 @@ var spine = (() => {
|
|
|
10116
9796
|
let p2x = vertices[p2], p2y = vertices[p2 + 1];
|
|
10117
9797
|
let p3x = vertices[p3], p3y = vertices[p3 + 1];
|
|
10118
9798
|
for (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
|
|
10119
|
-
if (!isConcave[ii])
|
|
10120
|
-
continue;
|
|
9799
|
+
if (!isConcave[ii]) continue;
|
|
10121
9800
|
let v = indices[ii] << 1;
|
|
10122
9801
|
let vx = vertices[v], vy = vertices[v + 1];
|
|
10123
|
-
if (
|
|
10124
|
-
if (
|
|
10125
|
-
if (
|
|
10126
|
-
break outer;
|
|
9802
|
+
if (_Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
|
|
9803
|
+
if (_Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
|
|
9804
|
+
if (_Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) break outer;
|
|
10127
9805
|
}
|
|
10128
9806
|
}
|
|
10129
9807
|
}
|
|
@@ -10131,8 +9809,7 @@ var spine = (() => {
|
|
|
10131
9809
|
}
|
|
10132
9810
|
if (next == 0) {
|
|
10133
9811
|
do {
|
|
10134
|
-
if (!isConcave[i])
|
|
10135
|
-
break;
|
|
9812
|
+
if (!isConcave[i]) break;
|
|
10136
9813
|
i--;
|
|
10137
9814
|
} while (i > 0);
|
|
10138
9815
|
break;
|
|
@@ -10149,8 +9826,8 @@ var spine = (() => {
|
|
|
10149
9826
|
vertexCount--;
|
|
10150
9827
|
let previousIndex = (vertexCount + i - 1) % vertexCount;
|
|
10151
9828
|
let nextIndex = i == vertexCount ? 0 : i;
|
|
10152
|
-
isConcave[previousIndex] =
|
|
10153
|
-
isConcave[nextIndex] =
|
|
9829
|
+
isConcave[previousIndex] = _Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
|
|
9830
|
+
isConcave[nextIndex] = _Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
|
|
10154
9831
|
}
|
|
10155
9832
|
if (vertexCount == 3) {
|
|
10156
9833
|
triangles.push(indices[2]);
|
|
@@ -10180,8 +9857,8 @@ var spine = (() => {
|
|
|
10180
9857
|
let merged = false;
|
|
10181
9858
|
if (fanBaseIndex == t1) {
|
|
10182
9859
|
let o = polygon.length - 4;
|
|
10183
|
-
let winding1 =
|
|
10184
|
-
let winding2 =
|
|
9860
|
+
let winding1 = _Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
|
|
9861
|
+
let winding2 = _Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
|
|
10185
9862
|
if (winding1 == lastWinding && winding2 == lastWinding) {
|
|
10186
9863
|
polygon.push(x3);
|
|
10187
9864
|
polygon.push(y3);
|
|
@@ -10210,7 +9887,7 @@ var spine = (() => {
|
|
|
10210
9887
|
polygonIndices.push(t1);
|
|
10211
9888
|
polygonIndices.push(t2);
|
|
10212
9889
|
polygonIndices.push(t3);
|
|
10213
|
-
lastWinding =
|
|
9890
|
+
lastWinding = _Triangulator.winding(x1, y1, x2, y2, x3, y3);
|
|
10214
9891
|
fanBaseIndex = t1;
|
|
10215
9892
|
}
|
|
10216
9893
|
}
|
|
@@ -10220,8 +9897,7 @@ var spine = (() => {
|
|
|
10220
9897
|
}
|
|
10221
9898
|
for (let i = 0, n = convexPolygons.length; i < n; i++) {
|
|
10222
9899
|
polygonIndices = convexPolygonsIndices[i];
|
|
10223
|
-
if (polygonIndices.length == 0)
|
|
10224
|
-
continue;
|
|
9900
|
+
if (polygonIndices.length == 0) continue;
|
|
10225
9901
|
let firstIndex = polygonIndices[0];
|
|
10226
9902
|
let lastIndex = polygonIndices[polygonIndices.length - 1];
|
|
10227
9903
|
polygon = convexPolygons[i];
|
|
@@ -10230,22 +9906,19 @@ var spine = (() => {
|
|
|
10230
9906
|
let prevX = polygon[o + 2], prevY = polygon[o + 3];
|
|
10231
9907
|
let firstX = polygon[0], firstY = polygon[1];
|
|
10232
9908
|
let secondX = polygon[2], secondY = polygon[3];
|
|
10233
|
-
let winding =
|
|
9909
|
+
let winding = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
|
|
10234
9910
|
for (let ii = 0; ii < n; ii++) {
|
|
10235
|
-
if (ii == i)
|
|
10236
|
-
continue;
|
|
9911
|
+
if (ii == i) continue;
|
|
10237
9912
|
let otherIndices = convexPolygonsIndices[ii];
|
|
10238
|
-
if (otherIndices.length != 3)
|
|
10239
|
-
continue;
|
|
9913
|
+
if (otherIndices.length != 3) continue;
|
|
10240
9914
|
let otherFirstIndex = otherIndices[0];
|
|
10241
9915
|
let otherSecondIndex = otherIndices[1];
|
|
10242
9916
|
let otherLastIndex = otherIndices[2];
|
|
10243
9917
|
let otherPoly = convexPolygons[ii];
|
|
10244
9918
|
let x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
|
|
10245
|
-
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
|
|
10246
|
-
|
|
10247
|
-
let
|
|
10248
|
-
let winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
|
|
9919
|
+
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue;
|
|
9920
|
+
let winding1 = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
|
|
9921
|
+
let winding2 = _Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
|
|
10249
9922
|
if (winding1 == winding && winding2 == winding) {
|
|
10250
9923
|
otherPoly.length = 0;
|
|
10251
9924
|
otherIndices.length = 0;
|
|
@@ -10295,7 +9968,7 @@ var spine = (() => {
|
|
|
10295
9968
|
};
|
|
10296
9969
|
|
|
10297
9970
|
// spine-core/src/SkeletonClipping.ts
|
|
10298
|
-
var SkeletonClipping = class {
|
|
9971
|
+
var SkeletonClipping = class _SkeletonClipping {
|
|
10299
9972
|
triangulator = new Triangulator();
|
|
10300
9973
|
clippingPolygon = new Array();
|
|
10301
9974
|
clipOutput = new Array();
|
|
@@ -10306,30 +9979,27 @@ var spine = (() => {
|
|
|
10306
9979
|
clipAttachment = null;
|
|
10307
9980
|
clippingPolygons = null;
|
|
10308
9981
|
clipStart(slot, clip) {
|
|
10309
|
-
if (this.clipAttachment)
|
|
10310
|
-
return 0;
|
|
9982
|
+
if (this.clipAttachment) return 0;
|
|
10311
9983
|
this.clipAttachment = clip;
|
|
10312
9984
|
let n = clip.worldVerticesLength;
|
|
10313
9985
|
let vertices = Utils.setArraySize(this.clippingPolygon, n);
|
|
10314
9986
|
clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
|
|
10315
9987
|
let clippingPolygon = this.clippingPolygon;
|
|
10316
|
-
|
|
9988
|
+
_SkeletonClipping.makeClockwise(clippingPolygon);
|
|
10317
9989
|
let clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
|
|
10318
9990
|
for (let i = 0, n2 = clippingPolygons.length; i < n2; i++) {
|
|
10319
9991
|
let polygon = clippingPolygons[i];
|
|
10320
|
-
|
|
9992
|
+
_SkeletonClipping.makeClockwise(polygon);
|
|
10321
9993
|
polygon.push(polygon[0]);
|
|
10322
9994
|
polygon.push(polygon[1]);
|
|
10323
9995
|
}
|
|
10324
9996
|
return clippingPolygons.length;
|
|
10325
9997
|
}
|
|
10326
9998
|
clipEndWithSlot(slot) {
|
|
10327
|
-
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data)
|
|
10328
|
-
this.clipEnd();
|
|
9999
|
+
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data) this.clipEnd();
|
|
10329
10000
|
}
|
|
10330
10001
|
clipEnd() {
|
|
10331
|
-
if (!this.clipAttachment)
|
|
10332
|
-
return;
|
|
10002
|
+
if (!this.clipAttachment) return;
|
|
10333
10003
|
this.clipAttachment = null;
|
|
10334
10004
|
this.clippingPolygons = null;
|
|
10335
10005
|
this.clippedVertices.length = 0;
|
|
@@ -10385,8 +10055,7 @@ var spine = (() => {
|
|
|
10385
10055
|
let s = clippedVertices.length;
|
|
10386
10056
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10387
10057
|
let clipOutputLength = clipOutput.length;
|
|
10388
|
-
if (clipOutputLength == 0)
|
|
10389
|
-
continue;
|
|
10058
|
+
if (clipOutputLength == 0) continue;
|
|
10390
10059
|
let clipOutputCount = clipOutputLength >> 1;
|
|
10391
10060
|
let clipOutputItems = this.clipOutput;
|
|
10392
10061
|
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
|
|
@@ -10446,8 +10115,7 @@ var spine = (() => {
|
|
|
10446
10115
|
let s = clippedVertices.length;
|
|
10447
10116
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10448
10117
|
let clipOutputLength = clipOutput.length;
|
|
10449
|
-
if (clipOutputLength == 0)
|
|
10450
|
-
continue;
|
|
10118
|
+
if (clipOutputLength == 0) continue;
|
|
10451
10119
|
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
|
10452
10120
|
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
|
10453
10121
|
let clipOutputCount = clipOutputLength >> 1;
|
|
@@ -10576,8 +10244,7 @@ var spine = (() => {
|
|
|
10576
10244
|
let s = clippedVertices.length;
|
|
10577
10245
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10578
10246
|
let clipOutputLength = clipOutput.length;
|
|
10579
|
-
if (clipOutputLength == 0)
|
|
10580
|
-
continue;
|
|
10247
|
+
if (clipOutputLength == 0) continue;
|
|
10581
10248
|
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
|
10582
10249
|
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
|
10583
10250
|
let clipOutputCount = clipOutputLength >> 1;
|
|
@@ -10700,8 +10367,7 @@ var spine = (() => {
|
|
|
10700
10367
|
}
|
|
10701
10368
|
output.push(output[0]);
|
|
10702
10369
|
output.push(output[1]);
|
|
10703
|
-
if (i == clippingVerticesLast)
|
|
10704
|
-
break;
|
|
10370
|
+
if (i == clippingVerticesLast) break;
|
|
10705
10371
|
let temp = output;
|
|
10706
10372
|
output = input;
|
|
10707
10373
|
output.length = 0;
|
|
@@ -10726,8 +10392,7 @@ var spine = (() => {
|
|
|
10726
10392
|
p2y = vertices[i + 3];
|
|
10727
10393
|
area += p1x * p2y - p2x * p1y;
|
|
10728
10394
|
}
|
|
10729
|
-
if (area < 0)
|
|
10730
|
-
return;
|
|
10395
|
+
if (area < 0) return;
|
|
10731
10396
|
for (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
|
|
10732
10397
|
let x = vertices[i], y = vertices[i + 1];
|
|
10733
10398
|
let other = lastX - i;
|
|
@@ -10773,8 +10438,7 @@ var spine = (() => {
|
|
|
10773
10438
|
let boneMap = root.bones[i];
|
|
10774
10439
|
let parent = null;
|
|
10775
10440
|
let parentName = getValue(boneMap, "parent", null);
|
|
10776
|
-
if (parentName)
|
|
10777
|
-
parent = skeletonData.findBone(parentName);
|
|
10441
|
+
if (parentName) parent = skeletonData.findBone(parentName);
|
|
10778
10442
|
let data = new BoneData(skeletonData.bones.length, boneMap.name, parent);
|
|
10779
10443
|
data.length = getValue(boneMap, "length", 0) * scale;
|
|
10780
10444
|
data.x = getValue(boneMap, "x", 0) * scale;
|
|
@@ -10787,8 +10451,7 @@ var spine = (() => {
|
|
|
10787
10451
|
data.inherit = Utils.enumValue(Inherit, getValue(boneMap, "inherit", "Normal"));
|
|
10788
10452
|
data.skinRequired = getValue(boneMap, "skin", false);
|
|
10789
10453
|
let color = getValue(boneMap, "color", null);
|
|
10790
|
-
if (color)
|
|
10791
|
-
data.color.setFromString(color);
|
|
10454
|
+
if (color) data.color.setFromString(color);
|
|
10792
10455
|
skeletonData.bones.push(data);
|
|
10793
10456
|
}
|
|
10794
10457
|
}
|
|
@@ -10797,15 +10460,12 @@ var spine = (() => {
|
|
|
10797
10460
|
let slotMap = root.slots[i];
|
|
10798
10461
|
let slotName = slotMap.name;
|
|
10799
10462
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
10800
|
-
if (!boneData)
|
|
10801
|
-
throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
|
|
10463
|
+
if (!boneData) throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
|
|
10802
10464
|
let data = new SlotData(skeletonData.slots.length, slotName, boneData);
|
|
10803
10465
|
let color = getValue(slotMap, "color", null);
|
|
10804
|
-
if (color)
|
|
10805
|
-
data.color.setFromString(color);
|
|
10466
|
+
if (color) data.color.setFromString(color);
|
|
10806
10467
|
let dark = getValue(slotMap, "dark", null);
|
|
10807
|
-
if (dark)
|
|
10808
|
-
data.darkColor = Color.fromString(dark);
|
|
10468
|
+
if (dark) data.darkColor = Color.fromString(dark);
|
|
10809
10469
|
data.attachmentName = getValue(slotMap, "attachment", null);
|
|
10810
10470
|
data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal"));
|
|
10811
10471
|
data.visible = getValue(slotMap, "visible", true);
|
|
@@ -10820,14 +10480,12 @@ var spine = (() => {
|
|
|
10820
10480
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10821
10481
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10822
10482
|
let bone = skeletonData.findBone(constraintMap.bones[ii]);
|
|
10823
|
-
if (!bone)
|
|
10824
|
-
throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
10483
|
+
if (!bone) throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
10825
10484
|
data.bones.push(bone);
|
|
10826
10485
|
}
|
|
10827
10486
|
let target = skeletonData.findBone(constraintMap.target);
|
|
10828
10487
|
;
|
|
10829
|
-
if (!target)
|
|
10830
|
-
throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
10488
|
+
if (!target) throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
10831
10489
|
data.target = target;
|
|
10832
10490
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
10833
10491
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
@@ -10847,14 +10505,12 @@ var spine = (() => {
|
|
|
10847
10505
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10848
10506
|
let boneName = constraintMap.bones[ii];
|
|
10849
10507
|
let bone = skeletonData.findBone(boneName);
|
|
10850
|
-
if (!bone)
|
|
10851
|
-
throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
10508
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
10852
10509
|
data.bones.push(bone);
|
|
10853
10510
|
}
|
|
10854
10511
|
let targetName = constraintMap.target;
|
|
10855
10512
|
let target = skeletonData.findBone(targetName);
|
|
10856
|
-
if (!target)
|
|
10857
|
-
throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
10513
|
+
if (!target) throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
10858
10514
|
data.target = target;
|
|
10859
10515
|
data.local = getValue(constraintMap, "local", false);
|
|
10860
10516
|
data.relative = getValue(constraintMap, "relative", false);
|
|
@@ -10882,25 +10538,21 @@ var spine = (() => {
|
|
|
10882
10538
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10883
10539
|
let boneName = constraintMap.bones[ii];
|
|
10884
10540
|
let bone = skeletonData.findBone(boneName);
|
|
10885
|
-
if (!bone)
|
|
10886
|
-
throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
10541
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
10887
10542
|
data.bones.push(bone);
|
|
10888
10543
|
}
|
|
10889
10544
|
let targetName = constraintMap.target;
|
|
10890
10545
|
let target = skeletonData.findSlot(targetName);
|
|
10891
|
-
if (!target)
|
|
10892
|
-
throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
10546
|
+
if (!target) throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
10893
10547
|
data.target = target;
|
|
10894
10548
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
10895
10549
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
10896
10550
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
10897
10551
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
10898
10552
|
data.position = getValue(constraintMap, "position", 0);
|
|
10899
|
-
if (data.positionMode == 0 /* Fixed */)
|
|
10900
|
-
data.position *= scale;
|
|
10553
|
+
if (data.positionMode == 0 /* Fixed */) data.position *= scale;
|
|
10901
10554
|
data.spacing = getValue(constraintMap, "spacing", 0);
|
|
10902
|
-
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
10903
|
-
data.spacing *= scale;
|
|
10555
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
|
|
10904
10556
|
data.mixRotate = getValue(constraintMap, "mixRotate", 1);
|
|
10905
10557
|
data.mixX = getValue(constraintMap, "mixX", 1);
|
|
10906
10558
|
data.mixY = getValue(constraintMap, "mixY", data.mixX);
|
|
@@ -10915,8 +10567,7 @@ var spine = (() => {
|
|
|
10915
10567
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10916
10568
|
const boneName = constraintMap.bone;
|
|
10917
10569
|
const bone = skeletonData.findBone(boneName);
|
|
10918
|
-
if (bone == null)
|
|
10919
|
-
throw new Error("Physics bone not found: " + boneName);
|
|
10570
|
+
if (bone == null) throw new Error("Physics bone not found: " + boneName);
|
|
10920
10571
|
data.bone = bone;
|
|
10921
10572
|
data.x = getValue(constraintMap, "x", 0);
|
|
10922
10573
|
data.y = getValue(constraintMap, "y", 0);
|
|
@@ -10950,8 +10601,7 @@ var spine = (() => {
|
|
|
10950
10601
|
for (let ii = 0; ii < skinMap.bones.length; ii++) {
|
|
10951
10602
|
let boneName = skinMap.bones[ii];
|
|
10952
10603
|
let bone = skeletonData.findBone(boneName);
|
|
10953
|
-
if (!bone)
|
|
10954
|
-
throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
10604
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
10955
10605
|
skin.bones.push(bone);
|
|
10956
10606
|
}
|
|
10957
10607
|
}
|
|
@@ -10959,8 +10609,7 @@ var spine = (() => {
|
|
|
10959
10609
|
for (let ii = 0; ii < skinMap.ik.length; ii++) {
|
|
10960
10610
|
let constraintName = skinMap.ik[ii];
|
|
10961
10611
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
10962
|
-
if (!constraint)
|
|
10963
|
-
throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10612
|
+
if (!constraint) throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10964
10613
|
skin.constraints.push(constraint);
|
|
10965
10614
|
}
|
|
10966
10615
|
}
|
|
@@ -10968,8 +10617,7 @@ var spine = (() => {
|
|
|
10968
10617
|
for (let ii = 0; ii < skinMap.transform.length; ii++) {
|
|
10969
10618
|
let constraintName = skinMap.transform[ii];
|
|
10970
10619
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
10971
|
-
if (!constraint)
|
|
10972
|
-
throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10620
|
+
if (!constraint) throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10973
10621
|
skin.constraints.push(constraint);
|
|
10974
10622
|
}
|
|
10975
10623
|
}
|
|
@@ -10977,8 +10625,7 @@ var spine = (() => {
|
|
|
10977
10625
|
for (let ii = 0; ii < skinMap.path.length; ii++) {
|
|
10978
10626
|
let constraintName = skinMap.path[ii];
|
|
10979
10627
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
10980
|
-
if (!constraint)
|
|
10981
|
-
throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10628
|
+
if (!constraint) throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10982
10629
|
skin.constraints.push(constraint);
|
|
10983
10630
|
}
|
|
10984
10631
|
}
|
|
@@ -10986,39 +10633,32 @@ var spine = (() => {
|
|
|
10986
10633
|
for (let ii = 0; ii < skinMap.physics.length; ii++) {
|
|
10987
10634
|
let constraintName = skinMap.physics[ii];
|
|
10988
10635
|
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
10989
|
-
if (!constraint)
|
|
10990
|
-
throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10636
|
+
if (!constraint) throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10991
10637
|
skin.constraints.push(constraint);
|
|
10992
10638
|
}
|
|
10993
10639
|
}
|
|
10994
10640
|
for (let slotName in skinMap.attachments) {
|
|
10995
10641
|
let slot = skeletonData.findSlot(slotName);
|
|
10996
|
-
if (!slot)
|
|
10997
|
-
throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
10642
|
+
if (!slot) throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
10998
10643
|
let slotMap = skinMap.attachments[slotName];
|
|
10999
10644
|
for (let entryName in slotMap) {
|
|
11000
10645
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
11001
|
-
if (attachment)
|
|
11002
|
-
skin.setAttachment(slot.index, entryName, attachment);
|
|
10646
|
+
if (attachment) skin.setAttachment(slot.index, entryName, attachment);
|
|
11003
10647
|
}
|
|
11004
10648
|
}
|
|
11005
10649
|
skeletonData.skins.push(skin);
|
|
11006
|
-
if (skin.name == "default")
|
|
11007
|
-
skeletonData.defaultSkin = skin;
|
|
10650
|
+
if (skin.name == "default") skeletonData.defaultSkin = skin;
|
|
11008
10651
|
}
|
|
11009
10652
|
}
|
|
11010
10653
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
11011
10654
|
let linkedMesh = this.linkedMeshes[i];
|
|
11012
10655
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
11013
|
-
if (!skin)
|
|
11014
|
-
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
10656
|
+
if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
11015
10657
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
11016
|
-
if (!parent)
|
|
11017
|
-
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
10658
|
+
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
11018
10659
|
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
11019
10660
|
linkedMesh.mesh.setParentMesh(parent);
|
|
11020
|
-
if (linkedMesh.mesh.region != null)
|
|
11021
|
-
linkedMesh.mesh.updateRegion();
|
|
10661
|
+
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
|
|
11022
10662
|
}
|
|
11023
10663
|
this.linkedMeshes.length = 0;
|
|
11024
10664
|
if (root.events) {
|
|
@@ -11052,8 +10692,7 @@ var spine = (() => {
|
|
|
11052
10692
|
let path = getValue(map, "path", name);
|
|
11053
10693
|
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
11054
10694
|
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
11055
|
-
if (!region)
|
|
11056
|
-
return null;
|
|
10695
|
+
if (!region) return null;
|
|
11057
10696
|
region.path = path;
|
|
11058
10697
|
region.x = getValue(map, "x", 0) * scale;
|
|
11059
10698
|
region.y = getValue(map, "y", 0) * scale;
|
|
@@ -11064,20 +10703,16 @@ var spine = (() => {
|
|
|
11064
10703
|
region.height = map.height * scale;
|
|
11065
10704
|
region.sequence = sequence;
|
|
11066
10705
|
let color = getValue(map, "color", null);
|
|
11067
|
-
if (color)
|
|
11068
|
-
|
|
11069
|
-
if (region.region != null)
|
|
11070
|
-
region.updateRegion();
|
|
10706
|
+
if (color) region.color.setFromString(color);
|
|
10707
|
+
if (region.region != null) region.updateRegion();
|
|
11071
10708
|
return region;
|
|
11072
10709
|
}
|
|
11073
10710
|
case "boundingbox": {
|
|
11074
10711
|
let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
|
|
11075
|
-
if (!box)
|
|
11076
|
-
return null;
|
|
10712
|
+
if (!box) return null;
|
|
11077
10713
|
this.readVertices(map, box, map.vertexCount << 1);
|
|
11078
10714
|
let color = getValue(map, "color", null);
|
|
11079
|
-
if (color)
|
|
11080
|
-
box.color.setFromString(color);
|
|
10715
|
+
if (color) box.color.setFromString(color);
|
|
11081
10716
|
return box;
|
|
11082
10717
|
}
|
|
11083
10718
|
case "mesh":
|
|
@@ -11085,12 +10720,10 @@ var spine = (() => {
|
|
|
11085
10720
|
let path = getValue(map, "path", name);
|
|
11086
10721
|
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
11087
10722
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
11088
|
-
if (!mesh)
|
|
11089
|
-
return null;
|
|
10723
|
+
if (!mesh) return null;
|
|
11090
10724
|
mesh.path = path;
|
|
11091
10725
|
let color = getValue(map, "color", null);
|
|
11092
|
-
if (color)
|
|
11093
|
-
mesh.color.setFromString(color);
|
|
10726
|
+
if (color) mesh.color.setFromString(color);
|
|
11094
10727
|
mesh.width = getValue(map, "width", 0) * scale;
|
|
11095
10728
|
mesh.height = getValue(map, "height", 0) * scale;
|
|
11096
10729
|
mesh.sequence = sequence;
|
|
@@ -11103,16 +10736,14 @@ var spine = (() => {
|
|
|
11103
10736
|
this.readVertices(map, mesh, uvs.length);
|
|
11104
10737
|
mesh.triangles = map.triangles;
|
|
11105
10738
|
mesh.regionUVs = uvs;
|
|
11106
|
-
if (mesh.region != null)
|
|
11107
|
-
mesh.updateRegion();
|
|
10739
|
+
if (mesh.region != null) mesh.updateRegion();
|
|
11108
10740
|
mesh.edges = getValue(map, "edges", null);
|
|
11109
10741
|
mesh.hullLength = getValue(map, "hull", 0) * 2;
|
|
11110
10742
|
return mesh;
|
|
11111
10743
|
}
|
|
11112
10744
|
case "path": {
|
|
11113
10745
|
let path = this.attachmentLoader.newPathAttachment(skin, name);
|
|
11114
|
-
if (!path)
|
|
11115
|
-
return null;
|
|
10746
|
+
if (!path) return null;
|
|
11116
10747
|
path.closed = getValue(map, "closed", false);
|
|
11117
10748
|
path.constantSpeed = getValue(map, "constantSpeed", true);
|
|
11118
10749
|
let vertexCount = map.vertexCount;
|
|
@@ -11122,42 +10753,35 @@ var spine = (() => {
|
|
|
11122
10753
|
lengths[i] = map.lengths[i] * scale;
|
|
11123
10754
|
path.lengths = lengths;
|
|
11124
10755
|
let color = getValue(map, "color", null);
|
|
11125
|
-
if (color)
|
|
11126
|
-
path.color.setFromString(color);
|
|
10756
|
+
if (color) path.color.setFromString(color);
|
|
11127
10757
|
return path;
|
|
11128
10758
|
}
|
|
11129
10759
|
case "point": {
|
|
11130
10760
|
let point = this.attachmentLoader.newPointAttachment(skin, name);
|
|
11131
|
-
if (!point)
|
|
11132
|
-
return null;
|
|
10761
|
+
if (!point) return null;
|
|
11133
10762
|
point.x = getValue(map, "x", 0) * scale;
|
|
11134
10763
|
point.y = getValue(map, "y", 0) * scale;
|
|
11135
10764
|
point.rotation = getValue(map, "rotation", 0);
|
|
11136
10765
|
let color = getValue(map, "color", null);
|
|
11137
|
-
if (color)
|
|
11138
|
-
point.color.setFromString(color);
|
|
10766
|
+
if (color) point.color.setFromString(color);
|
|
11139
10767
|
return point;
|
|
11140
10768
|
}
|
|
11141
10769
|
case "clipping": {
|
|
11142
10770
|
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
|
|
11143
|
-
if (!clip)
|
|
11144
|
-
return null;
|
|
10771
|
+
if (!clip) return null;
|
|
11145
10772
|
let end = getValue(map, "end", null);
|
|
11146
|
-
if (end)
|
|
11147
|
-
clip.endSlot = skeletonData.findSlot(end);
|
|
10773
|
+
if (end) clip.endSlot = skeletonData.findSlot(end);
|
|
11148
10774
|
let vertexCount = map.vertexCount;
|
|
11149
10775
|
this.readVertices(map, clip, vertexCount << 1);
|
|
11150
10776
|
let color = getValue(map, "color", null);
|
|
11151
|
-
if (color)
|
|
11152
|
-
clip.color.setFromString(color);
|
|
10777
|
+
if (color) clip.color.setFromString(color);
|
|
11153
10778
|
return clip;
|
|
11154
10779
|
}
|
|
11155
10780
|
}
|
|
11156
10781
|
return null;
|
|
11157
10782
|
}
|
|
11158
10783
|
readSequence(map) {
|
|
11159
|
-
if (map == null)
|
|
11160
|
-
return null;
|
|
10784
|
+
if (map == null) return null;
|
|
11161
10785
|
let sequence = new Sequence(getValue(map, "count", 0));
|
|
11162
10786
|
sequence.start = getValue(map, "start", 1);
|
|
11163
10787
|
sequence.digits = getValue(map, "digits", 0);
|
|
@@ -11199,13 +10823,11 @@ var spine = (() => {
|
|
|
11199
10823
|
for (let slotName in map.slots) {
|
|
11200
10824
|
let slotMap = map.slots[slotName];
|
|
11201
10825
|
let slot = skeletonData.findSlot(slotName);
|
|
11202
|
-
if (!slot)
|
|
11203
|
-
throw new Error("Slot not found: " + slotName);
|
|
10826
|
+
if (!slot) throw new Error("Slot not found: " + slotName);
|
|
11204
10827
|
let slotIndex = slot.index;
|
|
11205
10828
|
for (let timelineName in slotMap) {
|
|
11206
10829
|
let timelineMap = slotMap[timelineName];
|
|
11207
|
-
if (!timelineMap)
|
|
11208
|
-
continue;
|
|
10830
|
+
if (!timelineMap) continue;
|
|
11209
10831
|
let frames = timelineMap.length;
|
|
11210
10832
|
if (timelineName == "attachment") {
|
|
11211
10833
|
let timeline = new AttachmentTimeline(frames, slotIndex);
|
|
@@ -11338,14 +10960,12 @@ var spine = (() => {
|
|
|
11338
10960
|
for (let boneName in map.bones) {
|
|
11339
10961
|
let boneMap = map.bones[boneName];
|
|
11340
10962
|
let bone = skeletonData.findBone(boneName);
|
|
11341
|
-
if (!bone)
|
|
11342
|
-
throw new Error("Bone not found: " + boneName);
|
|
10963
|
+
if (!bone) throw new Error("Bone not found: " + boneName);
|
|
11343
10964
|
let boneIndex = bone.index;
|
|
11344
10965
|
for (let timelineName in boneMap) {
|
|
11345
10966
|
let timelineMap = boneMap[timelineName];
|
|
11346
10967
|
let frames = timelineMap.length;
|
|
11347
|
-
if (frames == 0)
|
|
11348
|
-
continue;
|
|
10968
|
+
if (frames == 0) continue;
|
|
11349
10969
|
if (timelineName === "rotate") {
|
|
11350
10970
|
timelines.push(readTimeline12(timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1));
|
|
11351
10971
|
} else if (timelineName === "translate") {
|
|
@@ -11390,11 +11010,9 @@ var spine = (() => {
|
|
|
11390
11010
|
for (let constraintName in map.ik) {
|
|
11391
11011
|
let constraintMap = map.ik[constraintName];
|
|
11392
11012
|
let keyMap = constraintMap[0];
|
|
11393
|
-
if (!keyMap)
|
|
11394
|
-
continue;
|
|
11013
|
+
if (!keyMap) continue;
|
|
11395
11014
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
11396
|
-
if (!constraint)
|
|
11397
|
-
throw new Error("IK Constraint not found: " + constraintName);
|
|
11015
|
+
if (!constraint) throw new Error("IK Constraint not found: " + constraintName);
|
|
11398
11016
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
11399
11017
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
11400
11018
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -11427,11 +11045,9 @@ var spine = (() => {
|
|
|
11427
11045
|
for (let constraintName in map.transform) {
|
|
11428
11046
|
let timelineMap = map.transform[constraintName];
|
|
11429
11047
|
let keyMap = timelineMap[0];
|
|
11430
|
-
if (!keyMap)
|
|
11431
|
-
continue;
|
|
11048
|
+
if (!keyMap) continue;
|
|
11432
11049
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
11433
|
-
if (!constraint)
|
|
11434
|
-
throw new Error("Transform constraint not found: " + constraintName);
|
|
11050
|
+
if (!constraint) throw new Error("Transform constraint not found: " + constraintName);
|
|
11435
11051
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
11436
11052
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
11437
11053
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -11480,14 +11096,12 @@ var spine = (() => {
|
|
|
11480
11096
|
for (let constraintName in map.path) {
|
|
11481
11097
|
let constraintMap = map.path[constraintName];
|
|
11482
11098
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
11483
|
-
if (!constraint)
|
|
11484
|
-
throw new Error("Path constraint not found: " + constraintName);
|
|
11099
|
+
if (!constraint) throw new Error("Path constraint not found: " + constraintName);
|
|
11485
11100
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
11486
11101
|
for (let timelineName in constraintMap) {
|
|
11487
11102
|
let timelineMap = constraintMap[timelineName];
|
|
11488
11103
|
let keyMap = timelineMap[0];
|
|
11489
|
-
if (!keyMap)
|
|
11490
|
-
continue;
|
|
11104
|
+
if (!keyMap) continue;
|
|
11491
11105
|
let frames = timelineMap.length;
|
|
11492
11106
|
if (timelineName === "position") {
|
|
11493
11107
|
let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
@@ -11535,15 +11149,13 @@ var spine = (() => {
|
|
|
11535
11149
|
let constraintIndex = -1;
|
|
11536
11150
|
if (constraintName.length > 0) {
|
|
11537
11151
|
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
11538
|
-
if (!constraint)
|
|
11539
|
-
throw new Error("Physics constraint not found: " + constraintName);
|
|
11152
|
+
if (!constraint) throw new Error("Physics constraint not found: " + constraintName);
|
|
11540
11153
|
constraintIndex = skeletonData.physicsConstraints.indexOf(constraint);
|
|
11541
11154
|
}
|
|
11542
11155
|
for (let timelineName in constraintMap) {
|
|
11543
11156
|
let timelineMap = constraintMap[timelineName];
|
|
11544
11157
|
let keyMap = timelineMap[0];
|
|
11545
|
-
if (!keyMap)
|
|
11546
|
-
continue;
|
|
11158
|
+
if (!keyMap) continue;
|
|
11547
11159
|
let frames = timelineMap.length;
|
|
11548
11160
|
if (timelineName == "reset") {
|
|
11549
11161
|
const timeline2 = new PhysicsConstraintResetTimeline(frames, constraintIndex);
|
|
@@ -11577,13 +11189,11 @@ var spine = (() => {
|
|
|
11577
11189
|
for (let attachmentsName in map.attachments) {
|
|
11578
11190
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
11579
11191
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
11580
|
-
if (!skin)
|
|
11581
|
-
throw new Error("Skin not found: " + attachmentsName);
|
|
11192
|
+
if (!skin) throw new Error("Skin not found: " + attachmentsName);
|
|
11582
11193
|
for (let slotMapName in attachmentsMap) {
|
|
11583
11194
|
let slotMap = attachmentsMap[slotMapName];
|
|
11584
11195
|
let slot = skeletonData.findSlot(slotMapName);
|
|
11585
|
-
if (!slot)
|
|
11586
|
-
throw new Error("Slot not found: " + slotMapName);
|
|
11196
|
+
if (!slot) throw new Error("Slot not found: " + slotMapName);
|
|
11587
11197
|
let slotIndex = slot.index;
|
|
11588
11198
|
for (let attachmentMapName in slotMap) {
|
|
11589
11199
|
let attachmentMap = slotMap[attachmentMapName];
|
|
@@ -11591,8 +11201,7 @@ var spine = (() => {
|
|
|
11591
11201
|
for (let timelineMapName in attachmentMap) {
|
|
11592
11202
|
let timelineMap = attachmentMap[timelineMapName];
|
|
11593
11203
|
let keyMap = timelineMap[0];
|
|
11594
|
-
if (!keyMap)
|
|
11595
|
-
continue;
|
|
11204
|
+
if (!keyMap) continue;
|
|
11596
11205
|
if (timelineMapName == "deform") {
|
|
11597
11206
|
let weighted = attachment.bones;
|
|
11598
11207
|
let vertices = attachment.vertices;
|
|
@@ -11625,8 +11234,7 @@ var spine = (() => {
|
|
|
11625
11234
|
}
|
|
11626
11235
|
let time2 = getValue(nextMap, "time", 0);
|
|
11627
11236
|
let curve = keyMap.curve;
|
|
11628
|
-
if (curve)
|
|
11629
|
-
bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
|
|
11237
|
+
if (curve) bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
|
|
11630
11238
|
time = time2;
|
|
11631
11239
|
keyMap = nextMap;
|
|
11632
11240
|
}
|
|
@@ -11665,8 +11273,7 @@ var spine = (() => {
|
|
|
11665
11273
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
11666
11274
|
let offsetMap = offsets[ii];
|
|
11667
11275
|
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
11668
|
-
if (!slot)
|
|
11669
|
-
throw new Error("Slot not found: " + slot);
|
|
11276
|
+
if (!slot) throw new Error("Slot not found: " + slot);
|
|
11670
11277
|
let slotIndex = slot.index;
|
|
11671
11278
|
while (originalIndex != slotIndex)
|
|
11672
11279
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
@@ -11675,8 +11282,7 @@ var spine = (() => {
|
|
|
11675
11282
|
while (originalIndex < slotCount)
|
|
11676
11283
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
11677
11284
|
for (let ii = slotCount - 1; ii >= 0; ii--)
|
|
11678
|
-
if (drawOrder[ii] == -1)
|
|
11679
|
-
drawOrder[ii] = unchanged[--unchangedIndex];
|
|
11285
|
+
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
|
|
11680
11286
|
}
|
|
11681
11287
|
timeline.setFrame(frame, getValue(drawOrderMap, "time", 0), drawOrder);
|
|
11682
11288
|
}
|
|
@@ -11688,8 +11294,7 @@ var spine = (() => {
|
|
|
11688
11294
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
11689
11295
|
let eventMap = map.events[i];
|
|
11690
11296
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
11691
|
-
if (!eventData)
|
|
11692
|
-
throw new Error("Event not found: " + eventMap.name);
|
|
11297
|
+
if (!eventData) throw new Error("Event not found: " + eventMap.name);
|
|
11693
11298
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
11694
11299
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
11695
11300
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|
|
@@ -11736,8 +11341,7 @@ var spine = (() => {
|
|
|
11736
11341
|
}
|
|
11737
11342
|
let time2 = getValue(nextMap, "time", 0);
|
|
11738
11343
|
let value2 = getValue(nextMap, "value", defaultValue) * scale;
|
|
11739
|
-
if (keyMap.curve)
|
|
11740
|
-
bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
|
|
11344
|
+
if (keyMap.curve) bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
|
|
11741
11345
|
time = time2;
|
|
11742
11346
|
value = value2;
|
|
11743
11347
|
keyMap = nextMap;
|
|
@@ -11790,7 +11394,7 @@ var spine = (() => {
|
|
|
11790
11394
|
// spine-core/src/polyfills.ts
|
|
11791
11395
|
(() => {
|
|
11792
11396
|
if (typeof Math.fround === "undefined") {
|
|
11793
|
-
Math.fround = function(array) {
|
|
11397
|
+
Math.fround = /* @__PURE__ */ function(array) {
|
|
11794
11398
|
return function(x) {
|
|
11795
11399
|
return array[0] = x, array[0];
|
|
11796
11400
|
};
|
|
@@ -11823,7 +11427,7 @@ var spine = (() => {
|
|
|
11823
11427
|
throw new Error("Unsupported environment");
|
|
11824
11428
|
}
|
|
11825
11429
|
}
|
|
11826
|
-
var CanvasKitTexture = class extends Texture {
|
|
11430
|
+
var CanvasKitTexture = class _CanvasKitTexture extends Texture {
|
|
11827
11431
|
getImage() {
|
|
11828
11432
|
return this._image;
|
|
11829
11433
|
}
|
|
@@ -11844,11 +11448,9 @@ var spine = (() => {
|
|
|
11844
11448
|
}
|
|
11845
11449
|
static async fromFile(ck, path, readFile) {
|
|
11846
11450
|
const imgData = await readFile(path);
|
|
11847
|
-
if (!imgData)
|
|
11848
|
-
throw new Error(`Could not load image ${path}`);
|
|
11451
|
+
if (!imgData) throw new Error(`Could not load image ${path}`);
|
|
11849
11452
|
const image = ck.MakeImageFromEncoded(imgData);
|
|
11850
|
-
if (!image)
|
|
11851
|
-
throw new Error(`Could not load image ${path}`);
|
|
11453
|
+
if (!image) throw new Error(`Could not load image ${path}`);
|
|
11852
11454
|
const paintPerBlendMode = /* @__PURE__ */ new Map();
|
|
11853
11455
|
const shaders = [];
|
|
11854
11456
|
for (const blendMode of [
|
|
@@ -11869,7 +11471,7 @@ var spine = (() => {
|
|
|
11869
11471
|
paintPerBlendMode.set(blendMode, paint);
|
|
11870
11472
|
shaders.push(shader);
|
|
11871
11473
|
}
|
|
11872
|
-
return new
|
|
11474
|
+
return new _CanvasKitTexture({ shaders, paintPerBlendMode, image });
|
|
11873
11475
|
}
|
|
11874
11476
|
};
|
|
11875
11477
|
async function loadTextureAtlas(ck, atlasFile, readFile) {
|
|
@@ -11923,7 +11525,7 @@ var spine = (() => {
|
|
|
11923
11525
|
this.skeleton.updateWorldTransform(physicsUpdate);
|
|
11924
11526
|
}
|
|
11925
11527
|
};
|
|
11926
|
-
var
|
|
11528
|
+
var SkeletonRenderer = class _SkeletonRenderer {
|
|
11927
11529
|
/**
|
|
11928
11530
|
* Creates a new skeleton renderer.
|
|
11929
11531
|
* @param ck the {@link CanvasKit} instance returned by `CanvasKitInit()`.
|
|
@@ -11934,6 +11536,7 @@ var spine = (() => {
|
|
|
11934
11536
|
clipper = new SkeletonClipping();
|
|
11935
11537
|
tempColor = new Color();
|
|
11936
11538
|
tempColor2 = new Color();
|
|
11539
|
+
static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
|
|
11937
11540
|
scratchPositions = Utils.newFloatArray(100);
|
|
11938
11541
|
scratchColors = Utils.newFloatArray(100);
|
|
11939
11542
|
scratchUVs = Utils.newFloatArray(100);
|
|
@@ -11943,8 +11546,7 @@ var spine = (() => {
|
|
|
11943
11546
|
* @param skeleton the skeleton or drawable to render.
|
|
11944
11547
|
*/
|
|
11945
11548
|
render(canvas, skeleton) {
|
|
11946
|
-
if (skeleton instanceof SkeletonDrawable)
|
|
11947
|
-
skeleton = skeleton.skeleton;
|
|
11549
|
+
if (skeleton instanceof SkeletonDrawable) skeleton = skeleton.skeleton;
|
|
11948
11550
|
let clipper = this.clipper;
|
|
11949
11551
|
let drawOrder = skeleton.drawOrder;
|
|
11950
11552
|
let skeletonColor = skeleton.color;
|
|
@@ -12049,8 +11651,6 @@ var spine = (() => {
|
|
|
12049
11651
|
clipper.clipEnd();
|
|
12050
11652
|
}
|
|
12051
11653
|
};
|
|
12052
|
-
|
|
12053
|
-
__publicField(SkeletonRenderer, "QUAD_TRIANGLES", [0, 1, 2, 2, 3, 0]);
|
|
12054
|
-
return __toCommonJS(src_exports);
|
|
11654
|
+
return __toCommonJS(index_exports);
|
|
12055
11655
|
})();
|
|
12056
11656
|
//# sourceMappingURL=spine-canvaskit.js.map
|