From eb190c4b3e96befcbf2de6e907fa1e33cb63b1c6 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Mon, 29 Apr 2013 14:38:22 +0200 Subject: [PATCH] Fixed attachment changes. --- spine-corona/spine-corona/spine.lua | 6 ++++++ spine-love/spine-love/spine.lua | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/spine-corona/spine-corona/spine.lua b/spine-corona/spine-corona/spine.lua index 427629ec0..de9ad4dfe 100644 --- a/spine-corona/spine-corona/spine.lua +++ b/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 diff --git a/spine-love/spine-love/spine.lua b/spine-love/spine-love/spine.lua index 62adc8e64..53a087f0d 100644 --- a/spine-love/spine-love/spine.lua +++ b/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