Cleanup: use more logical names for View3D.around
authorCampbell Barton <ideasman42@gmail.com>
Tue, 1 Dec 2015 07:52:24 +0000 (18:52 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 1 Dec 2015 07:53:26 +0000 (18:53 +1100)
D1651 (own patch)

19 files changed:
source/blender/blenloader/intern/versioning_260.c
source/blender/editors/armature/armature_edit.c
source/blender/editors/mesh/editmesh_bevel.c
source/blender/editors/mesh/editmesh_inset.c
source/blender/editors/object/object_transform.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_snap.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_orientations.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/intern/rna_space.c

index 9456c286c6ffbeffe4abe85b9ee3a073fe76aead..77a4aefb7acbf35f1c389e524ef487b0e151cd0c 100644 (file)
@@ -1386,7 +1386,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
                                                        SpaceClip *sclip = (SpaceClip *)sl;
 
                                                        if (sclip->around == 0) {
-                                                               sclip->around = V3D_CENTROID;
+                                                               sclip->around = V3D_AROUND_CENTER_MEAN;
                                                        }
                                                }
                                        }
index 5a0e70dc5dd912e3a4ca54ae408d118e29093109..94b7277ce8fc5ef5e0e22d4834dbc33cabff9acf 100644 (file)
@@ -156,7 +156,7 @@ void ED_armature_origin_set(Scene *scene, Object *ob, float cursor[3], int cente
                mul_m4_v3(ob->imat, cent);
        }
        else {
-               if (around == V3D_CENTROID) {
+               if (around == V3D_AROUND_CENTER_MEAN) {
                        int total = 0;
                        zero_v3(cent);
                        for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
index ce6856321d2d7023805737a267e48c549176526a..f001eadd9cd61381beeb14315e824794f6680095 100644 (file)
@@ -259,7 +259,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
        opdata = op->customdata;
 
        /* initialize mouse values */
-       if (!calculateTransformCenter(C, V3D_CENTROID, center_3d, opdata->mcenter)) {
+       if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEAN, center_3d, opdata->mcenter)) {
                /* in this case the tool will likely do nothing,
                 * ideally this will never happen and should be checked for above */
                opdata->mcenter[0] = opdata->mcenter[1] = 0;
index 14a477ee86cda4b86468d35e195579584d0af860..937547c99efe69815af7b1a39534cc22f1cd3c64 100644 (file)
@@ -280,7 +280,7 @@ static int edbm_inset_invoke(bContext *C, wmOperator *op, const wmEvent *event)
        opdata = op->customdata;
 
        /* initialize mouse values */
-       if (!calculateTransformCenter(C, V3D_CENTROID, center_3d, opdata->mcenter)) {
+       if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEAN, center_3d, opdata->mcenter)) {
                /* in this case the tool will likely do nothing,
                 * ideally this will never happen and should be checked for above */
                opdata->mcenter[0] = opdata->mcenter[1] = 0;
index ac1f13ee59c05c4082486e1c387c049bb0ff3fff..8f00c0eb467c6328974e6edbe801ce213f720838 100644 (file)
@@ -718,7 +718,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                mul_m4_v3(obedit->imat, cent);
                        }
                        else {
-                               if (around == V3D_CENTROID) {
+                               if (around == V3D_AROUND_CENTER_MEAN) {
                                        if (em->bm->totvert) {
                                                const float total_div = 1.0f / (float)em->bm->totvert;
                                                BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
@@ -825,9 +825,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                Mesh *me = ob->data;
 
                                if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
-                               else if (centermode == ORIGIN_TO_CENTER_OF_MASS) { BKE_mesh_center_centroid(me, cent); }
-                               else if (around == V3D_CENTROID)                 { BKE_mesh_center_median(me, cent); }
-                               else                                             { BKE_mesh_center_bounds(me, cent); }
+                               else if (centermode == ORIGIN_TO_CENTER_OF_MASS)    { BKE_mesh_center_centroid(me, cent); }
+                               else if (around == V3D_AROUND_CENTER_MEAN)          { BKE_mesh_center_median(me, cent); }
+                               else                                                { BKE_mesh_center_bounds(me, cent); }
 
                                negate_v3_v3(cent_neg, cent);
                                BKE_mesh_translate(me, cent_neg, 1);
@@ -839,9 +839,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                        else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
                                Curve *cu = ob->data;
 
-                               if      (centermode == ORIGIN_TO_CURSOR) { /* done */ }
-                               else if (around == V3D_CENTROID) { BKE_curve_center_median(cu, cent); }
-                               else                             { BKE_curve_center_bounds(cu, cent);   }
+                               if      (centermode == ORIGIN_TO_CURSOR)    { /* done */ }
+                               else if (around == V3D_AROUND_CENTER_MEAN)  { BKE_curve_center_median(cu, cent); }
+                               else                                        { BKE_curve_center_bounds(cu, cent); }
 
                                /* don't allow Z change if curve is 2D */
                                if ((ob->type == OB_CURVE) && !(cu->flag & CU_3D))
@@ -921,9 +921,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                        else if (ob->type == OB_MBALL) {
                                MetaBall *mb = ob->data;
 
-                               if      (centermode == ORIGIN_TO_CURSOR) { /* done */ }
-                               else if (around == V3D_CENTROID) { BKE_mball_center_median(mb, cent); }
-                               else                             { BKE_mball_center_bounds(mb, cent); }
+                               if      (centermode == ORIGIN_TO_CURSOR)    { /* done */ }
+                               else if (around == V3D_AROUND_CENTER_MEAN)  { BKE_mball_center_median(mb, cent); }
+                               else                                        { BKE_mball_center_bounds(mb, cent); }
 
                                negate_v3_v3(cent_neg, cent);
                                BKE_mball_translate(mb, cent_neg);
@@ -942,9 +942,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                        else if (ob->type == OB_LATTICE) {
                                Lattice *lt = ob->data;
 
-                               if      (centermode == ORIGIN_TO_CURSOR) { /* done */ }
-                               else if (around == V3D_CENTROID) { BKE_lattice_center_median(lt, cent); }
-                               else                             { BKE_lattice_center_bounds(lt, cent); }
+                               if      (centermode == ORIGIN_TO_CURSOR)    { /* done */ }
+                               else if (around == V3D_AROUND_CENTER_MEAN)  { BKE_lattice_center_median(lt, cent); }
+                               else                                        { BKE_lattice_center_bounds(lt, cent); }
 
                                negate_v3_v3(cent_neg, cent);
                                BKE_lattice_translate(lt, cent_neg, 1);
@@ -1044,8 +1044,8 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
        };
        
        static EnumPropertyItem prop_set_bounds_types[] = {
-               {V3D_CENTROID, "MEDIAN", 0, "Median Center", ""},
-               {V3D_CENTER, "BOUNDS", 0, "Bounds Center", ""},
+               {V3D_AROUND_CENTER_MEAN, "MEDIAN", 0, "Median Center", ""},
+               {V3D_AROUND_CENTER_BOUNDS, "BOUNDS", 0, "Bounds Center", ""},
                {0, NULL, 0, NULL, NULL}
        };
        
@@ -1064,5 +1064,5 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
        
        ot->prop = RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", "");
-       RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_CENTROID, "Center", "");
+       RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_AROUND_CENTER_MEAN, "Center", "");
 }
index c1db31a26dbd43178ddc1e46f6d936b7fbe0d8b9..7a66599655f318d3f356cb9a730af0cd0f5af907 100644 (file)
@@ -1534,7 +1534,7 @@ static int clip_set_2d_cursor_exec(bContext *C, wmOperator *op)
        bool show_cursor = false;
 
        show_cursor |= sclip->mode == SC_MODE_MASKEDIT;
-       show_cursor |= sclip->around == V3D_CURSOR;
+       show_cursor |= sclip->around == V3D_AROUND_CURSOR;
 
        if (!show_cursor) {
                return OPERATOR_CANCELLED;
index 8c4b97b51ff1f4ae5d17ef3f6ce395ba2c9f19bc..e1d4e4fabc561d7ae235c58861801e948cf90a06 100644 (file)
@@ -250,7 +250,7 @@ static SpaceLink *clip_new(const bContext *C)
        sc->zoom = 1.0f;
        sc->path_length = 20;
        sc->scopes.track_preview_height = 120;
-       sc->around = V3D_LOCAL;
+       sc->around = V3D_AROUND_LOCAL_ORIGINS;
 
        /* header */
        ar = MEM_callocN(sizeof(ARegion), "header for clip");
@@ -1213,7 +1213,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
        }
 
        show_cursor |= sc->mode == SC_MODE_MASKEDIT;
-       show_cursor |= sc->around == V3D_CURSOR;
+       show_cursor |= sc->around == V3D_AROUND_CURSOR;
 
        if (show_cursor) {
                glPushMatrix();
index 5a006ed24ce6bb78c6d17676e7fc4c266c0f0737..a1c2c8cca17c5bb1a9b9d904b945968b9befc1ae 100644 (file)
@@ -342,7 +342,7 @@ static SpaceLink *view3d_new(const bContext *C)
 
        v3d->twflag |= U.tw_flag & V3D_USE_MANIPULATOR;
        v3d->twtype = V3D_MANIP_TRANSLATE;
-       v3d->around = V3D_CENTROID;
+       v3d->around = V3D_AROUND_CENTER_MEAN;
        
        v3d->bundle_size = 0.2f;
        v3d->bundle_drawtype = OB_PLAINAXES;
index 7458d819213db1fe7fa1ad205141008045e2b248..d278d94738d7c7de7cbdde93a70755bb22c63cf7 100644 (file)
@@ -700,7 +700,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
        }
        else {
                /* If there's no selection, lastofs is unmodified and last value since static */
-               is_set = calculateTransformCenter(C, V3D_CENTROID, lastofs, NULL);
+               is_set = calculateTransformCenter(C, V3D_AROUND_CENTER_MEAN, lastofs, NULL);
        }
 
        copy_v3_v3(r_dyn_ofs, lastofs);
@@ -3757,7 +3757,7 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
                        float twmat[3][3];
 
                        /* same as transform manipulator when normal is set */
-                       ED_getTransformOrientationMatrix(C, twmat, V3D_ACTIVE);
+                       ED_getTransformOrientationMatrix(C, twmat, V3D_AROUND_ACTIVE);
 
                        mat3_to_quat(obact_quat, twmat);
                        invert_qt_normalized(obact_quat);
index 8bb84d00c8383243aae9c48dce4f51532444a133..e8e7d3c62fbf66dec797c7b3a6f3672338574f57 100644 (file)
@@ -223,7 +223,7 @@ static int snap_sel_to_curs_exec(bContext *C, wmOperator *op)
        cursor_global = ED_view3d_cursor3d_get(scene, v3d);
 
        if (use_offset) {
-               if ((v3d && v3d->around == V3D_ACTIVE) &&
+               if ((v3d && v3d->around == V3D_AROUND_ACTIVE) &&
                    snap_calc_active_center(C, true, center_global))
                {
                        /* pass */
@@ -543,7 +543,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
                        minmax_v3v3_v3(min, max, vec);
                }
                
-               if (v3d->around == V3D_CENTROID) {
+               if (v3d->around == V3D_AROUND_CENTER_MEAN) {
                        mul_v3_fl(centroid, 1.0f / (float)tvs.transverts_tot);
                        copy_v3_v3(cursor, centroid);
                }
@@ -595,7 +595,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
                        return false;
                }
 
-               if (v3d->around == V3D_CENTROID) {
+               if (v3d->around == V3D_AROUND_CENTER_MEAN) {
                        mul_v3_fl(centroid, 1.0f / (float)count);
                        copy_v3_v3(cursor, centroid);
                }
index 57688ca9f3c5e989ad36267e280410b28de96080..7656a8a54c63a7317916e74528559db4322834e3 100644 (file)
@@ -203,7 +203,7 @@ static void applySeqSlide(TransInfo *t, const int mval[2]);
 
 static bool transdata_check_local_center(TransInfo *t, short around)
 {
-       return ((around == V3D_LOCAL) && (
+       return ((around == V3D_AROUND_LOCAL_ORIGINS) && (
                    (t->flag & (T_OBJECT | T_POSE)) ||
                    (t->obedit && ELEM(t->obedit->type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE)) ||
                    (t->spacetype == SPACE_IPO) ||
@@ -213,7 +213,7 @@ static bool transdata_check_local_center(TransInfo *t, short around)
 
 bool transdata_check_local_islands(TransInfo *t, short around)
 {
-       return ((around == V3D_LOCAL) && (
+       return ((around == V3D_AROUND_LOCAL_ORIGINS) && (
                (t->obedit && ELEM(t->obedit->type, OB_MESH))));
 }
 
@@ -1553,8 +1553,8 @@ bool calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], floa
 
        initTransInfo(C, t, NULL, NULL);
 
-       /* avoid doing connectivity lookups (when V3D_LOCAL is set) */
-       t->around = V3D_CENTER;
+       /* avoid doing connectivity lookups (when V3D_AROUND_LOCAL_ORIGINS is set) */
+       t->around = V3D_AROUND_CENTER_BOUNDS;
 
        createTransData(C, t);              // make TransData structs from selection
 
@@ -3018,7 +3018,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
 
                /* rotation */
                if ((t->flag & T_POINTS) == 0) {
-                       ElementRotation(t, td, mat, V3D_LOCAL);
+                       ElementRotation(t, td, mat, V3D_AROUND_LOCAL_ORIGINS);
                }
 
                /* location */
@@ -4345,14 +4345,14 @@ static void applyTranslationValue(TransInfo *t, const float vec[3])
 
                                rotation_between_vecs_to_mat3(mat, original_normal, t->tsnap.snapNormal);
 
-                               ElementRotation(t, td, mat, V3D_LOCAL);
+                               ElementRotation(t, td, mat, V3D_AROUND_LOCAL_ORIGINS);
                        }
                        else {
                                float mat[3][3];
                                
                                unit_m3(mat);
                                
-                               ElementRotation(t, td, mat, V3D_LOCAL);
+                               ElementRotation(t, td, mat, V3D_AROUND_LOCAL_ORIGINS);
                        }
                }
                
@@ -8524,7 +8524,9 @@ bool checkUseAxisMatrix(TransInfo *t)
 {
        /* currently only checks for editmode */
        if (t->flag & T_EDIT) {
-               if ((t->around == V3D_LOCAL) && (ELEM(t->obedit->type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE))) {
+               if ((t->around == V3D_AROUND_LOCAL_ORIGINS) &&
+                   (ELEM(t->obedit->type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE)))
+               {
                        /* not all editmode supports axis-matrix */
                        return true;
                }
index 6a8e545ba3c687f5159536829559644fa2347dfd..924995e7b92b6a4cd2aaa32f2ecf4e32e0efeda5 100644 (file)
 static void transform_around_single_fallback(TransInfo *t)
 {
        if ((t->total == 1) &&
-           (ELEM(t->around, V3D_CENTER, V3D_CENTROID, V3D_ACTIVE)) &&
+           (ELEM(t->around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEAN, V3D_AROUND_ACTIVE)) &&
            (ELEM(t->mode, TFM_RESIZE, TFM_ROTATION, TFM_TRACKBALL)))
        {
-               t->around = V3D_LOCAL;
+               t->around = V3D_AROUND_LOCAL_ORIGINS;
        }
 }
 
@@ -681,7 +681,7 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
                }
                else if ((bone->flag & BONE_TRANSFORM) &&
                         (mode == TFM_ROTATION || mode == TFM_TRACKBALL) &&
-                        (around == V3D_LOCAL))
+                        (around == V3D_AROUND_LOCAL_ORIGINS))
                {
                        bone->flag |= BONE_TRANSFORM_CHILD;
                }
@@ -1275,7 +1275,9 @@ static void createTransArmatureVerts(TransInfo *t)
                                         * causes problem with snapping (see T45974).
                                         * However, in rotation mode, we want to keep that 'rotate bone around root with
                                         * only its tip selected' behavior (see T46325). */
-                                       if ((t->around == V3D_LOCAL) && ((t->mode == TFM_ROTATION) || (ebo->flag & BONE_ROOTSEL))) {
+                                       if ((t->around == V3D_AROUND_LOCAL_ORIGINS) &&
+                                           ((t->mode == TFM_ROTATION) || (ebo->flag & BONE_ROOTSEL)))
+                                       {
                                                copy_v3_v3(td->center, ebo->head);
                                        }
                                        else {
@@ -1551,7 +1553,7 @@ static void createTransCurveVerts(TransInfo *t)
                                        TransDataCurveHandleFlags *hdata = NULL;
                                        float axismtx[3][3];
 
-                                       if (t->around == V3D_LOCAL) {
+                                       if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
                                                float normal[3], plane[3];
 
                                                BKE_nurb_bezt_calc_normal(nu, bezt, normal);
@@ -1574,7 +1576,7 @@ static void createTransCurveVerts(TransInfo *t)
                                                copy_v3_v3(td->iloc, bezt->vec[0]);
                                                td->loc = bezt->vec[0];
                                                copy_v3_v3(td->center, bezt->vec[(hide_handles ||
-                                                                                 (t->around == V3D_LOCAL) ||
+                                                                                 (t->around == V3D_AROUND_LOCAL_ORIGINS) ||
                                                                                  (bezt->f2 & SELECT)) ? 1 : 0]);
                                                if (hide_handles) {
                                                        if (bezt->f2 & SELECT) td->flag = TD_SELECTED;
@@ -1591,7 +1593,7 @@ static void createTransCurveVerts(TransInfo *t)
 
                                                copy_m3_m3(td->smtx, smtx);
                                                copy_m3_m3(td->mtx, mtx);
-                                               if (t->around == V3D_LOCAL) {
+                                               if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
                                                        copy_m3_m3(td->axismtx, axismtx);
                                                }
 
@@ -1623,7 +1625,7 @@ static void createTransCurveVerts(TransInfo *t)
 
                                                copy_m3_m3(td->smtx, smtx);
                                                copy_m3_m3(td->mtx, mtx);
-                                               if (t->around == V3D_LOCAL) {
+                                               if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
                                                        copy_m3_m3(td->axismtx, axismtx);
                                                }
 
@@ -1644,7 +1646,7 @@ static void createTransCurveVerts(TransInfo *t)
                                                copy_v3_v3(td->iloc, bezt->vec[2]);
                                                td->loc = bezt->vec[2];
                                                copy_v3_v3(td->center, bezt->vec[(hide_handles ||
-                                                                                 (t->around == V3D_LOCAL) ||
+                                                                                 (t->around == V3D_AROUND_LOCAL_ORIGINS) ||
                                                                                  (bezt->f2 & SELECT)) ? 1 : 2]);
                                                if (hide_handles) {
                                                        if (bezt->f2 & SELECT) td->flag = TD_SELECTED;
@@ -1663,7 +1665,7 @@ static void createTransCurveVerts(TransInfo *t)
 
                                                copy_m3_m3(td->smtx, smtx);
                                                copy_m3_m3(td->mtx, mtx);
-                                               if (t->around == V3D_LOCAL) {
+                                               if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
                                                        copy_m3_m3(td->axismtx, axismtx);
                                                }
 
@@ -2261,7 +2263,7 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx
                copy_v3_v3(td->center, v_island->co);
                copy_m3_m3(td->axismtx, v_island->axismtx);
        }
-       else if (t->around == V3D_LOCAL) {
+       else if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
                copy_v3_v3(td->center, td->loc);
                createSpaceNormal(td->axismtx, no);
        }
@@ -2392,7 +2394,7 @@ static void createTransEditVerts(TransInfo *t)
                editmesh_set_connectivity_distance(em->bm, mtx, dists);
        }
 
-       if (t->around == V3D_LOCAL) {
+       if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
                island_info = editmesh_islands_info_calc(em, &island_info_tot, &island_vert_map);
        }
 
@@ -2760,7 +2762,7 @@ static void createTransUVs(bContext *C, TransInfo *t)
        int count = 0, countsel = 0, count_rejected = 0;
        const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
        const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0;
-       const bool is_island_center = (t->around == V3D_LOCAL);
+       const bool is_island_center = (t->around == V3D_AROUND_LOCAL_ORIGINS);
        const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
        const int cd_poly_tex_offset = CustomData_get_offset(&em->bm->pdata, CD_MTEXPOLY);
 
@@ -4019,7 +4021,8 @@ static bool graph_edit_is_translation_mode(TransInfo *t)
 
 static bool graph_edit_use_local_center(TransInfo *t)
 {
-       return (t->around == V3D_LOCAL) && !graph_edit_is_translation_mode(t);
+       return ((t->around == V3D_AROUND_LOCAL_ORIGINS) &&
+               (graph_edit_is_translation_mode(t) == false));
 }
 
 
@@ -5436,7 +5439,9 @@ static void set_trans_object_base_flags(TransInfo *t)
 
                        if (parsel) {
                                /* rotation around local centers are allowed to propagate */
-                               if ((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL) {
+                               if ((t->around == V3D_AROUND_LOCAL_ORIGINS) &&
+                                   (t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL))
+                               {
                                        base->flag |= BA_TRANSFORM_CHILD;
                                }
                                else {
@@ -5486,7 +5491,9 @@ static int count_proportional_objects(TransInfo *t)
        Base *base;
 
        /* rotations around local centers are allowed to propagate, so we take all objects */
-       if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL)) {
+       if (!((t->around == V3D_AROUND_LOCAL_ORIGINS) &&
+             (t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL)))
+       {
                /* mark all parents */
                for (base = scene->base.first; base; base = base->next) {
                        if (TESTBASELIB_BGMODE(v3d, scene, base)) {
@@ -5607,22 +5614,22 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
                                do_loc = true;
                        }
                        else if (tmode == TFM_ROTATION) {
-                               if (v3d->around == V3D_ACTIVE) {
+                               if (v3d->around == V3D_AROUND_ACTIVE) {
                                        if (ob != OBACT)
                                                do_loc = true;
                                }
-                               else if (v3d->around == V3D_CURSOR)
+                               else if (v3d->around == V3D_AROUND_CURSOR)
                                        do_loc = true;
                                
                                if ((v3d->flag & V3D_ALIGN) == 0)
                                        do_rot = true;
                        }
                        else if (tmode == TFM_RESIZE) {
-                               if (v3d->around == V3D_ACTIVE) {
+                               if (v3d->around == V3D_AROUND_ACTIVE) {
                                        if (ob != OBACT)
                                                do_loc = true;
                                }
-                               else if (v3d->around == V3D_CURSOR)
+                               else if (v3d->around == V3D_AROUND_CURSOR)
                                        do_loc = true;
                                
                                if ((v3d->flag & V3D_ALIGN) == 0)
@@ -5747,14 +5754,14 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
                                                        do_loc = true;
                                        }
                                        else if (tmode == TFM_ROTATION) {
-                                               if (ELEM(v3d->around, V3D_CURSOR, V3D_ACTIVE))
+                                               if (ELEM(v3d->around, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE))
                                                        do_loc = true;
                                                        
                                                if ((v3d->flag & V3D_ALIGN) == 0)
                                                        do_rot = true;
                                        }
                                        else if (tmode == TFM_RESIZE) {
-                                               if (ELEM(v3d->around, V3D_CURSOR, V3D_ACTIVE))
+                                               if (ELEM(v3d->around, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE))
                                                        do_loc = true;
                                                        
                                                if ((v3d->flag & V3D_ALIGN) == 0)
index 8d64b5f7577281fd84a545d302b9c4b429eb484a..3b40a55a27003cbbfa5580d7a7e6eecc4975b1e6 100644 (file)
@@ -1212,13 +1212,13 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
                
                /* bend always uses the cursor */
                if (t->mode == TFM_BEND) {
-                       t->around = V3D_CURSOR;
+                       t->around = V3D_AROUND_CURSOR;
                }
 
                t->current_orientation = v3d->twmode;
 
                /* exceptional case */
-               if (t->around == V3D_LOCAL) {
+               if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
                        if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
                                const bool use_island = transdata_check_local_islands(t, t->around);
 
@@ -1274,7 +1274,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
        else if (t->spacetype == SPACE_NODE) {
                // XXX for now, get View2D from the active region
                t->view = &ar->v2d;
-               t->around = V3D_CENTER;
+               t->around = V3D_AROUND_CENTER_BOUNDS;
        }
        else if (t->spacetype == SPACE_IPO) {
                SpaceIpo *sipo = sa->spacedata.first;
@@ -1300,7 +1300,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
                else {
                        t->view = NULL;
                }
-               t->around = V3D_CENTER;
+               t->around = V3D_AROUND_CENTER_BOUNDS;
        }
 
        if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
@@ -1771,13 +1771,13 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
 void calculateCenter(TransInfo *t)
 {
        switch (t->around) {
-               case V3D_CENTER:
+               case V3D_AROUND_CENTER_BOUNDS:
                        calculateCenterBound(t, t->center);
                        break;
-               case V3D_CENTROID:
+               case V3D_AROUND_CENTER_MEAN:
                        calculateCenterMedian(t, t->center);
                        break;
-               case V3D_CURSOR:
+               case V3D_AROUND_CURSOR:
                        if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP))
                                calculateCenterCursor2D(t, t->center);
                        else if (t->spacetype == SPACE_IPO)
@@ -1785,11 +1785,11 @@ void calculateCenter(TransInfo *t)
                        else
                                calculateCenterCursor(t, t->center);
                        break;
-               case V3D_LOCAL:
+               case V3D_AROUND_LOCAL_ORIGINS:
                        /* Individual element center uses median center for helpline and such */
                        calculateCenterMedian(t, t->center);
                        break;
-               case V3D_ACTIVE:
+               case V3D_AROUND_ACTIVE:
                {
                        if (calculateCenterActive(t, false, t->center)) {
                                /* pass */
index 5e5dbfdf80aaf1c0d4fb63d1052226db7f069b93..8131758f93cbc52ba96a3dc8518e7a106a903d7f 100644 (file)
@@ -293,7 +293,7 @@ static int calc_manipulator_stats(const bContext *C)
                        float vec[3] = {0, 0, 0};
 
                        /* USE LAST SELECTE WITH ACTIVE */
-                       if ((v3d->around == V3D_ACTIVE) && BM_select_history_active_get(em->bm, &ese)) {
+                       if ((v3d->around == V3D_AROUND_ACTIVE) && BM_select_history_active_get(em->bm, &ese)) {
                                BM_editselection_center(&ese, vec);
                                calc_tw_center(scene, vec);
                                totsel = 1;
@@ -318,7 +318,7 @@ static int calc_manipulator_stats(const bContext *C)
                        bArmature *arm = obedit->data;
                        EditBone *ebo;
 
-                       if ((v3d->around == V3D_ACTIVE) && (ebo = arm->act_edbone)) {
+                       if ((v3d->around == V3D_AROUND_ACTIVE) && (ebo = arm->act_edbone)) {
                                /* doesn't check selection or visibility intentionally */
                                if (ebo->flag & BONE_TIPSEL) {
                                        calc_tw_center(scene, ebo->tail);
@@ -354,7 +354,7 @@ static int calc_manipulator_stats(const bContext *C)
                        Curve *cu = obedit->data;
                        float center[3];
 
-                       if (v3d->around == V3D_ACTIVE && ED_curve_active_center(cu, center)) {
+                       if (v3d->around == V3D_AROUND_ACTIVE && ED_curve_active_center(cu, center)) {
                                calc_tw_center(scene, center);
                                totsel++;
                        }
@@ -386,11 +386,11 @@ static int calc_manipulator_stats(const bContext *C)
                                                        }
                                                        else {
                                                                if (bezt->f1 & SELECT) {
-                                                                       calc_tw_center(scene, bezt->vec[(v3d->around == V3D_LOCAL) ? 1 : 0]);
+                                                                       calc_tw_center(scene, bezt->vec[(v3d->around == V3D_AROUND_LOCAL_ORIGINS) ? 1 : 0]);
                                                                        totsel++;
                                                                }
                                                                if (bezt->f3 & SELECT) {
-                                                                       calc_tw_center(scene, bezt->vec[(v3d->around == V3D_LOCAL) ? 1 : 2]);
+                                                                       calc_tw_center(scene, bezt->vec[(v3d->around == V3D_AROUND_LOCAL_ORIGINS) ? 1 : 2]);
                                                                        totsel++;
                                                                }
                                                        }
@@ -416,7 +416,7 @@ static int calc_manipulator_stats(const bContext *C)
                        MetaBall *mb = (MetaBall *)obedit->data;
                        MetaElem *ml;
 
-                       if ((v3d->around == V3D_ACTIVE) && (ml = mb->lastelem)) {
+                       if ((v3d->around == V3D_AROUND_ACTIVE) && (ml = mb->lastelem)) {
                                calc_tw_center(scene, &ml->x);
                                totsel++;
                        }
@@ -433,7 +433,7 @@ static int calc_manipulator_stats(const bContext *C)
                        Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt;
                        BPoint *bp;
 
-                       if ((v3d->around == V3D_ACTIVE) && (bp = BKE_lattice_active_point_get(lt))) {
+                       if ((v3d->around == V3D_AROUND_ACTIVE) && (bp = BKE_lattice_active_point_get(lt))) {
                                calc_tw_center(scene, bp->vec);
                                totsel++;
                        }
@@ -465,7 +465,7 @@ static int calc_manipulator_stats(const bContext *C)
 
                if ((ob->lay & v3d->lay) == 0) return 0;
 
-               if ((v3d->around == V3D_ACTIVE) && (pchan = BKE_pose_channel_active(ob))) {
+               if ((v3d->around == V3D_AROUND_ACTIVE) && (pchan = BKE_pose_channel_active(ob))) {
                        /* doesn't check selection or visibility intentionally */
                        Bone *bone = pchan->bone;
                        if (bone) {
@@ -1592,11 +1592,11 @@ void BIF_draw_manipulator(const bContext *C)
 
                /* now we can define center */
                switch (v3d->around) {
-                       case V3D_CENTER:
-                       case V3D_ACTIVE:
+                       case V3D_AROUND_CENTER_BOUNDS:
+                       case V3D_AROUND_ACTIVE:
                        {
                                Object *ob;
-                               if (((v3d->around == V3D_ACTIVE) && (scene->obedit == NULL)) &&
+                               if (((v3d->around == V3D_AROUND_ACTIVE) && (scene->obedit == NULL)) &&
                                    ((ob = OBACT) && !(ob->mode & OB_MODE_POSE)))
                                {
                                        copy_v3_v3(rv3d->twmat[3], ob->obmat[3]);
@@ -1606,11 +1606,11 @@ void BIF_draw_manipulator(const bContext *C)
                                }
                                break;
                        }
-                       case V3D_LOCAL:
-                       case V3D_CENTROID:
+                       case V3D_AROUND_LOCAL_ORIGINS:
+                       case V3D_AROUND_CENTER_MEAN:
                                copy_v3_v3(rv3d->twmat[3], scene->twcent);
                                break;
-                       case V3D_CURSOR:
+                       case V3D_AROUND_CURSOR:
                                copy_v3_v3(rv3d->twmat[3], ED_view3d_cursor3d_get(scene, v3d));
                                break;
                }
index a1bb6f4e0f30b37abde5f8213f654ee10e036242..2ea18d509f0f5a578fc06b978de126717da2853e 100644 (file)
@@ -591,7 +591,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
        Base *base;
        Object *ob = OBACT;
        int result = ORIENTATION_NONE;
-       const bool activeOnly = (around == V3D_ACTIVE);
+       const bool activeOnly = (around == V3D_AROUND_ACTIVE);
 
        zero_v3(normal);
        zero_v3(plane);
@@ -854,7 +854,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
                                                        /* exception */
                                                        if (flag) {
                                                                float tvec[3];
-                                                               if ((around == V3D_LOCAL) ||
+                                                               if ((around == V3D_AROUND_LOCAL_ORIGINS) ||
                                                                    ELEM(flag, SEL_F2, SEL_F1 | SEL_F3, SEL_F1 | SEL_F2 | SEL_F3))
                                                                {
                                                                        BKE_nurb_bezt_calc_normal(nu, bezt, tvec);
@@ -1044,8 +1044,8 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
 
 int getTransformOrientation(const bContext *C, float normal[3], float plane[3])
 {
-       /* dummy value, not V3D_ACTIVE and not V3D_LOCAL */
-       short around = V3D_CENTER;
+       /* dummy value, not V3D_AROUND_ACTIVE and not V3D_AROUND_LOCAL_ORIGINS */
+       short around = V3D_AROUND_CENTER_BOUNDS;
 
        return getTransformOrientation_ex(C, normal, plane, around);
 }
index 3fc0b654b82d078c3c3b015484f3d694bb77604b..1a106b40f3202905d63b0e24fd498714ee206e87 100644 (file)
@@ -727,7 +727,7 @@ static bool uvedit_center(Scene *scene, Image *ima, Object *obedit, float cent[2
 {
        bool changed = false;
        
-       if (mode == V3D_CENTER) {  /* bounding box */
+       if (mode == V3D_AROUND_CENTER_BOUNDS) {  /* bounding box */
                float min[2], max[2];
                if (ED_uvedit_minmax(scene, ima, obedit, min, max)) {
                        mid_v2_v2v2(cent, min, max);
index 3ff3e29f79d5fb25f783a3aabb777cd02a647075..3f218136751fc6f146bd35e6c8771b4c02ee2c1e 100644 (file)
@@ -859,12 +859,12 @@ void ED_uvedit_live_unwrap(Scene *scene, Object *obedit)
 static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, 
                                     Object *ob, BMEditMesh *em)
 {
-       int around = (v3d) ? v3d->around : V3D_CENTER;
+       const int around = (v3d) ? v3d->around : V3D_AROUND_CENTER_BOUNDS;
 
        /* only operates on the edit object - this is all that's needed now */
 
        switch (around) {
-               case V3D_CENTER: /* bounding box center */
+               case V3D_AROUND_CENTER_BOUNDS: /* bounding box center */
                {
                        BMFace *efa;
                        BMLoop *l;
@@ -883,15 +883,15 @@ static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result,
                        mid_v3_v3v3(result, min, max);
                        break;
                }
-               case V3D_CURSOR:  /* cursor center */
+               case V3D_AROUND_CURSOR:  /* cursor center */
                {
                        const float *curs = ED_view3d_cursor3d_get(scene, v3d);
                        /* shift to objects world */
                        sub_v3_v3v3(result, curs, ob->obmat[3]);
                        break;
                }
-               case V3D_LOCAL:     /* object center */
-               case V3D_CENTROID:  /* multiple objects centers, only one object here*/
+               case V3D_AROUND_LOCAL_ORIGINS:  /* object center */
+               case V3D_AROUND_CENTER_MEAN:    /* multiple objects centers, only one object here*/
                default:
                        zero_v3(result);
                        break;
index 2384bb7347b73919c1a016a54e98d246bd9162f9..06c53547b7762a0fae81c1595f6d8ab11f4c4bf0 100644 (file)
@@ -315,11 +315,18 @@ typedef struct View3D {
 #define V3D_SHOW_WORLD                 (1 << 0)
 
 /* View3D->around */
-#define V3D_CENTER              0
-#define V3D_CENTROID    3
-#define V3D_CURSOR              1
-#define V3D_LOCAL               2
-#define V3D_ACTIVE              4
+enum {
+       /* center of the bounding box */
+       V3D_AROUND_CENTER_BOUNDS        = 0,
+       /* center from the sum of all points divided by the total */
+       V3D_AROUND_CENTER_MEAN          = 3,
+       /* pivot around the 2D/3D cursor */
+       V3D_AROUND_CURSOR                       = 1,
+       /* pivot around each items own origin */
+       V3D_AROUND_LOCAL_ORIGINS        = 2,
+       /* pivot around the active items origin */
+       V3D_AROUND_ACTIVE                       = 4,
+};
 
 /*View3D types (only used in tools, not actually saved)*/
 #define V3D_VIEW_STEPLEFT               1
index f3f4f3c1c3dfbae890aca5ce226394c464809445..ad26891c96ae263c48edec7f4ee07d3e722a02a3 100644 (file)
@@ -124,14 +124,14 @@ static EnumPropertyItem stereo3d_eye_items[] = {
 #endif
 
 static EnumPropertyItem pivot_items_full[] = {
-       {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
+       {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
                     "Pivot around bounding box center of selected object(s)"},
-       {V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
-       {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
+       {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
+       {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
                    "Individual Origins", "Pivot around each object's own origin"},
-       {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",
+       {V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",
                       "Pivot around the median point of selected objects"},
-       {V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"},
+       {V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -935,10 +935,10 @@ static EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED(C), P
                                                           PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
 {
        static EnumPropertyItem pivot_items[] = {
-               {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
-               {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
-               {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
-               {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
+               {V3D_AROUND_CENTER_BOUNDS, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
+               {V3D_AROUND_CENTER_MEAN, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
+               {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
+               {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
                            "Individual Origins", "Pivot around each object's own origin"},
                {0, NULL, 0, NULL, NULL}
        };
@@ -3426,11 +3426,11 @@ static void rna_def_space_graph(BlenderRNA *brna)
                
        /* this is basically the same as the one for the 3D-View, but with some entries omitted */
        static EnumPropertyItem gpivot_items[] = {
-               {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
-               {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
-               {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""},
-               /*{V3D_CENTROID, "MEDIAN_POINT", 0, "Median Point", ""}, */
-               /*{V3D_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""}, */
+               {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
+               {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
+               {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""},
+               /*{V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", 0, "Median Point", ""}, */
+               /*{V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""}, */
                {0, NULL, 0, NULL, NULL}
        };
 
@@ -4457,12 +4457,12 @@ static void rna_def_space_clip(BlenderRNA *brna)
        };
 
        static EnumPropertyItem pivot_items[] = {
-               {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
+               {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
                             "Pivot around bounding box center of selected object(s)"},
-               {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
-               {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
+               {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
+               {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
                            "Individual Origins", "Pivot around each object's own origin"},
-               {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",
+               {V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",
                               "Pivot around the median point of selected objects"},
                {0, NULL, 0, NULL, NULL}
        };