svn merge -r38971:38972 https://svn.blender.org/svnroot/bf-blender/trunk/blender...
[blender.git] / source / blender / editors / transform / transform.c
index fd2bb59294bb81840a010272d33f391c0b756d3b..6e9b78011a6dea6507024150f75c21786b3dd620 100644 (file)
@@ -124,12 +124,14 @@ void setTransformViewMatrices(TransInfo *t)
        calculateCenter2D(t);
 }
 
-void convertViewVec(TransInfo *t, float *vec, short dx, short dy)
+void convertViewVec(TransInfo *t, float *vec, int dx, int dy)
 {
        if (t->spacetype==SPACE_VIEW3D) {
-               if (t->ar->regiontype == RGN_TYPE_WINDOW)
-               {
-                       window_to_3d_delta(t->ar, vec, dx, dy);
+               if (t->ar->regiontype == RGN_TYPE_WINDOW) {
+                       float mval_f[2];
+                       mval_f[0]= dx;
+                       mval_f[1]= dy;
+                       ED_view3d_win_to_delta(t->ar, mval_f, vec);
                }
        }
        else if(t->spacetype==SPACE_IMAGE) {
@@ -571,8 +573,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                if (t->modifiers & MOD_CONSTRAINT_SELECT)
                        t->con.mode |= CON_SELECT;
 
-               t->mval[0] = event->x - t->ar->winrct.xmin;
-               t->mval[1] = event->y - t->ar->winrct.ymin;
+               VECCOPY2D(t->mval, event->mval);
 
                // t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */
                t->redraw |= TREDRAW_HARD;
@@ -787,7 +788,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                case SPACEKEY:
                        if ((t->spacetype==SPACE_VIEW3D) && event->alt) {
 #if 0 // TRANSFORM_FIX_ME
-                               short mval[2];
+                               int mval[2];
 
                                getmouseco_sc(mval);
                                BIF_selectOrientation();
@@ -972,7 +973,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                        break;
                case OKEY:
                        if (t->flag & T_PROP_EDIT && event->shift) {
-                               t->prop_mode = (t->prop_mode + 1) % 6;
+                               t->prop_mode = (t->prop_mode + 1) % PROP_MODE_MAX;
                                calculatePropRatio(t);
                                t->redraw |= TREDRAW_HARD;
                        }
@@ -1009,9 +1010,11 @@ int transformEvent(TransInfo *t, wmEvent *event)
                        else view_editmove(event->type);
                        t->redraw= 1;
                        break;
-//             case NDOFMOTION:
-//            viewmoveNDOF(1);
-  //         break;
+#if 0
+               case NDOF_MOTION:
+                       // should have been caught by tranform_modal
+                       return OPERATOR_PASS_THROUGH;
+#endif
                default:
                        handled = 0;
                        break;
@@ -1020,43 +1023,6 @@ int transformEvent(TransInfo *t, wmEvent *event)
                // Numerical input events
                t->redraw |= handleNumInput(&(t->num), event);
 
-               // NDof input events
-               switch(handleNDofInput(&(t->ndof), event))
-               {
-                       case NDOF_CONFIRM:
-                               if ((t->options & CTX_NDOF) == 0)
-                               {
-                                       /* Confirm on normal transform only */
-                                       t->state = TRANS_CONFIRM;
-                               }
-                               break;
-                       case NDOF_CANCEL:
-                               if (t->options & CTX_NDOF)
-                               {
-                                       /* Cancel on pure NDOF transform */
-                                       t->state = TRANS_CANCEL;
-                               }
-                               else
-                               {
-                                       /* Otherwise, just redraw, NDof input was cancelled */
-                                       t->redraw |= TREDRAW_HARD;
-                               }
-                               break;
-                       case NDOF_NOMOVE:
-                               if (t->options & CTX_NDOF)
-                               {
-                                       /* Confirm on pure NDOF transform */
-                                       t->state = TRANS_CONFIRM;
-                               }
-                               break;
-                       case NDOF_REFRESH:
-                               t->redraw |= TREDRAW_HARD;
-                               break;
-                       default:
-                               handled = 0;
-                               break;
-               }
-
                // Snapping events
                t->redraw |= handleSnapping(t, event);
 
@@ -1274,7 +1240,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
 
                                setlinestyle(3);
                                glBegin(GL_LINE_STRIP);
-                               glVertex2sv(t->mval);
+                               glVertex2iv(t->mval);
                                glVertex2fv(cent);
                                glEnd();
 
@@ -1319,7 +1285,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
 
                                        setlinestyle(3);
                                        glBegin(GL_LINE_STRIP);
-                                       glVertex2sv(t->mval);
+                                       glVertex2iv(t->mval);
                                        glVertex2fv(cent);
                                        glEnd();
 
@@ -1525,8 +1491,6 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
        t->mode = mode;
 
        t->launch_event = event ? event->type : -1;
-       if (RNA_property_is_set(op->ptr, "launch_event"))
-               t->launch_event = RNA_int_get(op->ptr, "launch_event");
 
        if (t->launch_event == EVT_TWEAK_R)
        {
@@ -2292,7 +2256,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event)
        return status;
 }
 
-int Warp(TransInfo *t, const short UNUSED(mval[2]))
+int Warp(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3];
@@ -2440,7 +2404,7 @@ int handleEventShear(TransInfo *t, wmEvent *event)
 }
 
 
-int Shear(TransInfo *t, const short UNUSED(mval[2]))
+int Shear(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        float vec[3];
@@ -2706,7 +2670,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
        constraintTransLim(t, td);
 }
 
-int Resize(TransInfo *t, const short mval[2])
+int Resize(TransInfo *t, const int mval[2])
 {
        TransData *td;
        float size[3], mat[3][3];
@@ -2811,7 +2775,7 @@ void initToSphere(TransInfo *t)
        t->val /= (float)t->total;
 }
 
-int ToSphere(TransInfo *t, const short UNUSED(mval[2]))
+int ToSphere(TransInfo *t, const int UNUSED(mval[2]))
 {
        float vec[3];
        float ratio, radius;
@@ -2891,10 +2855,6 @@ void initRotation(TransInfo *t)
        setInputPostFct(&t->mouse, postInputRotation);
        initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
        
-       t->ndof.axis = 16;
-       /* Scale down and flip input for rotation */
-       t->ndof.factor[0] = -0.2f;
-       
        t->idx_max = 0;
        t->num.idx_max = 0;
        t->snap[0] = 0.0f;
@@ -3158,7 +3118,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
        }
 }
 
-int Rotation(TransInfo *t, const short UNUSED(mval[2]))
+int Rotation(TransInfo *t, const int UNUSED(mval[2]))
 {
        char str[128], *spos= str;
        
@@ -3166,8 +3126,6 @@ int Rotation(TransInfo *t, const short UNUSED(mval[2]))
 
        final = t->values[0];
        
-       applyNDofInput(&t->ndof, &final);
-       
        snapGrid(t, &final);
        
        if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
@@ -3221,11 +3179,6 @@ void initTrackball(TransInfo *t)
 
        initMouseInputMode(t, &t->mouse, INPUT_TRACKBALL);
 
-       t->ndof.axis = 40;
-       /* Scale down input for rotation */
-       t->ndof.factor[0] = 0.2f;
-       t->ndof.factor[1] = 0.2f;
-
        t->idx_max = 1;
        t->num.idx_max = 1;
        t->snap[0] = 0.0f;
@@ -3266,7 +3219,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
        }
 }
 
