소스 검색

Fixed attachment changes.

NathanSweet 12 년 전
부모
커밋
eb190c4b3e
2개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      spine-corona/spine-corona/spine.lua
  2. 6 0
      spine-love/spine-love/spine.lua

+ 6 - 0
spine-corona/spine-corona/spine.lua

@@ -84,10 +84,16 @@ function spine.Skeleton.new (skeletonData, group)
 					images[slot] = nil
 				end
 			else
+				-- Attachment image has changed.
+				if image and image.attachment ~= attachment then
+					image:removeSelf()
+					image = nil
+				end
 				-- Create new image.
 				if not image then
 					image = self:createImage(attachment)
 					if image then
+						image.attachment = attachment
 						image:setReferencePoint(display.CenterReferencePoint)
 						image.width = attachment.width
 						image.height = attachment.height

+ 6 - 0
spine-love/spine-love/spine.lua

@@ -74,10 +74,16 @@ function spine.Skeleton.new (skeletonData, group)
 					images[attachment] = nil
 				end
 			else
+				-- Attachment image has changed.
+				if image and image.attachment ~= attachment then
+					image:removeSelf()
+					image = nil
+				end
 				-- Create new image.
 				if not image then
 					image = self:createImage(attachment)
 					if image then
+						image.attachment = attachment
 						local imageWidth = image:getWidth()
 						local imageHeight = image:getHeight()
 						attachment.widthRatio = attachment.width / imageWidth