Style cleanup of own modules using style checker from Campbell.
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 7 May 2012 08:53:59 +0000 (08:53 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 7 May 2012 08:53:59 +0000 (08:53 +0000)
16 files changed:
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/tracking.c
source/blender/editors/space_clip/clip_buttons.c
source/blender/editors/space_clip/clip_dopesheet_draw.c
source/blender/editors/space_clip/clip_dopesheet_ops.c
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/clip_graph_draw.c
source/blender/editors/space_clip/clip_graph_ops.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/clip_toolbar.c
source/blender/editors/space_clip/clip_utils.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_clip/tracking_ops.c

index 45dbf96fd60fcba1208c3b8578ba5d53098c072e..43cc63aefa6f0f337b52887306bee59ede94c737 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <math.h>  // floor
 #include <string.h>
-#include <stdlib.h>  
+#include <stdlib.h>
 
 #include "MEM_guardedalloc.h"
 
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 
-#include "DNA_curve_types.h"  
-#include "DNA_material_types.h"  
+#include "DNA_curve_types.h"
+#include "DNA_material_types.h"
 
 /* for dereferencing pointers */
-#include "DNA_key_types.h"  
-#include "DNA_scene_types.h"  
-#include "DNA_vfont_types.h"  
+#include "DNA_key_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_vfont_types.h"
 #include "DNA_object_types.h"
 
 #include "BKE_animsys.h"
-#include "BKE_anim.h"  
-#include "BKE_curve.h"  
-#include "BKE_displist.h"  
-#include "BKE_font.h" 
-#include "BKE_global.h" 
-#include "BKE_key.h"  
-#include "BKE_library.h"  
-#include "BKE_main.h"  
+#include "BKE_anim.h"
+#include "BKE_curve.h"
+#include "BKE_displist.h"
+#include "BKE_font.h"
+#include "BKE_global.h"
+#include "BKE_key.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
 #include "BKE_object.h"
 #include "BKE_material.h"
 
@@ -73,24 +73,29 @@ static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], c
 void BKE_curve_unlink(Curve *cu)
 {
        int a;
-       
+
        for (a = 0; a < cu->totcol; a++) {
                if (cu->mat[a]) cu->mat[a]->id.us--;
                cu->mat[a] = NULL;
        }
-       if (cu->vfont) cu->vfont->id.us--; 
+       if (cu->vfont)
+               cu->vfont->id.us--;
        cu->vfont = NULL;
 
-       if (cu->vfontb) cu->vfontb->id.us--; 
+       if (cu->vfontb)
+               cu->vfontb->id.us--;
        cu->vfontb = NULL;
 
-       if (cu->vfonti) cu->vfonti->id.us--; 
+       if (cu->vfonti)
+               cu->vfonti->id.us--;
        cu->vfonti = NULL;
 
-       if (cu->vfontbi) cu->vfontbi->id.us--; 
+       if (cu->vfontbi)
+               cu->vfontbi->id.us--;
        cu->vfontbi = NULL;
-       
-       if (cu->key) cu->key->id.us--;
+
+       if (cu->key)
+               cu->key->id.us--;
        cu->key = NULL;
 }
 
@@ -99,14 +104,20 @@ void BKE_curve_editfont_free(Curve *cu)
 {
        if (cu->editfont) {
                EditFont *ef = cu->editfont;
-               
-               if (ef->oldstr) MEM_freeN(ef->oldstr);
-               if (ef->oldstrinfo) MEM_freeN(ef->oldstrinfo);
-               if (ef->textbuf) MEM_freeN(ef->textbuf);
-               if (ef->textbufinfo) MEM_freeN(ef->textbufinfo);
-               if (ef->copybuf) MEM_freeN(ef->copybuf);
-               if (ef->copybufinfo) MEM_freeN(ef->copybufinfo);
-               
+
+               if (ef->oldstr)
+                       MEM_freeN(ef->oldstr);
+               if (ef->oldstrinfo)
+                       MEM_freeN(ef->oldstrinfo);
+               if (ef->textbuf)
+                       MEM_freeN(ef->textbuf);
+               if (ef->textbufinfo)
+                       MEM_freeN(ef->textbufinfo);
+               if (ef->copybuf)
+                       MEM_freeN(ef->copybuf);
+               if (ef->copybufinfo)
+                       MEM_freeN(ef->copybufinfo);
+
                MEM_freeN(ef);
                cu->editfont = NULL;
        }
@@ -142,13 +153,19 @@ void BKE_curve_free(Curve *cu)
        BKE_curve_editNurb_free(cu);
        BKE_curve_unlink(cu);
        BKE_free_animdata((ID *)cu);
-       
-       if (cu->mat) MEM_freeN(cu->mat);
-       if (cu->str) MEM_freeN(cu->str);
-       if (cu->strinfo) MEM_freeN(cu->strinfo);
-       if (cu->bb) MEM_freeN(cu->bb);
-       if (cu->path) free_path(cu->path);
-       if (cu->tb) MEM_freeN(cu->tb);
+
+       if (cu->mat)
+               MEM_freeN(cu->mat);
+       if (cu->str)
+               MEM_freeN(cu->str);
+       if (cu->strinfo)
+               MEM_freeN(cu->strinfo);
+       if (cu->bb)
+               MEM_freeN(cu->bb);
+       if (cu->path)
+               free_path(cu->path);
+       if (cu->tb)
+               MEM_freeN(cu->tb);
 }
 
 Curve *BKE_curve_add(const char *name, int type)
@@ -164,10 +181,11 @@ Curve *BKE_curve_add(const char *name, int type)
        cu->wordspace = 1.0;
        cu->spacing = cu->linedist = 1.0;
        cu->fsize = 1.0;
-       cu->ulheight = 0.05;    
+       cu->ulheight = 0.05;
        cu->texflag = CU_AUTOSPACE;
        cu->smallcaps_scale = 0.75f;
-       cu->twist_mode = CU_TWIST_MINIMUM;   // XXX: this one seems to be the best one in most cases, at least for curve deform...
+       /* XXX: this one seems to be the best one in most cases, at least for curve deform... */
+       cu->twist_mode = CU_TWIST_MINIMUM;
        cu->type = type;
        cu->bevfac1 = 0.0f;
        cu->bevfac2 = 1.0f;
@@ -185,7 +203,7 @@ Curve *BKE_curve_add(const char *name, int type)
                cu->tb = MEM_callocN(MAXTEXTBOX * sizeof(TextBox), "textbox");
                cu->tb[0].w = cu->tb[0].h = 0.0;
        }
-       
+
        return cu;
 }
 
@@ -193,7 +211,7 @@ Curve *BKE_curve_copy(Curve *cu)
 {
        Curve *cun;
        int a;
-       
+
        cun = BKE_libblock_copy(&cu->id);
        cun->nurb.first = cun->nurb.last = NULL;
        BKE_nurbList_duplicate(&(cun->nurb), &(cu->nurb));
@@ -202,7 +220,7 @@ Curve *BKE_curve_copy(Curve *cu)
        for (a = 0; a < cun->totcol; a++) {
                id_us_plus((ID *)cun->mat[a]);
        }
-       
+
        cun->str = MEM_dupallocN(cu->str);
        cun->strinfo = MEM_dupallocN(cu->strinfo);
        cun->tb = MEM_dupallocN(cu->tb);
@@ -225,20 +243,20 @@ Curve *BKE_curve_copy(Curve *cu)
 #endif // XXX old animation system
 
        id_us_plus((ID *)cun->vfont);
-       id_us_plus((ID *)cun->vfontb);  
+       id_us_plus((ID *)cun->vfontb);
        id_us_plus((ID *)cun->vfonti);
        id_us_plus((ID *)cun->vfontbi);
-       
+
        return cun;
 }
 
 static void extern_local_curve(Curve *cu)
