=bmesh= merge from trunk at r36529
[blender.git] / source / blender / editors / transform / transform_generics.c
index 11fd02b340e3d59c78e9a72050d7b6bd61d90ffa..9a19f1f3205ab9a9387e41ab6e3d5aef7b0e5acb 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file blender/editors/transform/transform_generics.c
+ *  \ingroup edtransform
+ */
+
+
 #include <string.h>
 #include <math.h>
 
@@ -67,6 +72,7 @@
 #include "BKE_mesh.h"
 #include "BKE_nla.h"
 #include "BKE_context.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_anim_api.h"
 #include "ED_armature.h"
@@ -109,19 +115,19 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3])
        if (t->persp != RV3D_ORTHO)
        {
                float p1[4], p2[4];
-               
+
                VECCOPY(p1, coord);
                p1[3] = 1.0f;
                VECCOPY(p2, p1);
                p2[3] = 1.0f;
                mul_m4_v4(t->viewmat, p2);
-               
+
                p2[0] = 2.0f * p2[0];
                p2[1] = 2.0f * p2[1];
                p2[2] = 2.0f * p2[2];
-               
+
                mul_m4_v4(t->viewinv, p2);
-               
+
                sub_v3_v3v3(vec, p1, p2);
        }
        else {
@@ -137,11 +143,11 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
        ModifierData *md= ob->modifiers.first;
        float tolerance[3] = {0.0f, 0.0f, 0.0f};
        int axis = 0;
-       
+
        for (; md; md=md->next) {
                if (md->type==eModifierType_Mirror) {
                        MirrorModifierData *mmd = (MirrorModifierData*) md;
-                       
+
                        if(mmd->flag & MOD_MIR_CLIPPING) {
                                axis = 0;
                                if(mmd->flag & MOD_MIR_AXIS_X) {
@@ -160,35 +166,35 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
                                        float mtx[4][4], imtx[4][4];
                                        int i;
                                        TransData *td = t->data;
-                                       
+
                                        if (mmd->mirror_ob) {
                                                float obinv[4][4];
-                                               
+
                                                invert_m4_m4(obinv, mmd->mirror_ob->obmat);
                                                mul_m4_m4m4(mtx, ob->obmat, obinv);
                                                invert_m4_m4(imtx, mtx);
                                        }
-                                       
+
                                        for(i = 0 ; i < t->total; i++, td++) {
                                                int clip;
                                                float loc[3], iloc[3];
-                                               
+
                                                if (td->flag & TD_NOACTION)
                                                        break;
                                                if (td->loc==NULL)
                                                        break;
-                                               
+
                                                if (td->flag & TD_SKIP)
                                                        continue;
-                                               
+
                                                copy_v3_v3(loc,  td->loc);
                                                copy_v3_v3(iloc, td->iloc);
-                                               
+
                                                if (mmd->mirror_ob) {
                                                        mul_m4_v3(mtx, loc);
                                                        mul_m4_v3(mtx, iloc);
                                                }
-                                               
+
                                                clip = 0;
                                                if(axis & 1) {
                                                        if(fabs(iloc[0])<=tolerance[0] ||
@@ -197,7 +203,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
                                                                clip = 1;
                                                        }
                                                }
-                                               
+
                                                if(axis & 2) {
                                                        if(fabs(iloc[1])<=tolerance[1] ||
                                                           loc[1]*iloc[1]<0.0f) {
@@ -220,19 +226,19 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
                                                }
                                        }
                                }
-                               
+
                        }
                }
        }
 }
 
 /* assumes obedit set to mesh object */
-static void editmesh_apply_to_mirror(TransInfo *t)
+static void editbmesh_apply_to_mirror(TransInfo *t)
 {
        TransData *td = t->data;
-       EditVert *eve;
+       BMVert *eve;
        int i;
-       
+
        for(i = 0 ; i < t->total; i++, td++) {
                if (td->flag & TD_NOACTION)
                        break;
@@ -240,7 +246,7 @@ static void editmesh_apply_to_mirror(TransInfo *t)
                        break;
                if (td->flag & TD_SKIP)
                        continue;
-               
+
                eve = td->extra;
                if (eve) {
                        eve->co[0]= -td->loc[0];
@@ -269,7 +275,7 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer)
         *      - we're not only keying for available channels
         *      - the option to add new actions for each round is not enabled
         */
-       if (IS_AUTOKEY_FLAG(INSERTAVAIL)==0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) {
+       if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)==0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) {
                /* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
                if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
                        AnimData *adt= BKE_animdata_from_id(id);
@@ -333,7 +339,7 @@ void recalcData(TransInfo *t)
                Scene *scene= t->scene;
                SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                
-               bAnimContext ac= {0};
+               bAnimContext ac= {NULL};
                ListBase anim_data = {NULL, NULL};
                bAnimListElem *ale;
                int filter;
@@ -349,22 +355,29 @@ void recalcData(TransInfo *t)
                
                ANIM_animdata_context_getdata(&ac);
                
-               /* get animdata blocks visible in editor, assuming that these will be the ones where things changed */
-               filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ANIMDATA);
-               ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-               
-               /* just tag these animdata-blocks to recalc, assuming that some data there changed 
-                * BUT only do this if realtime updates are enabled
-                */
-               if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) {
-                       for (ale= anim_data.first; ale; ale= ale->next) {
-                               /* set refresh tags for objects using this animation */
-                               ANIM_list_elem_update(t->scene, ale);
+               /* perform flush */
+               if (ac.datatype == ANIMCONT_GPENCIL) {
+                       /* flush transform values back to actual coordinates */
+                       flushTransGPactionData(t);
+               }
+               else {
+                       /* get animdata blocks visible in editor, assuming that these will be the ones where things changed */
+                       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ANIMDATA);
+                       ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+                       
+                       /* just tag these animdata-blocks to recalc, assuming that some data there changed 
+                        * BUT only do this if realtime updates are enabled
+                        */
+                       if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) {
+                               for (ale= anim_data.first; ale; ale= ale->next) {
+                                       /* set refresh tags for objects using this animation */
+                                       ANIM_list_elem_update(t->scene, ale);
+                               }
                        }
+                       
+                       /* now free temp channels */
+                       BLI_freelistN(&anim_data);
                }
-               
-               /* now free temp channels */
-               BLI_freelistN(&anim_data);
        }
        else if (t->spacetype == SPACE_IPO) {
                Scene *scene;
@@ -647,8 +660,7 @@ void recalcData(TransInfo *t)
                                                nu= nu->next;
                                        }
                                }
