Skip to content

Commit 7b96356

Browse files
committed
Fixed setSkin method and added other helper methods
1 parent 00661c4 commit 7b96356

1 file changed

Lines changed: 74 additions & 1 deletion

File tree

plugins/spine/src/gameobject/SpineGameObject.js

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,37 @@ var SpineGameObject = new Class({
234234
return output;
235235
},
236236

237+
getSkinList: function ()
238+
{
239+
var output = [];
240+
241+
var skeletonData = this.skeletonData;
242+
243+
if (skeletonData)
244+
{
245+
for (var i = 0; i < skeletonData.skins.length; i++)
246+
{
247+
output.push(skeletonData.skins[i].name);
248+
}
249+
}
250+
251+
return output;
252+
},
253+
254+
getSlotList: function ()
255+
{
256+
var output = [];
257+
258+
var skeleton = this.skeleton;
259+
260+
for (var i = 0; i < skeleton.slots.length; i++)
261+
{
262+
output.push(skeleton.slots[i].data.name);
263+
}
264+
265+
return output;
266+
},
267+
237268
getAnimationList: function ()
238269
{
239270
var output = [];
@@ -299,7 +330,13 @@ var SpineGameObject = new Class({
299330

300331
setSkinByName: function (skinName)
301332
{
302-
this.skeleton.setSkinByName(skinName);
333+
var skeleton = this.skeleton;
334+
335+
skeleton.setSkinByName(skinName);
336+
337+
skeleton.setSlotsToSetupPose();
338+
339+
this.state.apply(skeleton);
303340

304341
return this;
305342
},
@@ -324,6 +361,42 @@ var SpineGameObject = new Class({
324361
return this;
325362
},
326363

364+
getAttachment: function (slotIndex, attachmentName)
365+
{
366+
return this.skeleton.getAttachment(slotIndex, attachmentName);
367+
},
368+
369+
getAttachmentByName: function (slotName, attachmentName)
370+
{
371+
return this.skeleton.getAttachmentByName(slotName, attachmentName);
372+
},
373+
374+
setAttachment: function (slotName, attachmentName)
375+
{
376+
return this.skeleton.setAttachment(slotName, attachmentName);
377+
},
378+
379+
setToSetupPose: function ()
380+
{
381+
this.skeleton.setToSetupPose();
382+
383+
return this;
384+
},
385+
386+
setSlotsToSetupPose: function ()
387+
{
388+
this.skeleton.setSlotsToSetupPose();
389+
390+
return this;
391+
},
392+
393+
setBonesToSetupPose: function ()
394+
{
395+
this.skeleton.setBonesToSetupPose();
396+
397+
return this;
398+
},
399+
327400
getRootBone: function ()
328401
{
329402
return this.skeleton.getRootBone();

0 commit comments

Comments
 (0)