-int Trackball(TransInfo *t, const short UNUSED(mval[2]))
+int Trackball(TransInfo *t, const int UNUSED(mval[2]))
 {
        char str[128], *spos= str;
        float axis1[3], axis2[3];
@@ -3281,8 +3234,6 @@ int Trackball(TransInfo *t, const short UNUSED(mval[2]))
        phi[0] = t->values[0];
        phi[1] = t->values[1];
 
-       applyNDofInput(&t->ndof, phi);
-
        snapGrid(t, phi);
 
        if (hasNumInput(&t->num)) {
@@ -3336,8 +3287,6 @@ void initTranslation(TransInfo *t)
        t->num.flag = 0;
        t->num.idx_max = t->idx_max;
 
-       t->ndof.axis = (t->flag & T_2D_EDIT)? 1|2: 1|2|4;
-
        if(t->spacetype == SPACE_VIEW3D) {
                RegionView3D *rv3d = t->ar->regiondata;
 
@@ -3497,7 +3446,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) {
 }
 
 /* uses t->vec to store actual translation in */
-int Translation(TransInfo *t, const short UNUSED(mval[2]))
+int Translation(TransInfo *t, const int UNUSED(mval[2]))
 {
        char str[250];
 
@@ -3513,7 +3462,6 @@ int Translation(TransInfo *t, const short UNUSED(mval[2]))
                headerTranslation(t, pvec, str);
        }
        else {
-               applyNDofInput(&t->ndof, t->values);
                snapGrid(t, t->values);
                applyNumInput(&t->num, t->values);
                if (hasNumInput(&t->num)) {
@@ -3564,7 +3512,7 @@ void initShrinkFatten(TransInfo *t)
 
 
 
-int ShrinkFatten(TransInfo *t, const short UNUSED(mval[2]))
+int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 {
        float vec[3];
        float distance;
@@ -3622,10 +3570,6 @@ void initTilt(TransInfo *t)
 
        initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
 
-       t->ndof.axis = 16;
-       /* Scale down and flip input for rotation */
-       t->ndof.factor[0] = -0.2f;
-
        t->idx_max = 0;
        t->num.idx_max = 0;
        t->snap[0] = 0.0f;
@@ -3639,7 +3583,7 @@ void initTilt(TransInfo *t)
 
 
 
-int Tilt(TransInfo *t, const short UNUSED(mval[2]))
+int Tilt(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        int i;
@@ -3649,8 +3593,6 @@ int Tilt(TransInfo *t, const short UNUSED(mval[2]))
 
        final = t->values[0];
 
-       applyNDofInput(&t->ndof, &final);
-
        snapGrid(t, &final);
 
        if (hasNumInput(&t->num)) {
@@ -3711,7 +3653,7 @@ void initCurveShrinkFatten(TransInfo *t)
        t->flag |= T_NO_CONSTRAINT;
 }
 
-int CurveShrinkFatten(TransInfo *t, const short UNUSED(mval[2]))
+int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        float ratio;
@@ -3765,10 +3707,6 @@ void initPushPull(TransInfo *t)
 
        initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
 
-       t->ndof.axis = 4;
-       /* Flip direction */
-       t->ndof.factor[0] = -1.0f;
-
        t->idx_max = 0;
        t->num.idx_max = 0;
        t->snap[0] = 0.0f;
@@ -3779,7 +3717,7 @@ void initPushPull(TransInfo *t)
 }
 
 
-int PushPull(TransInfo *t, const short UNUSED(mval[2]))
+int PushPull(TransInfo *t, const int UNUSED(mval[2]))
 {
        float vec[3], axis[3];
        float distance;
@@ -3789,8 +3727,6 @@ int PushPull(TransInfo *t, const short UNUSED(mval[2]))
 
        distance = t->values[0];
 
-       applyNDofInput(&t->ndof, &distance);
-
        snapGrid(t, &distance);
 
        applyNumInput(&t->num, &distance);
@@ -3912,7 +3848,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event)
        return 0;
 }
 
-int Bevel(TransInfo *t, const short UNUSED(mval[2]))
+int Bevel(TransInfo *t, const int UNUSED(mval[2]))
 {
        float distance,d;
        int i;
@@ -3980,7 +3916,7 @@ void initBevelWeight(TransInfo *t)
        t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
 }
 
-int BevelWeight(TransInfo *t, const short UNUSED(mval[2]))
+int BevelWeight(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        float weight;
@@ -4053,7 +3989,7 @@ void initCrease(TransInfo *t)
        t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
 }
 
-int Crease(TransInfo *t, const short UNUSED(mval[2]))
+int Crease(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        float crease;
@@ -4172,7 +4108,7 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
        td->loc[1]= oldy;
 }
 
-int BoneSize(TransInfo *t, const short mval[2])
+int BoneSize(TransInfo *t, const int mval[2])
 {
        TransData *td = t->data;
        float size[3], mat[3][3];
@@ -4248,7 +4184,7 @@ void initBoneEnvelope(TransInfo *t)
        t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
 }
 
-int BoneEnvelope(TransInfo *t, const short UNUSED(mval[2]))
+int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        float ratio;
@@ -4391,7 +4327,7 @@ static int createSlideVerts(TransInfo *t)
                /*ok, let's try to survive this*/
                unit_m4(projectMat);
        } else {
-               view3d_get_object_project_mat(rv3d, t->obedit, projectMat);
+               ED_view3d_ob_project_mat_get(rv3d, t->obedit, projectMat);
        }
        
        BLI_smallhash_init(&sld->vhash);
@@ -4428,10 +4364,10 @@ static int createSlideVerts(TransInfo *t)
        j = 0;
        BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
                if (BM_TestHFlag(v, BM_SELECT)) {
-                       BMINDEX_SET(v, 1);
+                       BM_SetIndex(v, 1);
                        BLI_smallhash_insert(&table, (uintptr_t)v, SET_INT_IN_POINTER(j));
                        j += 1;
-               } else BMINDEX_SET(v, 0);
+               } else BM_SetIndex(v, 0);
        }
 
        if (!j)
@@ -4443,7 +4379,7 @@ static int createSlideVerts(TransInfo *t)
        while (1) {
                v = NULL;
                BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       if (BMINDEX_GET(v))
+                       if (BM_GetIndex(v))
                                break;
 
                }
@@ -4470,13 +4406,13 @@ static int createSlideVerts(TransInfo *t)
 
                        numsel += 1;
 
-                       if (!BMINDEX_GET(BM_OtherEdgeVert(e, v)))
+                       if (!BM_GetIndex(BM_OtherEdgeVert(e, v)))
                                break;
 
                        v = BM_OtherEdgeVert(e, v);
                } while (e != first->e);
 