-                       }
-                       else if(t->obedit->type==OB_LATTICE) {
+                       } else if(t->obedit->type==OB_LATTICE) {
                                Lattice *la= t->obedit->data;
 
                                if(t->state != TRANS_CANCEL) {
@@ -660,18 +672,20 @@ void recalcData(TransInfo *t)
                                if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
                        }
                        else if (t->obedit->type == OB_MESH) {
-                               EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
+                               BMEditMesh *em = ((Mesh*)t->obedit->data)->edit_btmesh;
+
                                /* mirror modifier clipping? */
                                if(t->state != TRANS_CANCEL) {
                                        clipMirrorModifier(t, t->obedit);
                                        applyProject(t);
                                }
                                if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
-                                       editmesh_apply_to_mirror(t);
-                                       
+                                       editbmesh_apply_to_mirror(t);
+
                                DAG_id_tag_update(t->obedit->data, 0);  /* sets recalc flags */
-                               
-                               recalc_editnormals(em);
+
+                               EDBM_RecalcNormals(em);
+                               BMEdit_RecalcTesselation(em);
                        }
                        else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
                                bArmature *arm= t->obedit->data;
@@ -762,6 +776,7 @@ void recalcData(TransInfo *t)
                                }
                                DAG_id_tag_update(t->obedit->data, 0);  /* sets recalc flags */
                        }
+       
                }
                else if( (t->flag & T_POSE) && t->poseobj) {
                        Object *ob= t->poseobj;
@@ -841,18 +856,18 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
        if (t->spacetype == SPACE_VIEW3D)
        {
                View3D *v3d = t->view;
-               
+
                glPushMatrix();
-               
+
                //if(t->obedit) glLoadMatrixf(t->obedit->obmat);        // sets opengl viewing
-               
-               
+
+
                copy_v3_v3(v3, dir);
                mul_v3_fl(v3, v3d->far);
-               
+
                sub_v3_v3v3(v2, center, v3);
                add_v3_v3v3(v1, center, v3);
-               
+
                if (options & DRAWLIGHT) {
                        col[0] = col[1] = col[2] = 220;
                }
@@ -861,13 +876,13 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
                }
                UI_make_axis_color(col, col2, axis);
                glColor3ubv(col2);
-               
+
                setlinestyle(0);
                glBegin(GL_LINE_STRIP);
                        glVertex3fv(v1);
                        glVertex3fv(v2);
                glEnd();
-               
+
                glPopMatrix();
        }
 }
@@ -884,33 +899,33 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        ARegion *ar = CTX_wm_region(C);
        ScrArea *sa = CTX_wm_area(C);
        Object *obedit = CTX_data_edit_object(C);
-       
+
        /* moving: is shown in drawobject() (transform color) */
 //  TRANSFORM_FIX_ME
 //     if(obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
 //     else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
 //     else G.moving= G_TRANSFORM_OBJ;
-       
+
        t->scene = sce;
        t->sa = sa;
        t->ar = ar;
        t->obedit = obedit;
        t->settings = ts;
-       
+
        t->data = NULL;
        t->ext = NULL;
-       
+
        t->helpline = HLP_NONE;
-       
+
        t->flag = 0;
-       
+
        t->redraw = 1; /* redraw first time */
-       
+
        if (event)
        {
                t->imval[0] = event->x - t->ar->winrct.xmin;
                t->imval[1] = event->y - t->ar->winrct.ymin;
-               
+
                t->event_type = event->type;
        }
        else
@@ -918,30 +933,30 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                t->imval[0] = 0;
                t->imval[1] = 0;
        }
-       
+
        t->con.imval[0] = t->imval[0];
        t->con.imval[1] = t->imval[1];
-       
+
        t->mval[0] = t->imval[0];
        t->mval[1] = t->imval[1];
-       
+
        t->transform            = NULL;
        t->handleEvent          = NULL;
-       
+
        t->total                        = 0;
-       
+
        t->val = 0.0f;
-       
+
        t->vec[0]                       =
                t->vec[1]               =
                t->vec[2]               = 0.0f;
-       
+
        t->center[0]            =
                t->center[1]    =
                t->center[2]    = 0.0f;
-       
+
        unit_m3(t->mat);
-       
+
        /* if there's an event, we're modal */
        if (event) {
                t->flag |= T_MODAL;
@@ -952,14 +967,29 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                t->options |= CTX_EDGE;
        }
 
