Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-12-14 11:09:42 +11:00
commit dd4c87cd04
Notes: blender-bot 2023-02-14 04:19:34 +01:00
Referenced by issue #59793, bug
44 changed files with 107 additions and 107 deletions

View File

@ -107,12 +107,12 @@ void BKE_editmesh_cache_ensure_poly_centers(BMEditMesh *em, EditMeshData *emd)
BM_mesh_elem_index_ensure(bm, BM_VERT);
BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) {
BM_face_calc_center_mean_vcos(bm, efa, polyCos[i], vertexCos);
BM_face_calc_center_median_vcos(bm, efa, polyCos[i], vertexCos);
}
}
else {
BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) {
BM_face_calc_center_mean(efa, polyCos[i]);
BM_face_calc_center_median(efa, polyCos[i]);
}
}

View File

@ -662,7 +662,7 @@ void BKE_scene_init(Scene *sce)
sce->toolsettings->autokey_mode = U.autokey_mode;
sce->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEAN;
sce->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEDIAN;
sce->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT;
sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
sce->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT;

View File

@ -1302,7 +1302,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
SpaceClip *sclip = (SpaceClip *)sl;
if (sclip->around == 0) {
sclip->around = V3D_AROUND_CENTER_MEAN;
sclip->around = V3D_AROUND_CENTER_MEDIAN;
}
}
}

View File

@ -1407,7 +1407,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "transform_pivot_point")) {
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
scene->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEAN;
scene->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEDIAN;
}
}

View File

@ -1333,9 +1333,9 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
float f_center[3];
float (*faces_center)[3] = BLI_array_alloca(faces_center, totface);
BM_face_calc_center_mean(f_new, f_center);
BM_face_calc_center_median(f_new, f_center);
for (i = 0; i < totface; i++) {
BM_face_calc_center_mean(faces[i], faces_center[i]);
BM_face_calc_center_median(faces[i], faces_center[i]);
}
l_iter = l_first = BM_FACE_FIRST_LOOP(f_new);

View File

@ -253,7 +253,7 @@ static int compute_mdisp_quad(
{
float cent[3];
/* computer center */
BM_face_calc_center_mean(l->f, cent);
BM_face_calc_center_median(l->f, cent);
BLI_assert(equals_v3v3(cent, l_f_center));
}
#endif
@ -527,8 +527,8 @@ void BM_loop_interp_multires(BMesh *bm, BMLoop *l_dst, const BMFace *f_src)
float f_dst_center[3];
float f_src_center[3];
BM_face_calc_center_mean(l_dst->f, f_dst_center);
BM_face_calc_center_mean(f_src, f_src_center);
BM_face_calc_center_median(l_dst->f, f_dst_center);
BM_face_calc_center_median(f_src, f_src_center);
BM_loop_interp_multires_ex(bm, l_dst, f_src, f_dst_center, f_src_center, cd_loop_mdisp_offset);
}
@ -555,8 +555,8 @@ void BM_face_interp_multires(BMesh *bm, BMFace *f_dst, const BMFace *f_src)
float f_dst_center[3];
float f_src_center[3];
BM_face_calc_center_mean(f_dst, f_dst_center);
BM_face_calc_center_mean(f_src, f_src_center);
BM_face_calc_center_median(f_dst, f_dst_center);
BM_face_calc_center_median(f_src, f_src_center);
BM_face_interp_multires_ex(bm, f_dst, f_src, f_dst_center, f_src_center, cd_loop_mdisp_offset);
}

View File

@ -828,7 +828,7 @@ void BM_editselection_center(BMEditSelection *ese, float r_center[3])
}
else if (ese->htype == BM_FACE) {
BMFace *efa = (BMFace *)ese->ele;
BM_face_calc_center_mean(efa, r_center);
BM_face_calc_center_median(efa, r_center);
}
}

View File

