Ver Fonte

Look in skin before default skin.

NathanSweet há 12 anos atrás
pai
commit
43018798ab

+ 1 - 1
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
 		if not attachmentName then error("attachmentName cannot be nil.", 2) end
 		local slotIndex = self.data:findSlotIndex(slotName)
 		local slotIndex = self.data:findSlotIndex(slotName)
 		if slotIndex == -1 then error("Slot not found: " .. slotName, 2) end
 		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
 		if self.data.defaultSkin then
 			local attachment = self.data.defaultSkin:getAttachment(slotIndex, attachmentName)
 			local attachment = self.data.defaultSkin:getAttachment(slotIndex, attachmentName)
 			if attachment then return attachment end
 			if attachment then return attachment end
 		end
 		end
-		if self.skin then return self.skin:getAttachment(slotIndex, attachmentName) end
 		return nil
 		return nil
 	end
 	end
 
 

+ 1 - 1
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 {
 Attachment* BaseSkeleton::getAttachment (int slotIndex, const string &attachmentName) const {
+	if (skin) return skin->getAttachment(slotIndex, attachmentName);
 	if (data->defaultSkin) {
 	if (data->defaultSkin) {
 		Attachment *attachment = data->defaultSkin->getAttachment(slotIndex, attachmentName);
 		Attachment *attachment = data->defaultSkin->getAttachment(slotIndex, attachmentName);
 		if (attachment) return attachment;
 		if (attachment) return attachment;
 	}
 	}
-	if (skin) return skin->getAttachment(slotIndex, attachmentName);
 	return 0;
 	return 0;
 }
 }
 
 

+ 1 - 1
spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java

@@ -216,11 +216,11 @@ public class Skeleton {
 	/** @return May be null. */
 	/** @return May be null. */
 	public Attachment getAttachment (int slotIndex, String attachmentName) {
 	public Attachment getAttachment (int slotIndex, String attachmentName) {
 		if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null.");
 		if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null.");
+		if (skin != null) return skin.getAttachment(slotIndex, attachmentName);
 		if (data.defaultSkin != null) {
 		if (data.defaultSkin != null) {
 			Attachment attachment = data.defaultSkin.getAttachment(slotIndex, attachmentName);
 			Attachment attachment = data.defaultSkin.getAttachment(slotIndex, attachmentName);
 			if (attachment != null) return attachment;
 			if (attachment != null) return attachment;
 		}
 		}
-		if (skin != null) return skin.getAttachment(slotIndex, attachmentName);
 		return null;
 		return null;
 	}
 	}