Merging r58362 through r58463 from trunk into soc-2013-depsgraph_mt
[blender.git] / source / blender / blenkernel / intern / constraint.c
index 7ead1da02d8ebbef1922367fc81a6dca1189cdde..8926ef0b599ff42d46bf3fc64be1c08f143f5038 100644 (file)
@@ -133,8 +133,8 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda
                                unit_m4(cob->matrix);
                        
                        copy_m4_m4(cob->startmat, cob->matrix);
+                       break;
                }
-               break;
                case CONSTRAINT_OBTYPE_BONE:
                {
                        /* only set if we have valid bone, otherwise default */
@@ -159,9 +159,8 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda
                                unit_m4(cob->matrix);
                                
                        copy_m4_m4(cob->startmat, cob->matrix);
+                       break;
                }
-               break;
-                       
                default: /* other types not yet handled */
                        unit_m4(cob->matrix);
                        unit_m4(cob->startmat);
@@ -196,8 +195,8 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob)
                                /* copy inverse of delta back to owner */
                                invert_m4_m4(cob->ob->constinv, delta);
                        }
+                       break;
                }
-               break;
                case CONSTRAINT_OBTYPE_BONE:
                {
                        /* cob->ob or cob->pchan might not exist */
@@ -208,8 +207,8 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob)
                                /* copy inverse of delta back to owner */
                                invert_m4_m4(cob->pchan->constinv, delta);
                        }
+                       break;
                }
-               break;
        }
        
        /* free tempolary struct */
@@ -247,8 +246,8 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[
                                        /* call self with slightly different values */
                                        BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
                                }
+                               break;
                        }
-                       break;
                        case CONSTRAINT_SPACE_POSE: /* ---------- FROM POSESPACE ---------- */
                        {
                                /* pose to world */
@@ -268,8 +267,8 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[
                                                mul_m4_m4m4(mat, imat, mat);
                                        }
                                }
+                               break;
                        }
-                       break;
                        case CONSTRAINT_SPACE_LOCAL: /* ------------ FROM LOCALSPACE --------- */
                        {
                                /* local to pose - do inverse procedure that was done for pose to local */
@@ -283,8 +282,8 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[
                                        /* call self with slightly different values */
                                        BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
                                }
+                               break;
                        }
-                       break;
                        case CONSTRAINT_SPACE_PARLOCAL: /* -------------- FROM LOCAL WITH PARENT ---------- */
                        {
                                /* local + parent to pose */
@@ -298,8 +297,8 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[
                                        /* call self with slightly different values */
                                        BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
                                }
+                               break;
                        }
-                       break;
                }
        }
        else {
@@ -2234,8 +2233,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                        
                                                /* the z axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_Z: /* LOCK X TRACK Z */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2248,8 +2247,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                        
                                                /* the z axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_nY: /* LOCK X TRACK -Y */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2263,8 +2262,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                        
                                                /* the z axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_nZ: /* LOCK X TRACK -Z */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2278,16 +2277,16 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                                
                                                /* the z axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
+                                               break;
                                        }
-                                       break;
                                        default:
                                        {
                                                unit_m3(totmat);
+                                               break;
                                        }
-                                       break;
                                }
+                               break;
                        }
-                       break;
                        case LOCK_Y: /* LOCK Y */
                        {
                                switch (data->trackflag) {
@@ -2303,8 +2302,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 
                                                /* the z axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_Z: /* LOCK Y TRACK Z */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2317,8 +2316,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                        
                                                /* the z axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_nX: /* LOCK Y TRACK -X */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2332,8 +2331,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                        
                                                /* the z axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_nZ: /* LOCK Y TRACK -Z */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2347,16 +2346,16 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                        
                                                /* the z axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
+                                               break;
                                        }
-                                       break;
                                        default:
                                        {
                                                unit_m3(totmat);
+                                               break;
                                        }
-                                       break;
                                }
+                               break;
                        }
-                       break;
                        case LOCK_Z: /* LOCK Z */
                        {
                                switch (data->trackflag) {
@@ -2372,8 +2371,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                        
                                                /* the x axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_Y: /* LOCK Z TRACK Y */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2386,8 +2385,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                                
                                                /* the x axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_nX: /* LOCK Z TRACK -X */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2401,8 +2400,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                        
                                                /* the x axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
+                                               break;
                                        }
-                                       break;
                                        case TRACK_nY: /* LOCK Z TRACK -Y */
                                        {
                                                /* Projection of Vector on the plane */
@@ -2416,21 +2415,21 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                                
                                                /* the x axis gets mapped onto a third orthogonal vector */
                                                cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
+                                               break;
                                        }
-                                       break;
                                        default:
                                        {
                                                unit_m3(totmat);
+                                               break;
                                        }
-                                       break;
                                }
+                               break;
                        }
-                       break;
                        default:
                        {
                                unit_m3(totmat);
+                               break;
                        }
-                       break;
                }
                /* Block to keep matrix heading */
                copy_m3_m4(tmpmat, cob->matrix);
@@ -2518,7 +2517,7 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
        
        /* only evaluate if there is a target */
        if (VALID_CONS_TARGET(ct)) {
-               float dvec[3], dist = 0.0f, sfac = 1.0f;
+               float dvec[3], dist, sfac = 1.0f;
                short clamp_surf = 0;
                
                /* calculate our current distance from the target */
@@ -4408,8 +4407,8 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch
                                con->ownspace = CONSTRAINT_SPACE_POSE;
                                con->flag |= CONSTRAINT_SPACEONCE;
                        }
+                       break;
                }
-               break;
        }
        
        return con;
@@ -4634,8 +4633,8 @@ void BKE_get_constraint_target_matrix(Scene *scene, bConstraint *con, int index,
                                        unit_m4(cob->matrix);
                                        unit_m4(cob->startmat);
                                }
+                               break;
                        }
-                       break;
                        case CONSTRAINT_OBTYPE_BONE: /* this may occur in some cases */
                        {
                                cob->ob = NULL; /* this might not work at all :/ */
@@ -4648,8 +4647,8 @@ void BKE_get_constraint_target_matrix(Scene *scene, bConstraint *con, int index,
                                        unit_m4(cob->matrix);
                                        unit_m4(cob->startmat);
                                }
+                               break;
                        }
-                       break;
                }
                
                /* get targets - we only need the first one though (and there should only be one) */