Revision: 42490
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42490
Author:   mont29
Date:     2011-12-07 15:21:38 +0000 (Wed, 07 Dec 2011)
Log Message:
-----------
Fix [#29461] Selection-to-Cursor works strange with bones with TrackTo 
constraint.

In fact, the problem was present with any kind of constraint?\226?\128?\166

We need the cursor coordinates in the rest bone space (aka armature space), i.e 
with all "manual" and "procedural" (constraints, ...) pose transforms cleared 
(as said in armature_mat_pose_to_bone:

        /* Remove the pchan's transforms from it's pose_mat.
         * This should leave behind the effects of restpose + 
         * parenting + constraints
         */

, only "manual" transforms are "cleared" by armature_loc_pose_to_bone...).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_snap.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_snap.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_snap.c     
2011-12-07 14:54:03 UTC (rev 42489)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_snap.c     
2011-12-07 15:21:38 UTC (rev 42490)
@@ -641,16 +641,19 @@
                                                if(pchan->bone->layer & 
arm->layer) {
                                                        if((pchan->bone->flag & 
BONE_CONNECTED)==0) { 
                                                                float curspn[3];
+                                                               float 
inv_restmat[4][4];
                                                                
-                                                               /* get location 
of cursor in bone-space */
-                                                               
armature_loc_pose_to_bone(pchan, cursp, curspn);
+                                                               /* get location 
of cursor in *rest* bone-space */
+                                                               
copy_v3_v3(curspn, cursp);
+                                                               
invert_m4_m4(inv_restmat, pchan->bone->arm_mat);
+                                                               
mul_m4_v3(inv_restmat, curspn);
                                                                
                                                                /* copy new 
position */
-                                                               if 
((pchan->protectflag & OB_LOCK_LOCX)==0)     
+                                                               if 
((pchan->protectflag & OB_LOCK_LOCX)==0)
                                                                        
pchan->loc[0]= curspn[0];
-                                                               if 
((pchan->protectflag & OB_LOCK_LOCY)==0)     
+                                                               if 
((pchan->protectflag & OB_LOCK_LOCY)==0)
                                                                        
pchan->loc[1]= curspn[1];
-                                                               if 
((pchan->protectflag & OB_LOCK_LOCZ)==0)     
+                                                               if 
((pchan->protectflag & OB_LOCK_LOCZ)==0)
                                                                        
pchan->loc[2]= curspn[2];
 
                                                                /* 
auto-keyframing */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to