[Bf-blender-cvs] [e406a9f3056] blender2.8: Multi-objects: Select similar edge SIMEDGE_FACE_ANGLE

Dalai Felinto noreply at git.blender.org
Fri Sep 21 19:47:27 CEST 2018


Commit: e406a9f305671f60912d90a2bdc6216b6e4db0ed
Author: Dalai Felinto
Date:   Fri Sep 21 13:57:33 2018 -0300
Branches: blender2.8
https://developer.blender.org/rBe406a9f305671f60912d90a2bdc6216b6e4db0ed

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.

===================================================================

M	source/blender/editors/mesh/editmesh_select_similar.c

===================================================================

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;
+					}
 				}
 			}
 		}



More information about the Bf-blender-cvs mailing list