only update attachments if they change

This commit is contained in:
Matias 2013-06-13 14:17:27 +03:00
parent d270c5e8da
commit 776cc3958d

View File

@ -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