Plumiferos bugfix:
authorTon Roosendaal <ton@blender.org>
Sat, 3 Jun 2006 11:49:30 +0000 (11:49 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 3 Jun 2006 11:49:30 +0000 (11:49 +0000)
The new (months ago) added option for "Local Constraint" always copied
and restored a PoseChannel quaternion, that disabled the required
normalizing of quaternions.

Only visible when you manually draw Ipo Curves, but it's probable that
it showed in other cases too.

source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/ipo.c

index f5d8edef1671180518e5ca3a32a15aa447078fbd..c40a7710a08d0bacdec74ff617cdd293b5fbdc44 100644 (file)
@@ -1370,6 +1370,7 @@ void chan_calc_mat(bPoseChannel *chan)
        SizeToMat3(chan->size, smat);
        
        NormalQuat(chan->quat);
+
        QuatToMat3(chan->quat, rmat);
        
        Mat3MulMat3(tmat, rmat, smat);
@@ -1472,7 +1473,8 @@ static void where_is_pose_bone(Object *ob, bPoseChannel *pchan, float ctime)
        Bone *bone, *parbone;
        bPoseChannel *parchan;
        float vec[3], quat[4];
-
+       int did_local= 0;       /* copying quaternion should be limited, chan_calc_mat() normalizes quat */
+       
        /* set up variables for quicker access below */
        bone= pchan->bone;
        parbone= bone->parent;
@@ -1483,14 +1485,18 @@ static void where_is_pose_bone(Object *ob, bPoseChannel *pchan, float ctime)
        if(pchan->constraints.first) {
                bConstraint *con;
                for(con=pchan->constraints.first; con; con= con->next) {
-                       if(con->flag & CONSTRAINT_LOCAL)
+                       if(con->flag & CONSTRAINT_LOCAL) {
                                do_local_constraint(pchan, con);
+                               did_local= 1;
+                       }
                }
        }
        
        /* this gives a chan_mat with actions (ipos) results */
        chan_calc_mat(pchan);
-       QUATCOPY(pchan->quat, quat);    /* local constraint hack. bad! */
+       
+       if(did_local) 
+               QUATCOPY(pchan->quat, quat);    /* local constraint hack. bad! */
        
        /* construct the posemat based on PoseChannels, that we do before applying constraints */
        /* pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */
index fae4777d543c95ed0ef26805ac405cc77ef98dd1..6ea44b4555eb08f36722ceefffe29095cf52fc0d 100644 (file)
@@ -1843,9 +1843,9 @@ void execute_action_ipo(bActionChannel *achan, bPoseChannel *pchan)
                for(icu= achan->ipo->curve.first; icu; icu= icu->next) {
                        void *poin= get_pchan_ipo_poin(pchan, icu->adrcode);
                        if(poin) {
-                         write_ipo_poin(poin, IPO_FLOAT, icu->curval);
-                         //printf("execute_action_ipo wrote_ipo_poin: %f\n", icu->curval);
-                         //printf("%s has poin %p value %f\n", achan->name, poin, icu->curval);
+                               write_ipo_poin(poin, IPO_FLOAT, icu->curval);
+                               //printf("execute_action_ipo wrote_ipo_poin: %f\n", icu->curval);
+                               //printf("%s has poin %p value %f\n", achan->name, poin, icu->curval);
                        }
                }
        }