-               BMINDEX_SET(v, 0);
+               BM_SetIndex(v, 0);
 
                l1 = l2 = l = NULL;
                l1 = e->l;
@@ -4533,8 +4469,8 @@ static int createSlideVerts(TransInfo *t)
                                        sub_v3_v3v3(sv->downvec, BM_OtherEdgeVert(l->e, v)->co, v->co);
                                }
 
-                               BMINDEX_SET(v, 0);
-                               BMINDEX_SET(v2, 0);
+                               BM_SetIndex(v, 0);
+                               BM_SetIndex(v2, 0);
                                
                                j += 2;
                                break;
@@ -4545,8 +4481,8 @@ static int createSlideVerts(TransInfo *t)
 
                        j += 1;
 
-                       BMINDEX_SET(v, 0);
-                       BMINDEX_SET(v2, 0);
+                       BM_SetIndex(v, 0);
+                       BM_SetIndex(v2, 0);
                } while (e != first->e && l1);
        }
 
@@ -4581,17 +4517,17 @@ static int createSlideVerts(TransInfo *t)
                                        j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
 
                                        if (tempsv[j].down) {
-                                               view3d_project_float_v3(ar, tempsv[j].down->co, vec1, projectMat);
+                                               ED_view3d_project_float_v3(ar, tempsv[j].down->co, vec1, projectMat);
                                        } else {
                                                add_v3_v3v3(vec1, v->co, tempsv[j].downvec);
-                                               view3d_project_float_v3(ar, vec1, vec1, projectMat);
+                                               ED_view3d_project_float_v3(ar, vec1, vec1, projectMat);
                                        }
                                        
                                        if (tempsv[j].up) {
-                                               view3d_project_float_v3(ar, tempsv[j].up->co, vec2, projectMat);
+                                               ED_view3d_project_float_v3(ar, tempsv[j].up->co, vec2, projectMat);
                                        } else {
                                                add_v3_v3v3(vec1, v->co, tempsv[j].upvec);
-                                               view3d_project_float_v3(ar, vec2, vec2, projectMat);
+                                               ED_view3d_project_float_v3(ar, vec2, vec2, projectMat);
                                        }
 
                                        d = dist_to_line_segment_v2(mval, vec1, vec2);