-       t->spacetype = sa->spacetype;
+
+       /* Assign the space type, some exceptions for running in different mode */
+       if(sa == NULL) {
+               /* background mode */
+               t->spacetype= SPACE_EMPTY;
+       }
+       else if ((ar == NULL) && (sa->spacetype == SPACE_VIEW3D)) {
+               /* running in the text editor */
+               t->spacetype= SPACE_EMPTY;
+       }
+       else {
+               /* normal operation */
+               t->spacetype= sa->spacetype;
+       }
+
+
        if(t->spacetype == SPACE_VIEW3D)
        {
                View3D *v3d = sa->spacedata.first;
-               
+
                t->view = v3d;
                t->animtimer= CTX_wm_screen(C)->animtimer;
-               
+
                /* turn manipulator off during transform */
                // FIXME: but don't do this when USING the manipulator...
                if (t->flag & T_MODAL) {
@@ -969,11 +999,11 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 
                if(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
                t->around = v3d->around;
-               
+
                if (op && RNA_struct_find_property(op->ptr, "constraint_orientation") && RNA_property_is_set(op->ptr, "constraint_orientation"))
                {
                        t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation");
-                       
+
                        if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C))
                        {
                                t->current_orientation = V3D_MANIP_GLOBAL;
@@ -983,14 +1013,27 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                {
                        t->current_orientation = v3d->twmode;
                }
+
+               /* exceptional case */
+               if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
+                       if(ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
+                               t->options |= CTX_NO_PET;
+                       }
+               }
        }
-       else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE)
+       else if(t->spacetype==SPACE_IMAGE)
        {
                SpaceImage *sima = sa->spacedata.first;
-               // XXX for now, get View2D  from the active region
+               // XXX for now, get View2D from the active region
                t->view = &ar->v2d;
                t->around = sima->around;
        }
+       else if(t->spacetype==SPACE_NODE)
+       {
+               // XXX for now, get View2D from the active region
+               t->view = &ar->v2d;
+               t->around = V3D_CENTER;
+       }
        else if(t->spacetype==SPACE_IPO) 
        {
                SpaceIpo *sipo= sa->spacedata.first;
@@ -1001,10 +1044,11 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        {
                // XXX for now, get View2D  from the active region
                t->view = &ar->v2d;
+
                // XXX for now, the center point is the midpoint of the data
                t->around = V3D_CENTER;
        }
-       
+
        if (op && RNA_property_is_set(op->ptr, "release_confirm"))
        {
                if (RNA_boolean_get(op->ptr, "release_confirm"))
@@ -1037,8 +1081,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                        t->mirror = 1;
                }
        }
-       
-       /* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
+
        if (op && RNA_struct_find_property(op->ptr, "proportional"))
        {
                if (RNA_property_is_set(op->ptr, "proportional"))
@@ -1108,7 +1151,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        setTransformViewMatrices(t);
        initNumInput(&t->num);
        initNDofInput(&t->ndof);
-       
+
        return 1;
 }
 
@@ -1116,7 +1159,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 void postTrans (bContext *C, TransInfo *t)
 {
        TransData *td;
-       
+
        if (t->draw_handle_view)
                ED_region_draw_cb_exit(t->ar->type, t->draw_handle_view);
        if (t->draw_handle_apply)
@@ -1137,7 +1180,7 @@ void postTrans (bContext *C, TransInfo *t)
        /* postTrans can be called when nothing is selected, so data is NULL already */
        if (t->data) {
                int a;
-               
+
                /* free data malloced per trans-data */
                for(a=0, td= t->data; a<t->total; a++, td++) {
                        if (td->flag & TD_BEZTRIPLE) 
@@ -1145,7 +1188,7 @@ void postTrans (bContext *C, TransInfo *t)
                }
                MEM_freeN(t->data);
        }
-       
+
        BLI_freelistN(&t->tsnap.points);
 
        if (t->ext) MEM_freeN(t->ext);
@@ -1153,7 +1196,7 @@ void postTrans (bContext *C, TransInfo *t)
                MEM_freeN(t->data2d);
                t->data2d= NULL;
        }
