diff --git a/README.md b/README.md index 4d9a35c..9f44373 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Add-on based on **Mikal's** sample from this [thread](https://www.construct.net/en/forum/construct-3/general-discussion-7/spine-animation-js-template-145940) ## Downloads -[Current Add-on, Release 1.51.1](https://github.com/gritsenko/c3_spine_plugin/releases/download/1.51.1/Spine-v1.51.1.c3addon) +[Current Add-on, Release 1.53.0](https://github.com/gritsenko/c3_spine_plugin/releases/download/1.53.0/Spine-v1.53.0.c3addon) [Previous Add-on Releases](https://github.com/gritsenko/c3_spine_plugin/releases) @@ -127,6 +127,8 @@ Useful for Dragon Bones Spine JSON export and earlier Spine versions. - Preview Spine render in editor (dependent on C3 editor SDK updates) ## Release notes +- 1.53.0 Add expressions for bbox and scale properties +- 1.52.0 Add customSkinOutfit script interface - 1.51.1 Add icon, error handling for addCustomSkinOutfit - 1.50.2 Fix worker mode support for C3 - 1.50.1 Fix slot color related to script add customskinoutfit diff --git a/dist/Spine-v1.52.0.c3addon b/dist/Spine-v1.52.0.c3addon new file mode 100644 index 0000000..990cb45 Binary files /dev/null and b/dist/Spine-v1.52.0.c3addon differ diff --git a/dist/Spine-v1.53.0.c3addon b/dist/Spine-v1.53.0.c3addon new file mode 100644 index 0000000..ccf7273 Binary files /dev/null and b/dist/Spine-v1.53.0.c3addon differ diff --git a/src/aces.json b/src/aces.json index 2ba0ff5..488383b 100644 --- a/src/aces.json +++ b/src/aces.json @@ -1090,6 +1090,46 @@ "type": "number" } ] + }, + { + "id": "bbox-offset-x", + "expressionName": "BboxOffsetX", + "scriptName": "BboxOffsetX", + "highlight": false, + "returnType": "number", + "params": [] + }, + { + "id": "bbox-offset-y", + "expressionName": "BboxOffsetY", + "scriptName": "BboxOffsetY", + "highlight": false, + "returnType": "number", + "params": [] + }, + { + "id": "bbox-size-x", + "expressionName": "BboxSizeX", + "scriptName": "BboxSizeX", + "highlight": false, + "returnType": "number", + "params": [] + }, + { + "id": "bbox-size-y", + "expressionName": "BboxSizeY", + "scriptName": "BboxSizeY", + "highlight": false, + "returnType": "number", + "params": [] + }, + { + "id": "skeleton-scale", + "expressionName": "SkeletonScale", + "scriptName": "SkeletonScale", + "highlight": false, + "returnType": "number", + "params": [] } ] } diff --git a/src/addon.json b/src/addon.json index 0e5367c..d2330ef 100755 --- a/src/addon.json +++ b/src/addon.json @@ -3,7 +3,7 @@ "type": "plugin", "name": "Spine", "id": "Gritsenko_Spine", - "version": "1.51.1", + "version": "1.53.0", "author": "Mikal and Igor Gritsenko", "website": "https://gritsenko.github.io/c3_spine_plugin", "documentation": "https://gritsenko.github.io/c3_spine_plugin", diff --git a/src/c3runtime/actions.js b/src/c3runtime/actions.js index fb4bc66..c9271c5 100644 --- a/src/c3runtime/actions.js +++ b/src/c3runtime/actions.js @@ -135,29 +135,7 @@ AddCustomSkin(skinName,addSkinName) { - if (!this.skeletonInfo || !this.skeletonInfo.skeleton) - { - if (this.debug) console.warn('[Spine] AddCustomSkin, skeleton is not available',skinName,addSkinName, this.uid, this.runtime.GetTickCount()); - return; - } - - const skeleton = this.skeletonInfo.skeleton; - - if (this.customSkins[skinName]) - { - let addSkin = skeleton.data.findSkin(addSkinName); - if (addSkin) - { - this.customSkins[skinName].addSkin(addSkin); - } else - { - if (this.debug) console.warn('[Spine] AddCustomSkin, add skin does not exist',skinName,addSkinName, this.uid, this.runtime.GetTickCount()); - } - } else - { - if (this.debug) console.warn('[Spine] AddCustomSkin, custom skin does not exist',skinName,addSkinName, this.uid, this.runtime.GetTickCount()); - } - this.SetRenderOnce(1.0, true, this.uid); + this._addCustomSkin(skinName, addSkinName); }, SetCustomSkin(skinName) diff --git a/src/c3runtime/expressions.js b/src/c3runtime/expressions.js index 59092a4..3939e94 100644 --- a/src/c3runtime/expressions.js +++ b/src/c3runtime/expressions.js @@ -299,6 +299,21 @@ }, CurrentValue(){ return this.currentValue; + }, + BboxOffsetX(){ + return this.bboxOffsetX; + }, + BboxOffsetY(){ + return this.bboxOffsetY; + }, + BboxSizeX(){ + return this.bboxSizeX; + }, + BboxSizeY(){ + return this.bboxSizeY; + }, + SkeletonScale(){ + return this.skeletonScale; } }; } \ No newline at end of file diff --git a/src/c3runtime/instance.js b/src/c3runtime/instance.js index 575f2a8..4c462f6 100644 --- a/src/c3runtime/instance.js +++ b/src/c3runtime/instance.js @@ -1173,6 +1173,33 @@ return (track.animationEnd-track.animationStart); } + + _addCustomSkin(skinName,addSkinName) + { + if (!this.skeletonInfo || !this.skeletonInfo.skeleton) + { + if (this.debug) console.warn('[Spine] AddCustomSkin, skeleton is not available',skinName,addSkinName, this.uid, this.runtime.GetTickCount()); + return; + } + + const skeleton = this.skeletonInfo.skeleton; + + if (this.customSkins[skinName]) + { + let addSkin = skeleton.data.findSkin(addSkinName); + if (addSkin) + { + this.customSkins[skinName].addSkin(addSkin); + } else + { + if (this.debug) console.warn('[Spine] AddCustomSkin, add skin does not exist',skinName,addSkinName, this.uid, this.runtime.GetTickCount()); + } + } else + { + if (this.debug) console.warn('[Spine] AddCustomSkin, custom skin does not exist',skinName,addSkinName, this.uid, this.runtime.GetTickCount()); + } + this.SetRenderOnce(1.0, true, this.uid); + } }; // Script interface. Use a WeakMap to safely hide the internal implementation details from the @@ -1234,6 +1261,11 @@ map.get(this)._applySlotColors(); } + addCustomSkin(skinName, addSkinName) + { + map.get(this)._addCustomSkin(skinName, addSkinName); + } + animationStart(trackIndex) { return map.get(this)._animationStart(trackIndex); diff --git a/src/c3runtime/spine-draw.js b/src/c3runtime/spine-draw.js index d9985c5..06f7269 100644 --- a/src/c3runtime/spine-draw.js +++ b/src/c3runtime/spine-draw.js @@ -346,7 +346,7 @@ class SpineBatch { // @ts-ignore if (!globalThis.spineBatcher) { - console.log('[Spine] SpineBatcher init, 1.51.1'); + console.log('[Spine] SpineBatcher init, 1.53.0'); // @ts-ignore globalThis.spineBatcher = new SpineBatch(); } \ No newline at end of file diff --git a/src/lang/en-US.json b/src/lang/en-US.json index 6d51020..a898b75 100644 --- a/src/lang/en-US.json +++ b/src/lang/en-US.json @@ -1060,6 +1060,31 @@ "translated-name": "CurrentKey", "params": { } + }, + "bbox-offset-x": { + "description": "Bounding box offset x", + "translated-name": "BboxOffsetX", + "params": {} + }, + "bbox-offset-y": { + "description": "Bounding box offset y", + "translated-name": "BboxOffsetY", + "params": {} + }, + "bbox-size-x": { + "description": "Bounding box size x", + "translated-name": "BboxSizeX", + "params": {} + }, + "bbox-size-y": { + "description": "Bounding box size y", + "translated-name": "BboxSizeY", + "params": {} + }, + "skeleton-scale": { + "description": "Skeleton scale", + "translated-name": "SkeletonScale", + "params": {} } } } diff --git a/src/plugin.js b/src/plugin.js index a6d23b8..c1d98e1 100755 --- a/src/plugin.js +++ b/src/plugin.js @@ -3,7 +3,7 @@ const C3 = self.C3; const PLUGIN_ID = "Gritsenko_Spine"; - const PLUGIN_VERSION = "1.51.1"; + const PLUGIN_VERSION = "1.53.0"; const PLUGIN_CATEGORY = "general"; const PLUGIN_CLASS = SDK.Plugins.Gritsenko_Spine = class SpinePlugin extends SDK.IPluginBase {