diff --git a/spine-libgdx/src/com/esotericsoftware/spine/AttachmentLoader.java b/spine-libgdx/src/com/esotericsoftware/spine/AttachmentLoader.java index f66e7d1d7..49bc1107e 100644 --- a/spine-libgdx/src/com/esotericsoftware/spine/AttachmentLoader.java +++ b/spine-libgdx/src/com/esotericsoftware/spine/AttachmentLoader.java @@ -27,5 +27,5 @@ package com.esotericsoftware.spine; public interface AttachmentLoader { /** @return May be null to not load any attachment. */ - public Attachment newAttachment (AttachmentType type, String name); + public Attachment newAttachment (Skin skin, AttachmentType type, String name); } diff --git a/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java b/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java index cdea326f4..9eb46b3d4 100644 --- a/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java +++ b/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java @@ -154,18 +154,18 @@ public class SkeletonBinary { int attachmentCount = input.readInt(true); for (int ii = 0; ii < attachmentCount; ii++) { String name = input.readString(); - skin.addAttachment(slotIndex, name, readAttachment(input, name)); + skin.addAttachment(slotIndex, name, readAttachment(input, skin, name)); } } return skin; } - private Attachment readAttachment (DataInput input, String attachmentName) throws IOException { + private Attachment readAttachment (DataInput input, Skin skin, String attachmentName) throws IOException { String name = input.readString(); if (name == null) name = attachmentName; AttachmentType type = AttachmentType.values()[input.readByte()]; - Attachment attachment = attachmentLoader.newAttachment(type, name); + Attachment attachment = attachmentLoader.newAttachment(skin, type, name); if (attachment instanceof RegionSequenceAttachment) { RegionSequenceAttachment regionSequenceAttachment = (RegionSequenceAttachment)attachment; diff --git a/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java b/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java index 38d856b4b..60efe7cdf 100644 --- a/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java +++ b/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java @@ -129,7 +129,7 @@ public class SkeletonJson { for (Entry slotEntry : ((OrderedMap)entry.value).entries()) { int slotIndex = skeletonData.findSlotIndex(slotEntry.key); for (Entry attachmentEntry : ((OrderedMap)slotEntry.value).entries()) { - Attachment attachment = readAttachment(attachmentEntry.key, attachmentEntry.value); + Attachment attachment = readAttachment(skin, attachmentEntry.key, attachmentEntry.value); if (attachment != null) skin.addAttachment(slotIndex, attachmentEntry.key, attachment); } } @@ -152,11 +152,11 @@ public class SkeletonJson { return skeletonData; } - private Attachment readAttachment (String name, OrderedMap map) { + private Attachment readAttachment (Skin skin, String name, OrderedMap map) { name = (String)map.get("name", name); AttachmentType type = AttachmentType.valueOf((String)map.get("type", AttachmentType.region.name())); - Attachment attachment = attachmentLoader.newAttachment(type, name); + Attachment attachment = attachmentLoader.newAttachment(skin, type, name); if (attachment instanceof RegionSequenceAttachment) { RegionSequenceAttachment regionSequenceAttachment = (RegionSequenceAttachment)attachment; diff --git a/spine-libgdx/src/com/esotericsoftware/spine/attachments/AtlasAttachmentLoader.java b/spine-libgdx/src/com/esotericsoftware/spine/attachments/AtlasAttachmentLoader.java index b5160d0ff..eca5700a3 100644 --- a/spine-libgdx/src/com/esotericsoftware/spine/attachments/AtlasAttachmentLoader.java +++ b/spine-libgdx/src/com/esotericsoftware/spine/attachments/AtlasAttachmentLoader.java @@ -28,6 +28,7 @@ package com.esotericsoftware.spine.attachments; import com.esotericsoftware.spine.Attachment; import com.esotericsoftware.spine.AttachmentLoader; import com.esotericsoftware.spine.AttachmentType; +import com.esotericsoftware.spine.Skin; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; @@ -40,7 +41,7 @@ public class AtlasAttachmentLoader implements AttachmentLoader { this.atlas = atlas; } - public Attachment newAttachment (AttachmentType type, String name) { + public Attachment newAttachment (Skin skin, AttachmentType type, String name) { Attachment attachment = null; switch (type) { case region: