Minor formatting tweaks (killing some "caterpillar if's"... yuck those things are...
authorJoshua Leung <aligorith@gmail.com>
Fri, 7 May 2010 10:59:48 +0000 (10:59 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 7 May 2010 10:59:48 +0000 (10:59 +0000)
source/blender/editors/object/object_constraint.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c

index c52fd15..039b18e 100644 (file)
@@ -609,6 +609,7 @@ void CONSTRAINT_OT_limitdistance_reset (wmOperatorType *ot)
 }
 
 /* ------------- Child-Of Constraint ------------------ */
+
 /* ChildOf Constraint - set inverse callback */
 static int childof_set_inverse_exec (bContext *C, wmOperator *op)
 {
index 8ff397a..4ae8d5d 100644 (file)
@@ -210,7 +210,8 @@ void projectIntView(TransInfo *t, float *vec, int *adr)
                        //vec[0] = vec[0]/((t->scene->r.frs_sec / t->scene->r.frs_sec_base));
 
                        UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
-               } else {
+               } 
+               else {
                        UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
                }
 
@@ -5308,19 +5309,19 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
                const short doTime= 0; //XXX doesn't work - getAnimEdit_DrawTime(t);
                const double secf= FPS;
                double val;
-
+               
                /* convert frame to nla-action time (if needed) */
                if (adt)
                        val= BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP);
                else
                        val= *(td->val);
-
+               
                /* do the snapping to nearest frame/second */
                if (doTime)
                        val= (float)( floor((val/secf) + 0.5f) * secf );
                else
                        val= (float)( floor(val+0.5f) );
-
+               
                /* convert frame out of nla-action time */
                if (adt)
                        *(td->val)= BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
@@ -5330,28 +5331,31 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
        /* snap key to nearest marker? */
        else if (autosnap == SACTSNAP_MARKER) {
                float val;
-
+               
                /* convert frame to nla-action time (if needed) */
                if (adt)
                        val= BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP);
                else
                        val= *(td->val);
-
+               
                /* snap to nearest marker */
                // TODO: need some more careful checks for where data comes from
                val= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, val);
-
+               
                /* convert frame out of nla-action time */
                if (adt)
                        *(td->val)= BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
                else
                        *(td->val)= val;
        }
-
+       
+       /* if the handles are to be moved too (as side-effect of keyframes moving, to keep the general effect) 
+        * offset them by the same amount so that the general angles are maintained (i.e. won't change while 
+        * handles are free-to-roam and keyframes are snap-locked)
+        */
        if ((td->flag & TD_MOVEHANDLE1) && td2d->h1) {
                td2d->h1[0] = td2d->ih1[0] + *td->val - td->ival;
        }
-
        if ((td->flag & TD_MOVEHANDLE2) && td2d->h2) {
                td2d->h2[0] = td2d->ih2[0] + *td->val - td->ival;
        }
index 3f9b6df..d1b6838 100644 (file)
@@ -3295,12 +3295,16 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt,
        if (td->flag & TD_MOVEHANDLE1) {
                td2d->h1 = bezt->vec[0];
                VECCOPY2D(td2d->ih1, td2d->h1);
-       } else td2d->h1 = NULL;
+       } 
+       else    
+               td2d->h1 = NULL;
 
        if (td->flag & TD_MOVEHANDLE2) {
                td2d->h2 = bezt->vec[2];
                VECCOPY2D(td2d->ih2, td2d->h2);
-       } else td2d->h2 = NULL;
+       } 
+       else 
+               td2d->h2 = NULL;
 
        memset(td->axismtx, 0, sizeof(td->axismtx));
        td->axismtx[2][2] = 1.0f;