Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-09-21 19:57:33 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-09-21 20:46:50 +0300
commite406a9f305671f60912d90a2bdc6216b6e4db0ed (patch)
tree76f64e3ce0b7e95c1e92979fe2f24bdf8baba7e3 /source/blender/editors/mesh/editmesh_select_similar.c
parent35f659aeb414866896081a39e9c464f71b83f311 (diff)
Multi-objects: Select similar edge SIMEDGE_FACE_ANGLE
I'm not sure why the original implementation was only checking for equal comparison but I'm doing the same here. It is a one line change if we want to support LT/GT anyways. Also "technically" we should compare the angles in the worldspace, since different scales will result in different angles. Added as a TODO but honestly I think this is overkill.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_select_similar.c')
-rw-r--r--source/blender/editors/mesh/editmesh_select_similar.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c
index a4f2ad071a4..7cc09aa8825 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -258,7 +258,8 @@ static float edge_length_squared_worldspace_get(Object *ob, BMEdge *edge) {
return len_squared_v3v3(v1, v2);
}
-/* wrap the above function but do selection flushing edge to face */
+/* Note/TODO(dfelinto) technically SIMEDGE_FACE_ANGLE should compare the angles in world space.
+ * Although doable this is overkill - at least for the initial multi-objects implementation. */
static int similar_edge_select_exec(bContext *C, wmOperator *op)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -270,7 +271,6 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
const int compare = RNA_enum_get(op->ptr, "compare");
if (ELEM(type,
- SIMEDGE_FACE_ANGLE,
SIMEDGE_CREASE,
SIMEDGE_BEVEL,
SIMEDGE_SEAM,
@@ -304,6 +304,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
GSet *gset = NULL;
switch (type) {
+ case SIMEDGE_FACE_ANGLE:
case SIMEDGE_LENGTH:
case SIMEDGE_DIR:
tree = BLI_kdtree_new(tot_edges_selected_all);
@@ -346,6 +347,15 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
BLI_kdtree_insert(tree, tree_index++, dummy);
break;
}
+ case SIMEDGE_FACE_ANGLE:
+ {
+ if (BM_edge_face_count_at_most(edge, 2) == 2) {
+ float angle = BM_edge_calc_face_angle(edge);
+ float dummy[3] = {angle, 0.0f, 0.0f};
+ BLI_kdtree_insert(tree, tree_index++, dummy);
+ }
+ break;
+ }
}
}
}
@@ -407,6 +417,17 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
}
break;
}
+ case SIMEDGE_FACE_ANGLE:
+ {
+ if (BM_edge_face_count_at_most(edge, 2) == 2) {
+ float angle = BM_edge_calc_face_angle(edge);
+ if (select_similar_compare_float_tree(tree, angle, thresh, SIM_CMP_EQ)) {
+ BM_edge_select_set(bm, edge, true);
+ changed = true;
+ }
+ }
+ break;
+ }
}
}
}