Browse Source

only update attachments if they change

Matias 12 năm trước cách đây
mục cha
commit
776cc3958d
1 tập tin đã thay đổi với 10 bổ sung3 xóa
  1. 10 3
      spine-lua/Animation.lua

+ 10 - 3
spine-lua/Animation.lua

@@ -413,9 +413,16 @@ function Animation.AttachmentTimeline.new ()
 		end
 		end
 
 
 		local attachmentName = self.attachmentNames[frameIndex]
 		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
 	end
 
 
 	return self
 	return self