diff --git a/spine-corona/spine/Skeleton.lua b/spine-corona/spine/Skeleton.lua index 0dbe95ec4..d3a2ba00d 100644 --- a/spine-corona/spine/Skeleton.lua +++ b/spine-corona/spine/Skeleton.lua @@ -143,11 +143,11 @@ function Skeleton.new (skeletonData, group) if not attachmentName then error("attachmentName cannot be nil.", 2) end local slotIndex = self.data:findSlotIndex(slotName) if slotIndex == -1 then error("Slot not found: " .. slotName, 2) end + if self.skin then return self.skin:getAttachment(slotIndex, attachmentName) end if self.data.defaultSkin then local attachment = self.data.defaultSkin:getAttachment(slotIndex, attachmentName) if attachment then return attachment end end - if self.skin then return self.skin:getAttachment(slotIndex, attachmentName) end return nil end diff --git a/spine-cpp/src/spine/BaseSkeleton.cpp b/spine-cpp/src/spine/BaseSkeleton.cpp index 20af3c1b3..c9e8db7fd 100644 --- a/spine-cpp/src/spine/BaseSkeleton.cpp +++ b/spine-cpp/src/spine/BaseSkeleton.cpp @@ -132,11 +132,11 @@ Attachment* BaseSkeleton::getAttachment (const string &slotName, const string &a } Attachment* BaseSkeleton::getAttachment (int slotIndex, const string &attachmentName) const { + if (skin) return skin->getAttachment(slotIndex, attachmentName); if (data->defaultSkin) { Attachment *attachment = data->defaultSkin->getAttachment(slotIndex, attachmentName); if (attachment) return attachment; } - if (skin) return skin->getAttachment(slotIndex, attachmentName); return 0; } diff --git a/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java b/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java index 1d590b904..9fdc16030 100644 --- a/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java +++ b/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java @@ -216,11 +216,11 @@ public class Skeleton { /** @return May be null. */ public Attachment getAttachment (int slotIndex, String attachmentName) { if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null."); + if (skin != null) return skin.getAttachment(slotIndex, attachmentName); if (data.defaultSkin != null) { Attachment attachment = data.defaultSkin.getAttachment(slotIndex, attachmentName); if (attachment != null) return attachment; } - if (skin != null) return skin.getAttachment(slotIndex, attachmentName); return null; }