-{      
+{
        id_lib_extern((ID *)cu->vfont);
-       id_lib_extern((ID *)cu->vfontb);        
+       id_lib_extern((ID *)cu->vfontb);
        id_lib_extern((ID *)cu->vfonti);
        id_lib_extern((ID *)cu->vfontbi);
-       
+
        if (cu->mat) {
                extern_local_matarar(cu->mat, cu->totcol);
        }
@@ -249,13 +267,14 @@ void BKE_curve_make_local(Curve *cu)
        Main *bmain = G.main;
        Object *ob;
        int is_local = FALSE, is_lib = FALSE;
-       
+
        /* - when there are only lib users: don't do
         * - when there are only local users: set flag
         * - mixed: do a copy
         */
-       
-       if (cu->id.lib == NULL) return;
+
+       if (cu->id.lib == NULL)
+               return;
 
        if (cu->id.us == 1) {
                id_clear_lib_data(bmain, &cu->id);
@@ -360,15 +379,15 @@ void BKE_curve_texspace_calc(Curve *cu)
        BoundBox *bb;
        float *fp, min[3], max[3];
        int tot, doit = 0;
-       
-       if (cu->bb == NULL) cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
+
+       if (cu->bb == NULL)
+               cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
        bb = cu->bb;
-       
+
        INIT_MINMAX(min, max);
 
        dl = cu->disp.first;
        while (dl) {
-               
                tot = ELEM(dl->type, DL_INDEX3, DL_INDEX4) ? dl->nr : dl->nr * dl->parts;
 
                if (tot) doit = 1;
@@ -414,12 +433,14 @@ int BKE_nurbList_verts_count(ListBase *nurb)
 {
        Nurb *nu;
        int tot = 0;
-       
+
        nu = nurb->first;
        while (nu) {
-               if (nu->bezt) tot += 3 * nu->pntsu;
-               else if (nu->bp) tot += nu->pntsu * nu->pntsv;
-               
+               if (nu->bezt)
+                       tot += 3 * nu->pntsu;
+               else if (nu->bp)
+                       tot += nu->pntsu * nu->pntsv;
+
                nu = nu->next;
        }
        return tot;
@@ -429,12 +450,14 @@ int BKE_nurbList_verts_count_without_handles(ListBase *nurb)
 {
        Nurb *nu;
        int tot = 0;
-       
+
        nu = nurb->first;
        while (nu) {
-               if (nu->bezt) tot += nu->pntsu;
-               else if (nu->bp) tot += nu->pntsu * nu->pntsv;
-               
+               if (nu->bezt)
+                       tot += nu->pntsu;
+               else if (nu->bp)
+                       tot += nu->pntsu * nu->pntsv;
+
                nu = nu->next;
        }
        return tot;
@@ -447,13 +470,17 @@ void BKE_nurb_free(Nurb *nu)
 
        if (nu == NULL) return;
 
-       if (nu->bezt) MEM_freeN(nu->bezt);
+       if (nu->bezt)
+               MEM_freeN(nu->bezt);
        nu->bezt = NULL;
-       if (nu->bp) MEM_freeN(nu->bp);
+       if (nu->bp)
+               MEM_freeN(nu->bp);
        nu->bp = NULL;
-       if (nu->knotsu) MEM_freeN(nu->knotsu);
+       if (nu->knotsu)
+               MEM_freeN(nu->knotsu);
        nu->knotsu = NULL;
-       if (nu->knotsv) MEM_freeN(nu->knotsv);
+       if (nu->knotsv)
+               MEM_freeN(nu->knotsv);
        nu->knotsv = NULL;
        /* if (nu->trim.first) freeNurblist(&(nu->trim)); */
 
@@ -496,9 +523,9 @@ Nurb *BKE_nurb_duplicate(Nurb *nu)
                newnu->bp =
                    (BPoint *)MEM_mallocN((len) * sizeof(BPoint), "duplicateNurb3");
                memcpy(newnu->bp, nu->bp, len * sizeof(BPoint));
-               
+
                newnu->knotsu = newnu->knotsv = NULL;
-               
+
                if (nu->knotsu) {
                        len = KNOTSU(nu);
                        if (len) {
@@ -520,14 +547,14 @@ Nurb *BKE_nurb_duplicate(Nurb *nu)
 void BKE_nurbList_duplicate(ListBase *lb1, ListBase *lb2)
 {
        Nurb *nu, *nun;
-       
+
        BKE_nurbList_free(lb1);
-       
+
        nu = lb2->first;
        while (nu) {
                nun = BKE_nurb_duplicate(nu);
                BLI_addtail(lb1, nun);
-               
+
                nu = nu->next;
        }
 }
@@ -537,7 +564,7 @@ void BKE_nurb_test2D(Nurb *nu)
        BezTriple *bezt;
        BPoint *bp;
        int a;
-       
+
        if ((nu->flag & CU_2D) == 0)
                return;
 
@@ -643,7 +670,8 @@ static void calcknots(float *knots, const short pnts, const short order, const s
                        k = 0.0;
                        for (a = 1; a <= pnts_order; a++) {
                                knots[a - 1] = k;
-                               if (a >= order && a <= pnts) k += 1.0f;
+                               if (a >= order && a <= pnts)
+                                       k += 1.0f;
                        }
                        break;
                case CU_NURB_BEZIER:
@@ -659,7 +687,8 @@ static void calcknots(float *knots, const short pnts, const short order, const s
                        else if (order == 3) {
                                k = 0.6f;
                                for (a = 0; a < pnts_order; a++) {
-                                       if (a >= order && a <= pnts) k += 0.5f;
+                                       if (a >= order && a <= pnts)
+                                               k += 0.5f;
                                        knots[a] = floorf(k);
                                }
                        }
@@ -680,7 +709,8 @@ static void makecyclicknots(float *knots, short pnts, short order)
 {
        int a, b, order2, c;
 
-       if (knots == NULL) return;
+       if (knots == NULL)
+               return;
 
        order2 = order - 1;
 
@@ -688,9 +718,11 @@ static void makecyclicknots(float *knots, short pnts, short order)
        if (order > 2) {
                b = pnts + order2;
                for (a = 1; a < order2; a++) {
-                       if (knots[b] != knots[b - a]) break;
+                       if (knots[b] != knots[b - a])
+                               break;
                }
-               if (a == order2) knots[pnts + order - 2] += 1.0f;
+               if (a == order2)
+                       knots[pnts + order - 2] += 1.0f;
        }
 
        b = order;
@@ -707,7 +739,8 @@ static void makeknots(Nurb *nu, short uv)
 {
        if (nu->type == CU_NURBS) {
                if (uv == 1) {
-                       if (nu->knotsu) MEM_freeN(nu->knotsu);
+                       if (nu->knotsu)
+                               MEM_freeN(nu->knotsu);
                        if (BKE_nurb_check_valid_u(nu)) {
                                nu->knotsu = MEM_callocN(4 + sizeof(float) * KNOTSU(nu), "makeknots");
                                if (nu->flagu & CU_NURB_CYCLIC) {
@@ -718,11 +751,12 @@ static void makeknots(Nurb *nu, short uv)
                                        calcknots(nu->knotsu, nu->pntsu, nu->orderu, nu->flagu);
                                }
                        }
-                       else nu->knotsu = NULL;
-               
+                       else
+                               nu->knotsu = NULL;
                }
                else if (uv == 2) {
-                       if (nu->knotsv) MEM_freeN(nu->knotsv);
+                       if (nu->knotsv)
+                               MEM_freeN(nu->knotsv);
                        if (BKE_nurb_check_valid_v(nu)) {
                                nu->knotsv = MEM_callocN(4 + sizeof(float) * KNOTSV(nu), "makeknots");
                                if (nu->flagv & CU_NURB_CYCLIC) {
@@ -757,8 +791,10 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
        opp2 = orderpluspnts - 1;
 
        /* this is for float inaccuracy */
-       if (t < knots[0]) t = knots[0];
-       else if (t > knots[opp2]) t = knots[opp2];
+       if (t < knots[0])
+               t = knots[0];
+       else
+               if (t > knots[opp2]) t = knots[opp2];
 
        /* this part is order '1' */
        o2 = order + 1;
@@ -775,10 +811,11 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
                        }
                        break;
                }
-               else basis[i] = 0.0;
+               else
+                       basis[i] = 0.0;
        }
        basis[i] = 0.0;
-       
+
        /* this is order 2, 3, ... */
        for (j = 2; j <= order; j++) {
 
@@ -819,22 +856,25 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
        float u, v, ustart, uend, ustep, vstart, vend, vstep, sumdiv;
        int i, j, iofs, jofs, cycl, len, curu, curv;
        int istart, iend, jsta, jen, *jstart, *jend, ratcomp;
-       
+
        int totu = nu->pntsu * resolu, totv = nu->pntsv * resolv;
-       
-       if (nu->knotsu == NULL || nu->knotsv == NULL) return;
-       if (nu->orderu > nu->pntsu) return;
-       if (nu->orderv > nu->pntsv) return;
-       if (coord_array == NULL) return;
-       
+
+       if (nu->knotsu == NULL || nu->knotsv == NULL)
+               return;
+       if (nu->orderu > nu->pntsu)
+               return;
+       if (nu->orderv > nu->pntsv)
+               return;
+       if (coord_array == NULL)
+               return;
+
        /* allocate and initialize */
        len = totu * totv;
-       if (len == 0) return;
-       
+       if (len == 0)
+               return;
 
-       
        sum = (float *)MEM_callocN(sizeof(float) * len, "makeNurbfaces1");
-       
+
        len = totu * totv;
        if (len == 0) {
                MEM_freeN(sum);
@@ -851,11 +891,13 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
                }
                bp++;
        }
-       
+
        fp = nu->knotsu;
        ustart = fp[nu->orderu - 1];
-       if (nu->flagu & CU_NURB_CYCLIC) uend = fp[nu->pntsu + nu->orderu - 1];
-       else uend = fp[nu->pntsu];
+       if (nu->flagu & CU_NURB_CYCLIC)
+               uend = fp[nu->pntsu + nu->orderu - 1];
+       else
+               uend = fp[nu->pntsu];
        ustep = (uend - ustart) / ((nu->flagu & CU_NURB_CYCLIC) ? totu : totu - 1);
 
        basisu = (float *)MEM_mallocN(sizeof(float) * KNOTSU(nu), "makeNurbfaces3");
@@ -863,8 +905,10 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
        fp = nu->knotsv;
        vstart = fp[nu->orderv - 1];
 
-       if (nu->flagv & CU_NURB_CYCLIC) vend = fp[nu->pntsv + nu->orderv - 1];
-       else vend = fp[nu->pntsv];
+       if (nu->flagv & CU_NURB_CYCLIC)
+               vend = fp[nu->pntsv + nu->orderv - 1];
+       else
+               vend = fp[nu->pntsv];
        vstep = (vend - vstart) / ((nu->flagv & CU_NURB_CYCLIC) ? totv : totv - 1);
 
        len = KNOTSV(nu);
@@ -873,7 +917,8 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
        jend = (int *)MEM_mallocN(sizeof(float) * totv, "makeNurbfaces5");
 
        /* precalculation of basisv and jstart, jend */
-       if (nu->flagv & CU_NURB_CYCLIC) cycl = nu->orderv - 1;
+       if (nu->flagv & CU_NURB_CYCLIC)
+               cycl = nu->orderv - 1;
        else cycl = 0;
        v = vstart;
        basis = basisv;
@@ -884,19 +929,19 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
                v += vstep;
        }
 
-       if (nu->flagu & CU_NURB_CYCLIC) cycl = nu->orderu - 1;
-       else cycl = 0;
+       if (nu->flagu & CU_NURB_CYCLIC)
+               cycl = nu->orderu - 1;
+       else
+               cycl = 0;
        in = coord_array;
        u = ustart;
        curu = totu;
        while (curu--) {
-
                basisNurb(u, nu->orderu, (short)(nu->pntsu + cycl), nu->knotsu, basisu, &istart, &iend);
 
                basis = basisv;
                curv = totv;
                while (curv--) {
-
                        jsta = jstart[curv];
                        jen = jend[curv];
 
@@ -906,26 +951,29 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
 
                        for (j = jsta; j <= jen; j++) {
 
-                               if (j >= nu->pntsv) jofs = (j - nu->pntsv);
-                               else jofs = j;
+                               if (j >= nu->pntsv)
+                                       jofs = (j - nu->pntsv);
+                               else
+                                       jofs = j;
                                bp = nu->bp + nu->pntsu * jofs + istart - 1;
 
                                for (i = istart; i <= iend; i++, fp++) {
-
                                        if (i >= nu->pntsu) {
                                                iofs = i - nu->pntsu;
                                                bp = nu->bp + nu->pntsu * jofs + iofs;
                                        }
-                                       else bp++;
+                                       else
+                                               bp++;
 
                                        if (ratcomp) {
                                                *fp = basisu[i] * basis[j] * bp->vec[3];
                                                sumdiv += *fp;
                                        }
-                                       else *fp = basisu[i] * basis[j];
+                                       else
+                                               *fp = basisu[i] * basis[j];
                                }
                        }
-               
+
                        if (ratcomp) {
                                fp = sum;
                                for (j = jsta; j <= jen; j++) {
@@ -939,17 +987,19 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
                        fp = sum;
                        for (j = jsta; j <= jen; j++) {
 
-                               if (j >= nu->pntsv) jofs = (j - nu->pntsv);
-                               else jofs = j;
+                               if (j >= nu->pntsv)
+                                       jofs = (j - nu->pntsv);
+                               else
+                                       jofs = j;
                                bp = nu->bp + nu->pntsu * jofs + istart - 1;
 
                                for (i = istart; i <= iend; i++, fp++) {
-
                                        if (i >= nu->pntsu) {
                                                iofs = i - nu->pntsu;
                                                bp = nu->bp + nu->pntsu * jofs + iofs;
                                        }
-                                       else bp++;
+                                       else
+                                               bp++;
 
                                        if (*fp != 0.0f) {
                                                in[0] += (*fp) * bp->vec[0];
@@ -963,7 +1013,8 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
                        basis += KNOTSV(nu);
                }
                u += ustep;
-               if (rowstride != 0) in = (float *) (((unsigned char *) in) + (rowstride - 3 * totv * sizeof(*in)));
+               if (rowstride != 0)
+                       in = (float *) (((unsigned char *) in) + (rowstride - 3 * totv * sizeof(*in)));
        }
 
        /* free */
@@ -974,7 +1025,8 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
        MEM_freeN(jend);
 }
 
-void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride)
+void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array,
+                        int resolu, int stride)
 /* coord_array has to be 3*4*pntsu*resolu in size and zero-ed
  * tilt_array and radius_array will be written to if valid */
 {
@@ -984,17 +1036,21 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *
        float *coord_fp = coord_array, *tilt_fp = tilt_array, *radius_fp = radius_array, *weight_fp = weight_array;
        int i, len, istart, iend, cycl;
 
-       if (nu->knotsu == NULL) return;
-       if (nu->orderu > nu->pntsu) return;
-       if (coord_array == NULL) return;
+       if (nu->knotsu == NULL)
+               return;
+       if (nu->orderu > nu->pntsu)
+               return;
+       if (coord_array == NULL)
+               return;
 
        /* allocate and initialize */
        len = nu->pntsu;
-       if (len == 0) return;
+       if (len == 0)
+               return;
        sum = (float *)MEM_callocN(sizeof(float) * len, "makeNurbcurve1");
-       
+
        resolu = (resolu * SEGMENTSU(nu));
-       
+
        if (resolu == 0) {
                MEM_freeN(sum);
                return;
@@ -1002,27 +1058,32 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *
 
        fp = nu->knotsu;
        ustart = fp[nu->orderu - 1];
-       if (nu->flagu & CU_NURB_CYCLIC) uend = fp[nu->pntsu + nu->orderu - 1];
-       else uend = fp[nu->pntsu];
+       if (nu->flagu & CU_NURB_CYCLIC)
+               uend = fp[nu->pntsu + nu->orderu - 1];
+       else
+               uend = fp[nu->pntsu];
        ustep = (uend - ustart) / (resolu - ((nu->flagu & CU_NURB_CYCLIC) ? 0 : 1));
-       
+
        basisu = (float *)MEM_mallocN(sizeof(float) * KNOTSU(nu), "makeNurbcurve3");
 
-       if (nu->flagu & CU_NURB_CYCLIC) cycl = nu->orderu - 1;
-       else cycl = 0;
+       if (nu->flagu & CU_NURB_CYCLIC)
+               cycl = nu->orderu - 1;
+       else
+               cycl = 0;
 
        u = ustart;
        while (resolu--) {
-
                basisNurb(u, nu->orderu, (short)(nu->pntsu + cycl), nu->knotsu, basisu, &istart, &iend);
+
                /* calc sum */
                sumdiv = 0.0;
                fp = sum;
                bp = nu->bp + istart - 1;
                for (i = istart; i <= iend; i++, fp++) {
-
-                       if (i >= nu->pntsu) bp = nu->bp + (i - nu->pntsu);
-                       else bp++;
+                       if (i >= nu->pntsu)
+                               bp = nu->bp + (i - nu->pntsu);
+                       else
+                               bp++;
 
                        *fp = basisu[i] * bp->vec[3];
                        sumdiv += *fp;
@@ -1039,34 +1100,36 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *
                fp = sum;
                bp = nu->bp + istart - 1;
                for (i = istart; i <= iend; i++, fp++) {
-
-                       if (i >= nu->pntsu) bp = nu->bp + (i - nu->pntsu);
-                       else bp++;
+                       if (i >= nu->pntsu)
+                               bp = nu->bp + (i - nu->pntsu);
+                       else
+                               bp++;
 
                        if (*fp != 0.0f) {
-                               
                                coord_fp[0] += (*fp) * bp->vec[0];
                                coord_fp[1] += (*fp) * bp->vec[1];
                                coord_fp[2] += (*fp) * bp->vec[2];
-                               
+
                                if (tilt_fp)
                                        (*tilt_fp) += (*fp) * bp->alfa;
-                               
+
                                if (radius_fp)
                                        (*radius_fp) += (*fp) * bp->radius;
 
                                if (weight_fp)
                                        (*weight_fp) += (*fp) * bp->weight;
-                               
                        }
                }
 
                coord_fp = (float *)(((char *)coord_fp) + stride);
-               
-               if (tilt_fp) tilt_fp = (float *)(((char *)tilt_fp) + stride);
-               if (radius_fp) radius_fp = (float *)(((char *)radius_fp) + stride);
-               if (weight_fp) weight_fp = (float *)(((char *)weight_fp) + stride);
-               
+
+               if (tilt_fp)
+                       tilt_fp = (float *)(((char *)tilt_fp) + stride);
+               if (radius_fp)
+                       radius_fp = (float *)(((char *)radius_fp) + stride);
+               if (weight_fp)
+                       weight_fp = (float *)(((char *)weight_fp) + stride);
+
                u += ustep;
        }
 
@@ -1134,7 +1197,7 @@ float *BKE_curve_surf_make_orco(Object *ob)
        int sizeu, sizev;
        int resolu, resolv;
        float *fp, *coord_array;
-       
+
        /* first calculate the size of the datablock */
        nu = cu->nurb.first;
        while (nu) {
@@ -1149,18 +1212,18 @@ float *BKE_curve_surf_make_orco(Object *ob)
 
                resolu = cu->resolu_ren ? cu->resolu_ren : nu->resolu;
                resolv = cu->resolv_ren ? cu->resolv_ren : nu->resolv;
-               
+
                sizeu = nu->pntsu * resolu;
                sizev = nu->pntsv * resolv;
                if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
                if (nu->flagv & CU_NURB_CYCLIC) sizev++;
                if (nu->pntsv > 1) tot += sizeu * sizev;
-               
+
                nu = nu->next;
        }
        /* makeNurbfaces wants zeros */
        fp = coord_array = MEM_callocN(3 * sizeof(float) * tot, "make_orco");
-       
+
        nu = cu->nurb.first;
        while (nu) {
                resolu = cu->resolu_ren ? cu->resolu_ren : nu->resolu;
@@ -1169,31 +1232,39 @@ float *BKE_curve_surf_make_orco(Object *ob)
                if (nu->pntsv > 1) {
                        sizeu = nu->pntsu * resolu;
                        sizev = nu->pntsv * resolv;
-                       if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
-                       if (nu->flagv & CU_NURB_CYCLIC) sizev++;
-                       
+
+                       if (nu->flagu & CU_NURB_CYCLIC)
+                               sizeu++;
+                       if (nu->flagv & CU_NURB_CYCLIC)
+                               sizev++;
+
                        if (cu->flag & CU_UV_ORCO) {
                                for (b = 0; b < sizeu; b++) {
                                        for (a = 0; a < sizev; a++) {
-                                               
-                                               if (sizev < 2) fp[0] = 0.0f;
-                                               else fp[0] = -1.0f + 2.0f * ((float)a) / (sizev - 1);
-                                               
-                                               if (sizeu < 2) fp[1] = 0.0f;
-                                               else fp[1] = -1.0f + 2.0f * ((float)b) / (sizeu - 1);
-                                               
+
+                                               if (sizev < 2)
+                                                       fp[0] = 0.0f;
+                                               else
+                                                       fp[0] = -1.0f + 2.0f * ((float)a) / (sizev - 1);
+
+                                               if (sizeu < 2)
+                                                       fp[1] = 0.0f;
+                                               else
+                                                       fp[1] = -1.0f + 2.0f * ((float)b) / (sizeu - 1);
+
                                                fp[2] = 0.0;
-                                               
+
                                                fp += 3;
                                        }
                                }
                        }
                        else {
-                               float *_tdata = MEM_callocN((nu->pntsu * resolu) * (nu->pntsv * resolv) * 3 * sizeof(float), "temp data");
+                               int size = (nu->pntsu * resolu) * (nu->pntsv * resolv) * 3 * sizeof(float);
+                               float *_tdata = MEM_callocN(size, "temp data");
                                float *tdata = _tdata;
-                               
+
                                BKE_nurb_makeFaces(nu, tdata, 0, resolu, resolv);
-                               
+
                                for (b = 0; b < sizeu; b++) {
                                        int use_b = b;
                                        if (b == sizeu - 1 && (nu->flagu & CU_NURB_CYCLIC))
@@ -1212,13 +1283,13 @@ float *BKE_curve_surf_make_orco(Object *ob)
                                                fp += 3;
                                        }
                                }
-                               
+
                                MEM_freeN(_tdata);
                        }
                }
                nu = nu->next;
        }
-       
+
        return coord_array;
 }
 
@@ -1242,7 +1313,9 @@ float *BKE_curve_make_orco(Scene *scene, Object *ob)
                        numVerts += dl->nr;
                }
                else if (dl->type == DL_SURF) {
-                       /* convertblender.c uses the Surface code for creating renderfaces when cyclic U only (closed circle beveling) */
+                       /* convertblender.c uses the Surface code for creating renderfaces when cyclic U only
+                        * (closed circle beveling)
+                        */
                        if (dl->flag & DL_CYCL_U) {
                                if (dl->flag & DL_CYCL_V)
                                        numVerts += (dl->parts + 1) * (dl->nr + 1);
@@ -1274,14 +1347,14 @@ float *BKE_curve_make_orco(Scene *scene, Object *ob)
                }
                else if (dl->type == DL_SURF) {
                        int sizeu = dl->nr, sizev = dl->parts;
-                       
+
                        /* exception as handled in convertblender.c too */
                        if (dl->flag & DL_CYCL_U) {
                                sizeu++;
                                if (dl->flag & DL_CYCL_V)
                                        sizev++;
                        }
-                       
+
                        for (u = 0; u < sizev; u++) {
                                for (v = 0; v < sizeu; v++, fp += 3) {
                                        if (cu->flag & CU_UV_ORCO) {
@@ -1293,7 +1366,7 @@ float *BKE_curve_make_orco(Scene *scene, Object *ob)
                                                float *vert;
                                                int realv = v % dl->nr;
                                                int realu = u % dl->parts;
-                                               
+
                                                vert = dl->verts + 3 * (dl->nr * realu + realv);
                                                copy_v3_v3(fp, vert);
 
@@ -1328,7 +1401,8 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
 // XXX if ( ob == obedit && ob->type == OB_FONT ) return;
 
        if (cu->bevobj) {
-               if (cu->bevobj->type != OB_CURVE) return;
+               if (cu->bevobj->type != OB_CURVE)
+                       return;
 
                bevcu = cu->bevobj->data;
                if (bevcu->ext1 == 0.0f && bevcu->ext2 == 0.0f) {
@@ -1355,7 +1429,8 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
                                        dlnew->verts = MEM_mallocN(3 * sizeof(float) * dl->parts * dl->nr, "makebevelcurve1");
                                        memcpy(dlnew->verts, dl->verts, 3 * sizeof(float) * dl->parts * dl->nr);
 
-                                       if (dlnew->type == DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE | DL_BACK_CURVE);
+                                       if (dlnew->type == DL_SEGM)
+                                               dlnew->flag |= (DL_FRONT_CURVE | DL_BACK_CURVE);
 
                                        BLI_addtail(disp, dlnew);
                                        fp = dlnew->verts;
@@ -1392,9 +1467,8 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
                fp[5] = cu->ext1;
        }
        else if ( (cu->flag & (CU_FRONT | CU_BACK)) == 0 && cu->ext1 == 0.0f) { // we make a full round bevel in that case
-               
                nr = 4 + 2 * cu->bevresol;
-                  
+
                dl = MEM_callocN(sizeof(DispList), "makebevelcurve p1");
                dl->verts = MEM_mallocN(nr * 3 * sizeof(float), "makebevelcurve p1");
                BLI_addtail(disp, dl);
@@ -1418,7 +1492,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
        }
        else {
                short dnr;
-               
+
                /* bevel now in three parts, for proper vertex normals */
                /* part 1, back */
 
@@ -1448,11 +1522,11 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
                                fp += 3;
                        }
                }
-               
+
                /* part 2, sidefaces */
                if (cu->ext1 != 0.0f) {
                        nr = 2;
-                       
+
                        dl = MEM_callocN(sizeof(DispList), "makebevelcurve p2");
                        dl->verts = MEM_callocN(nr * 3 * sizeof(float), "makebevelcurve p2");
                        BLI_addtail(disp, dl);
@@ -1470,7 +1544,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
                                dl = MEM_dupallocN(dl);
                                dl->verts = MEM_dupallocN(dl->verts);
                                BLI_addtail(disp, dl);
-                               
+
                                fp = dl->verts;
                                fp[1] = -fp[1];
                                fp[2] = -fp[2];
@@ -1478,7 +1552,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
                                fp[5] = -fp[5];
                        }
                }
-               
+
                /* part 3, front */
                if ((cu->flag & CU_FRONT) || !(cu->flag & CU_BACK)) {
                        dnr = nr = 2 + cu->bevresol;
@@ -1522,7 +1596,8 @@ static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], c
        float deler;
 
        deler = (v1[cox] - v2[cox]) * (v3[coy] - v4[coy]) - (v3[cox] - v4[cox]) * (v1[coy] - v2[coy]);
-       if (deler == 0.0f) return -1;
+       if (deler == 0.0f)
+               return -1;
 
        *labda = (v1[coy] - v3[coy]) * (v3[cox] - v4[cox]) - (v1[cox] - v3[cox]) * (v3[coy] - v4[coy]);
        *labda = -(*labda / deler);
@@ -1539,7 +1614,8 @@ static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], c
        vec[coy] = *labda * (v2[coy] - v1[coy]) + v1[coy];
 
        if (*labda >= 0.0f && *labda <= 1.0f && *mu >= 0.0f && *mu <= 1.0f) {
-               if (*labda == 0.0f || *labda == 1.0f || *mu == 0.0f || *mu == 1.0f) return 1;
+               if (*labda == 0.0f || *labda == 1.0f || *mu == 0.0f || *mu == 1.0f)
+                       return 1;
                return 2;
        }
        return 0;
@@ -1593,8 +1669,9 @@ static short bevelinside(BevList *bl1, BevList *bl2)
                prevbevp = bevp;
                bevp++;
        }
-       
-       if ( (links & 1) && (rechts & 1) ) return 1;
+
+       if ( (links & 1) && (rechts & 1) )
+               return 1;
        return 0;
 }
 
@@ -1609,8 +1686,10 @@ static int vergxcobev(const void *a1, const void *a2)
 {
        const struct bevelsort *x1 = a1, *x2 = a2;
 
-       if (x1->left > x2->left) return 1;
-       else if (x1->left < x2->left) return -1;
+       if (x1->left > x2->left)
+               return 1;
+       else if (x1->left < x2->left)
+               return -1;
        return 0;
 }
 
@@ -1622,8 +1701,10 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
 
        t01 = (float)sqrt(x1 * x1 + y1 * y1);
        t02 = (float)sqrt(x2 * x2 + y2 * y2);
-       if (t01 == 0.0f) t01 = 1.0f;
-       if (t02 == 0.0f) t02 = 1.0f;
+       if (t01 == 0.0f)
+               t01 = 1.0f;
+       if (t02 == 0.0f)
+               t02 = 1.0f;
 
        x1 /= t01;
        y1 /= t01;
@@ -1631,11 +1712,14 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
        y2 /= t02;
 
        t02 = x1 * x2 + y1 * y2;
-       if (fabs(t02) >= 1.0) t02 = .5 * M_PI;
-       else t02 = (saacos(t02)) / 2.0f;
+       if (fabs(t02) >= 1.0)
+               t02 = .5 * M_PI;
+       else
+               t02 = (saacos(t02)) / 2.0f;
 
        t02 = (float)sin(t02);
-       if (t02 == 0.0f) t02 = 1.0f;
+       if (t02 == 0.0f)
+               t02 = 1.0f;
 
        x3 = x1 - x2;
        y3 = y1 - y2;
@@ -1654,69 +1738,80 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
 
 }
 
-static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride)
+static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *tilt_array, float *radius_array,
+                         float *weight_array, int resolu, int stride)
 {
        BezTriple *pprev, *next, *last;
        float fac, dfac, t[4];
        int a;
-       
+
        if (tilt_array == NULL && radius_array == NULL)
                return;
-       
+
        last = nu->bezt + (nu->pntsu - 1);
-       
+
        /* returns a point */
        if (prevbezt == nu->bezt) {
-               if (nu->flagu & CU_NURB_CYCLIC) pprev = last;
-               else pprev = prevbezt;
+               if (nu->flagu & CU_NURB_CYCLIC)
+                       pprev = last;
+               else
+                       pprev = prevbezt;
        }
-       else pprev = prevbezt - 1;
-       
+       else
+               pprev = prevbezt - 1;
+
        /* next point */
        if (bezt == last) {
-               if (nu->flagu & CU_NURB_CYCLIC) next = nu->bezt;
-               else next = bezt;
+               if (nu->flagu & CU_NURB_CYCLIC)
+                       next = nu->bezt;
+               else
+                       next = bezt;
        }
-       else next = bezt + 1;
-       
+       else
+               next = bezt + 1;
+
        fac = 0.0;
        dfac = 1.0f / (float)resolu;
-       
+
        for (a = 0; a < resolu; a++, fac += dfac) {
                if (tilt_array) {
                        if (nu->tilt_interp == KEY_CU_EASE) { /* May as well support for tilt also 2.47 ease interp */
-                               *tilt_array = prevbezt->alfa + (bezt->alfa - prevbezt->alfa) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
+                               *tilt_array = prevbezt->alfa +
+                                       (bezt->alfa - prevbezt->alfa) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
                        }
                        else {
                                key_curve_position_weights(fac, t, nu->tilt_interp);
                                *tilt_array = t[0] * pprev->alfa + t[1] * prevbezt->alfa + t[2] * bezt->alfa + t[3] * next->alfa;
                        }
-                       
-                       tilt_array = (float *)(((char *)tilt_array) + stride); 
+
+                       tilt_array = (float *)(((char *)tilt_array) + stride);
                }
-               
+
                if (radius_array) {
                        if (nu->radius_interp == KEY_CU_EASE) {
                                /* Support 2.47 ease interp
                                 * Note! - this only takes the 2 points into account,
                                 * giving much more localized results to changes in radius, sometimes you want that */
-                               *radius_array = prevbezt->radius + (bezt->radius - prevbezt->radius) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
+                               *radius_array = prevbezt->radius +
+                                       (bezt->radius - prevbezt->radius) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
                        }
                        else {
-                               
+
                                /* reuse interpolation from tilt if we can */
                                if (tilt_array == NULL || nu->tilt_interp != nu->radius_interp) {
                                        key_curve_position_weights(fac, t, nu->radius_interp);
                                }
-                               *radius_array = t[0] * pprev->radius + t[1] * prevbezt->radius + t[2] * bezt->radius + t[3] * next->radius;
+                               *radius_array = t[0] * pprev->radius + t[1] * prevbezt->radius +
+                                       t[2] * bezt->radius + t[3] * next->radius;
                        }
-                       
-                       radius_array = (float *)(((char *)radius_array) + stride); 
+
+                       radius_array = (float *)(((char *)radius_array) + stride);
                }
 
                if (weight_array) {
                        /* basic interpolation for now, could copy tilt interp too  */
-                       *weight_array = prevbezt->weight + (bezt->weight - prevbezt->weight) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
+                       *weight_array = prevbezt->weight +
+                               (bezt->weight - prevbezt->weight) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
 
                        weight_array = (float *)(((char *)weight_array) + stride);
                }
@@ -1744,6 +1839,7 @@ static void bevel_list_cyclic_fix_3D(BevList *bl)
        copy_v3_v3(bevp->dir, bevp1->dir);
        copy_v3_v3(bevp->tan, bevp1->tan);
 }
+
 /* utility for make_bevel_list_3D_* funcs */
 static void bevel_list_calc_bisect(BevList *bl)
 {
@@ -1814,7 +1910,6 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
        int a;
 
        for (a = 0; a < smooth_iter; a++) {
-
                bevp2 = (BevPoint *)(bl + 1);
                bevp1 = bevp2 + (bl->nr - 1);
                bevp0 = bevp1 - 1;
@@ -1832,7 +1927,6 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
                        bevp1 = bevp2;
                        bevp2++;
                        nr--;
-
                }
 
                copy_qt_qt(bevp0_quat, bevp0->quat);
@@ -1853,7 +1947,6 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
                        interp_qt_qtqt(bevp1->quat, bevp1->quat, q, 0.5);
                        normalize_qt(bevp1->quat);
 
-
                        /* bevp0= bevp1; */ /* UNUSED */
                        bevp1 = bevp2;
                        bevp2++;
@@ -2003,7 +2096,6 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 
        nr = bl->nr;
        while (nr--) {
-
                cross_v3_v3v3(cross_tmp, bevp1->tan, bevp1->dir);
                cross_v3_v3v3(bevp1->tan, cross_tmp, bevp1->dir);
                normalize_v3(bevp1->tan);
@@ -2023,7 +2115,6 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 
        nr = bl->nr;
        while (nr--) {
-
                /* make perpendicular, modify tan in place, is ok */
                float cross_tmp[3];
                float zero[3] = {0, 0, 0};
@@ -2060,8 +2151,6 @@ static void make_bevel_list_3D(BevList *bl, int smooth_iter, int twist_mode)
        bevel_list_apply_tilt(bl);
 }
 
-
-
 /* only for 2 points */
 static void make_bevel_list_segment_3D(BevList *bl)
 {
@@ -2083,8 +2172,6 @@ static void make_bevel_list_segment_3D(BevList *bl)
        copy_qt_qt(bevp2->quat, bevp1->quat);
 }
 
-
-
 void BKE_curve_bevelList_make(Object *ob)
 {
        /*
@@ -2103,13 +2190,13 @@ void BKE_curve_bevelList_make(Object *ob)
        struct bevelsort *sortdata, *sd, *sd1;
        int a, b, nr, poly, resolu = 0, len = 0;
        int do_tilt, do_radius, do_weight;
-       
+
        /* this function needs an object, because of tflag and upflag */
        cu = ob->data;
 
        /* do we need to calculate the radius for each point? */
        /* do_radius = (cu->bevobj || cu->taperobj || (cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) ? 0 : 1; */
-       
+
        /* STEP 1: MAKE POLYS  */
 
        BLI_freelistN(&(cu->bev));
@@ -2120,14 +2207,13 @@ void BKE_curve_bevelList_make(Object *ob)
        else {
                nu = cu->nurb.first;
        }
-       
+
        while (nu) {
-               
                /* check if we will calculate tilt data */
                do_tilt = CU_DO_TILT(cu, nu);
                do_radius = CU_DO_RADIUS(cu, nu); /* normal display uses the radius, better just to calculate them */
                do_weight = 1;
-               
+
                /* check we are a single point? also check we are not a surface and that the orderu is sane,
                 * enforced in the UI but can go wrong possibly */
                if (!BKE_nurb_check_valid_u(nu)) {
@@ -2140,19 +2226,19 @@ void BKE_curve_bevelList_make(Object *ob)
                                resolu = cu->resolu_ren;
                        else
                                resolu = nu->resolu;
-                       
+
                        if (nu->type == CU_POLY) {
                                len = nu->pntsu;
                                bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelList2");
                                BLI_addtail(&(cu->bev), bl);
-       
+
                                if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
                                else bl->poly = -1;
                                bl->nr = len;
                                bl->dupe_nr = 0;
                                bevp = (BevPoint *)(bl + 1);
                                bp = nu->bp;
-       
+
                                while (len--) {
                                        copy_v3_v3(bevp->vec, bp->vec);
                                        bevp->alfa = bp->alfa;
@@ -2164,15 +2250,15 @@ void BKE_curve_bevelList_make(Object *ob)
                                }
                        }
                        else if (nu->type == CU_BEZIER) {
-       
-                               len = resolu * (nu->pntsu + (nu->flagu & CU_NURB_CYCLIC) - 1) + 1; /* in case last point is not cyclic */
+                               /* in case last point is not cyclic */
+                               len = resolu * (nu->pntsu + (nu->flagu & CU_NURB_CYCLIC) - 1) + 1;
                                bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelBPoints");
                                BLI_addtail(&(cu->bev), bl);
-       
+
                                if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
                                else bl->poly = -1;
                                bevp = (BevPoint *)(bl + 1);
-       
+
                                a = nu->pntsu - 1;
                                bezt = nu->bezt;
                                if (nu->flagu & CU_NURB_CYCLIC) {
@@ -2183,7 +2269,7 @@ void BKE_curve_bevelList_make(Object *ob)
                                        prevbezt = bezt;
                                        bezt++;
                                }
-                               
+
                                while (a--) {
                                        if (prevbezt->h2 == HD_VECT && bezt->h1 == HD_VECT) {
 
@@ -2200,14 +2286,14 @@ void BKE_curve_bevelList_make(Object *ob)
                                        else {
                                                /* always do all three, to prevent data hanging around */
                                                int j;
-                                               
+
                                                /* BevPoint must stay aligned to 4 so sizeof(BevPoint)/sizeof(float) works */
                                                for (j = 0; j < 3; j++) {
                                                        BKE_curve_forward_diff_bezier(prevbezt->vec[1][j],  prevbezt->vec[2][j],
                                                                                      bezt->vec[0][j],      bezt->vec[1][j],
                                                                                      &(bevp->vec[j]), resolu, sizeof(BevPoint));
                                                }
-                                               
+
                                                /* if both arrays are NULL do nothiong */
                                                alfa_bezpart(prevbezt, bezt, nu,
                                                             do_tilt    ? &bevp->alfa : NULL,
@@ -2215,7 +2301,7 @@ void BKE_curve_bevelList_make(Object *ob)
                                                             do_weight  ? &bevp->weight : NULL,
                                                             resolu, sizeof(BevPoint));
 
-                                               
+
                                                if (cu->twist_mode == CU_TWIST_TANGENT) {
                                                        forward_diff_bezier_cotangent(prevbezt->vec[1], prevbezt->vec[2],
                                                                                      bezt->vec[0],     bezt->vec[1],
@@ -2224,11 +2310,14 @@ void BKE_curve_bevelList_make(Object *ob)
 
                                                /* indicate with handlecodes double points */
                                                if (prevbezt->h1 == prevbezt->h2) {
-                                                       if (prevbezt->h1 == 0 || prevbezt->h1 == HD_VECT) bevp->split_tag = TRUE;
+                                                       if (prevbezt->h1 == 0 || prevbezt->h1 == HD_VECT)
+                                                               bevp->split_tag = TRUE;
                                                }
                                                else {
-                                                       if (prevbezt->h1 == 0 || prevbezt->h1 == HD_VECT) bevp->split_tag = TRUE;
-                                                       else if (prevbezt->h2 == 0 || prevbezt->h2 == HD_VECT) bevp->split_tag = TRUE;
+                                                       if (prevbezt->h1 == 0 || prevbezt->h1 == HD_VECT)
+                                                               bevp->split_tag = TRUE;
+                                                       else if (prevbezt->h2 == 0 || prevbezt->h2 == HD_VECT)
+                                                               bevp->split_tag = TRUE;
                                                }
                                                bl->nr += resolu;
                                                bevp += resolu;
@@ -2236,7 +2325,7 @@ void BKE_curve_bevelList_make(Object *ob)
                                        prevbezt = bezt;
                                        bezt++;
                                }
-                               
+
                                if ((nu->flagu & CU_NURB_CYCLIC) == 0) {      /* not cyclic: endpoint */
                                        copy_v3_v3(bevp->vec, prevbezt->vec[1]);
                                        bevp->alfa = prevbezt->alfa;
@@ -2248,7 +2337,7 @@ void BKE_curve_bevelList_make(Object *ob)
                        else if (nu->type == CU_NURBS) {
                                if (nu->pntsv == 1) {
                                        len = (resolu * SEGMENTSU(nu));
-                                       
+
                                        bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelList3");
                                        BLI_addtail(&(cu->bev), bl);
                                        bl->nr = len;
@@ -2256,7 +2345,7 @@ void BKE_curve_bevelList_make(Object *ob)
                                        if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
                                        else bl->poly = -1;
                                        bevp = (BevPoint *)(bl + 1);
-                                       
+
                                        BKE_nurb_makeCurve(nu, &bevp->vec[0],
                                                           do_tilt      ? &bevp->alfa : NULL,
                                                           do_radius    ? &bevp->radius : NULL,
@@ -2329,7 +2418,6 @@ void BKE_curve_bevelList_make(Object *ob)
                }
                bl = bl->next;
        }
-       
 
        /* find extreme left points, also test (turning) direction */
        if (poly > 0) {
@@ -2352,16 +2440,23 @@ void BKE_curve_bevelList_make(Object *ob)
                                sd->left = min;
 
                                bevp = (BevPoint *)(bl + 1);
-                               if (bevp1 == bevp) bevp0 = bevp + (bl->nr - 1);
-                               else bevp0 = bevp1 - 1;
+                               if (bevp1 == bevp)
+                                       bevp0 = bevp + (bl->nr - 1);
+                               else
+                                       bevp0 = bevp1 - 1;
                                bevp = bevp + (bl->nr - 1);
-                               if (bevp1 == bevp) bevp2 = (BevPoint *)(bl + 1);
-                               else bevp2 = bevp1 + 1;
+                               if (bevp1 == bevp)
+                                       bevp2 = (BevPoint *)(bl + 1);
+                               else
+                                       bevp2 = bevp1 + 1;
 
-                               inp = (bevp1->vec[0] - bevp0->vec[0]) * (bevp0->vec[1] - bevp2->vec[1]) + (bevp0->vec[1] - bevp1->vec[1]) * (bevp0->vec[0] - bevp2->vec[0]);
+                               inp = (bevp1->vec[0] - bevp0->vec[0]) * (bevp0->vec[1] - bevp2->vec[1]) +
+                                               (bevp0->vec[1] - bevp1->vec[1]) * (bevp0->vec[0] - bevp2->vec[0]);
 
-                               if (inp > 0.0f) sd->dir = 1;
-                               else sd->dir = 0;
+                               if (inp > 0.0f)
+                                       sd->dir = 1;
+                               else
+                                       sd->dir = 0;
 
                                sd++;
                        }
@@ -2555,18 +2650,20 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
 
                if (len != 0.0f) {
                        int leftviolate = 0, rightviolate = 0;  /* for mode==2 */
-                       
-                       if (len_a > 5.0f * len_b) len_a = 5.0f * len_b;
-                       if (len_b > 5.0f * len_a) len_b = 5.0f * len_a;
-                       
+
+                       if (len_a > 5.0f * len_b)
+                               len_a = 5.0f * len_b;
+                       if (len_b > 5.0f * len_a)
+                               len_b = 5.0f * len_a;
+
                        if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) {
                                len_a /= len;
                                madd_v3_v3v3fl(p2 - 3, p2, tvec, -len_a);
-                               
+
                                if ((bezt->h1 == HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
                                        float ydiff1 = prev->vec[1][1] - bezt->vec[1][1];
                                        float ydiff2 = next->vec[1][1] - bezt->vec[1][1];
-                                       if ( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
+                                       if ((ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f)) {
                                                bezt->vec[0][1] = bezt->vec[1][1];
                                        }
                                        else { /* handles should not be beyond y coord of two others */
@@ -2588,7 +2685,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
                        if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {
                                len_b /= len;
                                madd_v3_v3v3fl(p2 + 3, p2, tvec,  len_b);
-                               
+
                                if ((bezt->h2 == HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
                                        float ydiff1 = prev->vec[1][1] - bezt->vec[1][1];
                                        float ydiff2 = next->vec[1][1] - bezt->vec[1][1];
@@ -2614,7 +2711,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
                        if (leftviolate || rightviolate) { /* align left handle */
                                float h1[3], h2[3];
                                float dot;
-                               
+
                                sub_v3_v3v3(h1, p2 - 3, p2);
                                sub_v3_v3v3(h2, p2, p2 + 3);
 
@@ -2632,7 +2729,6 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
                                        add_v3_v3v3(p2 - 3, p2, h2);
                                }
                        }
-                       
                }
        }
 
@@ -2652,8 +2748,10 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
 
        len_b = len_v3v3(p2, p2 + 3);
        len_a = len_v3v3(p2, p2 - 3);
-       if (len_a == 0.0f) len_a = 1.0f;
-       if (len_b == 0.0f) len_b = 1.0f;
+       if (len_a == 0.0f)
+               len_a = 1.0f;
+       if (len_b == 0.0f)
+               len_b = 1.0f;
 
        if (bezt->f1 & SELECT) { /* order of calculation */
                if (bezt->h2 == HD_ALIGN) { /* aligned */
@@ -2698,9 +2796,11 @@ static void calchandlesNurb_intern(Nurb *nu, int skip_align)
        BezTriple *bezt, *prev, *next;
        short a;
 
-       if (nu->type != CU_BEZIER) return;
-       if (nu->pntsu < 2) return;
-       
+       if (nu->type != CU_BEZIER)
+               return;
+       if (nu->pntsu < 2)
+               return;
+
        a = nu->pntsu;
        bezt = nu->bezt;
        if (nu->flagu & CU_NURB_CYCLIC) prev = bezt + (a - 1);
@@ -2711,10 +2811,13 @@ static void calchandlesNurb_intern(Nurb *nu, int skip_align)
                calchandleNurb_intern(bezt, prev, next, 0, skip_align);
                prev = bezt;
                if (a == 1) {
-                       if (nu->flagu & CU_NURB_CYCLIC) next = nu->bezt;
-                       else next = NULL;
+                       if (nu->flagu & CU_NURB_CYCLIC)
+                               next = nu->bezt;
+                       else
+                               next = NULL;
                }
-               else next++;
+               else
+                       next++;
 
                bezt++;
        }
@@ -2749,10 +2852,13 @@ void BKE_nurb_handles_test(Nurb *nu)
        a = nu->pntsu;
        while (a--) {
                flag = 0;
-               if (bezt->f1 & SELECT) flag++;
-               if (bezt->f2 & SELECT) flag += 2;
-               if (bezt->f3 & SELECT) flag += 4;
-               
+               if (bezt->f1 & SELECT)
+                       flag++;
+               if (bezt->f2 & SELECT)
+                       flag += 2;
+               if (bezt->f3 & SELECT)
+                       flag += 4;
+
                if (!(flag == 0 || flag == 7) ) {
                        if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) {   /* auto */
                                bezt->h1 = HD_ALIGN;
@@ -2760,7 +2866,7 @@ void BKE_nurb_handles_test(Nurb *nu)
                        if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {   /* auto */
                                bezt->h2 = HD_ALIGN;
                        }
-                       
+
                        if (bezt->h1 == HD_VECT) {   /* vector */
                                if (flag < 4) bezt->h1 = 0;
                        }
@@ -2770,28 +2876,28 @@ void BKE_nurb_handles_test(Nurb *nu)
                }
                bezt++;
        }
-       
+
        BKE_nurb_handles_calc(nu);
 }
 
 void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
 {
        /* checks handle coordinates and calculates type */
-       
+
        BezTriple *bezt2, *bezt1, *bezt0;
        int i, align, leftsmall, rightsmall;
 
-       if (nu == NULL || nu->bezt == NULL) return;
-       
+       if (nu == NULL || nu->bezt == NULL)
+               return;
+
        bezt2 = nu->bezt;
        bezt1 = bezt2 + (nu->pntsu - 1);
        bezt0 = bezt1 - 1;
        i = nu->pntsu;
 
        while (i--) {
-               
                align = leftsmall = rightsmall = 0;
-               
+
                /* left handle: */
                if (flag == 0 || (bezt1->f1 & flag) ) {
                        bezt1->h1 = 0;
@@ -2809,7 +2915,6 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
                                /* or vector handle? */
                                if (dist_to_line_v2(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001f)
                                        bezt1->h1 = HD_VECT;
-                               
                        }
                }
                /* right handle: */
@@ -2827,16 +2932,19 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
                                /* or vector handle? */
                                if (dist_to_line_v2(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001f)
                                        bezt1->h2 = HD_VECT;
-                               
                        }
                }
-               if (leftsmall && bezt1->h2 == HD_ALIGN) bezt1->h2 = 0;
-               if (rightsmall && bezt1->h1 == HD_ALIGN) bezt1->h1 = 0;
-               
+               if (leftsmall && bezt1->h2 == HD_ALIGN)
+                       bezt1->h2 = 0;
+               if (rightsmall && bezt1->h1 == HD_ALIGN)
+                       bezt1->h1 = 0;
+
                /* undesired combination: */
-               if (bezt1->h1 == HD_ALIGN && bezt1->h2 == HD_VECT) bezt1->h1 = 0;
-               if (bezt1->h2 == HD_ALIGN && bezt1->h1 == HD_VECT) bezt1->h2 = 0;
-               
+               if (bezt1->h1 == HD_ALIGN && bezt1->h2 == HD_VECT)
+                       bezt1->h1 = 0;
+               if (bezt1->h2 == HD_ALIGN && bezt1->h1 == HD_VECT)
+                       bezt1->h2 = 0;
+
                bezt0 = bezt1;
                bezt1 = bezt2;
                bezt2++;
@@ -2848,7 +2956,7 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
 void BKE_nurbList_handles_autocalc(ListBase *editnurb, int flag)
 {
        Nurb *nu;
-       
+
        nu = editnurb->first;
        while (nu) {
                BKE_nurb_handles_autocalc(nu, flag);
@@ -2876,11 +2984,15 @@ void BKE_nurbList_handles_set(ListBase *editnurb, short code)
                                a = nu->pntsu;
                                while (a--) {
                                        if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
-                                               if (bezt->f1 & SELECT) bezt->h1 = code;
-                                               if (bezt->f3 & SELECT) bezt->h2 = code;
+                                               if (bezt->f1 & SELECT)
+                                                       bezt->h1 = code;
+                                               if (bezt->f3 & SELECT)
+                                                       bezt->h2 = code;
                                                if (bezt->h1 != bezt->h2) {
-                                                       if (ELEM(bezt->h1, HD_ALIGN, HD_AUTO)) bezt->h1 = HD_FREE;
-                                                       if (ELEM(bezt->h2, HD_ALIGN, HD_AUTO)) bezt->h2 = HD_FREE;
+                                                       if (ELEM(bezt->h1, HD_ALIGN, HD_AUTO))
+                                                               bezt->h1 = HD_FREE;
+                                                       if (ELEM(bezt->h2, HD_ALIGN, HD_AUTO))
+                                                               bezt->h2 = HD_FREE;
                                                }
                                        }
                                        bezt++;
@@ -2892,7 +3004,6 @@ void BKE_nurbList_handles_set(ListBase *editnurb, short code)
        }
        else {
                /* there is 1 handle not FREE: FREE it all, else make ALIGNED  */
-               
                nu = editnurb->first;
                if (code == 5) {
                        ok = HD_ALIGN;
@@ -2926,7 +3037,7 @@ void BKE_nurbList_handles_set(ListBase *editnurb, short code)
                                while (a--) {
                                        if (bezt->f1 & SELECT) bezt->h1 = ok;
                                        if (bezt->f3 & SELECT) bezt->h2 = ok;
-       
+
                                        bezt++;
                                }
                                BKE_nurb_handles_calc(nu);
@@ -2975,14 +3086,16 @@ void BKE_nurb_direction_switch(Nurb *nu)
                if (a & 1) a += 1;  /* if odd, also swap middle content */
                a /= 2;
                while (a > 0) {
-                       if (bezt1 != bezt2) SWAP(BezTriple, *bezt1, *bezt2);
+                       if (bezt1 != bezt2)
+                               SWAP(BezTriple, *bezt1, *bezt2);
 
                        swapdata(bezt1->vec[0], bezt1->vec[2], 12);
-                       if (bezt1 != bezt2) swapdata(bezt2->vec[0], bezt2->vec[2], 12);
+                       if (bezt1 != bezt2)
+                               swapdata(bezt2->vec[0], bezt2->vec[2], 12);
 
                        SWAP(char, bezt1->h1, bezt1->h2);
                        SWAP(short, bezt1->f1, bezt1->f3);
-                       
+
                        if (bezt1 != bezt2) {
                                SWAP(char, bezt2->h1, bezt2->h2);
                                SWAP(short, bezt2->f1, bezt2->f3);
@@ -2990,7 +3103,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
                                bezt2->alfa = -bezt2->alfa;
                        }
                        a--;
-                       bezt1++; 
+                       bezt1++;
                        bezt2--;
                }
        }
@@ -3004,7 +3117,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
                        a--;
                        bp1->alfa = -bp1->alfa;
                        bp2->alfa = -bp2->alfa;
-                       bp1++; 
+                       bp1++;
                        bp2--;
                }
                if (nu->type == CU_NURBS) {
@@ -3018,7 +3131,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
                                while (fp1 != fp2 && a > 0) {
                                        SWAP(float, *fp1, *fp2);
                                        a--;
-                                       fp1++; 
+                                       fp1++;
                                        fp2--;
                                }
                                /* and make in increasing order again */
@@ -3030,7 +3143,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
                                        fp1++;
                                        fp2++;
                                }
-               
+
                                a = KNOTSU(nu) - 1;
                                fp1 = nu->knotsu;
                                fp2 = tempf;
@@ -3046,18 +3159,16 @@ void BKE_nurb_direction_switch(Nurb *nu)
                }
        }
        else {
-               
                for (b = 0; b < nu->pntsv; b++) {
-               
                        bp1 = nu->bp + b * nu->pntsu;
                        a = nu->pntsu;
                        bp2 = bp1 + (a - 1);
                        a /= 2;
-                       
+
                        while (bp1 != bp2 && a > 0) {
                                SWAP(BPoint, *bp1, *bp2);
                                a--;
-                               bp1++; 
+                               bp1++;
                                bp2--;
                        }
                }
@@ -3182,31 +3293,46 @@ void BKE_curve_keyVertexTilts_apply(Curve *UNUSED(cu), ListBase *lb, float *key)
 
 int BKE_nurb_check_valid_u(struct Nurb *nu)
 {
-       if (nu == NULL) return 0;
-       if (nu->pntsu <= 1) return 0;
-       if (nu->type != CU_NURBS) return 1;           /* not a nurb, lets assume its valid */
+       if (nu == NULL)
+               return 0;
+       if (nu->pntsu <= 1)
+               return 0;
+       if (nu->type != CU_NURBS)
+               return 1;           /* not a nurb, lets assume its valid */
 
        if (nu->pntsu < nu->orderu) return 0;
        if (((nu->flag & CU_NURB_CYCLIC) == 0) && (nu->flagu & CU_NURB_BEZIER)) { /* Bezier U Endpoints */
                if (nu->orderu == 4) {
-                       if (nu->pntsu < 5) return 0;          /* bezier with 4 orderu needs 5 points */
+                       if (nu->pntsu < 5)
+                               return 0;          /* bezier with 4 orderu needs 5 points */
+               }
+               else {
+                       if (nu->orderu != 3)
+                               return 0;       /* order must be 3 or 4 */
                }
-               else if (nu->orderu != 3) return 0;       /* order must be 3 or 4 */
        }
        return 1;
 }
 int BKE_nurb_check_valid_v(struct Nurb *nu)
 {
-       if (nu == NULL) return 0;
-       if (nu->pntsv <= 1) return 0;
-       if (nu->type != CU_NURBS) return 1;           /* not a nurb, lets assume its valid */
+       if (nu == NULL)
+               return 0;
+       if (nu->pntsv <= 1)
+               return 0;
+       if (nu->type != CU_NURBS)
+               return 1;           /* not a nurb, lets assume its valid */
 
-       if (nu->pntsv < nu->orderv) return 0;
+       if (nu->pntsv < nu->orderv)
+               return 0;
        if (((nu->flag & CU_NURB_CYCLIC) == 0) && (nu->flagv & CU_NURB_BEZIER)) { /* Bezier V Endpoints */
                if (nu->orderv == 4) {
-                       if (nu->pntsv < 5) return 0;          /* bezier with 4 orderu needs 5 points */
+                       if (nu->pntsv < 5)
+                               return 0;          /* bezier with 4 orderu needs 5 points */
+               }
+               else {
+                       if (nu->orderv != 3)
+                               return 0;       /* order must be 3 or 4 */
                }
-               else if (nu->orderv != 3) return 0;       /* order must be 3 or 4 */
        }
        return 1;
 }
@@ -3366,7 +3492,8 @@ void BKE_curve_delete_material_index(Curve *cu, int index)
                for (nu = cu->nurb.first; nu; nu = nu->next) {
                        if (nu->mat_nr && nu->mat_nr >= index) {
                                nu->mat_nr--;
-                               if (curvetype == OB_CURVE) nu->charidx--;
+                               if (curvetype == OB_CURVE)
+                                       nu->charidx--;
                        }
                }
        }
index 8b4d699006d0ef03c6ec416b7dc5baf854bf3892..a3f5c5c23c61084344470fd1745a12a5db074af2 100644 (file)
@@ -484,7 +484,8 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
                        dl = dl->next;
                }
 
-               if (totvert && (tot = BLI_scanfill_calc(&sf_ctx, FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
+               /* XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { */
+               if (totvert && (tot = BLI_scanfill_calc(&sf_ctx, FALSE))) {
                        if (tot) {
                                dlnew = MEM_callocN(sizeof(DispList), "filldisplist");
                                dlnew->type = DL_INDEX3;
@@ -743,7 +744,8 @@ static ModifierData *curve_get_tessellate_point(Scene *scene, Object *ob, int fo
        return pretessellatePoint;
 }
 
-static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, float (**originalVerts_r)[3], float (**deformedVerts_r)[3], int *numVerts_r)
+static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, float (**originalVerts_r)[3],
+                                     float (**deformedVerts_r)[3], int *numVerts_r)
 {
        ModifierData *md = modifiers_getVirtualModifierList(ob);
        ModifierData *pretessellatePoint;
@@ -1412,7 +1414,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
                                                        /* CU_2D conflicts with R_NOPUNOFLIP */
                                                        dl->rt = nu->flag & ~CU_2D;
 
-                                                       dl->bevelSplitFlag = MEM_callocN(sizeof(*dl->col2) * ((steps + 0x1F) >> 5), "bevelSplitFlag");
+                                                       dl->bevelSplitFlag = MEM_callocN(sizeof(*dl->col2) * ((steps + 0x1F) >> 5),
+                                                                                        "bevelSplitFlag");
 
                                                        /* for each point of poly make a bevel piece */
                                                        bevp = (BevPoint *)(bl + 1) + start;
index 31741718a09add32014ec58f8c124ccaa3cc1abd..cf63fb267e8186e7b7e60a18260c1f479389fb2e 100644 (file)
@@ -635,7 +635,8 @@ static ImBuf *get_postprocessed_cached_frame(MovieClip *clip, MovieClipUser *use
        return cache->postprocessed.ibuf;
 }
 
-static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int flag, int postprocess_flag)
+static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf,
+                                               int flag, int postprocess_flag)
 {
        MovieClipCache *cache = clip->cache;
        MovieTrackingCamera *camera = &clip->tracking.camera;
@@ -851,7 +852,8 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
        return stableibuf;
 }
 
-ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag)
+ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle,
+                                     int postprocess_flag)
 {
        ImBuf *ibuf, *stableibuf = NULL;
        int framenr = user->framenr;
index b68102885eaa9cf2aca4c02d9a279693bf99258d..b27a065730bbecbf420a1d4cf306e5c51d35131a 100644 (file)
@@ -166,11 +166,11 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
                        /* search shouldn't be moved inside pattern */
                        if (track->search_min[a] > pat_min[a]) {
                                track->search_min[a] = pat_min[a];
-                               track->search_max[a] = track->search_min[a]+dim[a];
+                               track->search_max[a] = track->search_min[a] + dim[a];
                        }
                        if (track->search_max[a] < pat_max[a]) {
                                track->search_max[a] = pat_max[a];
-                               track->search_min[a] = track->search_max[a]-dim[a];
+                               track->search_min[a] = track->search_max[a] - dim[a];
                        }
                }
        }
@@ -196,8 +196,8 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
                sub_v2_v2v2(dim, track->pat_max, track->pat_min);
 
                for (a = 0; a < 2; a++) {
-                       track->pat_min[a] = -dim[a]/2.0f;
-                       track->pat_max[a] = dim[a]/2.0f;
+                       track->pat_min[a] = -dim[a] / 2.0f;
+                       track->pat_max[a] = dim[a] / 2.0f;
                }
        }
 }
@@ -302,8 +302,9 @@ MovieTrackingMarker *BKE_tracking_insert_marker(MovieTrackingTrack *track, Movie
                else
                        track->markers = MEM_callocN(sizeof(MovieTrackingMarker), "MovieTracking markers");
 
-               memmove(track->markers+a+2, track->markers+a+1, (track->markersnr-a-2)*sizeof(MovieTrackingMarker));
-               track->markers[a+1] = *marker;
+               memmove(track->markers + a + 2, track->markers + a + 1,
+                       (track->markersnr - a - 2) * sizeof(MovieTrackingMarker));
+               track->markers[a + 1] = *marker;
 
                track->last_marker = a + 1;
 
@@ -315,12 +316,13 @@ void BKE_tracking_delete_marker(MovieTrackingTrack *track, int framenr)
 {
        int a = 0;
 
-       while (a<track->markersnr) {
+       while (a < track->markersnr) {
                if (track->markers[a].framenr == framenr) {
                        if (track->markersnr > 1) {
-                               memmove(track->markers+a, track->markers+a+1, (track->markersnr-a-1)*sizeof(MovieTrackingMarker));
+                               memmove(track->markers + a, track->markers + a + 1,
+                                       (track->markersnr - a - 1) * sizeof(MovieTrackingMarker));
                                track->markersnr--;
-                               track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
+                               track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker) * track->markersnr);
                        }
                        else {
                                MEM_freeN(track->markers);
@@ -337,7 +339,7 @@ void BKE_tracking_delete_marker(MovieTrackingTrack *track, int framenr)
 
 MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int framenr)
 {
-       int a = track->markersnr-1;
+       int a = track->markersnr - 1;
 
        if (!track->markersnr)
                return NULL;
@@ -360,7 +362,7 @@ MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int fram
                }
 
                /* if there's no marker for exact position, use nearest marker from left side */
-               return &track->markers[a-1];
+               return &track->markers[a - 1];
        }
        else {
                while (a >= 0 && track->markers[a].framenr >= framenr) {
@@ -461,16 +463,16 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
                }
 
                if (track->markersnr)
-                       put_disabled_marker(track, &track->markers[track->markersnr-1], 0, 1);
+                       put_disabled_marker(track, &track->markers[track->markersnr - 1], 0, 1);
        }
        else if (action == TRACK_CLEAR_UPTO) {
-               a = track->markersnr-1;
+               a = track->markersnr - 1;
 
                while (a >= 0) {
                        if (track->markers[a].framenr <= ref_frame) {
-                               memmove(track->markers, track->markers+a, (track->markersnr-a)*sizeof(MovieTrackingMarker));
+                               memmove(track->markers, track->markers + a, (track->markersnr - a) * sizeof(MovieTrackingMarker));
 
-                               track->markersnr = track->markersnr-a;
+                               track->markersnr = track->markersnr - a;
                                track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
 
                                break;
@@ -521,8 +523,8 @@ void BKE_tracking_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack
                        markers[i] = dst_track->markers[b++];
                }
                else {
-                       if ((src_track->markers[a].flag & MARKER_DISABLED)==0) {
-                               if ((dst_track->markers[b].flag & MARKER_DISABLED)==0) {
+                       if ((src_track->markers[a].flag & MARKER_DISABLED) == 0) {
+                               if ((dst_track->markers[b].flag & MARKER_DISABLED) == 0) {
                                        /* both tracks are enabled on this frame, so find the whole segment
                                         * on which tracks are intersecting and blend tracks using linear
                                         * interpolation to prevent jumps */
@@ -532,8 +534,8 @@ void BKE_tracking_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack
                                        int j, inverse = 0;
 
                                        inverse = (b == 0) ||
-                                                 (dst_track->markers[b-1].flag & MARKER_DISABLED) ||
-                                                 (dst_track->markers[b-1].framenr != frame - 1);
+                                                 (dst_track->markers[b - 1].flag & MARKER_DISABLED) ||
+                                                 (dst_track->markers[b - 1].framenr != frame - 1);
 
                                        /* find length of intersection */
                                        while (a < src_track->markersnr && b < dst_track->markersnr) {
@@ -969,7 +971,7 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
        /* count */
        track = tracksbase->first;
        while (track) {
-               if (TRACK_SELECTED(track) && (track->flag & (TRACK_LOCKED | TRACK_HIDDEN))==0) {
+               if (TRACK_SELECTED(track) && (track->flag & (TRACK_LOCKED | TRACK_HIDDEN)) == 0) {
                        MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr);
 
                        if ((marker->flag & MARKER_DISABLED) == 0)
@@ -1000,13 +1002,13 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
 
 #ifdef WITH_LIBMV
                                        {
-                                               float patx = (int)((track->pat_max[0]-track->pat_min[0])*width),
-                                                     paty = (int)((track->pat_max[1]-track->pat_min[1])*height);
+                                               float patx = (int)((track->pat_max[0] - track->pat_min[0]) * width),
+                                                     paty = (int)((track->pat_max[1] - track->pat_min[1]) * height);
 
-                                               float search_size_x = (track->search_max[0]-track->search_min[0])*width;
-                                               float search_size_y = (track->search_max[1]-track->search_min[1])*height;
-                                               float pattern_size_x = (track->pat_max[0]-track->pat_min[0])*width;
-                                               float pattern_size_y = (track->pat_max[1]-track->pat_min[1])*height;
+                                               float search_size_x = (track->search_max[0] - track->search_min[0]) * width;
+                                               float search_size_y = (track->search_max[1] - track->search_min[1]) * height;
+                                               float pattern_size_x = (track->pat_max[0] - track->pat_min[0]) * width;
+                                               float pattern_size_y = (track->pat_max[1] - track->pat_min[1]) * height;
                                                int wndx = (int)patx / 2, wndy = (int)paty / 2;
                                                int half_wnd = MAX2(wndx, wndy);
 
@@ -1021,17 +1023,20 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
                                                 * than the search size */
                                                int level = MIN2(track->pyramid_levels, max_pyramid_levels);
 
+                                               struct libmv_RegionTracker *region_tracker;
+
                                                if (track->tracker == TRACKER_KLT) {
-                                                       track_context.region_tracker =
-                                                               libmv_pyramidRegionTrackerNew(100, level, half_wnd, track->minimum_correlation);
+                                                       region_tracker = libmv_pyramidRegionTrackerNew(100, level, half_wnd,
+                                                                                                      track->minimum_correlation);
                                                }
                                                else if (track->tracker == TRACKER_HYBRID) {
-                                                       track_context.region_tracker =
-                                                               libmv_hybridRegionTrackerNew(100, half_wnd, track->minimum_correlation);
+                                                       region_tracker = libmv_hybridRegionTrackerNew(100, half_wnd, track->minimum_correlation);
                                                }
                                                else if (track->tracker == TRACKER_SAD) {
-                                                       track_context.region_tracker = libmv_bruteRegionTrackerNew(MAX2(wndx, wndy), track->minimum_correlation);
+                                                       region_tracker = libmv_bruteRegionTrackerNew(MAX2(wndx, wndy), track->minimum_correlation);
                                                }
+
+                                               track_context.region_tracker = region_tracker;
                                        }
 #endif
 
@@ -1094,7 +1099,8 @@ void BKE_tracking_context_free(MovieTrackingContext *context)
 /* zap channels from the imbuf that are disabled by the user. this can lead to
  * better tracks sometimes. however, instead of simply zeroing the channels
  * out, do a partial grayscale conversion so the display is better. */
-void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disable_green, int disable_blue, int grayscale)
+void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disable_green, int disable_blue,
+                                         int grayscale)
 {
        int x, y;
        float scale;
@@ -1181,13 +1187,13 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki
        h = (max[1] - min[1]) * ibuf->y;
 
        /* dimensions should be odd */
-       w = w|1;
-       h = h|1;
+       w = w | 1;
+       h = h | 1;
 
-       x1 = x-(int)(w * (-min[0] / (max[0] - min[0])));
-       y1 = y-(int)(h * (-min[1] / (max[1] - min[1])));
+       x1 = x - (int)(w * (-min[0] / (max[0] - min[0])));
+       y1 = y - (int)(h * (-min[1] / (max[1] - min[1])));
 
-       tmpibuf = IMB_allocImBuf(w+margin*2, h+margin*2, 32, IB_rect);
+       tmpibuf = IMB_allocImBuf(w + margin * 2, h + margin * 2, 32, IB_rect);
        IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1 - margin, y1 - margin, w + margin * 2, h + margin * 2);
 
        if (pos != NULL) {
@@ -1310,17 +1316,17 @@ static ImBuf *get_keyframed_ibuf(MovieTrackingContext *context, MovieTrackingTra
                                  MovieTrackingMarker *marker, MovieTrackingMarker **marker_keyed)
 {
        int framenr = marker->framenr;
-       int a = marker-track->markers;
+       int a = marker - track->markers;
 
        *marker_keyed = marker;
 
        while (a >= 0 && a < track->markersnr) {
-               int next = (context->backwards) ? a+1 : a-1;
+               int next = (context->backwards) ? a + 1 : a - 1;
                int is_keyframed = FALSE;
                MovieTrackingMarker *cur_marker = &track->markers[a];
                MovieTrackingMarker *next_marker = NULL;
 
-               if (next>=0 && next<track->markersnr)
+               if (next >= 0 && next < track->markersnr)
                        next_marker = &track->markers[next];
 
                /* if next mrker is disabled, stop searching keyframe and use current frame as keyframe */
@@ -1442,8 +1448,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
                        margin[1] = MAX2(margin[1], (float)track->margin / ibuf_new->y);
 
                        /* do not track markers which are too close to boundary */
-                       if (marker->pos[0]<margin[0] || marker->pos[0]>1.0f-margin[0] ||
-                           marker->pos[1]<margin[1] || marker->pos[1]>1.0f-margin[1])
+                       if (marker->pos[0] < margin[0] || marker->pos[0] > 1.0f - margin[0] ||
+                           marker->pos[1] < margin[1] || marker->pos[1] > 1.0f - margin[1])
                        {
                                onbound = TRUE;
                        }
@@ -1669,7 +1675,8 @@ static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, M
 
        reconstruction->camnr = 0;
        reconstruction->cameras = NULL;
-       reconstructed = MEM_callocN((efra-sfra+1)*sizeof(MovieReconstructedCamera), "temp reconstructed camera");
+       reconstructed = MEM_callocN((efra - sfra + 1) * sizeof(MovieReconstructedCamera),
+                                   "temp reconstructed camera");
 
        for (a = sfra; a <= efra; a++) {
                double matd[4][4];
@@ -1704,8 +1711,9 @@ static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, M
        }
 
        if (reconstruction->camnr) {
-               reconstruction->cameras = MEM_callocN(reconstruction->camnr * sizeof(MovieReconstructedCamera), "reconstructed camera");
-               memcpy(reconstruction->cameras, reconstructed, reconstruction->camnr * sizeof(MovieReconstructedCamera));
+               int size = reconstruction->camnr * sizeof(MovieReconstructedCamera);
+               reconstruction->cameras = MEM_callocN(size, "reconstructed camera");
+               memcpy(reconstruction->cameras, reconstructed, size);
        }
 
        if (origin_set) {
@@ -1783,7 +1791,8 @@ int BKE_tracking_can_reconstruct(MovieTracking *tracking, MovieTrackingObject *o
                return TRUE;
        }
        else if (count_tracks_on_both_keyframes(tracking, tracksbase) < 8) {
-               BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction", error_size);
+               BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction",
+                           error_size);
 
                return FALSE;
        }
@@ -1818,7 +1827,7 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
 
        track = tracksbase->first;
        while (track) {
-               int first = 0, last = track->markersnr-1;
+               int first = 0, last = track->markersnr - 1;
                MovieTrackingMarker *first_marker = &track->markers[0];
                MovieTrackingMarker *last_marker = &track->markers[track->markersnr - 1];
 
@@ -1834,7 +1843,7 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
                        last_marker--;
                }
 
-               if (first<track->markersnr - 1)
+               if (first < track->markersnr - 1)
                        sfra = MIN2(sfra, first_marker->framenr);
 
                if (last >= 0)
@@ -2010,21 +2019,21 @@ static int reconstruction_camera_index(MovieTrackingReconstruction *reconstructi
        if (!reconstruction->camnr)
                return -1;
 
-       if (framenr<cameras[0].framenr) {
+       if (framenr < cameras[0].framenr) {
                if (nearest)
                        return 0;
                else
                        return -1;
        }
 
-       if (framenr>cameras[reconstruction->camnr - 1].framenr) {
+       if (framenr > cameras[reconstruction->camnr - 1].framenr) {
                if (nearest)
                        return reconstruction->camnr - 1;
                else
                        return -1;
        }
 
-       if (reconstruction->last_camera<reconstruction->camnr)
+       if (reconstruction->last_camera < reconstruction->camnr)
                a = reconstruction->last_camera;
 
        if (cameras[a].framenr >= framenr)
@@ -2106,9 +2115,9 @@ void BKE_tracking_get_interpolated_camera(MovieTracking *tracking, MovieTracking
        }
 
        if (cameras[a].framenr != framenr && a > 0 && a < reconstruction->camnr - 1) {
-               float t = ((float)framenr-cameras[a].framenr) / (cameras[a + 1].framenr-cameras[a].framenr);
+               float t = ((float)framenr - cameras[a].framenr) / (cameras[a + 1].framenr - cameras[a].framenr);
 
-               blend_m4_m4m4(mat, cameras[a].mat, cameras[a+1].mat, t);
+               blend_m4_m4m4(mat, cameras[a].mat, cameras[a + 1].mat, t);
        }
        else {
                copy_m4_m4(mat, cameras[a].mat);
@@ -2135,8 +2144,8 @@ void BKE_get_tracking_mat(Scene *scene, Object *ob, float mat[4][4])
 void BKE_tracking_camera_shift(MovieTracking *tracking, int winx, int winy, float *shiftx, float *shifty)
 {
        /* indeed in both of cases it should be winx -- it's just how camera shift works for blender's camera */
-       *shiftx = (0.5f * winx-tracking->camera.principal[0]) / winx;
-       *shifty = (0.5f * winy-tracking->camera.principal[1]) / winx;
+       *shiftx = (0.5f * winx - tracking->camera.principal[0]) / winx;
+       *shifty = (0.5f * winy - tracking->camera.principal[1]) / winx;
 }
 
 void BKE_tracking_camera_to_blender(MovieTracking *tracking, Scene *scene, Camera *camera, int width, int height)
@@ -2145,9 +2154,9 @@ void BKE_tracking_camera_to_blender(MovieTracking *tracking, Scene *scene, Camer
 
        camera->sensor_x = tracking->camera.sensor_width;
        camera->sensor_fit = CAMERA_SENSOR_FIT_AUTO;
-       camera->lens = focal*camera->sensor_x/width;
+       camera->lens = focal * camera->sensor_x / width;
 
-       scene->r.xsch = width*tracking->camera.pixel_aspect;
+       scene->r.xsch = width * tracking->camera.pixel_aspect;
        scene->r.ysch = height;
 
        scene->r.xasp = 1.0f;
@@ -2160,7 +2169,7 @@ void BKE_tracking_projection_matrix(MovieTracking *tracking, MovieTrackingObject
                                     int framenr, int winx, int winy, float mat[4][4])
 {
        MovieReconstructedCamera *camera;
-       float lens = tracking->camera.focal*tracking->camera.sensor_width/(float)winx;
+       float lens = tracking->camera.focal * tracking->camera.sensor_width / (float)winx;
        float viewfac, pixsize, left, right, bottom, top, clipsta, clipend;
        float winmat[4][4];
        float ycor =  1.0f / tracking->camera.pixel_aspect;
@@ -2172,11 +2181,11 @@ void BKE_tracking_projection_matrix(MovieTracking *tracking, MovieTrackingObject
        clipend = 1000.0f;
 
        if (winx >= winy)
-               viewfac = (lens*winx)/tracking->camera.sensor_width;
+               viewfac = (lens * winx) / tracking->camera.sensor_width;
        else
-               viewfac = (ycor*lens*winy)/tracking->camera.sensor_width;
+               viewfac = (ycor * lens * winy) / tracking->camera.sensor_width;
 
-       pixsize = clipsta/viewfac;
+       pixsize = clipsta / viewfac;
 
        left = -0.5f * (float)winx + shiftx * winside;
        bottom = -0.5f * (ycor) * (float)winy + shifty * winside;
@@ -2278,7 +2287,7 @@ void BKE_tracking_apply_intrinsics(MovieTracking *tracking, float co[2], float n
 
 #ifdef WITH_LIBMV
        double x, y;
-       float aspy = 1.0f/tracking->camera.pixel_aspect;
+       float aspy = 1.0f / tracking->camera.pixel_aspect;
 
        /* normalize coords */
        x = (co[0] - camera->principal[0]) / camera->focal;
@@ -2326,7 +2335,7 @@ static int point_in_stroke(bGPDstroke *stroke, float x, float y)
 
        prev = stroke->totpoints - 1;
 
-       for (i = 0; i<stroke->totpoints; i++) {
+       for (i = 0; i < stroke->totpoints; i++) {
                if ((points[i].y < y && points[prev].y >= y) || (points[prev].y < y && points[i].y >= y)) {
                        float fac = (y - points[i].y) / (points[prev].y - points[i].y);
 
@@ -2507,7 +2516,7 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width
                b[0] *= width;
                b[1] *= height;
 
-               *angle = -atan2(a[0]*b[1]-a[1]*b[0], a[0]*b[0]+a[1]*b[1]);
+               *angle = -atan2(a[0] * b[1] - a[1] * b[0], a[0] * b[0] + a[1] * b[1]);
                *angle *= stab->rotinf;
 
                /* convert to rotation around image center */
@@ -2563,10 +2572,10 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
 
                        for (i = 0; i < 4; i++) {
                                int j;
-                               float a[3] = {0.0f, 0.0f, 0.0f}, b[3]= {0.0f, 0.0f, 0.0f};
+                               float a[3] = {0.0f, 0.0f, 0.0f}, b[3] = {0.0f, 0.0f, 0.0f};
 
                                copy_v3_v3(a, points[i]);
-                               copy_v3_v3(b, points[(i+1)%4]);
+                               copy_v3_v3(b, points[(i + 1) % 4]);
 
                                mul_m4_v3(mat, a);
                                mul_m4_v3(mat, b);
@@ -2622,7 +2631,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
 
                stab->scale = scale;
 
-               if (stab->maxscale>0.0f)
+               if (stab->maxscale > 0.0f)
                        stab->scale = MIN2(stab->scale, stab->maxscale);
        }
        else {
@@ -2663,7 +2672,8 @@ static ImBuf* stabilize_alloc_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
        return cacheibuf;
 }
 
-void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle)
+void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int width, int height,
+                                     float loc[2], float *scale, float *angle)
 {
        float firstmedian[2], median[2];
        MovieTrackingStabilization *stab = &tracking->stabilization;
@@ -2701,7 +2711,8 @@ void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int w
        }
 }
 
-ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, float loc[2], float *scale, float *angle)
+ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
+                              float loc[2], float *scale, float *angle)
 {
        float tloc[2], tscale, tangle;
        MovieTrackingStabilization *stab = &tracking->stabilization;
@@ -2798,10 +2809,11 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
        return tmpibuf;
 }
 
-void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect, float loc[2], float scale, float angle, float mat[4][4])
+void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect,
+                                   float loc[2], float scale, float angle, float mat[4][4])
 {
        float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4], amat[4][4], iamat[4][4];
-       float svec[3]= {scale, scale, scale};
+       float svec[3] = {scale, scale, scale};
 
        unit_m4(rmat);
        unit_m4(lmat);
@@ -3013,7 +3025,7 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
        MovieTrackingTrack *track;
        int index = BLI_findindex(&tracking->objects, object);
 
-       if (index<0)
+       if (index < 0)
                return;
 
        if (object->flag & TRACKING_OBJECT_CAMERA) {
@@ -3034,7 +3046,7 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
 
        tracking->tot_object--;
 
-       if (index>0)
+       if (index > 0)
                tracking->objectnr = index - 1;
        else
                tracking->objectnr = 0;
@@ -3042,7 +3054,8 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
 
 void BKE_tracking_object_unique_name(MovieTracking *tracking, MovieTrackingObject *object)
 {
-       BLI_uniquename(&tracking->objects, object, "Object", '.', offsetof(MovieTrackingObject, name), sizeof(object->name));
+       BLI_uniquename(&tracking->objects, object, "Object", '.',
+                      offsetof(MovieTrackingObject, name), sizeof(object->name));
 }
 
 MovieTrackingObject *BKE_tracking_named_object(MovieTracking *tracking, const char *name)
index 5761a285d729ed9131267bcd1af4b39d5d94e904..18f191a46a6ed5b4606cf1ba5f5c4399fd162e0d 100644 (file)
@@ -165,9 +165,10 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
 
        block = uiLayoutAbsoluteBlock(layout);
 
-       scopes->track_preview_height = (scopes->track_preview_height<=UI_UNIT_Y)?UI_UNIT_Y:scopes->track_preview_height;
+       scopes->track_preview_height = (scopes->track_preview_height <= UI_UNIT_Y)?UI_UNIT_Y : scopes->track_preview_height;
 
-       uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->track_preview_height, scopes, 0, 0, 0, 0, "");
+       uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin,
+             scopes->track_preview_height, scopes, 0, 0, 0, 0, "");
 }
 
 /********************* Marker Template ************************/
@@ -213,7 +214,7 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
 
        marker->flag = cb->marker_flag;
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
 }
 
 static void marker_block_handler(bContext *C, void *arg_cb, int event)
@@ -227,12 +228,12 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
        marker = BKE_tracking_ensure_marker(cb->track, cb->framenr);
 
        if (event == B_MARKER_POS) {
-               marker->pos[0] = cb->marker_pos[0]/width;
-               marker->pos[1] = cb->marker_pos[1]/height;
+               marker->pos[0] = cb->marker_pos[0] / width;
+               marker->pos[1] = cb->marker_pos[1] / height;
 
                /* to update position of "parented" objects */
                DAG_id_tag_update(&cb->clip->id, 0);
-               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+               WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
                ok = TRUE;
        }
@@ -278,17 +279,17 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
 
                sub_v2_v2v2(search_dim, cb->track->search_max, cb->track->search_min);
 
-               dim[0] = cb->track_search[0]/width;
-               dim[1] = cb->track_search[1]/height;
+               dim[0] = cb->track_search[0] / width;
+               dim[1] = cb->track_search[1] / height;
 
                sub_v2_v2(dim, search_dim);
                mul_v2_fl(dim, 0.5f);
 
-               cb->track->search_min[0]-= dim[0];
-               cb->track->search_min[1]-= dim[1];
+               cb->track->search_min[0] -= dim[0];
+               cb->track->search_min[1] -= dim[1];
 
-               cb->track->search_max[0]+= dim[0];
-               cb->track->search_max[1]+= dim[1];
+               cb->track->search_max[0] += dim[0];
+               cb->track->search_max[1] += dim[1];
 
                BKE_tracking_clamp_track(cb->track, CLAMP_SEARCH_DIM);
 
@@ -314,16 +315,17 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
 
                /* to update position of "parented" objects */
                DAG_id_tag_update(&cb->clip->id, 0);
-               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+               WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
                ok = TRUE;
        }
 
        if (ok)
-               WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, cb->clip);
+               WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, cb->clip);
 }
 
-void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, int compact)
+void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr,
+                      PointerRNA *trackptr, int compact)
 {
        PropertyRNA *prop;
        uiBlock *block;
@@ -375,7 +377,8 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
                else
                        tip = "Marker is enabled at current frame";
 
-               bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, tip);
+               bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20,
+                                     &cb->marker_flag, 0, 0, 1, 0, tip);
                uiButSetNFunc(bt, marker_update_cb, cb, NULL);
        }
        else {
index 574eb5b25709dabe785c4560c2074c73467602d6..84209f7b7442226df5553883fb42f60f8c41394d 100644 (file)
@@ -122,13 +122,13 @@ static void draw_keyframe_shape(float x, float y, float xscale, float yscale, sh
 
        /* adjust view transform before starting */
        glTranslatef(x, y, 0.0f);
-       glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.0f);
+       glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f);
 
        /* anti-aliased lines for more consistent appearance */
        glEnable(GL_LINE_SMOOTH);
 
        if (sel)
-               UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255*(1.0f-alpha));
+               UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha));
        else
                glColor4f(0.91f, 0.91f, 0.91f, alpha);
 
index 9b9190e3e05adcc7e6f8c4d5ad6c19ccc1cf7364..0fd17523425f568f2d633e2ef784bd4ff707b5b3 100644 (file)
@@ -100,7 +100,7 @@ static int dopesheet_select_channel_exec(bContext *C, wmOperator *op)
                current_channel_index++;
        }
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+       WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -129,7 +129,7 @@ void CLIP_OT_dopesheet_select_channel(wmOperatorType *ot)
        ot->poll = dopesheet_select_channel_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
index 33bc67db8e4c06db8994af6752d453580b7b8bb1..f92f639586d64e5f224f732937db8df18d3f8f67 100644 (file)
@@ -87,7 +87,7 @@ void clip_draw_curfra_label(SpaceClip *sc, float x, float y)
        glRecti(x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f);
 
        UI_ThemeColor(TH_TEXT);
-       BLF_position(fontid, x+2.0f, y+2.0f, 0.0f);
+       BLF_position(fontid, x + 2.0f, y + 2.0f, 0.0f);
        BLF_draw(fontid, numstr, sizeof(numstr));
 }
 
@@ -128,7 +128,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
                        int framenr;
                        MovieTrackingMarker *marker;
 
-                       while (a<track->markersnr) {
+                       while (a < track->markersnr) {
                                if (track->markers[a].framenr >= i)
                                        break;
 
@@ -191,7 +191,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
        x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx;
 
        UI_ThemeColor(TH_CFRAME);
-       glRecti(x, 0, x+framelen, 8);
+       glRecti(x, 0, x + framelen, 8);
 
        clip_draw_curfra_label(sc, x, 8.0f);
 }
@@ -267,7 +267,7 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf,
                         * be binder fallback to simple draw pixels solution */
                        if (need_fallback) {
                                /* set zoom */
-                               glPixelZoom(zoomx*width/ibuf->x, zoomy*height/ibuf->y);
+                               glPixelZoom(zoomx * width / ibuf->x, zoomy * height / ibuf->y);
 
                                glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 
@@ -346,7 +346,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 
        b = count;
        i = framenr;
-       while (i <= framenr+count) {
+       while (i <= framenr + count) {
                marker = BKE_tracking_get_marker(track, i);
 
                if (!marker || marker->flag & MARKER_DISABLED)
@@ -357,7 +357,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
                                curindex = b;
 
                        add_v2_v2v2(path[b++], marker->pos, track->offset);
-                       ED_clip_point_undistorted_pos(sc, path[b-1], path[b-1]);
+                       ED_clip_point_undistorted_pos(sc, path[b - 1], path[b - 1]);
                }
                else
                        break;
@@ -414,7 +414,8 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
        glPointSize(1.0f);
 }
 
-static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int width, int height)
+static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
+                                float marker_pos[2], int width, int height)
 {
        int tiny = sc->flag & SC_SHOW_TINY_MARKER;
        int show_search = FALSE;
@@ -434,7 +435,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 
                ED_clip_point_undistorted_pos(sc, pos, pos);
 
-               if (BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
+               if (BLI_in_rctf(&r, pos[0] - marker_pos[0], pos[1] - marker_pos[1])) {
                        if (tiny) glPointSize(3.0f);
                        else glPointSize(4.0f);
                        glBegin(GL_POINTS);
@@ -513,7 +514,8 @@ static void track_colors(MovieTrackingTrack *track, int act, float col[3], float
        }
 }
 
-static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int width, int height, int act, int sel)
+static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
+                             float marker_pos[2], int width, int height, int act, int sel)
 {
        int tiny = sc->flag & SC_SHOW_TINY_MARKER;
        int show_search = 0;
@@ -521,8 +523,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 
        track_colors(track, act, col, scol);
 
-       px[0]= 1.0f / width / sc->zoom;
-       px[1]= 1.0f / height / sc->zoom;
+       px[0] = 1.0f / width / sc->zoom;
+       px[1] = 1.0f / height / sc->zoom;
 
        /* marker position and offset position */
        if ((track->flag & SELECT) == sel && (marker->flag & MARKER_DISABLED) == 0) {
@@ -548,7 +550,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
                add_v2_v2v2(pos, marker->pos, track->offset);
                ED_clip_point_undistorted_pos(sc, pos, pos);
 
-               if (BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
+               if (BLI_in_rctf(&r, pos[0] - marker_pos[0], pos[1] - marker_pos[1])) {
                        if (!tiny)
                                glPointSize(2.0f);
 
@@ -768,18 +770,18 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
                }
 
                glBegin(GL_QUADS);
-                       glVertex3f(x-tdx, y+tdy, 0);
-                       glVertex3f(x+tdx, y+tdy, 0);
-                       glVertex3f(x+tdx, y-tdy, 0);
-                       glVertex3f(x-tdx, y-tdy, 0);
+                       glVertex3f(x - tdx, y + tdy, 0);
+                       glVertex3f(x + tdx, y + tdy, 0);
+                       glVertex3f(x + tdx, y - tdy, 0);
+                       glVertex3f(x - tdx, y - tdy, 0);
                glEnd();
 
                /* search re-sizing triangle */
                x = track->search_max[0];
                y = track->search_min[1];
 
-               tdx = searchdx*2.0f;
-               tdy = searchdy*2.0f;
+               tdx = searchdx * 2.0f;
+               tdy = searchdy * 2.0f;
 
                if (outline) {
                        tdx += px[0];
@@ -788,12 +790,12 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 
                glBegin(GL_TRIANGLES);
                        glVertex3f(x, y, 0);
-                       glVertex3f(x-tdx, y, 0);
-                       glVertex3f(x, y+tdy, 0);
+                       glVertex3f(x - tdx, y, 0);
+                       glVertex3f(x, y + tdy, 0);
                glEnd();
        }
 
-       if ((sc->flag & SC_SHOW_MARKER_PATTERN) && ((track->pat_flag & SELECT)==sel || outline)) {
+       if ((sc->flag & SC_SHOW_MARKER_PATTERN) && ((track->pat_flag & SELECT) == sel || outline)) {
                if (!outline) {
                        if (track->pat_flag & SELECT)
                                glColor3fv(scol);
@@ -814,10 +816,10 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
                }
 
                glBegin(GL_QUADS);
-                       glVertex3f(x-tdx, y+tdy, 0);
-                       glVertex3f(x+tdx, y+tdy, 0);
-                       glVertex3f(x+tdx, y-tdy, 0);
-                       glVertex3f(x-tdx, y-tdy, 0);
+                       glVertex3f(x - tdx, y + tdy, 0);
+                       glVertex3f(x + tdx, y + tdy, 0);
+                       glVertex3f(x + tdx, y - tdy, 0);
+                       glVertex3f(x - tdx, y - tdy, 0);
                glEnd();
 
                /* pattern re-sizing triangle */
@@ -834,8 +836,8 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 
                glBegin(GL_TRIANGLES);
                        glVertex3f(x, y, 0);
-                       glVertex3f(x-tdx, y, 0);
-                       glVertex3f(x, y+tdy, 0);
+                       glVertex3f(x - tdx, y, 0);
+                       glVertex3f(x, y + tdy, 0);
                glEnd();
        }
 
@@ -845,8 +847,8 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
                glLineWidth(1.0f);
 }
 
-static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int act,
-                              int width, int height, float zoomx, float zoomy)
+static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
+                              float marker_pos[2], int act, int width, int height, float zoomx, float zoomy)
 {
        char str[128] = {0}, state[64] = {0};
        float dx = 0.0f, dy = 0.0f, fontsize, pos[3];
@@ -971,7 +973,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
                /* count */
                track = tracksbase->first;
                while (track) {
-                       if ((track->flag & TRACK_HIDDEN)==0) {
+                       if ((track->flag & TRACK_HIDDEN) == 0) {
                                marker = BKE_tracking_get_marker(track, framenr);
 
                                if (MARKER_VISIBLE(sc, track, marker))
@@ -988,7 +990,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
                        track = tracksbase->first;
                        fp = marker_pos;
                        while (track) {
-                               if ((track->flag & TRACK_HIDDEN)==0) {
+                               if ((track->flag & TRACK_HIDDEN) == 0) {
                                        marker = BKE_tracking_get_marker(track, framenr);
 
                                        if (MARKER_VISIBLE(sc, track, marker)) {
@@ -1009,7 +1011,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
        if (sc->flag & SC_SHOW_TRACK_PATH) {
                track = tracksbase->first;
                while (track) {
-                       if ((track->flag & TRACK_HIDDEN)==0)
+                       if ((track->flag & TRACK_HIDDEN) == 0)
                                draw_track_path(sc, clip, track);
 
                        track = track->next;
@@ -1020,7 +1022,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
        track = tracksbase->first;
        fp = marker_pos;
        while (track) {
-               if ((track->flag & TRACK_HIDDEN)==0) {
+               if ((track->flag & TRACK_HIDDEN) == 0) {
                        marker = BKE_tracking_get_marker(track, framenr);
 
                        if (MARKER_VISIBLE(sc, track, marker)) {
@@ -1044,7 +1046,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
        track = tracksbase->first;
        fp = marker_pos;
        while (track) {
-               if ((track->flag & TRACK_HIDDEN)==0) {
+               if ((track->flag & TRACK_HIDDEN) == 0) {
                        int act = track == act_track;
                        marker = BKE_tracking_get_marker(track, framenr);
 
@@ -1066,7 +1068,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 
        /* active marker would be displayed on top of everything else */
        if (act_track) {
-               if ((act_track->flag & TRACK_HIDDEN)==0) {
+               if ((act_track->flag & TRACK_HIDDEN) == 0) {
                        marker = BKE_tracking_get_marker(act_track, framenr);
 
                        if (MARKER_VISIBLE(sc, act_track, marker)) {
@@ -1096,7 +1098,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
                                if (MARKER_VISIBLE(sc, track, marker)) {
                                        float npos[2];
                                        copy_v4_v4(vec, track->bundle_pos);
-                                       vec[3]=1;
+                                       vec[3] = 1;
 
                                        mul_v4_m4v4(pos, mat, vec);
 
@@ -1111,7 +1113,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 
                                                sub_v2_v2(vec, npos);
 
-                                               if (len_v2(vec)< 3.0f)
+                                               if (len_v2(vec) < 3.0f)
                                                        glColor3f(0.0f, 1.0f, 0.0f);
                                                else
                                                        glColor3f(1.0f, 0.0f, 0.0f);
@@ -1165,7 +1167,8 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
                MEM_freeN(marker_pos);
 }
 
-static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int width, int height, float zoomx, float zoomy)
+static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
+                            int width, int height, float zoomx, float zoomy)
 {
        float x, y;
        const int n = 10;
@@ -1199,9 +1202,9 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
 
                for (a = 0; a < 4; a++) {
                        if (a < 2)
-                               val[a][a%2] = FLT_MAX;
+                               val[a][a % 2] = FLT_MAX;
                        else
-                               val[a][a%2] = -FLT_MAX;
+                               val[a][a % 2] = -FLT_MAX;
                }
 
                zero_v2(pos);
@@ -1213,10 +1216,10 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
                                        for (a = 0; a < 4; a++) {
                                                int ok;
 
-                                               if (a<2)
-                                                       ok = tpos[a%2] < val[a][a%2];
+                                               if (a < 2)
+                                                       ok = tpos[a % 2] < val[a][a % 2];
                                                else
-                                                       ok = tpos[a%2] > val[a][a%2];
+                                                       ok = tpos[a % 2] > val[a][a % 2];
 
                                                if (ok) {
                                                        copy_v2_v2(val[a], tpos);
@@ -1310,11 +1313,11 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
                                                                        pos[0] = stroke->points[i].x * width;
                                                                        pos[1] = stroke->points[i].y * height * aspy;
 
-                                                                       npos[0] = stroke->points[i+1].x * width;
-                                                                       npos[1] = stroke->points[i+1].y * height * aspy;
+                                                                       npos[0] = stroke->points[i + 1].x * width;
+                                                                       npos[1] = stroke->points[i + 1].y * height * aspy;
 
                                                                        len = len_v2v2(pos, npos);
-                                                                       steps = ceil(len/5.0f);
+                                                                       steps = ceil(len / 5.0f);
 
                                                                        /* we want to distort only long straight lines */
                                                                        if (stroke->totpoints == 2) {
@@ -1323,11 +1326,11 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
                                                                        }
 
                                                                        sub_v2_v2v2(dpos, npos, pos);
-                                                                       mul_v2_fl(dpos, 1.0f/steps);
+                                                                       mul_v2_fl(dpos, 1.0f / steps);
 
                                                                        for (j = 0; j <= steps; j++) {
                                                                                BKE_tracking_apply_intrinsics(tracking, pos, tpos);
-                                                                               glVertex2f(tpos[0]/width, tpos[1]/(height*aspy));
+                                                                               glVertex2f(tpos[0] / width, tpos[1] / (height*aspy));
 
                                                                                add_v2_v2(pos, dpos);
                                                                        }
@@ -1434,7 +1437,7 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
        if (onlyv2d) {
                /* if manual calibration is used then grease pencil data is already
                 * drawed in draw_distortion */
-               if ((sc->flag & SC_MANUAL_CALIBRATION)==0 || sc->mode != SC_MODE_DISTORTION) {
+               if ((sc->flag & SC_MANUAL_CALIBRATION) == 0 || sc->mode != SC_MODE_DISTORTION) {
                        ibuf = ED_space_clip_get_buffer(sc);
 
                        if (ibuf) {
index bd34a51819cd2501213cbc163d270542f7d2a2c8..94422e5189191835e12d5fd46d67ee1b0114216c 100644 (file)
@@ -162,7 +162,7 @@ void ED_space_clip_set(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *c
        }
 
        if (C)
-               WM_event_add_notifier(C, NC_MOVIECLIP|NA_SELECTED, sc->clip);
+               WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, sc->clip);
 }
 
 MovieClip *ED_space_clip(SpaceClip *sc)
@@ -220,8 +220,8 @@ void ED_space_clip_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy)
 
        ED_space_clip_size(sc, &width, &height);
 
-       *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1)/(float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin)*width);
-       *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1)/(float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)*height);
+       *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
+       *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height);
 }
 
 void ED_space_clip_aspect(SpaceClip *sc, float *aspx, float *aspy)
@@ -317,7 +317,8 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
                return FALSE;
 
        /* center view */
-       clip_view_center_to_point(sc, (max[0]+min[0])/(2*frame_width), (max[1]+min[1])/(2*frame_height));
+       clip_view_center_to_point(sc, (max[0] + min[0]) / (2 * frame_width),
+                                 (max[1] + min[1]) / (2 * frame_height));
 
        w = max[0] - min[0];
        h = max[1] - min[1];
@@ -337,7 +338,7 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
 
                newzoom = 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy));
 
-               if (fit || sc->zoom>newzoom)
+               if (fit || sc->zoom > newzoom)
                        sc->zoom = newzoom;
        }
 
index 9f9bdcb6cd2a9cff8e32882fab77086ed3089e87..853a7d7cad1195b97e4a299ce7561ad875898bcc 100644 (file)
@@ -81,7 +81,7 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float
        glPushMatrix();
 
        glTranslatef(x, y, 0.0f);
-       glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.0f);
+       glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f);
        glCallList(displist);
 
        glPopMatrix();
@@ -166,7 +166,8 @@ static void draw_tracks_curves(View2D *v2d, SpaceClip *sc)
 
        /* draw graph lines */
        glEnable(GL_BLEND);
-       clip_graph_tracking_values_iterate(sc, act_track, tracking_segment_point_cb, tracking_segment_start_cb, tracking_segment_end_cb);
+       clip_graph_tracking_values_iterate(sc, act_track, tracking_segment_point_cb,
+                                       tracking_segment_start_cb, tracking_segment_end_cb);
        glDisable(GL_BLEND);
 
        /* selected knot handles on top of curves */
@@ -183,10 +184,10 @@ static void draw_frame_curves(SpaceClip *sc)
 
        glColor3f(0.0f, 0.0f, 1.0f);
 
-       for (i = 0; i<reconstruction->camnr; i++) {
+       for (i = 0; i < reconstruction->camnr; i++) {
                MovieReconstructedCamera *camera = &reconstruction->cameras[i];
 
-               if (lines && camera->framenr!=prevfra+1) {
+               if (lines && camera->framenr != prevfra + 1) {
                        glEnd();
                        lines = 0;
                }
index efe48cd4b3694b32dac300c9d9ac571ed766327e..10692ada5d9dd7ce1d2438cce76969f186bceb35 100644 (file)
@@ -144,7 +144,7 @@ static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *tr
        float d = dx * dx + dy * dy;
 
        if (data->marker == NULL || d < data->min_dist) {
-               float co[2]= {marker->framenr, val};
+               float co[2] = {marker->framenr, val};
 
                data->track = track;
                data->marker = marker;
@@ -252,7 +252,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
        }
 
        if (sel)
-               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+               WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -358,7 +358,7 @@ static int border_select_graph_exec(bContext *C, wmOperator *op)
        clip_graph_tracking_values_iterate_track(sc, act_track, &userdata, border_select_cb, NULL, NULL);
 
        if (userdata.change) {
-               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+               WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
                return OPERATOR_FINISHED;
        }
@@ -430,7 +430,7 @@ static int graph_select_all_markers_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+       WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -447,7 +447,7 @@ void CLIP_OT_graph_select_all_markers(wmOperatorType *ot)
        ot->poll = ED_space_clip_graph_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        WM_operator_properties_select_all(ot);
 }
@@ -481,7 +481,7 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /******************** delete knot operator ********************/
@@ -522,7 +522,7 @@ void CLIP_OT_graph_delete_knot(wmOperatorType *ot)
        ot->poll = ED_space_clip_graph_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /******************** view all operator ********************/
@@ -662,7 +662,7 @@ static int graph_disable_markers_exec(bContext *C, wmOperator *op)
 
        DAG_id_tag_update(&clip->id, 0);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -686,7 +686,7 @@ void CLIP_OT_graph_disable_markers(wmOperatorType *ot)
        ot->poll = ED_space_clip_graph_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute");
index 485830dbe6cf0ef0626b48ab56437f14f7565938..fb99bf37a24cf28e0b1d4ea18028169e7b21e886 100644 (file)
@@ -93,8 +93,8 @@ static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float locatio
        if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
                ED_space_clip_size(sc, &width, &height);
 
-               sc->xof += ((location[0] - 0.5f) * width-sc->xof) * (sc->zoom-oldzoom) / sc->zoom;
-               sc->yof += ((location[1] - 0.5f) * height-sc->yof) * (sc->zoom-oldzoom) / sc->zoom;
+               sc->xof += ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;
+               sc->yof += ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;
        }
 }
 
@@ -164,7 +164,8 @@ static int open_exec(bContext *C, wmOperator *op)
                if (op->customdata)
                        MEM_freeN(op->customdata);
 
-               BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", str, errno ? strerror(errno) : "Unsupported movie clip format");
+               BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", str,
+                           errno ? strerror(errno) : "Unsupported movie clip format");
 
                return OPERATOR_CANCELLED;
        }
@@ -188,7 +189,7 @@ static int open_exec(bContext *C, wmOperator *op)
                ED_space_clip_set(C, screen, sc, clip);
        }
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_ADDED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_ADDED, clip);
 
        MEM_freeN(op->customdata);
 
@@ -233,10 +234,11 @@ void CLIP_OT_open(wmOperatorType *ot)
        ot->cancel = open_cancel;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
-       WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+       WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE,
+                                      WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
 }
 
 /******************* reload clip operator *********************/
@@ -250,7 +252,7 @@ static int reload_exec(bContext *C, wmOperator *UNUSED(op))
 
        BKE_movieclip_reload(clip);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -412,7 +414,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot)
        ot->poll = ED_space_clip_view_clip_poll;
 
        /* flags */
-       ot->flag = OPTYPE_BLOCKING;
+       ot->flag = OPTYPE _ BLOCKING;
 
        /* properties */
        RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -500,7 +502,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
 
        switch (event->type) {
                case MOUSEMOVE:
-                       factor = 1.0f + (vpd->x-event->x + vpd->y - event->y) / 300.0f;
+                       factor = 1.0f + (vpd->x - event->x + vpd->y - event->y) / 300.0f;
                        RNA_float_set(op->ptr, "factor", factor);
                        sclip_zoom_set(sc, ar, vpd->zoom * factor, vpd->location);
                        ED_region_tag_redraw(CTX_wm_region(C));
@@ -539,7 +541,7 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
        ot->poll = ED_space_clip_view_clip_poll;
 
        /* flags */
-       ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+       ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 
        /* properties */
        RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX,
@@ -586,7 +588,8 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot)
        ot->poll = ED_space_clip_view_clip_poll;
 
        /* properties */
-       RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
+       RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location",
+                            "Cursor location in screen coordinates", -10.0f, 10.0f);
 }
 
 static int view_zoom_out_exec(bContext *C, wmOperator *op)
@@ -627,7 +630,8 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot)
        ot->poll = ED_space_clip_view_clip_poll;
 
        /* properties */
-       RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
+       RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location",
+                            "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
 }
 
 /********************** view zoom ratio operator *********************/
@@ -781,7 +785,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
 
        /* do updates */
        sound_seek_scene(CTX_data_main(C), CTX_data_scene(C));
-       WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+       WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
 }
 
 static int change_frame_exec(bContext *C, wmOperator *op)
@@ -867,7 +871,7 @@ void CLIP_OT_change_frame(wmOperatorType *ot)
        ot->poll = change_frame_poll;
 
        /* flags */
-       ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
+       ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
 
        /* rna */
        RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
@@ -904,16 +908,16 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto
        int size_nr = undistort ? 1 : 0;
 
        if (size_flag & size_flags[size_nr][0])
-               build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25;
+               build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_25;
 
        if (size_flag & size_flags[size_nr][1])
-               build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_50;
+               build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_50;
 
        if (size_flag & size_flags[size_nr][2])
-               build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_75;
+               build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_75;
 
        if (size_flag & size_flags[size_nr][3])
-               build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_100;
+               build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_100;
 
        return build_count;
 }
@@ -958,7 +962,8 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
                if (clip->source != MCLIP_SRC_MOVIE)
                        BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, NULL, cfra, build_sizes, build_count, 0);
 
-               BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1);
+               BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra,
+                                               build_undistort_sizes, build_undistort_count, 1);
 
                if (*stop || G.afbreek)
                        break;
@@ -986,7 +991,7 @@ static void proxy_endjob(void *pjv)
 
        BKE_movieclip_reload(pj->clip);
 
-       WM_main_add_notifier(NC_MOVIECLIP|ND_DISPLAY, pj->clip);
+       WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, pj->clip);
 }
 
 static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1015,7 +1020,7 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
        }
 
        WM_jobs_customdata(steve, pj, proxy_freejob);
-       WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|ND_DISPLAY, 0);
+       WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
        WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
 
        G.afbreek = 0;
@@ -1057,7 +1062,7 @@ static int mode_set_exec(bContext *C, wmOperator *op)
                sc->mode = mode;
        }
 
-       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CLIP, NULL);
+       WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -1094,14 +1099,14 @@ void ED_operatormacros_clip(void)
        wmOperatorTypeMacro *otmacro;
 
        ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move",
-                                         "Add new marker and move it on movie", OPTYPE_UNDO|OPTYPE_REGISTER);
+                                         "Add new marker and move it on movie", OPTYPE_UNDO | OPTYPE_REGISTER);
        WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
        otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
        RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
 
        ot = WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide",
                                          "Add new marker and slide it with mouse until mouse button release",
-                                         OPTYPE_UNDO|OPTYPE_REGISTER);
+                                         OPTYPE_UNDO | OPTYPE_REGISTER);
        WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
        otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
        RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE);
index da8bf8fedd9efd0ef8438433dded3a49a4a1cccf..3ffba75f2efaf44f7fc9bd3c92762868dd2084a7 100644 (file)
@@ -151,7 +151,7 @@ static ARegion *clip_has_tools_region(ScrArea *sa)
 
                BLI_insertlinkafter(&sa->regionbase, artool, arprops);
                arprops->regiontype = RGN_TYPE_TOOL_PROPS;
-               arprops->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+               arprops->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
        }
 
        return artool;
index 2545106d132ba28d0386713474638ff7f7d3db8d..4142c30d825dad94bbdf495264ded1b1e42813f5 100644 (file)
@@ -190,20 +190,21 @@ void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, Movie
        BKE_tracking_free_track(track);
        BLI_freelinkN(tracksbase, track);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
 
        if (update_stab) {
                tracking->stabilization.ok = FALSE;
-               WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
+               WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
        }
 
        DAG_id_tag_update(&clip->id, 0);
 
        if (has_bundle)
-               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+               WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 }
 
-void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase, MovieTrackingTrack *track, MovieTrackingMarker *marker)
+void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase,
+                        MovieTrackingTrack *track, MovieTrackingMarker *marker)
 {
        if (track->markersnr == 1) {
                clip_delete_track(C, clip, tracksbase, track);
@@ -211,7 +212,7 @@ void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase, Movi
        else {
                BKE_tracking_delete_marker(track, marker->framenr);
 
-               WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+               WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
        }
 }
 
@@ -253,7 +254,7 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
 
        /* because the frame number text is subject to the same scaling as the contents of the view */
        UI_view2d_getscale(v2d, &xscale, &yscale);
-       glScalef(1.0f/xscale, 1.0f, 1.0f);
+       glScalef(1.0f / xscale, 1.0f, 1.0f);
 
        clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);
 
index 1c0d2db91a90315b288f4d1156214989eec21e8d..a3e17d420b316299e3874a86c9678810cf8811c7 100644 (file)
@@ -81,7 +81,7 @@ static void init_preview_region(const bContext *C, ARegion *ar)
 
        if (sc->view == SC_VIEW_DOPESHEET) {
                ar->v2d.tot.xmin = -10.0f;
-               ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+               ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
                ar->v2d.tot.xmax = (float)(sa->winx);
                ar->v2d.tot.ymax = 0.0f;
 
@@ -95,7 +95,7 @@ static void init_preview_region(const bContext *C, ARegion *ar)
 
                ar->v2d.minzoom = 0.01f;
                ar->v2d.maxzoom = 50;
-               ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+               ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
                ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
                ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
                ar->v2d.keepofs = V2D_KEEPOFS_Y;
@@ -116,8 +116,8 @@ static void init_preview_region(const bContext *C, ARegion *ar)
                ar->v2d.max[0] = MAXFRAMEF;
                ar->v2d.max[1] = FLT_MAX;
 
-               ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
-               ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
+               ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
+               ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
 
                ar->v2d.minzoom = 0.0f;
                ar->v2d.maxzoom = 0.0f;
@@ -232,7 +232,8 @@ static SpaceLink *clip_new(const bContext *C)
 
        sc = MEM_callocN(sizeof(SpaceClip), "initclip");
        sc->spacetype = SPACE_CLIP;
-       sc->flag = SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES;
+       sc->flag = SC_SHOW_MARKER_PATTERN | SC_SHOW_TRACK_PATH | SC_MANUAL_CALIBRATION |
+                  SC_SHOW_GRAPH_TRACKS | SC_SHOW_GRAPH_FRAMES;
        sc->zoom = 1.0f;
        sc->path_length = 20;
        sc->scopes.track_preview_height = 120;
@@ -256,7 +257,7 @@ static SpaceLink *clip_new(const bContext *C)
 
        BLI_addtail(&sc->regionbase, ar);
        ar->regiontype = RGN_TYPE_TOOL_PROPS;
-       ar->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+       ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
 
        /* properties view */
        ar = MEM_callocN(sizeof(ARegion), "properties for clip");
@@ -369,12 +370,12 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
                        }
                        break;
                 case NC_SCREEN:
-                       if (wmn->data ==ND_ANIMPLAY) {
+                       if (wmn->data == ND_ANIMPLAY) {
                                ED_area_tag_redraw(sa);
                        }
                        break;
                case NC_SPACE:
-                       if (wmn->data ==ND_SPACE_CLIP) {
+                       if (wmn->data == ND_SPACE_CLIP) {
                                clip_scopes_tag_refresh(sa);
                                clip_stabilization_tag_refresh(sa);
                                ED_area_tag_redraw(sa);
@@ -512,7 +513,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_CTRL, 0);
        RNA_boolean_set(kmi->ptr, "backwards", FALSE);
        RNA_boolean_set(kmi->ptr, "sequence", TRUE);
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+       kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
        RNA_boolean_set(kmi->ptr, "backwards", TRUE);
        RNA_boolean_set(kmi->ptr, "sequence", TRUE);
 
@@ -560,16 +561,16 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "CLIP_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
 
        /* jump to special frame */
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+       kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "position", 0);
 
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+       kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "position", 1);
 
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+       kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "position", 2);
 
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+       kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "position", 3);
 
        /* "timeline" */
@@ -645,7 +646,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
        RNA_boolean_set(kmi->ptr, "clear_active", FALSE);
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+       kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
        RNA_boolean_set(kmi->ptr, "clear_active", FALSE);
 
@@ -690,7 +691,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
        RNA_boolean_set(kmi->ptr, "clear_active", TRUE);
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+       kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
        RNA_boolean_set(kmi->ptr, "clear_active", TRUE);
 
@@ -708,7 +709,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        RNA_boolean_set(kmi->ptr, "extend", TRUE);      /* toggle */
 }
 
-const char *clip_context_dir[]= {"edit_movieclip", NULL};
+const char *clip_context_dir[] = {"edit_movieclip", NULL};
 
 static int clip_context(const bContext *C, const char *member, bContextDataResult *result)
 {
@@ -879,8 +880,8 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
                        ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED;
                        view_changed = TRUE;
                }
-               if (ar_tool_props && (ar_tool_props->alignment != (RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV))) {
-                       ar_tool_props->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+               if (ar_tool_props && (ar_tool_props->alignment != (RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV))) {
+                       ar_tool_props->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
                        view_changed = TRUE;
                }
        }
@@ -984,8 +985,8 @@ static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar)
        ar->v2d.mask.ymax = winy;
 
        /* which part of the image space do we see? */
-       x1 = ar->winrct.xmin + (winx-sc->zoom * w) / 2.0f;
-       y1 = ar->winrct.ymin + (winy-sc->zoom * h) / 2.0f;
+       x1 = ar->winrct.xmin + (winx - sc->zoom * w) / 2.0f;
+       y1 = ar->winrct.ymin + (winy - sc->zoom * h) / 2.0f;
 
        x1 -= sc->zoom * sc->xof;
        y1 -= sc->zoom * sc->yof;
@@ -1146,7 +1147,8 @@ static void dopesheet_area_draw(const bContext *C, ARegion *ar)
 
        /* time grid */
        unit = (sc->flag & SC_SHOW_SECONDS)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES;
-       grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
+       grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP,
+                                  V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
        UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
        UI_view2d_grid_free(grid);
 
@@ -1298,11 +1300,11 @@ static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn)
        /* context changes */
        switch (wmn->category) {
                case NC_SCREEN:
-                       if (wmn->data ==ND_GPENCIL)
+                       if (wmn->data == ND_GPENCIL)
                                ED_region_tag_redraw(ar);
                        break;
                case NC_BRUSH:
-                       if (wmn->action ==NA_EDITED)
+                       if (wmn->action == NA_EDITED)
                                ED_region_tag_redraw(ar);
                        break;
        }
@@ -1336,7 +1338,7 @@ void ED_spacetype_clip(void)
        art->init = clip_main_area_init;
        art->draw = clip_main_area_draw;
        art->listener = clip_main_area_listener;
-       art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_GPENCIL;
+       art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_GPENCIL;
 
        BLI_addhead(&st->regiontypes, art);
 
@@ -1347,7 +1349,7 @@ void ED_spacetype_clip(void)
        art->init = clip_preview_area_init;
        art->draw = clip_preview_area_draw;
        art->listener = clip_preview_area_listener;
-       art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
 
        BLI_addhead(&st->regiontypes, art);
 
@@ -1355,7 +1357,7 @@ void ED_spacetype_clip(void)
        art = MEM_callocN(sizeof(ARegionType), "spacetype clip region properties");
        art->regionid = RGN_TYPE_UI;
        art->prefsizex = UI_COMPACT_PANEL_WIDTH;
-       art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
+       art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI;
        art->init = clip_properties_area_init;
        art->draw = clip_properties_area_draw;
        art->listener = clip_properties_area_listener;
@@ -1366,7 +1368,7 @@ void ED_spacetype_clip(void)
        art = MEM_callocN(sizeof(ARegionType), "spacetype clip region tools");
        art->regionid = RGN_TYPE_TOOLS;
        art->prefsizex = UI_COMPACT_PANEL_WIDTH;
-       art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
+       art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI;
        art->listener = clip_props_area_listener;
        art->init = clip_tools_area_init;
        art->draw = clip_tools_area_draw;
@@ -1378,7 +1380,7 @@ void ED_spacetype_clip(void)
        art->regionid = RGN_TYPE_TOOL_PROPS;
        art->prefsizex = 0;
        art->prefsizey = 120;
-       art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
+       art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI;
        art->listener = clip_props_area_listener;
        art->init = clip_tools_area_init;
        art->draw = clip_tools_area_draw;
@@ -1390,7 +1392,7 @@ void ED_spacetype_clip(void)
        art = MEM_callocN(sizeof(ARegionType), "spacetype clip region");
        art->regionid = RGN_TYPE_HEADER;
        art->prefsizey = HEADERY;
-       art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
+       art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
 
        art->init = clip_header_area_init;
        art->draw = clip_header_area_draw;
@@ -1403,7 +1405,7 @@ void ED_spacetype_clip(void)
        art = MEM_callocN(sizeof(ARegionType), "spacetype clip channels region");
        art->regionid = RGN_TYPE_CHANNELS;
        art->prefsizex = UI_COMPACT_PANEL_WIDTH;
-       art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
+       art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI;
        art->listener = clip_channels_area_listener;
        art->init = clip_channels_area_init;
        art->draw = clip_channels_area_draw;
index 56f50d41a128e6cb018c435a1ccfdef7d0085982..8e11269254f298c0827c75899fd17c563eec1902 100644 (file)
@@ -116,7 +116,7 @@ static int add_marker_exec(bContext *C, wmOperator *op)
        sc->xlockof = 0;
        sc->ylockof = 0;
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -145,7 +145,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_size_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MIN, FLT_MAX,
@@ -190,7 +190,7 @@ void CLIP_OT_delete_track(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** delete marker operator *********************/
@@ -211,7 +211,7 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
                        MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, framenr);
 
                        if (marker) {
-                               has_selection |= track->markersnr>1;
+                               has_selection |= track->markersnr > 1;
 
                                clip_delete_marker(C, clip, tracksbase, track, marker);
                        }
@@ -241,7 +241,7 @@ void CLIP_OT_delete_marker(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** slide marker operator *********************/
@@ -357,8 +357,8 @@ static int mouse_on_corner(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki
                inside = co[0] >= crn[0] - dx && co[0] <= crn[0] + tdx && co[1] >= crn[1] - tdy && co[1] <= crn[1] + dy;
        }
        else {
-               crn[0] = marker->pos[0]+min[0];
-               crn[1] = marker->pos[1]+max[1];
+               crn[0] = marker->pos[0] + min[0];
+               crn[1] = marker->pos[1] + max[1];
 
                inside = co[0] >= crn[0] - dx && co[0] <= crn[0] + dx && co[1] >= crn[1] - dy && co[1] <= crn[1] + dy;
        }
@@ -374,7 +374,7 @@ static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki
        add_v2_v2v2(pos, marker->pos, track->offset);
 
        dx = 12.0f / width / sc->zoom;
-       dy = 12.0f / height /sc->zoom;
+       dy = 12.0f / height / sc->zoom;
 
        dx = MIN2(dx, (track->pat_max[0] - track->pat_min[0]) / 2.0f);
        dy = MIN2(dy, (track->pat_max[1] - track->pat_min[1]) / 2.0f);
@@ -421,21 +421,26 @@ static void *slide_marker_customdata(bContext *C, wmEvent *event)
                        if ((marker->flag & MARKER_DISABLED) == 0) {
                                if (!customdata)
                                        if (mouse_on_offset(sc, track, marker, co, width, height))
-                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT, SLIDE_ACTION_POS, width, height);
+                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT,
+                                                                                     SLIDE_ACTION_POS, width, height);
 
                                if (sc->flag & SC_SHOW_MARKER_SEARCH) {
                                        if (mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 1, width, height))
-                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_OFFSET, width, height);
+                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH,
+                                                                                     SLIDE_ACTION_OFFSET, width, height);
                                        else if (mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 0, width, height))
-                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_SIZE, width, height);
+                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH,
+                                                                                     SLIDE_ACTION_SIZE, width, height);
                                }
 
                                if (!customdata && (sc->flag & SC_SHOW_MARKER_PATTERN)) {
                                        if (mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 1,  width, height))