-       
+
        if(t->spacetype==SPACE_IMAGE) {
                SpaceImage *sima= t->sa->spacedata.first;
                if(sima->flag & SI_LIVE_UNWRAP)
@@ -1171,12 +1214,19 @@ void postTrans (bContext *C, TransInfo *t)
        {
                MEM_freeN(t->mouse.data);
        }
+
+       if (t->customFree) {
+               t->customFree(t);
+       }
+       else if (t->customData) {
+               MEM_freeN(t->customData);
+       }
 }
 
 void applyTransObjects(TransInfo *t)
 {
        TransData *td;
-       
+
        for (td = t->data; td < t->data + t->total; td++) {
                VECCOPY(td->iloc, td->loc);
                if (td->ext->rot) {
@@ -1212,16 +1262,16 @@ static void restoreElement(TransData *td) {
                if (td->ext->size) {
                        VECCOPY(td->ext->size, td->ext->isize);
                }
-               if (td->ext->quat) {
-                       QUATCOPY(td->ext->quat, td->ext->iquat);
+                       if (td->ext->quat) {
+                               QUATCOPY(td->ext->quat, td->ext->iquat);
+                       }
                }
-       }
-       
+
        if (td->flag & TD_BEZTRIPLE) {
                *(td->hdata->h1) = td->hdata->ih1;
                *(td->hdata->h2) = td->hdata->ih2;
        }
-}
+       }
 
 void restoreTransObjects(TransInfo *t)
 {
@@ -1231,7 +1281,7 @@ void restoreTransObjects(TransInfo *t)
        for (td = t->data; td < t->data + t->total; td++) {
                restoreElement(td);
        }
-       
+
        for (td2d=t->data2d; t->data2d && td2d < t->data2d + t->total; td2d++) {
                if (td2d->h1) {
                        td2d->h1[0] = td2d->ih1[0];
@@ -1244,7 +1294,7 @@ void restoreTransObjects(TransInfo *t)
        }
 
        unit_m3(t->mat);
-       
+
        recalcData(t);
 }
 
@@ -1253,7 +1303,7 @@ void calculateCenter2D(TransInfo *t)
        if (t->flag & (T_EDIT|T_POSE)) {
                Object *ob= t->obedit?t->obedit:t->poseobj;
                float vec[3];
-               
+
                VECCOPY(vec, t->center);
                mul_m4_v3(ob->obmat, vec);
                projectIntView(t, vec, t->center2d);
@@ -1266,21 +1316,21 @@ void calculateCenter2D(TransInfo *t)
 void calculateCenterCursor(TransInfo *t)
 {
        float *cursor;
-       
+
        cursor = give_cursor(t->scene, t->view);
        VECCOPY(t->center, cursor);
-       
+
        /* If edit or pose mode, move cursor in local space */
        if (t->flag & (T_EDIT|T_POSE)) {
                Object *ob = t->obedit?t->obedit:t->poseobj;
                float mat[3][3], imat[3][3];
-               
+
                sub_v3_v3v3(t->center, t->center, ob->obmat[3]);
                copy_m3_m4(mat, ob->obmat);
                invert_m3_m3(imat, mat);
                mul_m3_v3(imat, t->center);
        }
-       
+
        calculateCenter2D(t);
 }
 
@@ -1295,16 +1345,16 @@ void calculateCenterCursor2D(TransInfo *t)
                ED_space_image_uv_aspect(sima, &aspx, &aspy);
                cursor = sima->cursor;
        }
-       
+
        if (cursor) {
                t->center[0] = cursor[0] * aspx;
                t->center[1] = cursor[1] * aspy;
        }
-       
+
        calculateCenter2D(t);
 }
 
-void calculateCenterCursorGraph2D(TransInfo *t)
+static void calculateCenterCursorGraph2D(TransInfo *t)
 {
        SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
        Scene *scene= t->scene;
@@ -1321,7 +1371,7 @@ void calculateCenterMedian(TransInfo *t)
        float partial[3] = {0.0f, 0.0f, 0.0f};
        int total = 0;
        int i;
-       
+
        for(i = 0; i < t->total; i++) {
                if (t->data[i].flag & TD_SELECTED) {
                        if (!(t->data[i].flag & TD_NOCENTER))
@@ -1341,7 +1391,7 @@ void calculateCenterMedian(TransInfo *t)
        if(i)
                mul_v3_fl(partial, 1.0f / total);
        VECCOPY(t->center, partial);
-       
+
        calculateCenter2D(t);
 }
 
@@ -1371,7 +1421,7 @@ void calculateCenterBound(TransInfo *t)
        }
        add_v3_v3v3(t->center, min, max);
        mul_v3_fl(t->center, 0.5);
-       
+
        calculateCenter2D(t);
 }
 
@@ -1403,16 +1453,16 @@ void calculateCenter(TransInfo *t)
                /* EDIT MODE ACTIVE EDITMODE ELEMENT */
 
                if (t->obedit && t->obedit->type == OB_MESH) {
-                       EditSelection ese;
-                       EditMesh *em = BKE_mesh_get_editmesh(t->obedit->data);
+                       BMEditSelection ese;
+                       BMEditMesh *em = ((Mesh*)t->obedit->data)->edit_btmesh;
                        
-                       if (EM_get_actSelection(em, &ese)) {
-                               EM_editselection_center(t->center, &ese);
-                               calculateCenter2D(t);
-                               break;
+                       if (EDBM_get_actSelection(em, &ese)) {
+                       EDBM_editselection_center(em, t->center, &ese);
+                       calculateCenter2D(t);
+                       break;
                        }
                } /* END EDIT MODE ACTIVE ELEMENT */
-               
+
                calculateCenterMedian(t);
                if((t->flag & (T_EDIT|T_POSE))==0)
                {
@@ -1424,10 +1474,10 @@ void calculateCenter(TransInfo *t)
                                projectIntView(t, t->center, t->center2d);
                        }
                }
-               
+
                }
        }
