diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index d9961e5..0ef12fa 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -82,6 +82,7 @@ enum {
SIMFACE_SIDES,
SIMFACE_PERIMETER,
SIMFACE_NORMAL,
+ SIMFACE_LOCATION,
SIMFACE_COPLANAR,
SIMFACE_SMOOTH,
#ifdef WITH_FREESTYLE
@@ -107,6 +108,7 @@ enum {
/* similar vertex selection slot values */
enum {
SIMVERT_NORMAL = 0,
+ SIMVERT_LOCATION,
SIMVERT_FACE,
SIMVERT_VGROUP,
SIMVERT_EDGE
diff --git a/source/blender/bmesh/operators/bmo_similar.c b/source/blender/bmesh/operators/bmo_similar.c
index 708d57a..6376ff0 100644
--- a/source/blender/bmesh/operators/bmo_similar.c
+++ b/source/blender/bmesh/operators/bmo_similar.c
@@ -142,10 +142,10 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
}
/*
- * Save us some computation burden: In case of perimeter/area/coplanar selection we compute
+ * Save us some computation burden: In case of perimeter/area/coplanar/image/location selection we compute
* only once.
*/
- if (type == SIMFACE_PERIMETER || type == SIMFACE_AREA || type == SIMFACE_COPLANAR || type == SIMFACE_IMAGE) {
+ if (type == SIMFACE_PERIMETER || type == SIMFACE_AREA || type == SIMFACE_COPLANAR || type == SIMFACE_IMAGE || type == SIMFACE_LOCATION) {
for (i = 0; i < num_total; i++) {
switch (type) {
case SIMFACE_PERIMETER:
@@ -172,6 +172,10 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
f_ext[i].t = mtpoly->tpage;
}
break;
+
+ case SIMFACE_LOCATION:
+ BM_face_calc_center_mean(f_ext[i].f, f_ext[i].c);
+ break;
}
}
}
@@ -206,6 +210,14 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
}
break;
+ case SIMFACE_LOCATION:
+ delta_fl = len_squared_v3v3(f_ext[i].c, f_ext[indices[idx]].c);
+ if (delta_fl <= thresh * thresh) {
+ BMO_elem_flag_enable(bm, fm, FACE_MARK);
+ cont = false;
+ }
+ break;
+
case SIMFACE_COPLANAR:
{
float sign = 1.0f;
@@ -611,6 +623,12 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
cont = false;
}
break;
+ case SIMVERT_LOCATION:
+ if (len_squared_v3v3(v->co, vs->co) <= thresh_radians * thresh_radians) {
+ BMO_elem_flag_enable(bm, v, VERT_MARK);
+ cont = false;
+ }
+ break;
case SIMVERT_FACE:
/* number of adjacent faces */
delta_i = v_ext[i].num_faces - v_ext[indices[idx]].num_faces;
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 09b146f..a5e68e7 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -965,6 +965,7 @@ static EnumPropertyItem prop_similar_types[] = {
{SIMVERT_FACE, "FACE", 0, "Amount of Adjacent Faces", ""},
{SIMVERT_VGROUP, "VGROUP", 0, "Vertex Groups", ""},
{SIMVERT_EDGE, "EDGE", 0, "Amount of connecting edges", ""},
+ {SIMVERT_LOCATION, "LOCATION", 0, "Location", ""},
{SIMEDGE_LENGTH, "LENGTH", 0, "Length", ""},
{SIMEDGE_DIR, "DIR", 0, "Direction", ""},
@@ -984,6 +985,7 @@ static EnumPropertyItem prop_similar_types[] = {
{SIMFACE_SIDES, "SIDES", 0, "Polygon Sides", ""},
{SIMFACE_PERIMETER, "PERIMETER", 0, "Perimeter", ""},
{SIMFACE_NORMAL, "NORMAL", 0, "Normal", ""},
+ {SIMFACE_LOCATION, "LOCATION", 0, "Location", ""},
{SIMFACE_COPLANAR, "COPLANAR", 0, "Co-planar", ""},
{SIMFACE_SMOOTH, "SMOOTH", 0, "Flat/Smooth", ""},
#ifdef WITH_FREESTYLE
@@ -1202,7 +1204,7 @@ void MESH_OT_select_similar(wmOperatorType *ot)
RNA_def_enum(ot->srna, "compare", prop_similar_compare_types, SIM_CMP_EQ, "Compare", "");
- RNA_def_float(ot->srna, "threshold", 0.0f, 0.0f, 1.0f, "Threshold", "", 0.0f, 1.0f);
+ RNA_def_float(ot->srna, "threshold", 0.0f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1.0f);
}