Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
1.7.0 - Add event condition
Browse files Browse the repository at this point in the history
Add Condition trigger for animation events.
  • Loading branch information
MikalDev committed Jul 24, 2020
1 parent 64194ad commit 287d516
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 2 deletions.
Binary file added dist/Spine-v1.7.0.c3addon
Binary file not shown.
11 changes: 11 additions & 0 deletions src/aces.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@
"id": "on-error",
"scriptName": "OnError",
"isTrigger": true
},
{
"id": "on-event",
"scriptName": "OnEvent",
"isTrigger": true,
"params": [
{
"id": "event-name",
"type": "string"
}
]
}
],
"actions": [
Expand Down
2 changes: 1 addition & 1 deletion src/addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "plugin",
"name": "Spine",
"id": "Gritsenko_Spine",
"version": "1.6.0",
"version": "1.7.0",
"author": "Igor Gritsenko and Mikal",
"website": "https://gritsenko.github.io/c3_spine_plugin",
"documentation": "https://gritsenko.github.io/c3_spine_plugin",
Expand Down
4 changes: 3 additions & 1 deletion src/c3runtime/conditions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
},
OnError() {
return true;
},
OnEvent(eventName) {
return this.completeEventName == eventName;
}

};
}
43 changes: 43 additions & 0 deletions src/c3runtime/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
this.completeAnimationName = ""
this.spineError = null
this.animationSpeed = 1.0
this.completeEventName = ""

const wi = this.GetWorldInfo();
// Enable collisions based on property, add ACEs if needed
Expand Down Expand Up @@ -293,6 +294,10 @@
this.completeAnimationName = this.animationName;
this.Trigger(C3.Plugins.Gritsenko_Spine.Cnds.OnAnimationFinished);
this.Trigger(C3.Plugins.Gritsenko_Spine.Cnds.OnAnyAnimationFinished);
},
event: (trackIndex, event) => {
this.completeEventName = event.data.name;
this.Trigger(C3.Plugins.Gritsenko_Spine.Cnds.OnEvent);
}
};

Expand Down Expand Up @@ -469,6 +474,44 @@

Release() {
super.Release();
this.DEMO_NAME = null;
this.canvas = null;
this.bgColor = null;
this.isPlaying = null;
this.assetManager = null;
this.isSkeletonLoaded = null;
this.isSkeletonLoading = null;
this.isSpineInitialized = null;
this.skeletonInfo = null;
this.renderer = null;
this.gl = null;
this.atlasPath = null;
this.jsonPath = null;
this.atlasPath = null;
this.pngPath = null;
this.skinName = null;
this.animationName = null;
this.skeletonName = null;
this.skeletonScale = null;
this.premultipliedAlpha = null;
this.collisionsEnabled = null;
this.defaultMix = null;
this.isMirrored = null;
this._elementId = null;
this._elementTexture = null
this._newElementId = fnull;
this.pngURI = null;
this.atlasURI = null;
this.jsonURI = null;
this.c3renderer = null;
this.c3wgl = null;
this.canvas = null;
this.spineFB = null
this.initSpineInProgress = null;
this.completeAnimationName = null;
this.spineError = null
this.animationSpeed = null;
this.completeEventName = null;
}

Tick() {
Expand Down
11 changes: 11 additions & 0 deletions src/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@
"list-name": "On error",
"display-text": "On error",
"description": "Triggered on any spine error, error message in error expression."
},
"on-event": {
"list-name": "On animation event",
"display-text": "On event {0}",
"description": "Triggered on specified animation event.",
"params": {
"event-name": {
"name": "Event name",
"desc": "Event name"
}
}
}
},
"actions": {
Expand Down

0 comments on commit 287d516

Please sign in to comment.