@@ -4673,6 +4609,12 @@ void projectSVData(TransInfo *t, int final)
        if (!em)
                return;
        
+       /* BMESH_TODO, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)
+        * currently all vertex data is interpolated which is nice mostly
+        * except for shape keys where you dont want to modify UVs for eg.
+        * current BMesh code doesnt make it easy to pick which data we interpolate
+        * - campbell */
+
        BLI_smallhash_init(&visit);
        
                for (i=0, tempsv=sld->sv; i<sld->totsv; i++, tempsv++) {
@@ -4745,7 +4687,7 @@ void freeSlideVerts(TransInfo *t)
        SmallHashIter hiter;
        BMFace *copyf;
        
-#if 0
+#if 0 /*BMESH_TODO*/
        if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
                TransDataSlideVert *tempsv;
                LinkNode *look = sld->vertlist;
@@ -4819,8 +4761,8 @@ void initEdgeSlide(TransInfo *t)
        t->idx_max = 0;
        t->num.idx_max = 0;
        t->snap[0] = 0.0f;
-       t->snap[1] = (float)((5.0/180)*M_PI);
-       t->snap[2] = t->snap[1] * 0.2f;
+       t->snap[1] = 0.1f;
+       t->snap[2] = t->snap[1] * 0.1f;
 
        t->num.increment = t->snap[1];
 
@@ -4854,7 +4796,7 @@ int doEdgeSlide(TransInfo *t, float perc)
        return 1;
 }
 
