Ok, so here is a patch addressing the issues mentioned above (I choose the second solution, but rather using the first one is trivial change): http://projects.blender.org/tracker/download.php/9/498/29461/18881/bt29461_armature_pchan_pose_mode.patch
Basically, I factorized into a new function (pchan_to_pose_mat) the compute of two matrices, one to compute rot/scale of pchan in parent space, the other to do the same for location. That two matrices differ when either HINGE/NO_SCALE/NO_LOCAL_LOCATION options are enabled. Then, I can use those two matrices in the pose solver (where_is_pose_bone) and armature_mat_pose_to_bone (used by snap to cursor/to grid). We probably lose a bit of performances, but imho the gain in readability is more than worth it! It could probably be used by the transform code too (in add_pose_transdata) – but I’ve just had enough of matrices for now. ;) Also, that new code most likely can be optimized a bit by power-matrix-users, and need a general cleanup/proofread/testing, but I did test it in quite some various situations, and it always worked for me so far. Cheers, Bastien Le 30/12/2011 12:10, Bastien Montagne a écrit : > Hi devs! > > I have spent quite some hours this week on those two bugs: > http://projects.blender.org/tracker/index.php?func=detail&aid=27898 and > http://projects.blender.org/tracker/?func=detail&aid=29461 > > While searching and reading code about pose transforms (I don’t like > matrices, and they don’t like me :/ ), I think I found some > problems/incoherences in the way the Hinge/NoScale options are handled > *for the position of the bone*. See also this small demo file > (http://www.pasteall.org/blend/10564), with one child, unconnected bone, > pose-translated, and a parent bone pose-scaled by a factor two. > > When you disable only Inherit Rotation, the bone moves back half of its > Pose translation. This is because its position is evaluated fully in its > parent rest space (instead of using parent rest rotation and parent pose > scale). > > When you disable only Inherit Scale, the bone does not move. This is > because its position is evaluated into its parent pose space (instead of > using parent pose rotation and parent rest scale). > > So, imho, we should fix those incoherences… But how ? Do we always want > to use the parent pose space for the child position (thus never moving > the child bone when disabling/enabling the Inherit Rotation/Scale > options) ? Or do we want to fully respect the logic, and make the > pose-location of the child bone depend on the hinge/no scale options > (i.e. use parent rest scale and/or rotation) ? > > Cheers, > Bastien > _______________________________________________ > Bf-committers mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-committers _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
