Skip to content

Commit f8e6b4a

Browse files
committed
Merged latest runtime changes. Removed SetTrackMixBlend, but added additive parameter to set/add animation.
1 parent be25a9c commit f8e6b4a

File tree

7 files changed

+122
-130
lines changed

7 files changed

+122
-130
lines changed

spine-ts/spine-construct3/spine-construct3-lib/src/C3Matrix.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ export class C3Matrix {
8383
public gameToBone (x: number, y: number, bone: Bone) {
8484
const point = this.gameToSkeleton(x, y);
8585
if (bone.parent)
86-
return bone.parent.applied.worldToLocal(point);
87-
return bone.applied.worldToLocal(point);
86+
return bone.parent.appliedPose.worldToLocal(point);
87+
return bone.appliedPose.worldToLocal(point);
8888
}
8989

9090
public skeletonToGame = (skeletonX: number, skeletonY: number) => {
@@ -95,12 +95,12 @@ export class C3Matrix {
9595
}
9696

9797
public boneToGame (bone: Bone) {
98-
const { applied } = bone;
99-
return this.skeletonToGame(applied.worldX, applied.worldY);
98+
const { appliedPose } = bone;
99+
return this.skeletonToGame(appliedPose.worldX, appliedPose.worldY);
100100
}
101101

102102
public gameToBoneRotation (gameAngleDeg: number, bone: Bone) {
103-
return bone.applied.worldToLocalRotation(this.gameToSkeletonRotation(gameAngleDeg)) - 180;
103+
return bone.appliedPose.worldToLocalRotation(this.gameToSkeletonRotation(gameAngleDeg)) - 180;
104104
}
105105

106106
public gameToSkeletonRotation (gameAngleDeg: number) {

spine-ts/spine-construct3/spine-construct3-lib/src/C3SkeletonRenderer.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ abstract class C3SkeletonRenderer<
130130
for (let i = 0, n = bones.length; i < n; i++) {
131131
const bone = bones[i];
132132
// if (!bone.parent) continue;
133-
const boneApplied = bone.applied;
133+
const boneApplied = bone.appliedPose;
134134
const { x: x1, y: y1 } = matrix.skeletonToGame(boneApplied.worldX, boneApplied.worldY);
135135
const endX = boneApplied.worldX + bone.data.length * boneApplied.a;
136136
const endY = boneApplied.worldY + bone.data.length * boneApplied.c;
@@ -163,11 +163,11 @@ abstract class C3SkeletonRenderer<
163163
for (let i = 0, n = slots.length; i < n; i++) {
164164
const slot = slots[i];
165165
if (!slot.bone.active) continue;
166-
const attachment = slot.applied.attachment;
166+
const attachment = slot.appliedPose.attachment;
167167
if (attachment instanceof RegionAttachment) {
168168
const vertices = this.tempVertices;
169169

170-
attachment.computeWorldVertices(slot, attachment.getOffsets(slot.applied), vertices, 0, 2);
170+
attachment.computeWorldVertices(slot, attachment.getOffsets(slot.appliedPose), vertices, 0, 2);
171171
let p = matrix.skeletonToGame(vertices[0], vertices[1]);
172172
const x1 = p.x, y1 = p.y;
173173
p = matrix.skeletonToGame(vertices[2], vertices[3]);
@@ -187,7 +187,7 @@ abstract class C3SkeletonRenderer<
187187
for (let i = 0, n = slots.length; i < n; i++) {
188188
const slot = slots[i];
189189
if (!slot.bone.active) continue;
190-
const attachment = slot.applied.attachment;
190+
const attachment = slot.appliedPose.attachment;
191191
if (!(attachment instanceof MeshAttachment)) continue;
192192
const vertices = this.tempVertices;
193193
attachment.computeWorldVertices(skeleton, slot, 0, attachment.worldVerticesLength, vertices, 0, 2);
@@ -227,7 +227,7 @@ abstract class C3SkeletonRenderer<
227227
for (let i = 0, n = slots.length; i < n; i++) {
228228
const slot = slots[i];
229229
if (!slot.bone.active) continue;
230-
const attachment = slot.applied.attachment;
230+
const attachment = slot.appliedPose.attachment;
231231
if (!(attachment instanceof PathAttachment)) continue;
232232
let nn = attachment.worldVerticesLength;
233233
const world = this.tempArray = Utils.setArraySize(this.tempArray, nn, 0);
@@ -272,7 +272,7 @@ abstract class C3SkeletonRenderer<
272272
for (let i = 0, n = slots.length; i < n; i++) {
273273
const slot = slots[i];
274274
if (!slot.bone.active) continue;
275-
const attachment = slot.applied.attachment;
275+
const attachment = slot.appliedPose.attachment;
276276
if (!(attachment instanceof ClippingAttachment)) continue;
277277
const nn = attachment.worldVerticesLength;
278278
const world = this.tempArray = Utils.setArraySize(this.tempArray, nn, 0);
@@ -411,7 +411,7 @@ export class C3RendererRuntime extends C3SkeletonRenderer<IRenderer, C3TextureRu
411411
};
412412

413413
public renderDragHandles (bone: Bone, radius: number) {
414-
const boneApplied = bone.applied;
414+
const boneApplied = bone.appliedPose;
415415
const { x: x1, y: y1 } = this.matrix.skeletonToGame(boneApplied.worldX, boneApplied.worldY);
416416
this.renderer.setColorFillMode();
417417
this.renderer.setColor([1, 0, 0, .2]);

spine-ts/spine-construct3/src/aces.json

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"$schema": "../aces.schema.json",
3-
43
"custom": {
54
"conditions": [
65
{
@@ -162,6 +161,14 @@
162161
{
163162
"id": "loop",
164163
"type": "boolean"
164+
},
165+
{
166+
"id": "additive",
167+
"type": "combo",
168+
"items": [
169+
"disabled",
170+
"enabled"
171+
]
165172
}
166173
]
167174
},
@@ -186,6 +193,14 @@
186193
{
187194
"id": "delay",
188195
"type": "number"
196+
},
197+
{
198+
"id": "additive",
199+
"type": "combo",
200+
"items": [
201+
"disabled",
202+
"enabled"
203+
]
189204
}
190205
]
191206
},
@@ -322,7 +337,10 @@
322337
{
323338
"id": "units",
324339
"type": "combo",
325-
"items": ["seconds", "ratio"]
340+
"items": [
341+
"seconds",
342+
"ratio"
343+
]
326344
}
327345
]
328346
},
@@ -365,7 +383,12 @@
365383
{
366384
"id": "physics-mode",
367385
"type": "combo",
368-
"items": ["none", "reset", "update", "pose"]
386+
"items": [
387+
"none",
388+
"reset",
389+
"update",
390+
"pose"
391+
]
369392
}
370393
]
371394
},
@@ -395,22 +418,6 @@
395418
}
396419
]
397420
},
398-
{
399-
"id": "set-track-mix-blend",
400-
"scriptName": "SetTrackMixBlend",
401-
"highlight": false,
402-
"params": [
403-
{
404-
"id": "mix-blend",
405-
"type": "combo",
406-
"items": ["setup", "first", "replace", "add"]
407-
},
408-
{
409-
"id": "track-index",
410-
"type": "number"
411-
}
412-
]
413-
},
414421
{
415422
"id": "clear-track",
416423
"scriptName": "ClearTrack",
@@ -460,12 +467,18 @@
460467
{
461468
"id": "mode",
462469
"type": "combo",
463-
"items": ["local", "game"]
470+
"items": [
471+
"local",
472+
"game"
473+
]
464474
},
465475
{
466476
"id": "apply-mode",
467477
"type": "combo",
468-
"items": ["once", "hold"]
478+
"items": [
479+
"once",
480+
"hold"
481+
]
469482
},
470483
{
471484
"id": "x",
@@ -517,7 +530,11 @@
517530
{
518531
"id": "target",
519532
"type": "combo",
520-
"items": ["all", "bones", "slots"]
533+
"items": [
534+
"all",
535+
"bones",
536+
"slots"
537+
]
521538
}
522539
]
523540
},
@@ -529,7 +546,10 @@
529546
{
530547
"id": "type",
531548
"type": "combo",
532-
"items": ["bone", "slot"]
549+
"items": [
550+
"bone",
551+
"slot"
552+
]
533553
},
534554
{
535555
"id": "name",
@@ -625,7 +645,10 @@
625645
{
626646
"id": "type",
627647
"type": "combo",
628-
"items": ["bone", "slot"]
648+
"items": [
649+
"bone",
650+
"slot"
651+
]
629652
},
630653
{
631654
"id": "name",
@@ -649,7 +672,10 @@
649672
{
650673
"id": "type",
651674
"type": "combo",
652-
"items": ["bone", "slot"]
675+
"items": [
676+
"bone",
677+
"slot"
678+
]
653679
},
654680
{
655681
"id": "name",

spine-ts/spine-construct3/src/c3runtime/actions.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
4545
this.flip(isFlipped);
4646
},
4747

48-
SetAnimation (this: SDKInstanceClass, track: number, animation: string, loop = false) {
49-
this.setAnimation(track, animation, loop);
48+
SetAnimation (this: SDKInstanceClass, track: number, animation: string, loop = false, additive: 0 | 1 = 0) {
49+
this.setAnimation(track, animation, loop, additive === 1);
5050
},
5151

52-
AddAnimation (this: SDKInstanceClass, track: number, animation: string, loop = false, delay = 0) {
53-
this.addAnimation(track, animation, loop, delay);
52+
AddAnimation (this: SDKInstanceClass, track: number, animation: string, loop = false, delay = 0, additive: 0 | 1 = 0) {
53+
this.addAnimation(track, animation, loop, delay, additive === 1);
5454
},
5555

5656
Play (this: SDKInstanceClass) {
@@ -113,9 +113,6 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
113113
this.setTrackAlpha(alpha, trackIndex);
114114
},
115115

116-
SetTrackMixBlend (this: SDKInstanceClass, mixBlend: 0 | 1 | 2 | 3, trackIndex: number) {
117-
this.setTrackMixBlend(mixBlend, trackIndex);
118-
},
119116

120117
ClearTrack (this: SDKInstanceClass, trackIndex: number) {
121118
this.clearTrack(trackIndex);

0 commit comments

Comments
 (0)