Skip to content

Commit

Permalink
feat (runtime) 4.1 support
Browse files Browse the repository at this point in the history
Update to 4.1.19 runtime (modified for C3)
Fix renderquality action for 4.x assetmanager
Fix creating skeleton without defined skin
  • Loading branch information
MikalDev committed Jul 16, 2022
1 parent ec78dfd commit 84d3b9f
Show file tree
Hide file tree
Showing 7 changed files with 926 additions and 615 deletions.
Binary file added dist/Spine-v2.4.0.c3addon
Binary file not shown.
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": "2.3.1",
"version": "2.4.0",
"author": "Mikal and Igor Gritsenko",
"website": "https://gritsenko.github.io/c3_spine_plugin",
"documentation": "https://gritsenko.github.io/c3_spine_plugin",
Expand Down
4 changes: 2 additions & 2 deletions src/c3runtime/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@
if (this.skeletonName == "")
{
// this._sdkType._skeletonData = this._sdkType._skeletonJson.readSkeletonData(this.assetManager.get(this.DEMO_NAME, this.jsonURI));
this._sdkType._skeletonData = this._sdkType._skeletonJson.readSkeletonData(assetManager.get(assetTag, this._sdkType._jsonURI));
this._sdkType._skeletonData = this._sdkType._skeletonJson.readSkeletonData(assetManager.get(this._sdkType._jsonURI));
} else
{
this._sdkType._skeletonData = this._sdkType._skeletonJson.readSkeletonData(assetManager.get(assetTag, this._sdkType._jsonURI) [this.skeletonName] );
this._sdkType._skeletonData = this._sdkType._skeletonJson.readSkeletonData(assetManager.get(this._sdkType._jsonURI) [this.skeletonName] );
}
},

Expand Down
10 changes: 7 additions & 3 deletions src/c3runtime/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
this.sdkType._assetPaths[this.atlasPath] = this.atlasURI;
this.sdkType._assetPaths[this.jsonURI] = this.jsonURI;
this.sdkType._assetPaths[this.jsonPath] = this.jsonURI;
this.sdkType._jsonURI = this.jsonURI;

assetManager.loadText(this.jsonURI);

Expand Down Expand Up @@ -283,9 +284,12 @@
// If skeletonData not initialized, create it and stop other instances from creating it
// @ts-ignore
let skeleton = new spine.Skeleton(this.sdkType._skeletonData);
let subskin = skeleton.data.findSkin(this.skinName);
if (subskin === undefined) {
subskin = skeleton.data.skins[0];
let subskin
if (this.skinName) {
subskin = skeleton.data.findSkin(this.skinName);
if (!subskin) subskin = skeleton.data.defaultSkin;
} else {
subskin = skeleton.data.defaultSkin;
}

skeleton.setSkin(subskin);
Expand Down
2 changes: 1 addition & 1 deletion src/c3runtime/spine-draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class SpineBatch {
// @ts-ignore
if (!globalThis.spineBatcher)
{
console.info('[Spine] SpineBatcher init, 2.3.1, Spine 4.0.x compatible');
console.info('[Spine] SpineBatcher init, 2.4.0, Spine 4.1.x compatible');
// @ts-ignore
globalThis.spineBatcher = new SpineBatch();
}
Loading

0 comments on commit 84d3b9f

Please sign in to comment.