mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-20 00:36:43 +08:00
[lua] Fixed Skin:attachAll, wrong indexing. Fixed MeshAttachment:setParentMesh, didn't set worldVerticesLength
This commit is contained in:
parent
f3e544319d
commit
5c71fcaaf8
@ -63,21 +63,24 @@ function Skin:getAttachment (slotIndex, name)
|
||||
end
|
||||
|
||||
function Skin:attachAll(skeleton, oldSkin)
|
||||
local slotIndex = 0
|
||||
for i, slot in ipairs(skeleton.slots) do
|
||||
local slotAttachment = slot.attachment
|
||||
if slotAttachment and slotIndex <= #oldSkin.attachments then
|
||||
local dictionary = oldSkin.attachments[slotIndex]
|
||||
for key, value in dictionary do
|
||||
local skinAttachment = value
|
||||
if slotAttachment == skinAttachment then
|
||||
local attachment = getAttachment(slotIndex, key)
|
||||
if attachment then slot.attachment = attachment end
|
||||
break
|
||||
if slotAttachment then
|
||||
local dictionary = oldSkin.attachments[i]
|
||||
if (dictionary) then
|
||||
for key, value in pairs(dictionary) do
|
||||
local skinAttachment = value
|
||||
if slotAttachment == skinAttachment then
|
||||
local attachment = self:getAttachment(i, key)
|
||||
if attachment then
|
||||
print("Set attachment " .. attachment.name .. " on slot " .. slot.data.name)
|
||||
slot:setAttachment(attachment)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
slotIndex = slotIndex + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -103,6 +103,7 @@ function MeshAttachment:setParentMesh (parentMesh)
|
||||
if parentMesh then
|
||||
self.bones = parentMesh.bones
|
||||
self.vertices = parentMesh.vertices
|
||||
self.worldVerticesLength = parentMesh.worldVerticesLength
|
||||
self.regionUVs = parentMesh.regionUVs
|
||||
self.triangles = parentMesh.triangles
|
||||
self.hullLength = parentMesh.hullLength
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user