(I'm open for suggestions for a better subject title)
Previously the bone position outside of "fit to curve length" mode was incorrect.
It assumed that the curve was completely straight with no bends or turns.
This would lead to bones being scaled down as their final position would be servery underestimated in some cases.
The solution is to do a sphere -> curve intersection test to see where to put the bones while still preserving their length.
As we are using the tessellated curve data this essentially boils down to us doing a sphere -> line intersection check.
An old undocumented feature is that when the bone rolls off the curve, the constraint influence decreases until it can be full pose able again.
You can see this by applying the pose as rest pose (T77330, T81704).
Here is also an additional example file:
There is currently a patch for this already (D9244), but I felt it was a bit overly complicated and came up with an alternate solution.
I'm guessing that @Sybren A. Stüvel (sybren) wants me to do some additional cleanup in the file as the existing comments and variable names do not follow our code guidelines.
(Camel case, comments not starting with capital letter and ending with a period etc)
However for the initial review, I have not cleaned anything so all changes (except a clang format change at the end of the file) is only relevant to the fix.
TODO:
- Explain the "roll off" feature when bones end up entirely or partially outside of the curve. (Add this explanation to the manual as well.)