-                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_OFFSET, width, height);
+                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT,
+                                                              SLIDE_ACTION_OFFSET, width, height);
 
                                        if (!customdata && mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 0, width, height))
-                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_SIZE, width, height);
+                                               customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT,
+                                                                                     SLIDE_ACTION_SIZE, width, height);
                                }
 
                                if (customdata)
@@ -465,7 +470,7 @@ static int slide_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
                hide_cursor(C);
                WM_event_add_modal_handler(C, op);
 
-               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+               WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
                return OPERATOR_RUNNING_MODAL;
        }
@@ -490,7 +495,7 @@ static void cancel_mouse_slide(SlideMarkerData *data)
                else {
                        int a;
 
-                       for (a = 0; a<data->track->markersnr; a++)
+                       for (a = 0; a < data->track->markersnr; a++)
                                copy_v2_v2(data->track->markers[a].pos, data->smarkers[a]);
 
                        copy_v2_v2(data->offset, data->soff);
@@ -527,8 +532,8 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
                        /* no break! update area size */
 
                case MOUSEMOVE:
-                       mdelta[0] = event->mval[0]-data->mval[0];
-                       mdelta[1] = event->mval[1]-data->mval[1];
+                       mdelta[0] = event->mval[0] - data->mval[0];
+                       mdelta[1] = event->mval[1] - data->mval[1];
 
                        dx = mdelta[0] / data->width / sc->zoom;
 
@@ -554,7 +559,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
                                        data->marker->flag &= ~MARKER_TRACKED;
                                }
 
