The goal: Have a photoshop-exported skin import directly onto an existing skeleton with matching bone and slot names.
Problem: Photoshop export script calculates offset and rotation of each piece in relation to the root bone, but Spine expects these offsets to be relative to their parent bones.
Proposed solution: A JSON import option that ignores the offset and rotation values of bones, slots, and attachments already existing on the skeleton. Then, mapping the new skin attachments to bones and slots of matching names.
Here's how I'm doing this manually:
1) In Spine, move all slots to the root bone. Spine recalculates attachment offset and rotation automatically relative to the root bone in the process. This matches the data exported from Photoshop, where everything is relative to root.
2) Export project as JSON.
3) Export art from Photoshop as JSON.
4) Copy new skin data from Photoshop JSON to project JSON.
5) Import project JSON as new project.
6) Move all slots back to their bone assignments. Spine recalculates attachment offset and rotation automatically relative to the parent bone in the process.
Result: New skin works with existing skeleton and animation is preserved. All previously existing skins also work. Works with both white-space stripped and non-stripped images.
Here's a simplified example of what photoshop exports:
"bones": [
{ "name": "root" },
{ "name": "8_r_forearm", "parent": "6_r_arm", "length": 108.25, "rotation": 175.24, "x": 266.93, "y": -0.81 }
],
"slots": [
{ "name": "8_r_forearm", "bone": "root", "attachment": "8_r_forearm" }
],
"skins": {
"default": {
"8_r_forearm": {
"8_r_forearm": { "x": -57, "y": 124, "width": 108, "height": 116 }
}
},
"base_detective": {
"8_r_forearm": {
"8_r_forearm": { "name": "base_detective/8_r_forearm", "x": -57, "y": 128, "width": 116, "height": 128 }
}
}
}
In comparison to what Spine exports:
"bones": [
{ "name": "root" },
{ "name": "8_r_forearm", "parent": "6_r_arm", "length": 108.25, "rotation": 175.24, "x": 266.93, "y": -0.81 }
],
"slots": [
{ "name": "8_r_forearm", "bone": "8_r_forearm", "attachment": "8_r_forearm" }
],
"skins": {
"default": {
"8_r_forearm": {
"8_r_forearm": { "x": 58.38, "y": 2.67, "rotation": -46.55, "width": 108, "height": 116 }
}
},
"base_detective": {
"8_r_forearm": {
"8_r_forearm": { "name": "base_detective/8_r_forearm", "x": 61.28, "y": 5.42, "rotation": -46.55, "width": 116, "height": 128 }
}
}
}
Also, holy cow, thank you for reading through that and weighing the option.