transform - use 2d float's for the viewport center (allows for vector math functions...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 12 Oct 2013 03:42:06 +0000 (03:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 12 Oct 2013 03:42:06 +0000 (03:42 +0000)
source/blender/editors/include/ED_transform.h
source/blender/editors/mesh/editmesh_bevel.c
source/blender/editors/mesh/editmesh_inset.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_input.c
source/blender/editors/util/ed_util.c

index 81308dd84f211efdcff00589b39ea2dbfff8e17f..eff79b6a0393f040793ee79cf823df4178737bbf 100644 (file)
@@ -103,7 +103,7 @@ enum TfmMode {
  * returns 1 if successful, 0 otherwise (usually means there's no selection)
  * (if 0 is returns, *vec is unmodified)
  * */
-int calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], int cent2d[2]);
+int calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2]);
 
 struct TransInfo;
 struct ScrArea;
index 6033e7ee471ca74b03abf01681cb55c612aee1b6..97da0047793d221887882972f4e821f1108a476b 100644 (file)
@@ -64,7 +64,7 @@ typedef struct {
        float shift_factor; /* The current factor when shift is pressed. Negative when shift not active. */
 
        /* modal only */
-       int mcenter[2];
+       float mcenter[2];
        BMBackup mesh_backup;
        void *draw_handle_pixel;
        short twtype;
index 3966826a5b2e42708db18a41487b3dcb7ef4303a..718228680268ee4e8b6c3ef54ff6694c88cf937d 100644 (file)
@@ -68,7 +68,7 @@ typedef struct {
        NumInput num_input;
 
        /* modal only */
-       int mcenter[2];
+       float mcenter[2];
        BMBackup mesh_backup;
        void *draw_handle_pixel;
        short twtype;
index ce2f07f18130bed8c66b7c2e5fe3b84034e1201b..239d629769547fd85ac26828fa30678635386ee1 100644 (file)
@@ -1360,7 +1360,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
        }
 }
 
-int calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], int cent2d[2])
+int calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], float cent2d[2])
 {
        TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data");
        int success;
@@ -1390,7 +1390,7 @@ int calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], int c
                calculateCenter(t);
 
                if (cent2d) {
-                       copy_v2_v2_int(cent2d, t->center2d);
+                       copy_v2_v2(cent2d, t->center2d);
                }
 
                if (cent3d) {
@@ -7238,7 +7238,7 @@ int TimeSlide(TransInfo *t, const int mval[2])
 
 void initTimeScale(TransInfo *t)
 {
-       int center[2];
+       float center[2];
 
        /* this tool is only really available in the Action Editor
         * AND NLA Editor (for strip scaling)
@@ -7253,7 +7253,7 @@ void initTimeScale(TransInfo *t)
        /* recalculate center2d to use CFRA and mouse Y, since that's
         * what is used in time scale */
        t->center[0] = t->scene->r.cfra;
-       projectIntView(t, t->center, center);
+       projectFloatView(t, t->center, center);
        center[1] = t->imval[1];
 
        /* force a reinit with the center2d used here */
index a4828317604de928fa59f586c2ee2fd57559d074..9355773c47b06ef4b2af68c48364e10bbab2a201 100644 (file)
@@ -271,7 +271,7 @@ typedef struct MouseInput {
        int     imval[2];               /* initial mouse position                */
        char    precision;
        int     precision_mval[2];      /* mouse position when precision key was pressed */
-       int             center[2];
+       float   center[2];
        float   factor;
        void    *data; /* additional data, if needed by the particular function */
 } MouseInput;
@@ -300,7 +300,7 @@ typedef struct TransInfo {
        float           prop_size;              /* proportional circle radius           */
        char            proptext[20];   /* proportional falloff text                    */
        float       center[3];      /* center of transformation             */
-       int         center2d[2];    /* center in screen coordinates         */
+       float       center2d[2];    /* center in screen coordinates         */
        int         imval[2];       /* initial mouse position               */
        short           event_type;             /* event->type used to invoke transform */
        short       idx_max;            /* maximum index on the input vector    */
@@ -687,7 +687,7 @@ typedef enum {
        INPUT_CUSTOM_RATIO_FLIP
 } MouseInputMode;
 
-void initMouseInput(TransInfo *t, MouseInput *mi, const int center[2], const int mval[2]);
+void initMouseInput(TransInfo *t, MouseInput *mi, const float center[2], const int mval[2]);
 void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode);
 int handleMouseInput(struct TransInfo *t, struct MouseInput *mi, const struct wmEvent *event);
 void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, const int mval[2], float output[3]);
index 233ef1d18a574d86fd08a2848132aae75bf18cf6..b6f031614ca822e22e562fbb1dd4e92c776826be 100644 (file)
@@ -1484,10 +1484,10 @@ void calculateCenter2D(TransInfo *t)
                
                copy_v3_v3(vec, t->center);
                mul_m4_v3(ob->obmat, vec);
-               projectIntView(t, vec, t->center2d);
+               projectFloatView(t, vec, t->center2d);
        }
        else {
-               projectIntView(t, t->center, t->center2d);
+               projectFloatView(t, t->center, t->center2d);
        }
 }
 
@@ -1691,7 +1691,7 @@ void calculateCenter(TransInfo *t)
                                Object *ob = OBACT;
                                if (ob) {
                                        copy_v3_v3(t->center, ob->obmat[3]);
-                                       projectIntView(t, t->center, t->center2d);
+                                       projectFloatView(t, t->center, t->center2d);
                                }
                        }
                        break;
@@ -1723,7 +1723,7 @@ void calculateCenter(TransInfo *t)
                                axis[1] = t->center[1] - 6.0f * axis[1];
                                axis[2] = t->center[2] - 6.0f * axis[2];
                                
-                               projectIntView(t, axis, t->center2d);
+                               projectFloatView(t, axis, t->center2d);
                                
                                /* rotate only needs correct 2d center, grab needs ED_view3d_calc_zfac() value */
                                if (t->mode == TFM_TRANSLATION) {
index c035b6173c86e28cfb5a68cfa614c6ad5563fe13..db214e1f6db4289f428c8cd1a7ea381f786d1da8 100644 (file)
@@ -279,7 +279,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
        output[0] = *angle;
 }
 
-void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, const int center[2], const int mval[2])
+void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, const float center[2], const int mval[2])
 {
        mi->factor = 0;
        mi->precision = 0;
index 35e6c40c36b1e555fe28a11a2e1bcc00efc3fd6a..7424acd752fd165f7bad5572cf790146a8028c0f 100644 (file)
@@ -258,7 +258,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
 void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info)
 {
        wmWindow *win = CTX_wm_window(C);
-       const int *mval_src = (int *)arg_info;
+       const float *mval_src = (float *)arg_info;
        const int mval_dst[2] = {win->eventstate->x - ar->winrct.xmin,
                                 win->eventstate->y - ar->winrct.ymin};
 
@@ -266,7 +266,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info
        setlinestyle(3);
        glBegin(GL_LINE_STRIP);
        glVertex2iv(mval_dst);
-       glVertex2iv(mval_src);
+       glVertex2fv(mval_src);
        glEnd();
        setlinestyle(0);
 }