- 已编辑
Generic JS runtime scales child bones with parent
Hi there
My company has bought a couple if licenses for your wonderful software, we're creating a series of animations, and everything has been going great so far.
Unfortunately we've run into a major issue after we started animating the scale of some of the bones in our our setup. Even though inherit scale is set to "off", any children of a given bone still scale with that parent bone when we scale it, and it really breaks our animations. I took a look at the json-data, and inheritScale is indeed set to "false" for every single bone in our skeleton. I've verified the issue with the Turbulenz rendering engine and the Pixi.js runtime, so it looks like the problem is in the JS-runtime. The animations looks just fine inside Spine and when we export them as MOVs.
Can it be something in our animation setup? Or is there a bug in the generic runtime?
I guess we could counter-scale the child bones with the same amount to prevent the issue from happening, but that workflow is extremely complicated, and I'd rather not have to do that.
FYI: The counter-scaling trick works, it's just a bad workflow and it makes the animations look broken in the editor.
Can you verify you use the latest spine-js? spine.js line 78 has "if (this.data.inheritScale) {" and similar for rotation on line 85. Actually it looks like a problem with how the JSON is loaded. I committed a fix to github, can you try that?
The updated spine.js didn't seem to fix the problem, and it introduced a new one where the textures aren't applied properly:
Take a look:
http://96.251.72.63/spine/turbulenz_new/
And this is with the previous spine.js:
http://96.251.72.63/spine/turbulenz_old/
On both animations, I'm scaling the chest and the upper legs. You'll notice that all the child bones of those bones scale with them. The reason the head looks right is that I'm applying the counter-scaling technique I described above.
I actually know how to fix the problem now. Since we don't need to use inheritScale at all, I can simply default it to false instead of true.
So my problem is solved, but the repository still has the problem.
Thanks for pointing me in the right direction!
Ah, sorry. Should be fixed in git:
http://esotericsoftware.com/spine/files ... turbulenz/
You have the Boolean flag flipped in lines 1153 & 1154. They should be
boneData.inheritScale = boneMap["inheritScale"] || boneMap["inheritScale"] == "true";
boneData.inheritRotation = boneMap["inheritRotation"] || boneMap["inheritRotation"] == "true";
The way you have it now both properties resolve to true if they're false in the boneMap and vice versa.
I believe it is correct as-is. If the value is not in the JSON, it should evaluate to true. Otherwise the value is coming from JSON, so it will be a string, not a boolean.