Cleanup: use more logical names for View3D.around
D1651 (own patch)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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", "");
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user