Nate wroteDid you remember to copy /spine-lua/*
into /spine-love/spine-lua/
?
Again, what is attachmentName
for the left leg SlotData? What happens in Slot setToSetupPose
?
Yes, I have both libs correctly setup on my project. I thought that was the case, tried to move the folder and the game didn't even booted. My current structure is:
Project/
spine-lua/
spine-love/
main.lua
I "modified" setToSetupPose
to print the attachmentName and index as follows:
function Slot:setToSetupPose ()
[...]
print(data.index..' '..data.attachmentName)
if data.attachmentName then
attachment = self.bone.skeleton:getAttachmentByIndex(data.index, data.attachmentName)
end
[...]
end
and everything seems to be ok:
1 left_arm
2 left_hand
3 left_thigh
4 left_foot
5 left_leg
6 right_foot
7 right_thigh
8 right_leg
9 abdomen
10 chest
11 head
12 right_arm
13 sword
14 right_hand
This was the same result every time setToSetupPose
was called (every time the animation changed).
Investigating further, I also modified setAttachment
to print the attachment name
function Slot:setAttachment (attachment)
print('set '..attachment.name)
if self.attachment == attachment then return end
[...]
end
Here is my output
calling state:setAnimationByName [run]
< called state:setAnimationByName [run]
calling skeleton:setToSetupPose
set left_arm
set left_hand
set left_thigh
set left_foot
set left_leg
set right_foot
set right_thigh
set right_leg
set abdomen
set chest
set head
set right_arm
set sword
set right_hand
<< exiting skeleton:setToSetupPose
/* This is the expected behaviour. Changing attachment while running, so both legs look identical */
calling state:apply
set right_foot
set right_leg
<<< called state:apply
calling state:apply
set right_foot
set right_leg
<<< called state:apply
calling state:apply
set right_foot
set right_leg
[...]
/* Stopped running */
calling state:setAnimationByName [idle]
< called state:setAnimationByName [idle]
calling skeleton:setToSetupPose
set left_arm
set left_hand
set left_thigh
set left_foot
set left_leg
set right_foot
set right_thigh
set right_leg
set abdomen
set chest
set head
set right_arm
set sword
set right_hand
<< exiting skeleton:setToSetupPose
/* Buggy behaviour */
calling state:apply
set right_foot
set right_leg
<<< called state:apply