@ -299,12 +299,12 @@ BMFace *BM_face_split(
float f_dst_center[3];
float f_src_center[3];
BM_face_calc_center_mean(f_tmp, f_src_center);
BM_face_calc_center_median(f_tmp, f_src_center);
BM_face_calc_center_mean(f, f_dst_center);
BM_face_calc_center_median(f, f_dst_center);
BM_face_interp_multires_ex(bm, f, f_tmp, f_dst_center, f_src_center, cd_loop_mdisp_offset);
BM_face_calc_center_mean(f_new, f_dst_center);
BM_face_calc_center_median(f_new, f_dst_center);
BM_face_interp_multires_ex(bm, f_new, f_tmp, f_dst_center, f_src_center, cd_loop_mdisp_offset);
#if 0
@ -642,7 +642,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
for (i = 0; i < BLI_array_len(oldfaces); i++) {
float f_center_old[3];
BM_face_calc_center_mean(oldfaces[i], f_center_old);
BM_face_calc_center_median(oldfaces[i], f_center_old);
for (j = 0; j < 2; j++) {
BMEdge *e1 = j ? e_new : e;
@ -660,7 +660,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
if (BM_ELEM_API_FLAG_TEST(l->f, _FLAG_OVERLAP)) {
float f_center[3];
BM_face_calc_center_mean(l->f, f_center);
BM_face_calc_center_median(l->f, f_center);
BM_face_interp_multires_ex(
bm, l->f, oldfaces[i],
f_center, f_center_old, cd_loop_mdisp_offset);

View File

@ -1963,8 +1963,8 @@ static BMOpDefine bmo_wireframe_def = {
};
static BMO_FlagSet bmo_enum_poke_center_mode[] = {
{BMOP_POKE_MEAN_WEIGHTED, "MEAN_WEIGHTED"},
{BMOP_POKE_MEAN, "MEAN"},
{BMOP_POKE_MEDIAN_WEIGHTED, "MEAN_WEIGHTED"},
{BMOP_POKE_MEDIAN, "MEAN"},
{BMOP_POKE_BOUNDS, "BOUNDS"},
{0, NULL},
};

View File

@ -104,8 +104,8 @@ enum {
/* Poke face center calculation */
enum {
BMOP_POKE_MEAN_WEIGHTED = 0,
BMOP_POKE_MEAN,
BMOP_POKE_MEDIAN_WEIGHTED = 0,
BMOP_POKE_MEDIAN,
BMOP_POKE_BOUNDS
};

View File

@ -108,7 +108,7 @@ static float bm_face_calc_poly_normal_vertex_cos(
/**
* \brief COMPUTE POLY CENTER (BMFace)
*/
static void bm_face_calc_poly_center_mean_vertex_cos(
static void bm_face_calc_poly_center_median_vertex_cos(
const BMFace *f, float r_cent[3],
float const (*vertexCos)[3])
{
@ -585,7 +585,7 @@ void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3])
/**
* computes the center of a face, using the mean average
*/
void BM_face_calc_center_mean(const BMFace *f, float r_cent[3])
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
{
const BMLoop *l_iter, *l_first;
@ -602,7 +602,7 @@ void BM_face_calc_center_mean(const BMFace *f, float r_cent[3])
* computes the center of a face, using the mean average
* weighted by edge length
*/
void BM_face_calc_center_mean_weighted(const BMFace *f, float r_cent[3])
void BM_face_calc_center_median_weighted(const BMFace *f, float r_cent[3])
{
const BMLoop *l_iter;
const BMLoop *l_first;
@ -880,7 +880,7 @@ float BM_face_calc_normal_subset(const BMLoop *l_first, const BMLoop *l_last, fl
}
/* exact same as 'BM_face_calc_normal' but accepts vertex coords */
void BM_face_calc_center_mean_vcos(
void BM_face_calc_center_median_vcos(
const BMesh *bm, const BMFace *f, float r_cent[3],
float const (*vertexCos)[3])
{
@ -888,7 +888,7 @@ void BM_face_calc_center_mean_vcos(
BLI_assert((bm->elem_index_dirty & BM_VERT) == 0);
(void)bm;
bm_face_calc_poly_center_mean_vertex_cos(f, r_cent, vertexCos);
bm_face_calc_poly_center_median_vertex_cos(f, r_cent, vertexCos);
}
/**
@ -1103,7 +1103,7 @@ void BM_face_triangulate(
}
if (cd_loop_mdisp_offset != -1) {
BM_face_calc_center_mean(f, f_center);
BM_face_calc_center_median(f, f_center);
}
/* loop over calculated triangles and create new geometry */
@ -1175,7 +1175,7 @@ void BM_face_triangulate(
if (cd_loop_mdisp_offset != -1) {
float f_new_center[3];
BM_face_calc_center_mean(f_new, f_new_center);
BM_face_calc_center_median(f_new, f_new_center);
BM_face_interp_multires_ex(bm, f_new, f, f_new_center, f_center, cd_loop_mdisp_offset);
}
}

View File

@ -53,11 +53,11 @@ void BM_face_calc_tangent_edge_diagonal(const BMFace *f, float r_plane[3]) ATTR
void BM_face_calc_tangent_vert_diagonal(const BMFace *f, float r_plane[3]) ATTR_NONNULL();
void BM_face_calc_tangent_auto(const BMFace *f, float r_plane[3]) ATTR_NONNULL();
void BM_face_calc_center_bounds(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_mean(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_vcos(
void BM_face_calc_center_median(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_median_vcos(
const BMesh *bm, const BMFace *f, float r_cent[3],
float const (*vertexCos)[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_weighted(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_median_weighted(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_bounds_expand(const BMFace *f, float min[3], float max[3]);

View File

@ -1860,7 +1860,7 @@ float BM_vert_calc_shell_factor_ex(const BMVert *v, const float no[3], const cha
* \note quite an obscure function.
* used in bmesh operators that have a relative scale options,
*/
float BM_vert_calc_mean_tagged_edge_length(const BMVert *v)
float BM_vert_calc_median_tagged_edge_length(const BMVert *v)
{
BMIter iter;
BMEdge *e;

View File

@ -132,7 +132,7 @@ float BM_vert_calc_edge_angle(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NO
float BM_vert_calc_edge_angle_ex(const BMVert *v, const float fallback) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_vert_calc_shell_factor(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_vert_calc_shell_factor_ex(const BMVert *v, const float no[3], const char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_vert_calc_mean_tagged_edge_length(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_vert_calc_median_tagged_edge_length(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMLoop *BM_face_find_shortest_loop(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMLoop *BM_face_find_longest_loop(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();

View File

@ -107,7 +107,7 @@ static int recalc_face_normals_find_index(BMesh *bm, BMFace **faces, const int f
for (i = 0; i < faces_len; i++) {
float f_cent[3];
const float f_area = BM_face_calc_area(faces[i]);
BM_face_calc_center_mean_weighted(faces[i], f_cent);
BM_face_calc_center_median_weighted(faces[i], f_cent);
madd_v3_v3fl(cent, f_cent, cent_fac * f_area);
cent_area_accum += f_area;

View File

@ -67,7 +67,7 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
continue;
}
BM_face_calc_center_mean_weighted(f, faces_center[i]);
BM_face_calc_center_median_weighted(f, faces_center[i]);
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
@ -101,7 +101,7 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
/* keep original face data (else we 'move' the face) */
#if 0
BM_face_normal_update(f);
BM_face_calc_center_mean_weighted(f, f_center);
BM_face_calc_center_median_weighted(f, f_center);
#endif
plane_from_point_normal_v3(plane, faces_center[i], f->no);

View File

@ -57,14 +57,14 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
void (*bm_face_calc_center_fn)(const BMFace *f, float r_cent[3]);
switch (center_mode) {
case BMOP_POKE_MEAN_WEIGHTED:
bm_face_calc_center_fn = BM_face_calc_center_mean_weighted;
case BMOP_POKE_MEDIAN_WEIGHTED:
bm_face_calc_center_fn = BM_face_calc_center_median_weighted;
break;
case BMOP_POKE_BOUNDS:
bm_face_calc_center_fn = BM_face_calc_center_bounds;
break;
case BMOP_POKE_MEAN:
bm_face_calc_center_fn = BM_face_calc_center_mean;
case BMOP_POKE_MEDIAN:
bm_face_calc_center_fn = BM_face_calc_center_median;
break;
default:
BLI_assert(0);
@ -90,11 +90,11 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
BMO_vert_flag_enable(bm, v_center, ELE_NEW);
if (cd_loop_mdisp_offset != -1) {
if (center_mode == BMOP_POKE_MEAN) {
if (center_mode == BMOP_POKE_MEDIAN) {
copy_v3_v3(f_center_mean, f_center);
}
else {
BM_face_calc_center_mean(f, f_center_mean);
BM_face_calc_center_median(f, f_center_mean);
}
}
@ -132,7 +132,7 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
if (cd_loop_mdisp_offset != -1) {
float f_new_center[3];
BM_face_calc_center_mean(f_new, f_new_center);
BM_face_calc_center_median(f_new, f_new_center);
BM_face_interp_multires_ex(bm, f_new, f, f_new_center, f_center, cd_loop_mdisp_offset);
}

View File

@ -100,7 +100,7 @@ static void bm_decim_build_quadrics(BMesh *bm, Quadric *vquadrics)
double plane_db[4];
Quadric q;
BM_face_calc_center_mean(f, center);
BM_face_calc_center_median(f, center);
copy_v3db_v3fl(plane_db, f->no);
plane_db[3] = -dot_v3db_v3fl(plane_db, center);

View File

@ -1578,7 +1578,7 @@ bool BM_mesh_intersect(
BLI_assert(ELEM(side, 0, 1));
side = !side;
// BM_face_calc_center_mean(f, co);
// BM_face_calc_center_median(f, co);
BM_face_calc_point_in_face(f, co);
hits = isect_bvhtree_point_v3(tree_pair[side], looptri_coords, co);

View File

@ -215,7 +215,7 @@ static float edgetag_cut_cost_face(BMEdge *e_a, BMEdge *e_b, BMFace *f)
mid_v3_v3v3(e_a_cent, e_a->v1->co, e_a->v1->co);
mid_v3_v3v3(e_b_cent, e_b->v1->co, e_b->v1->co);
BM_face_calc_center_mean_weighted(f, f_cent);
BM_face_calc_center_median_weighted(f, f_cent);
return step_cost_3_v3(e_a_cent, e_b_cent, f_cent);
}
@ -380,8 +380,8 @@ static float facetag_cut_cost_edge(BMFace *f_a, BMFace *f_b, BMEdge *e, const vo
float f_b_cent[3];
float e_cent[3];
BM_face_calc_center_mean_weighted(f_a, f_a_cent);
BM_face_calc_center_mean_weighted(f_b, f_b_cent);
BM_face_calc_center_median_weighted(f_a, f_a_cent);
BM_face_calc_center_median_weighted(f_b, f_b_cent);
#if 0
mid_v3_v3v3(e_cent, e->v1->co, e->v2->co);
#else
@ -412,8 +412,8 @@ static float facetag_cut_cost_vert(BMFace *f_a, BMFace *f_b, BMVert *v, const vo
float f_a_cent[3];
float f_b_cent[3];
BM_face_calc_center_mean_weighted(f_a, f_a_cent);
BM_face_calc_center_mean_weighted(f_b, f_b_cent);
BM_face_calc_center_median_weighted(f_a, f_a_cent);
BM_face_calc_center_median_weighted(f_b, f_b_cent);
return step_cost_3_v3_ex(
f_a_cent, v->co, f_b_cent,

View File

@ -269,7 +269,7 @@ void BM_mesh_wireframe(
if (verts_relfac) {
if (use_relative_offset) {
verts_relfac[i] = BM_vert_calc_mean_tagged_edge_length(v_src);
verts_relfac[i] = BM_vert_calc_median_tagged_edge_length(v_src);
}
else {
verts_relfac[i] = 1.0f;
@ -315,7 +315,7 @@ void BM_mesh_wireframe(
verts_pos[i] = NULL;
}
/* conflicts with BM_vert_calc_mean_tagged_edge_length */
/* conflicts with BM_vert_calc_median_tagged_edge_length */
if (use_relative_offset == false) {
BM_elem_flag_disable(v_src, BM_ELEM_TAG);
}

View File

@ -1928,7 +1928,7 @@ static bool add_edit_facedot(
copy_v3_v3(pnor, rdata->edit_data->polyNos[poly]);
}
else {
BM_face_calc_center_mean(efa, center);
BM_face_calc_center_median(efa, center);
copy_v3_v3(pnor, efa->no);
}
selected = (BM_elem_flag_test(efa, BM_ELEM_SELECT) != 0) ? true : false;

View File

@ -345,7 +345,7 @@ void DRW_edit_mesh_mode_text_measure_stats(
BM_ITER_MESH_INDEX(f, &iter, em->bm, BM_FACES_OF_MESH, i) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
BM_face_calc_center_mean(f, v1);
BM_face_calc_center_median(f, v1);
mul_m4_v3(ob->obmat, v1);
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);

View File

@ -160,7 +160,7 @@ void ED_armature_origin_set(Main *bmain, Object *ob, float cursor[3], int center
mul_m4_v3(ob->imat, cent);
}
else {
if (around == V3D_AROUND_CENTER_MEAN) {
if (around == V3D_AROUND_CENTER_MEDIAN) {
int total = 0;
zero_v3(cent);
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {

View File

@ -2335,7 +2335,7 @@ static int gp_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op))
}
}
if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEAN && count) {
if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEDIAN && count) {
mul_v3_fl(centroid, 1.0f / (float)count);
copy_v3_v3(cursor, centroid);
}

View File

@ -469,7 +469,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
opdata = op->customdata;
/* initialize mouse values */
if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEAN, center_3d, opdata->mcenter)) {
if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEDIAN, 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;

View File

@ -326,7 +326,7 @@ static int edbm_inset_invoke(bContext *C, wmOperator *op, const wmEvent *event)
opdata = op->customdata;
/* initialize mouse values */
if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEAN, center_3d, opdata->mcenter)) {
if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEDIAN, 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;

View File

@ -1262,10 +1262,10 @@ bool EDBM_unified_findnearest_from_raycast(
if (BM_elem_flag_test(f, BM_ELEM_HIDDEN) == false) {
float point[3];
if (coords) {
BM_face_calc_center_mean_vcos(bm, f, point, coords);
BM_face_calc_center_median_vcos(bm, f, point, coords);
}
else {
BM_face_calc_center_mean(f, point);
BM_face_calc_center_median(f, point);
}
mul_m4_v3(obedit->obmat, point);
float depth;
@ -1830,7 +1830,7 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de
float cent[3];
float co[2], tdist;
BM_face_calc_center_mean(f, cent);
BM_face_calc_center_median(f, cent);
if (ED_view3d_project_float_object(
vc.ar, cent, co, V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{

View File

@ -159,7 +159,7 @@ static void face_pos_direction_worldspace_scaled_get(Object *ob, BMFace *face, f
copy_v3_v3(r_dir, face->no);
normalize_v3(r_dir);
BM_face_calc_center_mean(face, center);
BM_face_calc_center_median(face, center);
mul_m4_v3(ob->obmat, center);
distance = dot_v3v3(r_dir, center);

View File

@ -4647,9 +4647,9 @@ static int edbm_poke_face_exec(bContext *C, wmOperator *op)
void MESH_OT_poke(wmOperatorType *ot)
{
static const EnumPropertyItem poke_center_modes[] = {
{BMOP_POKE_MEAN_WEIGHTED, "MEAN_WEIGHTED", 0, "Weighted Mean", "Weighted Mean Face Center"},
{BMOP_POKE_MEAN, "MEAN", 0, "Mean", "Mean Face Center"},
{BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face Bounds Center"},
{BMOP_POKE_MEDIAN_WEIGHTED, "MEDIAN_WEIGHTED", 0, "Weighted Median", "Weighted median face center"},
{BMOP_POKE_MEDIAN, "MEDIAN", 0, "Median", "Mean face center"},
{BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face bounds center"},
{0, NULL, 0, NULL, NULL}};
@ -4667,7 +4667,7 @@ void MESH_OT_poke(wmOperatorType *ot)
RNA_def_float_distance(ot->srna, "offset", 0.0f, -1e3f, 1e3f, "Poke Offset", "Poke Offset", -1.0f, 1.0f);
RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry");
RNA_def_enum(ot->srna, "center_mode", poke_center_modes, BMOP_POKE_MEAN_WEIGHTED,
RNA_def_enum(ot->srna, "center_mode", poke_center_modes, BMOP_POKE_MEDIAN_WEIGHTED,
"Poke Center", "Poke Face Center Calculation");
}
@ -5710,7 +5710,7 @@ static void sort_bmelem_flag(
BM_ITER_MESH_INDEX (fa, &iter, em->bm, BM_FACES_OF_MESH, i) {
if (BM_elem_flag_test(fa, flag)) {
float co[3];
BM_face_calc_center_mean(fa, co);
BM_face_calc_center_median(fa, co);
mul_m4_v3(mat, co);
pb[i] = false;
@ -5776,7 +5776,7 @@ static void sort_bmelem_flag(
BM_ITER_MESH_INDEX (fa, &iter, em->bm, BM_FACES_OF_MESH, i) {
if (BM_elem_flag_test(fa, flag)) {
float co[3];
BM_face_calc_center_mean(fa, co);
BM_face_calc_center_median(fa, co);
pb[i] = false;
sb[affected[2]].org_idx = i;
@ -7400,7 +7400,7 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent *
break;
}
case V3D_AROUND_CENTER_MEAN:
case V3D_AROUND_CENTER_MEDIAN:
{
bmesh_selected_verts_center_calc(bm, target);
add_v3_v3(target, obedit->loc);

View File

@ -848,7 +848,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
mul_m4_v3(obedit->imat, cent);
}
else {
if (around == V3D_AROUND_CENTER_MEAN) {
if (around == V3D_AROUND_CENTER_MEDIAN) {
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) {
@ -963,7 +963,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
else if (centermode == ORIGIN_TO_CENTER_OF_MASS_VOLUME) {
BKE_mesh_center_of_volume(me, cent);
}
else if (around == V3D_AROUND_CENTER_MEAN) {
else if (around == V3D_AROUND_CENTER_MEDIAN) {
BKE_mesh_center_median(me, cent);
}
else {
@ -980,9 +980,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_AROUND_CENTER_MEAN) { 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_MEDIAN) { 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))
@ -1062,9 +1062,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_AROUND_CENTER_MEAN) { 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_MEDIAN) { 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);
@ -1083,9 +1083,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_AROUND_CENTER_MEAN) { 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_MEDIAN) { 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);
@ -1254,7 +1254,7 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
};
static const EnumPropertyItem prop_set_bounds_types[] = {
{V3D_AROUND_CENTER_MEAN, "MEDIAN", 0, "Median Center", ""},
{V3D_AROUND_CENTER_MEDIAN, "MEDIAN", 0, "Median Center", ""},
{V3D_AROUND_CENTER_BOUNDS, "BOUNDS", 0, "Bounds Center", ""},
{0, NULL, 0, NULL, NULL}
};
@ -1274,7 +1274,7 @@ 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_AROUND_CENTER_MEAN, "Center", "");
RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_AROUND_CENTER_MEDIAN, "Center", "");
}
/* -------------------------------------------------------------------- */

View File

@ -325,7 +325,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_AROUND_CENTER_MEAN, lastofs, NULL);
is_set = calculateTransformCenter(C, V3D_AROUND_CENTER_MEDIAN, lastofs, NULL);
}
copy_v3_v3(r_dyn_ofs, lastofs);

View File

@ -658,7 +658,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
}
MEM_freeN(objects);
if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEAN) {
if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEDIAN) {
mul_v3_fl(centroid, 1.0f / (float)global_transverts_tot);
copy_v3_v3(cursor, centroid);
}
@ -709,7 +709,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
return false;
}
if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEAN) {
if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEDIAN) {
mul_v3_fl(centroid, 1.0f / (float)count);
copy_v3_v3(cursor, centroid);
}

View File

@ -6114,7 +6114,7 @@ static void slide_origdata_interp_data_vert(
BMLoop *l;
BM_ITER_ELEM_INDEX (l, &liter, sv->v, BM_LOOPS_OF_VERT, j) {
BM_face_calc_center_mean(l->f, faces_center[j]);
BM_face_calc_center_median(l->f, faces_center[j]);
}
BM_ITER_ELEM_INDEX (l, &liter, sv->v, BM_LOOPS_OF_VERT, j) {
@ -6124,7 +6124,7 @@ static void slide_origdata_interp_data_vert(
BMLoop *l_other;
int j_other;
BM_face_calc_center_mean(f_copy, f_copy_center);
BM_face_calc_center_median(f_copy, f_copy_center);
BM_ITER_ELEM_INDEX (l_other, &liter_other, sv->v, BM_LOOPS_OF_VERT, j_other) {
BM_face_interp_multires_ex(

View File

@ -131,7 +131,7 @@
static void transform_around_single_fallback(TransInfo *t)
{
if ((t->data_len_all == 1) &&
(ELEM(t->around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEAN, V3D_AROUND_ACTIVE)) &&
(ELEM(t->around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEDIAN, V3D_AROUND_ACTIVE)) &&
(ELEM(t->mode, TFM_RESIZE, TFM_ROTATION, TFM_TRACKBALL)))
{
t->around = V3D_AROUND_LOCAL_ORIGINS;

View File

@ -2046,7 +2046,7 @@ static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[
case V3D_AROUND_CENTER_BOUNDS:
calculateCenterBound(t, r_center);
break;
case V3D_AROUND_CENTER_MEAN:
case V3D_AROUND_CENTER_MEDIAN:
calculateCenterMedian(t, r_center);
break;
case V3D_AROUND_CURSOR:

View File

@ -1163,7 +1163,7 @@ static void gizmo_prepare_mat(
break;
}
case V3D_AROUND_LOCAL_ORIGINS:
case V3D_AROUND_CENTER_MEAN:
case V3D_AROUND_CENTER_MEDIAN:
copy_v3_v3(rv3d->twmat[3], tbounds->center);
break;
case V3D_AROUND_CURSOR:

View File

@ -1529,7 +1529,7 @@ static void applyGridIncrement(TransInfo *t, float *val, int max_index, const fl
* this isn't useful as a global center for absolute grid snapping
* since its not based on the position of the selection. */
if (t->around == V3D_AROUND_CURSOR) {
const TransCenterData *cd = transformCenter_from_type(t, V3D_AROUND_CENTER_MEAN);
const TransCenterData *cd = transformCenter_from_type(t, V3D_AROUND_CENTER_MEDIAN);
center_global = cd->global;
}

View File

@ -1071,7 +1071,7 @@ static void uv_map_transform_calc_center_median(BMEditMesh *em, float r_center[3
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
float center[3];
BM_face_calc_center_mean(efa, center);
BM_face_calc_center_median(efa, center);
add_v3_v3(r_center, center);
center_accum_num += 1;
}
@ -1099,7 +1099,7 @@ static void uv_map_transform_center(
mid_v3_v3v3(r_center, bounds[0], bounds[1]);
break;
}
case V3D_AROUND_CENTER_MEAN:
case V3D_AROUND_CENTER_MEDIAN:
{
uv_map_transform_calc_center_median(em, r_center);
break;

View File

@ -488,7 +488,7 @@ 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,
V3D_AROUND_CENTER_MEDIAN = 3,
/* pivot around the 2D/3D cursor */
V3D_AROUND_CURSOR = 1,
/* pivot around each items own origin */

View File

@ -462,7 +462,7 @@ const EnumPropertyItem rna_enum_transform_pivot_items_full[] = {
{V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
{V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL,
"Individual Origins", "Pivot around each object's own origin"},
{V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
{V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
"Pivot around the median point of selected objects"},
{V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", ICON_PIVOT_ACTIVE, "Active Element", "Pivot around active object"},
{0, NULL, 0, NULL, NULL}

View File

@ -1191,7 +1191,7 @@ static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(
{
static const EnumPropertyItem pivot_items[] = {
{V3D_AROUND_CENTER_BOUNDS, "CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center", ""},
{V3D_AROUND_CENTER_MEAN, "MEDIAN", ICON_PIVOT_MEDIAN, "Median Point", ""},
{V3D_AROUND_CENTER_MEDIAN, "MEDIAN", ICON_PIVOT_MEDIAN, "Median Point", ""},
{V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", ""},
{V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL,
"Individual Origins", "Pivot around each selected island's own median point"},
@ -4084,7 +4084,7 @@ static void rna_def_space_graph(BlenderRNA *brna)
{V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center", ""},
{V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", ""},
{V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL, "Individual Centers", ""},
/*{V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", 0, "Median Point", ""}, */
/*{V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", 0, "Median Point", ""}, */
/*{V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""}, */
{0, NULL, 0, NULL, NULL}
};
@ -4992,7 +4992,7 @@ static void rna_def_space_clip(BlenderRNA *brna)
{V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
{V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_CENTER_ONLY,
"Individual Origins", "Pivot around each object's own origin"},
{V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
{V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
"Pivot around the median point of selected objects"},
{0, NULL, 0, NULL, NULL}
};

View File

@ -1219,7 +1219,7 @@ static BMFace *skin_hole_target_face(BMesh *bm, Frame *frame)
}
/* Nearest test */
BM_face_calc_center_mean(f, poly_center);
BM_face_calc_center_median(f, poly_center);
dist = len_v3v3(frame_center, poly_center);
if (dist < best_center_dist) {
center_target_face = f;

View File

@ -1869,7 +1869,7 @@ static PyObject *bpy_bmface_calc_tangent_vert_diagonal(BPy_BMFace *self)
}
PyDoc_STRVAR(bpy_bmface_calc_center_mean_doc,
PyDoc_STRVAR(bpy_bmface_calc_center_median_doc,
".. method:: calc_center_median()\n"
"\n"
" Return median center of the face.\n"
@ -1882,11 +1882,11 @@ static PyObject *bpy_bmface_calc_center_mean(BPy_BMFace *self)
float cent[3];
BPY_BM_CHECK_OBJ(self);
BM_face_calc_center_mean(self->f, cent);
BM_face_calc_center_median(self->f, cent);
return Vector_CreatePyObject(cent, 3, NULL);
}
PyDoc_STRVAR(bpy_bmface_calc_center_mean_weighted_doc,
PyDoc_STRVAR(bpy_bmface_calc_center_median_weighted_doc,
".. method:: calc_center_median_weighted()\n"
"\n"
" Return median center of the face weighted by edge lengths.\n"
@ -1894,12 +1894,12 @@ PyDoc_STRVAR(bpy_bmface_calc_center_mean_weighted_doc,
" :return: a 3D vector.\n"
" :rtype: :class:`mathutils.Vector`\n"
);
static PyObject *bpy_bmface_calc_center_mean_weighted(BPy_BMFace *self)
static PyObject *bpy_bmface_calc_center_median_weighted(BPy_BMFace *self)
{
float cent[3];
BPY_BM_CHECK_OBJ(self);
BM_face_calc_center_mean_weighted(self->f, cent);
BM_face_calc_center_median_weighted(self->f, cent);
return Vector_CreatePyObject(cent, 3, NULL);
}
@ -2773,8 +2773,8 @@ static struct PyMethodDef bpy_bmface_methods[] = {
{"calc_tangent_edge_pair", (PyCFunction)bpy_bmface_calc_tangent_edge_pair, METH_NOARGS, bpy_bmface_calc_tangent_edge_pair_doc},
{"calc_tangent_edge_diagonal", (PyCFunction)bpy_bmface_calc_tangent_edge_diagonal, METH_NOARGS, bpy_bmface_calc_tangent_edge_diagonal_doc},
{"calc_tangent_vert_diagonal", (PyCFunction)bpy_bmface_calc_tangent_vert_diagonal, METH_NOARGS, bpy_bmface_calc_tangent_vert_diagonal_doc},
{"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc},
{"calc_center_median_weighted", (PyCFunction)bpy_bmface_calc_center_mean_weighted, METH_NOARGS, bpy_bmface_calc_center_mean_weighted_doc},
{"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_median_doc},
{"calc_center_median_weighted", (PyCFunction)bpy_bmface_calc_center_median_weighted, METH_NOARGS, bpy_bmface_calc_center_median_weighted_doc},
{"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc},
{"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc},