diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-01 10:52:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-01 10:53:26 +0300 |
commit | 9e56c570c3fbca4bae9a1da24828b6e640299f99 (patch) | |
tree | 5698d3d2dc2f8ae2dc77c070d9beefa4e69e109e /source | |
parent | 2f80d304b0d50ea25367219b339bcfaa7958bbf4 (diff) |
Cleanup: use more logical names for View3D.around
D1651 (own patch)
Diffstat (limited to 'source')
19 files changed, 131 insertions, 115 deletions
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 9456c286c6f..77a4aefb7ac 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -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; } } } diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 5a0e70dc5dd..94b7277ce8f 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -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) { diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index ce6856321d2..f001eadd9cd 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -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; diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 14a477ee86c..937547c99ef 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -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; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index ac1f13ee59c..8f00c0eb467 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -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", ""); } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index c1db31a26db..7a66599655f 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -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; diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 8c4b97b51ff..e1d4e4fabc5 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -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(); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 5a006ed24ce..a1c2c8cca17 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -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; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 7458d819213..d278d94738d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -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); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 8bb84d00c83..e8e7d3c62fb 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -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); } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 57688ca9f3c..7656a8a54c6 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -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; } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 6a8e545ba3c..924995e7b92 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -129,10 +129,10 @@ 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) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 8d64b5f7577..3b40a55a270 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -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 */ diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 5e5dbfdf80a..8131758f93c 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -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; } diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index a1bb6f4e0f3..2ea18d509f0 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -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); } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 3fc0b654b82..1a106b40f32 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -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); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 3ff3e29f79d..3f218136751 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -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; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 2384bb7347b..06c53547b77 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -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 diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index f3f4f3c1c3d..ad26891c96a 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -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} }; |