-int EdgeSlide(TransInfo *t, const short UNUSED(mval[2]))
+int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
 {
        char str[50];
        float final;
@@ -4863,6 +4805,9 @@ int EdgeSlide(TransInfo *t, const short UNUSED(mval[2]))
 
        snapGrid(t, &final);
 
+       /* only do this so out of range values are not displayed */
+       CLAMP(final, -1.0f, 1.0f);
+
        if (hasNumInput(&t->num)) {
                char c[20];
 
@@ -4870,10 +4815,10 @@ int EdgeSlide(TransInfo *t, const short UNUSED(mval[2]))
 
                outputNumInput(&(t->num), c);
 
-               sprintf(str, "Edge Slide Percent: %s", &c[0]);
+               sprintf(str, "Edge Slide: %s", &c[0]);
        }
        else {
-               sprintf(str, "Edge Slide Percent: %.2f", final);
+               sprintf(str, "Edge Slide: %.2f", final);
        }
 
        CLAMP(final, -1.0f, 1.0f);
@@ -4913,7 +4858,7 @@ void initBoneRoll(TransInfo *t)
        t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
 }
 
-int BoneRoll(TransInfo *t, const short UNUSED(mval[2]))
+int BoneRoll(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        int i;
@@ -4974,7 +4919,7 @@ void initBakeTime(TransInfo *t)
        t->num.increment = t->snap[1];
 }
 
-int BakeTime(TransInfo *t, const short mval[2])
+int BakeTime(TransInfo *t, const int mval[2])
 {
        TransData *td = t->data;
        float time;
@@ -5049,7 +4994,7 @@ void initMirror(TransInfo *t)
        }
 }
 