-                               WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+                               WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
                                DAG_id_tag_update(&sc->clip->id, 0);
                        }
                        else {
@@ -580,7 +585,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
                                        else {
                                                int a;
 
-                                               for (a = 0; a<data->track->markersnr; a++)
+                                               for (a = 0; a < data->track->markersnr; a++)
                                                        add_v2_v2v2(data->track->markers[a].pos, data->smarkers[a], d);
 
                                                sub_v2_v2v2(data->offset, data->soff, d);
@@ -591,7 +596,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
                                }
                        }
 
-                       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL);
+                       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
 
                        break;
 
@@ -613,7 +618,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
 
                        show_cursor(C);
 
-                       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL);
+                       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
 
                        return OPERATOR_CANCELLED;
        }
@@ -634,7 +639,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
        ot->modal = slide_marker_modal;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING;
 
        /* properties */
        RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -657,10 +662,10 @@ static int mouse_on_side(float co[2], float x1, float y1, float x2, float y2, fl
 
 static int mouse_on_rect(float co[2], float pos[2], float min[2], float max[2], float epsx, float epsy)
 {
-       return mouse_on_side(co, pos[0]+min[0], pos[1]+min[1], pos[0]+max[0], pos[1]+min[1], epsx, epsy) ||
-              mouse_on_side(co, pos[0]+min[0], pos[1]+min[1], pos[0]+min[0], pos[1]+max[1], epsx, epsy) ||
-              mouse_on_side(co, pos[0]+min[0], pos[1]+max[1], pos[0]+max[0], pos[1]+max[1], epsx, epsy) ||
-              mouse_on_side(co, pos[0]+max[0], pos[1]+min[1], pos[0]+max[0], pos[1]+max[1], epsx, epsy);
+       return mouse_on_side(co, pos[0] + min[0], pos[1] + min[1], pos[0] + max[0], pos[1] + min[1], epsx, epsy) ||
+              mouse_on_side(co, pos[0] + min[0], pos[1] + min[1], pos[0] + min[0], pos[1] + max[1], epsx, epsy) ||
+              mouse_on_side(co, pos[0] + min[0], pos[1] + max[1], pos[0] + max[0], pos[1] + max[1], epsx, epsy) ||
+              mouse_on_side(co, pos[0] + max[0], pos[1] + min[1], pos[0] + max[0], pos[1] + max[1], epsx, epsy);
 }
 
 static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *track)
