diff --git a/spine-ts/spine-construct3/spine-construct3-lib/src/C3SkeletonRenderer.ts b/spine-ts/spine-construct3/spine-construct3-lib/src/C3SkeletonRenderer.ts index c8d35b513..1cb7bf8cc 100644 --- a/spine-ts/spine-construct3/spine-construct3-lib/src/C3SkeletonRenderer.ts +++ b/spine-ts/spine-construct3/spine-construct3-lib/src/C3SkeletonRenderer.ts @@ -53,7 +53,7 @@ abstract class C3SkeletonRenderer< super(); } - draw (skeleton: Skeleton, opacity = 1) { + draw (skeleton: Skeleton, inColors: [number, number, number], opacity = 1) { const { matrix, inv255 } = this; let command = this.render(skeleton); @@ -81,9 +81,9 @@ abstract class C3SkeletonRenderer< const colorDst = i * 4; const alpha = (color >>> 24 & 0xFF) * inv255 * opacity; const alphaInverse = inv255 * alpha; - c3colors[colorDst] = (color >>> 16 & 0xFF) * alphaInverse; - c3colors[colorDst + 1] = (color >>> 8 & 0xFF) * alphaInverse; - c3colors[colorDst + 2] = (color & 0xFF) * alphaInverse; + c3colors[colorDst] = inColors[0] * (color >>> 16 & 0xFF) * alphaInverse; + c3colors[colorDst + 1] = inColors[1] * (color >>> 8 & 0xFF) * alphaInverse; + c3colors[colorDst + 2] = inColors[2] * (color & 0xFF) * alphaInverse; c3colors[colorDst + 3] = alpha; } diff --git a/spine-ts/spine-construct3/src/c3runtime/instance.ts b/spine-ts/spine-construct3/src/c3runtime/instance.ts index 528132a90..d33d919e7 100644 --- a/spine-ts/spine-construct3/src/c3runtime/instance.ts +++ b/spine-ts/spine-construct3/src/c3runtime/instance.ts @@ -148,7 +148,8 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase { if (!skeleton) return; this.skeletonRenderer ||= new spine.C3RendererRuntime(renderer, this.matrix); - this.skeletonRenderer.draw(skeleton, this.opacity); + this.skeletonRenderer.draw(skeleton, this.colorRgb, this.opacity); + if (this.propDebugSkeleton) this.skeletonRenderer.drawDebug(skeleton, this.x, this.y, this.getBoundingQuad(false)); this.renderDragHandles(); } diff --git a/spine-ts/spine-construct3/src/instance.ts b/spine-ts/spine-construct3/src/instance.ts index 53399cb80..967fe7a14 100644 --- a/spine-ts/spine-construct3/src/instance.ts +++ b/spine-ts/spine-construct3/src/instance.ts @@ -206,7 +206,8 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase { this.update(0); this.skeletonRenderer ||= new spine.C3RendererEditor(iRenderer, this.matrix); - this.skeletonRenderer.draw(skeleton, _inst.GetOpacity()); + const color = _inst.GetColor(); + this.skeletonRenderer.draw(skeleton, [color.getR(), color.getG(), color.getB()], color.getA() * _inst.GetOpacity()); const quad = _inst.GetQuad(); if (_inst.GetPropertyValue(PLUGIN_CLASS.PROP_DEBUG_SKELETON) as boolean) this.skeletonRenderer.drawDebug(skeleton, rectX, rectY, quad); diff --git a/spine-ts/spine-construct3/src/plugin.ts b/spine-ts/spine-construct3/src/plugin.ts index 361e3093c..2e483d5fe 100644 --- a/spine-ts/spine-construct3/src/plugin.ts +++ b/spine-ts/spine-construct3/src/plugin.ts @@ -41,20 +41,26 @@ const PLUGIN_CLASS = class SpineC3Plugin extends SDK.IPluginBase { SDK.Lang.PushContext(`plugins.${PLUGIN_ID.toLowerCase()}`); - // @ts-ignore this._info.SetName(globalThis.lang(".name")); - // @ts-ignore this._info.SetDescription(globalThis.lang(".description")); this._info.SetCategory(PLUGIN_CATEGORY); this._info.SetAuthor("Esoteric Software"); - // @ts-ignore this._info.SetHelpUrl(globalThis.lang(".help-url")); this._info.SetPluginType("world"); // mark as world plugin, which can draw + this._info.SetIsResizable(true); // allow to be resized this._info.SetIsRotatable(true); // allow to be rotated this._info.SetHasImage(false); this._info.SetSupportsEffects(true); // allow effects this._info.SetMustPreDraw(true); + + this._info.AddCommonPositionACEs(); // Position: Set X/Y, Set position, etc. + this._info.AddCommonSizeACEs(); // Size: Set size, width, height + this._info.AddCommonAngleACEs(); // Angle: Set angle, rotate + this._info.AddCommonAppearanceACEs(); // Appearance: Set opacity, visible, color + this._info.AddCommonZOrderACEs(); // Z order: bring to front/back, move up/down + this._info.SetSupportsColor(true); // enable system colour/transparency + this._info.SetRuntimeModuleMainScript("c3runtime/main.js"); this._info.AddC3RuntimeScript("c3runtime/spine-construct3-lib.js"); this._info.AddFileDependency({