When using your photoshop to spine script to export different skins we encounter a draw order problem. The draw order of the elements is not respected at all when importing the json into spine. We notice that the order of the skins slots is the right one in the json but the merge that creates the general list of slots (and so the draw order) does not work at all which gives a big difference as we can see on this example.
In this exemple we have three skins in our psd file in three folder like that:
The skin section of the json represents however well the order of the layers, as we can see it here:
Only the general slots section does not keep the relative draws order of the elements for the merging elements.
We use the same names for the parts of the different skins because our goal is to replace them by linked mesh from the "common" skin in spine.
I think that the new skin elements (which have a different name) are added afterwards instead of being inserted in the right place in relation to the already present attachment of the common skin.
the correct draw order for this example psd project should be:
json
"slots": [
{ "name": "cape_back", "bone": "root", "attachment": "cape_back" },
{ "name": "fly_1", "bone": "root", "attachment": "fly_1" },
{ "name": "fly_2", "bone": "root", "attachment": "fly_2" },
{ "name": "arm_R", "bone": "root", "attachment": "arm_R" },
{ "name": "torso", "bone": "root", "attachment": "torso" },
{ "name": "bowie", "bone": "root", "attachment": "bowie" },
{ "name": "arm_L", "bone": "root", "attachment": "arm_L" },
{ "name": "cape_front4", "bone": "root", "attachment": "cape_front4" },
{ "name": "cape_front3", "bone": "root", "attachment": "cape_front3" },
{ "name": "cape_front2", "bone": "root", "attachment": "cape_front2" },
{ "name": "cape_front1", "bone": "root", "attachment": "cape_front1" },
{ "name": "leg_L", "bone": "root", "attachment": "leg_L" },
{ "name": "leg_R", "bone": "root", "attachment": "leg_R" },
{ "name": "tibiat_L", "bone": "root", "attachment": "tibiat_L" },
{ "name": "tibiat_R", "bone": "root", "attachment": "tibiat_R" },
{ "name": "foot_L", "bone": "root", "attachment": "foot_L" },
{ "name": "foot_R", "bone": "root", "attachment": "foot_R" },
{ "name": "pelvis", "bone": "root", "attachment": "pelvis" },
{ "name": "head", "bone": "root", "attachment": "head" },
{ "name": "hat", "bone": "root", "attachment": "hat" },
],
instead of what is currently coming out of the psd script :
json
"slots": [
// skin common
{ "name": "arm_R", "bone": "root", "attachment": "arm_R" },
{ "name": "torso", "bone": "root", "attachment": "torso" },
{ "name": "arm_L", "bone": "root", "attachment": "arm_L" },
{ "name": "leg_L", "bone": "root", "attachment": "leg_L" },
{ "name": "leg_R", "bone": "root", "attachment": "leg_R" },
{ "name": "tibiat_L", "bone": "root", "attachment": "tibiat_L" },
{ "name": "tibiat_R", "bone": "root", "attachment": "tibiat_R" },
{ "name": "foot_L", "bone": "root", "attachment": "foot_L" },
{ "name": "foot_R", "bone": "root", "attachment": "foot_R" },
{ "name": "pelvis", "bone": "root", "attachment": "pelvis" },
{ "name": "head", "bone": "root", "attachment": "head" },
// skin blue
{ "name": "fly_1", "bone": "root", "attachment": "fly_1" },
{ "name": "fly_2", "bone": "root", "attachment": "fly_2" },
{ "name": "bowie", "bone": "root", "attachment": "bowie" },
// skin dark
{ "name": "cape_back", "bone": "root", "attachment": "cape_back" },
{ "name": "cape_front1", "bone": "root", "attachment": "cape_front1" },
{ "name": "cape_front2", "bone": "root", "attachment": "cape_front2" },
{ "name": "cape_front3", "bone": "root", "attachment": "cape_front3" },
{ "name": "cape_front4", "bone": "root", "attachment": "cape_front4" },
{ "name": "hat", "bone": "root", "attachment": "hat" }
],
Here the psd file used: https://drive.google.com/file/d/1vE5eTOlkkiFXaPZMdW3z3RezVc6CIuSo/view?usp=sharing
Is it possible to fix this draw order problem when exporting photoshop to spine?
Thanks in advance.