-       
+
        /* setting constraint center */
        VECCOPY(t->con.center, t->center);
        if(t->flag & (T_EDIT|T_POSE))
@@ -1435,7 +1485,7 @@ void calculateCenter(TransInfo *t)
                Object *ob= t->obedit?t->obedit:t->poseobj;
                mul_m4_v3(ob->obmat, t->con.center);
        }
-       
+
        /* for panning from cameraview */
        if(t->flag & T_OBJECT)
        {
@@ -1444,21 +1494,21 @@ void calculateCenter(TransInfo *t)
                        View3D *v3d = t->view;
                        Scene *scene = t->scene;
                        RegionView3D *rv3d = t->ar->regiondata;
-                       
+
                        if(v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
                        {
                                float axis[3];
                                /* persinv is nasty, use viewinv instead, always right */
                                VECCOPY(axis, t->viewinv[2]);
                                normalize_v3(axis);
-                               
+
                                /* 6.0 = 6 grid units */
                                axis[0]= t->center[0]- 6.0f*axis[0];
                                axis[1]= t->center[1]- 6.0f*axis[1];
                                axis[2]= t->center[2]- 6.0f*axis[2];
-                               
+
                                projectIntView(t, axis, t->center2d);
-                               
+
                                /* rotate only needs correct 2d center, grab needs initgrabz() value */
                                if(t->mode==TFM_TRANSLATION)
                                {
@@ -1468,14 +1518,14 @@ void calculateCenter(TransInfo *t)
                        }
                }
        }
-       
+
        if(t->spacetype==SPACE_VIEW3D)
        {
                /* initgrabz() defines a factor for perspective depth correction, used in window_to_3d_delta() */
                if(t->flag & (T_EDIT|T_POSE)) {
                        Object *ob= t->obedit?t->obedit:t->poseobj;
                        float vec[3];
-                       
+
                        VECCOPY(vec, t->center);
                        mul_m4_v3(ob->obmat, vec);
                        initgrabz(t->ar->regiondata, vec[0], vec[1], vec[2]);
@@ -1520,7 +1570,7 @@ void calculatePropRatio(TransInfo *t)
                        else {
                                /* Use rdist for falloff calculations, it is the real distance */
                                td->flag &= ~TD_NOACTION;
-                               
+
                                if (connected)
                                        dist= (t->prop_size-td->dist)/t->prop_size;
                                else
@@ -1533,7 +1583,7 @@ void calculatePropRatio(TransInfo *t)
                                 */
                                if (dist < 0.0f)
                                        dist = 0.0f;
-                               
+
                                switch(t->prop_mode) {
                                case PROP_SHARP:
                                        td->factor= dist*dist;