@@ -671,9 +676,9 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac
 
        ED_space_clip_size(sc, &width, &height);
 
-       epsx = MIN4(track->pat_min[0]-track->search_min[0], track->search_max[0]-track->pat_max[0],
+       epsx = MIN4(track->pat_min[0] - track->search_min[0], track->search_max[0] - track->pat_max[0],
                   fabsf(track->pat_min[0]), fabsf(track->pat_max[0])) / 2;
-       epsy = MIN4(track->pat_min[1]-track->search_min[1], track->search_max[1]-track->pat_max[1],
+       epsy = MIN4(track->pat_min[1] - track->search_min[1], track->search_max[1] - track->pat_max[1],
                   fabsf(track->pat_min[1]), fabsf(track->pat_max[1])) / 2;
 
        epsx = MAX2(epsx, 2.0f / width);
@@ -684,7 +689,7 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac
                        return TRACK_AREA_SEARCH;
        }
 
-       if ((marker->flag & MARKER_DISABLED)== 0) {
+       if ((marker->flag & MARKER_DISABLED) == 0) {
                if (sc->flag & SC_SHOW_MARKER_PATTERN)
                        if (mouse_on_rect(co, marker->pos, track->pat_min, track->pat_max, epsx, epsy))
                                return TRACK_AREA_PAT;
@@ -692,8 +697,11 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac
                epsx = 12.0f / width;
                epsy = 12.0f / height;
 
-               if (fabsf(co[0]-marker->pos[0]-track->offset[0])< epsx && fabsf(co[1]-marker->pos[1]-track->offset[1])<=epsy)
+               if (fabsf(co[0] - marker->pos[0] - track->offset[0]) < epsx &&
+                   fabsf(co[1] - marker->pos[1] - track->offset[1]) <= epsy)
+               {
                        return TRACK_AREA_POINT;
+               }
        }
 
        return TRACK_AREA_NONE;
@@ -702,7 +710,7 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac
 static float dist_to_rect(float co[2], float pos[2], float min[2], float max[2])
 {
        float d1, d2, d3, d4;
-       float p[2] = {co[0]-pos[0], co[1]-pos[1]};
+       float p[2] = {co[0] - pos[0], co[1] - pos[1]};
        float v1[2] = {min[0], min[1]}, v2[2] = {max[0], min[1]},
              v3[2] = {max[0], max[1]}, v4[2] = {min[0], max[1]};
 
@@ -726,8 +734,9 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas
                if (((cur->flag & TRACK_HIDDEN) == 0) && MARKER_VISIBLE(sc, cur, marker)) {
                        float dist, d1, d2 = FLT_MAX, d3 = FLT_MAX;
 
-                       d1 = sqrtf((co[0]-marker->pos[0]-cur->offset[0])*(co[0]-marker->pos[0]-cur->offset[0])+
-                                         (co[1]-marker->pos[1]-cur->offset[1])*(co[1]-marker->pos[1]-cur->offset[1])); /* distance to marker point */
+                       /* distance to marker point */
+                       d1 = sqrtf((co[0] - marker->pos[0] - cur->offset[0]) * (co[0] - marker->pos[0] - cur->offset[0]) +
+                                         (co[1] - marker->pos[1] - cur->offset[1]) * (co[1] - marker->pos[1] - cur->offset[1]));
 
                        /* distance to pattern boundbox */
                        if (sc->flag & SC_SHOW_MARKER_PATTERN)
@@ -740,7 +749,7 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas
                        /* choose minimal distance. useful for cases of overlapped markers. */
                        dist = MIN3(d1, d2, d3);
 
-                       if (track == NULL || dist<mindist) {
+                       if (track == NULL || dist < mindist) {
                                track = cur;
                                mindist = dist;
                        }
@@ -791,7 +800,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
 
        BKE_tracking_dopesheet_tag_update(tracking);
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+       WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -821,7 +830,7 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
                        clip->tracking.act_track = slidedata->track;
 
-                       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+                       WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
                        MEM_freeN(slidedata);
 
@@ -890,7 +899,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
 
                        if (MARKER_VISIBLE(sc, track, marker)) {
                                if (BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
-                                       BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
+                                       BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode != GESTURE_MODAL_SELECT);
                                }
                                else if (!extend) {
                                        BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 1);
@@ -906,7 +915,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
        if (change) {
                BKE_tracking_dopesheet_tag_update(tracking);
 
-               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+               WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
                return OPERATOR_FINISHED;
        }
@@ -981,7 +990,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
                        MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
 
                        if (MARKER_VISIBLE(sc, track, marker) && marker_inside_ellipse(marker, offset, ellipse)) {
-                               BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
+                               BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode != GESTURE_MODAL_SELECT);
 
                                change = TRUE;
                        }
@@ -993,7 +1002,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
        if (change) {
                BKE_tracking_dopesheet_tag_update(tracking);
 
-               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+               WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
                return OPERATOR_FINISHED;
        }
@@ -1015,7 +1024,7 @@ void CLIP_OT_select_circle(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -1057,7 +1066,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
 
        track = tracksbase->first;
        while (track) {
-               if ((track->flag & TRACK_HIDDEN)==0) {
+               if ((track->flag & TRACK_HIDDEN) == 0) {
                        marker = BKE_tracking_get_marker(track, framenr);
 
                        if (MARKER_VISIBLE(sc, track, marker)) {
@@ -1092,7 +1101,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
 
        BKE_tracking_dopesheet_tag_update(tracking);
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+       WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -1109,7 +1118,7 @@ void CLIP_OT_select_all(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        WM_operator_properties_select_all(ot);
 }
@@ -1133,7 +1142,7 @@ static int select_groped_exec(bContext *C, wmOperator *op)
                marker = BKE_tracking_get_marker(track, sc->user.framenr);
 
                if (group == 0) { /* Keyframed */
-                       ok = marker->framenr == sc->user.framenr && (marker->flag & MARKER_TRACKED)==0;
+                       ok = marker->framenr == sc->user.framenr && (marker->flag & MARKER_TRACKED) == 0;
                }
                else if (group == 1) { /* Estimated */
                        ok = marker->framenr != sc->user.framenr;
@@ -1174,7 +1183,7 @@ static int select_groped_exec(bContext *C, wmOperator *op)
 
        BKE_tracking_dopesheet_tag_update(tracking);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -1202,7 +1211,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_size_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* proeprties */
        RNA_def_enum(ot->srna, "group", select_group_items, TRACK_CLEAR_REMAINED, "Action", "Clear action to execute");
@@ -1254,10 +1263,10 @@ static void clear_invisible_track_selection(SpaceClip *sc, MovieClip *clip)
        ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
        int hidden = 0;
 
-       if ((sc->flag & SC_SHOW_MARKER_PATTERN)==0)
+       if ((sc->flag & SC_SHOW_MARKER_PATTERN) == 0)
                hidden |= TRACK_AREA_PAT;
 
-       if ((sc->flag & SC_SHOW_MARKER_SEARCH)==0)
+       if ((sc->flag & SC_SHOW_MARKER_SEARCH) == 0)
                hidden |= TRACK_AREA_SEARCH;
 
        if (hidden) {
@@ -1284,7 +1293,7 @@ static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit
        track = tracksbase->first;
        while (track) {
                if (TRACK_VIEW_SELECTED(sc, track)) {
-                       if ((track->flag & TRACK_HIDDEN)==0 && (track->flag & TRACK_LOCKED)==0) {
+                       if ((track->flag & TRACK_HIDDEN) == 0 && (track->flag & TRACK_LOCKED) == 0) {
                                BKE_tracking_ensure_marker(track, framenr);
 
                                if (track->frames_limit) {
@@ -1391,15 +1400,15 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo
                        if (!BKE_tracking_next(tmj->context))
                                break;
 
-                       exec_time = PIL_check_seconds_timer()-start_time;
+                       exec_time = PIL_check_seconds_timer() - start_time;
                        if (tmj->delay > (float)exec_time)
-                               PIL_sleep_ms(tmj->delay-(float)exec_time);
+                               PIL_sleep_ms(tmj->delay - (float)exec_time);
                }
                else if (!BKE_tracking_next(tmj->context))
                                break;
 
                *do_update = TRUE;
-               *progress = (float)(framenr-tmj->sfra) / (tmj->efra-tmj->sfra);
+               *progress = (float)(framenr - tmj->sfra) / (tmj->efra - tmj->sfra);
 
                if (tmj->backwards)
                        framenr--;
@@ -1435,7 +1444,7 @@ static void track_markers_freejob(void *tmv)
 
        MEM_freeN(tmj);
 
-       WM_main_add_notifier(NC_SCENE|ND_FRAME, tmj->scene);
+       WM_main_add_notifier(NC_SCENE | ND_FRAME, tmj->scene);
 }
 
 static int track_markers_exec(bContext *C, wmOperator *op)
@@ -1450,7 +1459,7 @@ static int track_markers_exec(bContext *C, wmOperator *op)
        int sequence = RNA_boolean_get(op->ptr, "sequence");
        int frames_limit;
 
-       if (track_count_markers(sc, clip)==0)
+       if (track_count_markers(sc, clip) == 0)
                return OPERATOR_CANCELLED;
 
        track_init_markers(sc, clip, &frames_limit);
@@ -1462,8 +1471,10 @@ static int track_markers_exec(bContext *C, wmOperator *op)
 
        /* limit frames to be tracked by user setting */
        if (frames_limit) {
-               if (backwards) efra = MAX2(efra, sfra-frames_limit);
-               else efra = MIN2(efra, sfra+frames_limit);
+               if (backwards)
+                       efra = MAX2(efra, sfra - frames_limit);
+               else
+                       efra = MIN2(efra, sfra + frames_limit);
        }
 
        if (!track_markers_check_direction(backwards, framenr, efra))
@@ -1489,8 +1500,8 @@ static int track_markers_exec(bContext *C, wmOperator *op)
        /* update scene current frame to the lastes tracked frame */
        scene->r.cfra = framenr;
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
-       WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
 
        return OPERATOR_FINISHED;
 }
@@ -1513,7 +1524,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
        if (clip->tracking_context)
                return OPERATOR_CANCELLED;
 
-       if (track_count_markers(sc, clip)==0)
+       if (track_count_markers(sc, clip) == 0)
                return OPERATOR_CANCELLED;
 
        if (!sequence)
@@ -1534,8 +1545,10 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
         * with fixed FPS. To deal with editor refresh we have to synchronize
         * tracks from job and tracks in clip. Do this in timer callback
         * to prevent threading conflicts. */
-       if (tmj->delay>0) WM_jobs_timer(steve, tmj->delay/1000.0f, NC_MOVIECLIP|NA_EVALUATED, 0);
-       else WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|NA_EVALUATED, 0);
+       if (tmj->delay > 0)
+               WM_jobs_timer(steve, tmj->delay / 1000.0f, NC_MOVIECLIP | NA_EVALUATED, 0);
+       else
+               WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | NA_EVALUATED, 0);
 
        WM_jobs_callbacks(steve, track_markers_startjob, NULL, track_markers_updatejob, NULL);
 
@@ -1554,7 +1567,7 @@ static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
 {
        /* no running tracking, remove handler and pass through */
        if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
-               return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+               return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 
        /* running tracking */
        switch (event->type) {
@@ -1691,8 +1704,8 @@ static void solve_camera_freejob(void *scv)
 
        DAG_id_tag_update(&clip->id, 0);
 
-       WM_main_add_notifier(NC_MOVIECLIP|NA_EVALUATED, clip);
-       WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, NULL);
+       WM_main_add_notifier(NC_MOVIECLIP | NA_EVALUATED, clip);
+       WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, NULL);
 
        /* update active clip displayed in scene buttons */
        WM_main_add_notifier(NC_SCENE, scene);
@@ -1753,12 +1766,12 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 
        /* hide reconstruction statistics from previous solve */
        reconstruction->flag &= ~TRACKING_RECONSTRUCTED;
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
 
        /* setup job */
        steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
        WM_jobs_customdata(steve, scj, solve_camera_freejob);
-       WM_jobs_timer(steve, 0.1, NC_MOVIECLIP|NA_EVALUATED, 0);
+       WM_jobs_timer(steve, 0.1, NC_MOVIECLIP | NA_EVALUATED, 0);
        WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
 
        G.afbreek = 0;
@@ -1776,7 +1789,7 @@ static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *even
 {
        /* no running solver, remove handler and pass through */
        if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
-               return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+               return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 
        /* running tracking */
        switch (event->type) {
@@ -1802,7 +1815,7 @@ void CLIP_OT_solve_camera(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** clear solution operator *********************/
@@ -1832,8 +1845,8 @@ static int clear_solution_exec(bContext *C, wmOperator *UNUSED(op))
 
        DAG_id_tag_update(&clip->id, 0);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
-       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -1850,7 +1863,7 @@ void CLIP_OT_clear_solution(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** clear track operator *********************/
@@ -1878,7 +1891,7 @@ static int clear_track_path_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -1902,7 +1915,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* proeprties */
        RNA_def_enum(ot->srna, "action", clear_path_actions, TRACK_CLEAR_REMAINED, "Action", "Clear action to execute");
@@ -1921,7 +1934,7 @@ static int disable_markers_exec(bContext *C, wmOperator *op)
        int action = RNA_enum_get(op->ptr, "action");
 
        while (track) {
-               if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+               if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) {
                        MovieTrackingMarker *marker = BKE_tracking_ensure_marker(track, sc->user.framenr);
 
                        if (action == 0)
@@ -1936,7 +1949,7 @@ static int disable_markers_exec(bContext *C, wmOperator *op)
 
        DAG_id_tag_update(&clip->id, 0);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -1960,7 +1973,7 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute");
@@ -1973,13 +1986,13 @@ static Object *get_camera_with_movieclip(Scene *scene, MovieClip *clip)
        Object *camera = scene->camera;
        Base *base;
 
-       if (camera && BKE_object_movieclip_get(scene, camera, 0)==clip)
+       if (camera && BKE_object_movieclip_get(scene, camera, 0) == clip)
                return camera;
 
        base = scene->base.first;
        while (base) {
                if (base->object->type == OB_CAMERA) {
-                       if (BKE_object_movieclip_get(scene, base->object, 0)==clip) {
+                       if (BKE_object_movieclip_get(scene, base->object, 0) == clip) {
                                camera = base->object;
                                break;
                        }
@@ -2144,7 +2157,7 @@ static int set_origin_exec(bContext *C, wmOperator *op)
 
                track = track->next;
        }
-       mul_v3_fl(median, 1.0f/selected_count);
+       mul_v3_fl(median, 1.0f / selected_count);
 
        BKE_get_tracking_mat(scene, camera, mat);
 
@@ -2162,8 +2175,8 @@ static int set_origin_exec(bContext *C, wmOperator *op)
        DAG_id_tag_update(&clip->id, 0);
        DAG_id_tag_update(&object->id, OB_RECALC_OB);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
-       WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -2180,7 +2193,7 @@ void CLIP_OT_set_origin(wmOperatorType *ot)
        ot->poll = set_orientation_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_boolean(ot->srna, "use_median", 0, "Use Median", "Set origin to median point of selected bundles");
@@ -2254,7 +2267,7 @@ static void set_axis(Scene *scene,  Object *ob, MovieClip *clip, MovieTrackingOb
                else {
                        copy_v3_v3(mat[1], vec);
 
-                       if (is_camera || fabsf(vec[2])<1e-3f) {
+                       if (is_camera || fabsf(vec[2]) < 1e-3f) {
                                mat[1][2] = 0.0f;
                                mat[2][0] = 0.0f; mat[2][1] = 0.0f; mat[2][2] = 1.0f;
                                cross_v3_v3v3(mat[0], mat[1], mat[2]);
@@ -2318,7 +2331,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
                           {1.0f, 0.0f, 0.0f, 0.0f},
                           {0.0f, 0.0f, 0.0f, 1.0f}};   /* 90 degrees Y-axis rotation matrix */
 
-       if (count_selected_bundles(C)!=3) {
+       if (count_selected_bundles(C) != 3) {
                BKE_report(op->reports, RPT_ERROR, "Three tracks with bundles are needed to orient the floor");
 
                return OPERATOR_CANCELLED;
@@ -2339,7 +2352,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
 
        /* get 3 bundles to use as reference */
        track = tracksbase->first;
-       while (track && tot<3) {
+       while (track && tot < 3) {
                if (track->flag & TRACK_HAS_BUNDLE && TRACK_VIEW_SELECTED(sc, track)) {
                        mul_v3_m4v3(vec[tot], mat, track->bundle_pos);
 
@@ -2389,7 +2402,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
                BKE_object_apply_mat4(object, newmat, 0, 0);
 
                /* make camera have positive z-coordinate */
-               if (object->loc[2]<0) {
+               if (object->loc[2] < 0) {
                        invert_m4(rot);
                        mult_m4_m4m4(newmat, rot, mat);
                        BKE_object_apply_mat4(object, newmat, 0, 0);
@@ -2405,8 +2418,8 @@ static int set_plane_exec(bContext *C, wmOperator *op)
        DAG_id_tag_update(&clip->id, 0);
        DAG_id_tag_update(&object->id, OB_RECALC_OB);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
-       WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -2429,7 +2442,7 @@ void CLIP_OT_set_plane(wmOperatorType *ot)
        ot->poll = set_orientation_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_enum(ot->srna, "plane", plane_items, 0, "Plane", "Plane to be used for orientation");
@@ -2449,7 +2462,7 @@ static int set_axis_exec(bContext *C, wmOperator *op)
        ListBase *tracksbase;
        int axis = RNA_enum_get(op->ptr, "axis");
 
-       if (count_selected_bundles(C)!=1) {
+       if (count_selected_bundles(C) != 1) {
                BKE_report(op->reports, RPT_ERROR, "Single track with bundle should be selected to define axis");
 
                return OPERATOR_CANCELLED;
@@ -2477,8 +2490,8 @@ static int set_axis_exec(bContext *C, wmOperator *op)
        DAG_id_tag_update(&clip->id, 0);
        DAG_id_tag_update(&object->id, OB_RECALC_OB);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
-       WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -2501,7 +2514,7 @@ void CLIP_OT_set_axis(wmOperatorType *ot)
        ot->poll = set_orientation_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_enum(ot->srna, "axis", axis_actions, 0, "Axis", "Axis to use to align bundle along");
@@ -2551,7 +2564,7 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
 
        sub_v3_v3(vec[0], vec[1]);
 
-       if (len_v3(vec[0])>1e-5f) {
+       if (len_v3(vec[0]) > 1e-5f) {
                scale = dist / len_v3(vec[0]);
 
                if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
@@ -2561,7 +2574,7 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
                else if (!scale_solution) {
                        Object *solver_camera = object_solver_camera(scene, object);
 
-                       object->size[0] = object->size[1] = object->size[2] = 1.0f/scale;
+                       object->size[0] = object->size[1] = object->size[2] = 1.0f / scale;
 
                        if (solver_camera) {
                                object->size[0] /= solver_camera->size[0];
@@ -2578,8 +2591,8 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
                if (object)
                        DAG_id_tag_update(&object->id, OB_RECALC_OB);
 
-               WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
-               WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+               WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
+               WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
        }
 
        return OPERATOR_FINISHED;
@@ -2614,7 +2627,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
        ot->poll = set_orientation_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX,
@@ -2666,7 +2679,7 @@ void CLIP_OT_set_solution_scale(wmOperatorType *ot)
        ot->poll = set_solution_scale_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX,
@@ -2686,10 +2699,10 @@ static int set_center_principal_exec(bContext *C, wmOperator *UNUSED(op))
        if (width == 0 || height == 0)
                return OPERATOR_CANCELLED;
 
-       clip->tracking.camera.principal[0] = ((float)width)/2.0f;
-       clip->tracking.camera.principal[1] = ((float)height)/2.0f;
+       clip->tracking.camera.principal[0] = ((float)width) / 2.0f;
+       clip->tracking.camera.principal[1] = ((float)height) / 2.0f;
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -2706,7 +2719,7 @@ void CLIP_OT_set_center_principal(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** hide tracks operator *********************/
@@ -2745,7 +2758,7 @@ static int hide_tracks_exec(bContext *C, wmOperator *op)
 
        BKE_tracking_dopesheet_tag_update(tracking);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -2762,7 +2775,7 @@ void CLIP_OT_hide_tracks(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected tracks");
@@ -2787,7 +2800,7 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op))
 
        BKE_tracking_dopesheet_tag_update(tracking);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -2804,7 +2817,7 @@ void CLIP_OT_hide_tracks_clear(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** detect features operator *********************/
@@ -2862,7 +2875,7 @@ static int detect_features_exec(bContext *C, wmOperator *op)
 
        IMB_freeImBuf(ibuf);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -2886,7 +2899,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_frame_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_enum(ot->srna, "placement", placement_items, 0, "Placement", "Placement for detected features");
@@ -2914,8 +2927,8 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
 
                delta = pos == 1 ? 1 : -1;
 
-               while (sc->user.framenr+delta >= SFRA && sc->user.framenr+delta <= EFRA) {
-                       MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, sc->user.framenr+delta);
+               while (sc->user.framenr + delta >= SFRA && sc->user.framenr + delta <= EFRA) {
+                       MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, sc->user.framenr + delta);
 
                        if (!marker || marker->flag & MARKER_DISABLED)
                                break;
@@ -2933,7 +2946,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
 
                        a += delta;
 
-                       while (a+delta >= SFRA && a+delta <= EFRA) {
+                       while (a + delta >= SFRA && a + delta <= EFRA) {
                                MovieReconstructedCamera *cam;
 
                                cam = BKE_tracking_get_reconstructed_camera(tracking, object, a);
@@ -2953,10 +2966,10 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
                CFRA = sc->user.framenr;
                sound_seek_scene(CTX_data_main(C), CTX_data_scene(C));
 
-               WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+               WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
        }
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL);
+       WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -2981,7 +2994,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_enum(ot->srna, "position", position_items, 0, "Position", "Position to jump to");
@@ -3021,7 +3034,7 @@ static int join_tracks_exec(bContext *C, wmOperator *op)
                track = next;
        }
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -3038,7 +3051,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_size_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** lock tracks operator *********************/
@@ -3064,7 +3077,7 @@ static int lock_tracks_exec(bContext *C, wmOperator *op)
                track = track->next;
        }
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -3088,7 +3101,7 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Lock action to execute");
@@ -3121,7 +3134,7 @@ static int track_copy_color_exec(bContext *C, wmOperator *UNUSED(op))
                track = track->next;
        }
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -3138,7 +3151,7 @@ void CLIP_OT_track_copy_color(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** add 2d stabilization tracks operator *********************/
@@ -3155,7 +3168,7 @@ static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
 
        track = tracksbase->first;
        while (track) {
-               if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_USE_2D_STAB)==0) {
+               if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_USE_2D_STAB) == 0) {
                        track->flag |= TRACK_USE_2D_STAB;
                        stab->tot_track++;
 
@@ -3169,7 +3182,7 @@ static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
                stab->ok = 0;
 
                DAG_id_tag_update(&clip->id, 0);
-               WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
+               WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
        }
 
        return OPERATOR_FINISHED;
@@ -3187,7 +3200,7 @@ void CLIP_OT_stabilize_2d_add(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** remove 2d stabilization tracks operator *********************/
@@ -3211,7 +3224,7 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op))
                                stab->act_track--;
                                stab->tot_track--;
 
-                               if (stab->act_track<0)
+                               if (stab->act_track < 0)
                                        stab->act_track = 0;
 
                                update = 1;
@@ -3229,7 +3242,7 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op))
                stab->ok = 0;
 
                DAG_id_tag_update(&clip->id, 0);
-               WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
+               WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
        }
 
        return OPERATOR_FINISHED;
@@ -3247,7 +3260,7 @@ void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** select 2d stabilization tracks operator *********************/
@@ -3273,7 +3286,7 @@ static int stabilize_2d_select_exec(bContext *C, wmOperator *UNUSED(op))
        }
 
        if (update)
-               WM_event_add_notifier(C, NC_MOVIECLIP|ND_SELECT, clip);
+               WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -3290,7 +3303,7 @@ void CLIP_OT_stabilize_2d_select(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** set 2d stabilization rotation track operator *********************/
@@ -3309,7 +3322,7 @@ static int stabilize_2d_set_rotation_exec(bContext *C, wmOperator *UNUSED(op))
                stab->ok = 0;
 
                DAG_id_tag_update(&clip->id, 0);
-               WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
+               WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
        }
 
        return OPERATOR_FINISHED;
@@ -3327,7 +3340,7 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** clean tracks operator *********************/
@@ -3342,30 +3355,30 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
        if (del)
                new_markers = MEM_callocN(markersnr*sizeof(MovieTrackingMarker), "track cleaned markers");
 
-       for (a = 0; a<markersnr; a++) {
+       for (a = 0; a < markersnr; a++) {
                int end = 0;
 
                if (prev == -1) {
-                       if ((markers[a].flag & MARKER_DISABLED)==0)
+                       if ((markers[a].flag & MARKER_DISABLED) == 0)
                                prev = a;
                        else
                                start_disabled = 1;
                }
 
                if (prev >= 0) {
-                       end =  a == markersnr-1;
-                       end |= (a < markersnr-1) && (markers[a].framenr != markers[a+1].framenr-1 ||
-                                                    markers[a].flag & MARKER_DISABLED);
+                       end =  a == markersnr - 1;
+                       end |= (a < markersnr - 1) && (markers[a].framenr != markers[a + 1].framenr - 1 ||
+                                                      markers[a].flag & MARKER_DISABLED);
                }
 
                if (end) {
                        int segok = 1, len = 0;
 
-                       if (a != prev && markers[a].framenr != markers[a-1].framenr+1)
-                               len = a-prev;
+                       if (a != prev && markers[a].framenr != markers[a - 1].framenr + 1)
+                               len = a - prev;
                        else if (markers[a].flag & MARKER_DISABLED)
-                               len = a-prev;
-                       else len = a-prev+1;
+                               len = a - prev;
+                       else len = a - prev + 1;
 
                        if (frames) {
                                if (len < frames) {
@@ -3386,7 +3399,7 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
 
                                        /* place disabled marker in front of current segment */
                                        if (start_disabled) {
-                                               memcpy(new_markers+count, markers+prev, sizeof(MovieTrackingMarker));
+                                               memcpy(new_markers + count, markers + prev, sizeof(MovieTrackingMarker));
                                                new_markers[count].framenr--;
                                                new_markers[count].flag |= MARKER_DISABLED;
 
@@ -3394,7 +3407,7 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
                                                start_disabled = 0;
                                        }
 
-                                       memcpy(new_markers+count, markers+prev, t*sizeof(MovieTrackingMarker));
+                                       memcpy(new_markers + count, markers + prev, t * sizeof(MovieTrackingMarker));
                                        count += t;
                                }
                                else if (markers[a].flag & MARKER_DISABLED) {
@@ -3443,11 +3456,11 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
        while (track) {
                next = track->next;
 
-               if ((track->flag & TRACK_HIDDEN)==0 && (track->flag & TRACK_LOCKED)==0) {
+               if ((track->flag & TRACK_HIDDEN) == 0 && (track->flag & TRACK_LOCKED) == 0) {
                        int ok = 1;
 
                        ok = (is_track_clean(track, frames, action == TRACKING_CLEAN_DELETE_SEGMENT)) &&
-                           (error == 0.0f || (track->flag & TRACK_HAS_BUNDLE)==0  || track->error < error);
+                           (error == 0.0f || (track->flag & TRACK_HAS_BUNDLE) == 0  || track->error < error);
 
                        if (!ok) {
                                if (action == TRACKING_CLEAN_SELECT) {
@@ -3476,7 +3489,7 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
                track = next;
        }
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|ND_SELECT, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -3503,7 +3516,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
        static EnumPropertyItem actions_items[] = {
                        {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"},
                        {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"},
-                       {TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"},
+                       {TRACKING_CLEAN DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"},
                        {0, NULL, 0, NULL, NULL}
        };
 
@@ -3518,7 +3531,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
        RNA_def_int(ot->srna, "frames", 0, 0, INT_MAX, "Tracked Frames",
@@ -3538,7 +3551,7 @@ static int tracking_object_new_exec(bContext *C, wmOperator *UNUSED(op))
 
        BKE_tracking_new_object(tracking, "Object");
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -3555,7 +3568,7 @@ void CLIP_OT_tracking_object_new(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** remove tracking object *********************/
@@ -3576,7 +3589,7 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op)
 
        BKE_tracking_remove_object(tracking, object);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -3593,7 +3606,7 @@ void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
        ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** copy tracks to clipboard operator *********************/
@@ -3647,7 +3660,7 @@ static int paste_tracks_exec(bContext *C, wmOperator *UNUSED(op))
 
        BKE_tracking_clipboard_paste_tracks(tracking, object);
 
-       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+       WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
 
        return OPERATOR_FINISHED;
 }
@@ -3664,5 +3677,5 @@ void CLIP_OT_paste_tracks(wmOperatorType *ot)
        ot->poll = paste_tracks_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }