mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-20 00:36:43 +08:00
Look in skin before default skin.
This commit is contained in:
parent
5fdcfaca2e
commit
43018798ab
@ -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
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user