-int Mirror(TransInfo *t, const short UNUSED(mval[2]))
+int Mirror(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td;
        float size[3], mat[3][3];
@@ -5126,7 +5071,7 @@ void initAlign(TransInfo *t)
        initMouseInputMode(t, &t->mouse, INPUT_NONE);
 }
 
-int Align(TransInfo *t, const short UNUSED(mval[2]))
+int Align(TransInfo *t, const int UNUSED(mval[2]))
 {
        TransData *td = t->data;
        float center[3];
@@ -5184,8 +5129,6 @@ void initSeqSlide(TransInfo *t)
        t->num.flag = 0;
        t->num.idx_max = t->idx_max;
 
-       t->ndof.axis = 1|2;
-
        t->snap[0] = 0.0f;
        t->snap[1] = floor(t->scene->r.frs_sec / t->scene->r.frs_sec_base);
        t->snap[2] = 10.0f;
@@ -5229,7 +5172,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) {
        }
 }
 
-int SeqSlide(TransInfo *t, const short UNUSED(mval[2]))
+int SeqSlide(TransInfo *t, const int UNUSED(mval[2]))
 {
        char str[200];
 
@@ -5240,7 +5183,6 @@ int SeqSlide(TransInfo *t, const short UNUSED(mval[2]))
                VECCOPY(t->values, tvec);
        }
        else {
-               applyNDofInput(&t->ndof, t->values);
                snapGrid(t, t->values);
                applyNumInput(&t->num, t->values);
        }
@@ -5405,7 +5347,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
 void initTimeTranslate(TransInfo *t)
 {
        /* this tool is only really available in the Action Editor... */
-       if (t->spacetype != SPACE_ACTION) {
+       if (!ELEM(t->spacetype, SPACE_ACTION, SPACE_SEQ)) {
                t->state = TRANS_CANCEL;
        }
 
@@ -5519,7 +5461,7 @@ static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
        }
 }
 
-int TimeTranslate(TransInfo *t, const short mval[2])
+int TimeTranslate(TransInfo *t, const int mval[2])
 {
        View2D *v2d = (View2D *)t->view;
        float cval[2], sval[2];
@@ -5649,7 +5591,7 @@ static void applyTimeSlide(TransInfo *t, float sval)
        }
 }
 
-int TimeSlide(TransInfo *t, const short mval[2])
+int TimeSlide(TransInfo *t, const int mval[2])
 {
        View2D *v2d = (View2D *)t->view;
        float cval[2], sval[2];
@@ -5774,7 +5716,7 @@ static void applyTimeScale(TransInfo *t) {
        }
 }
 
-int TimeScale(TransInfo *t, const short UNUSED(mval[2]))
+int TimeScale(TransInfo *t, const int UNUSED(mval[2]))
 {
        char str[200];
        
@@ -5800,54 +5742,3 @@ void BIF_TransformSetUndo(char *UNUSED(str))
        // TRANSFORM_FIX_ME
        //Trans.undostr= str;
 }
-
-
-#if 0 // TRANSFORM_FIX_ME
-static void NDofTransform(void)
-{
-       float fval[7];
-       float maxval = 50.0f; // also serves as threshold
-       int axis = -1;
-       int mode = 0;
-       int i;
-
-       getndof(fval);
-
-       for(i = 0; i < 6; i++)
-       {
-               float val = fabs(fval[i]);
-               if (val > maxval)
-               {
-                       axis = i;
-                       maxval = val;
-               }
-       }
-
-       switch(axis)
-       {
-               case -1:
-                       /* No proper axis found */
-                       break;
-               case 0:
-               case 1:
-               case 2:
-                       mode = TFM_TRANSLATION;
-                       break;
-               case 4:
-                       mode = TFM_ROTATION;
-                       break;
-               case 3:
-               case 5:
-                       mode = TFM_TRACKBALL;
-                       break;
-               default:
-                       printf("ndof: what we are doing here ?");
-       }
-
-       if (mode != 0)
-       {
-               initTransform(mode, CTX_NDOF);
-               Transform();
-       }
-}
-#endif