From 776cc3958d2b6545bb33669260953c175287433e Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 13 Jun 2013 14:17:27 +0300 Subject: [PATCH] only update attachments if they change --- spine-lua/Animation.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spine-lua/Animation.lua b/spine-lua/Animation.lua index 8d5fb15c3..4ba650705 100644 --- a/spine-lua/Animation.lua +++ b/spine-lua/Animation.lua @@ -413,9 +413,16 @@ function Animation.AttachmentTimeline.new () end local attachmentName = self.attachmentNames[frameIndex] - local attachment - if attachmentName then attachment = skeleton:getAttachment(self.slotName, attachmentName) end - skeleton.slotsByName[self.slotName]:setAttachment(attachment) + local slot = skeleton.slotsByName[self.slotName] + if attachmentName then + if not slot.attachment then + slot:setAttachment(skeleton:getAttachment(self.slotName, attachmentName)) + elseif attachmentName and slot.attachment.name ~= attachmentName then + slot:setAttachment(skeleton:getAttachment(self.slotName, attachmentName)) + end + end + + end return self