Added optional child argument

This commit is contained in:
Richard Davey 2018-10-25 17:14:57 +01:00
parent f6124e253b
commit caa55e7ab3
2 changed files with 18 additions and 4 deletions

View file

@ -47,7 +47,7 @@ var SpineCanvasPlugin = new Class({
return runtime;
},
createSkeleton: function (key)
createSkeleton: function (key, child)
{
var atlasData = this.cache.get(key);
@ -68,7 +68,14 @@ var SpineCanvasPlugin = new Class({
var skeletonJson = new SpineCanvas.SkeletonJson(atlasLoader);
var skeletonData = skeletonJson.readSkeletonData(this.json.get(key));
var data = this.json.get(key);
if (child)
{
data = data[child];
}
var skeletonData = skeletonJson.readSkeletonData(data);
var skeleton = new SpineCanvas.Skeleton(skeletonData);

View file

@ -76,7 +76,7 @@ var SpineWebGLPlugin = new Class({
return runtime;
},
createSkeleton: function (key)
createSkeleton: function (key, child)
{
var atlasData = this.cache.get(key);
@ -99,7 +99,14 @@ var SpineWebGLPlugin = new Class({
var skeletonJson = new SpineWebGL.SkeletonJson(atlasLoader);
var skeletonData = skeletonJson.readSkeletonData(this.json.get(key));
var data = this.json.get(key);
if (child)
{
data = data[child];
}
var skeletonData = skeletonJson.readSkeletonData(data);
var skeleton = new SpineWebGL.Skeleton(skeletonData);