From 93e3107806466cc5de64d30298f843505e2b8f79 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 29 Apr 2013 16:59:53 +0000 Subject: select loose wasn't working very usefully if you only wanted to select loose verts, now select loose verts/edges/faces depending on the selection mode. --- doc/python_api/sphinx_doc_gen.py | 2 +- release/scripts/startup/bl_ui/space_view3d.py | 2 +- source/blender/editors/mesh/editmesh_select.c | 51 +++++++++++++++++++-------- source/blender/editors/mesh/mesh_intern.h | 2 +- source/blender/editors/mesh/mesh_ops.c | 2 +- 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index d844b04dce5..3152685485a 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1045,7 +1045,7 @@ def pycontext2sphinx(basepath): if prop.identifier in struct_blacklist: continue - type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID) + type_descr = prop.get_type_description(class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID) fw(".. data:: %s\n\n" % prop.identifier) if prop.description: fw(" %s\n\n" % prop.description) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 20e49d3b3ff..036f701918d 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -600,7 +600,7 @@ class VIEW3D_MT_select_edit_mesh(Menu): layout.operator("mesh.select_face_by_sides") if context.scene.tool_settings.mesh_select_mode[2] is False: layout.operator("mesh.select_non_manifold", text="Non Manifold") - layout.operator("mesh.select_loose_verts", text="Loose Verts/Edges") + layout.operator("mesh.select_loose", text="Loose Geometry") layout.operator_menu_enum("mesh.select_similar", "type", text="Similar") layout.separator() diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 40362821942..2b836261fba 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2684,26 +2684,49 @@ void MESH_OT_select_face_by_sides(wmOperatorType *ot) } -static int edbm_select_loose_verts_exec(bContext *C, wmOperator *op) +static int edbm_select_loose_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); - BMVert *eve; - BMEdge *eed; + BMesh *bm = em->bm; BMIter iter; if (!RNA_boolean_get(op->ptr, "extend")) EDBM_flag_disable_all(em, BM_ELEM_SELECT); - BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { - if (!eve->e) { - BM_vert_select_set(em->bm, eve, true); + if (em->selectmode & SCE_SELECT_VERTEX) { + BMVert *eve; + BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { + if (!eve->e) { + BM_vert_select_set(bm, eve, true); + } } } - BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { - if (!eed->l) { - BM_edge_select_set(em->bm, eed, true); + if (em->selectmode & SCE_SELECT_EDGE) { + BMEdge *eed; + BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) { + if (BM_edge_is_wire(eed)) { + BM_edge_select_set(bm, eed, true); + } + } + } + + if (em->selectmode & SCE_SELECT_FACE) { + BMFace *efa; + BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { + BMIter liter; + BMLoop *l; + bool is_loose = true; + BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { + if (!BM_edge_is_boundary(l->e)) { + is_loose = false; + break; + } + } + if (is_loose) { + BM_face_select_set(bm, efa, true); + } } } @@ -2713,15 +2736,15 @@ static int edbm_select_loose_verts_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void MESH_OT_select_loose_verts(wmOperatorType *ot) +void MESH_OT_select_loose(wmOperatorType *ot) { /* identifiers */ - ot->name = "Select Loose Vertices/Edges"; - ot->description = "Select vertices with no edges nor faces, and edges with no faces"; - ot->idname = "MESH_OT_select_loose_verts"; + ot->name = "Select Loose Geometry"; + ot->description = "Select loose geometry based on the selection mode"; + ot->idname = "MESH_OT_select_loose"; /* api callbacks */ - ot->exec = edbm_select_loose_verts_exec; + ot->exec = edbm_select_loose_exec; ot->poll = ED_operator_editmesh; /* flags */ diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 5b447bf254f..4975ade9849 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -138,7 +138,7 @@ void MESH_OT_select_shortest_path(struct wmOperatorType *ot); void MESH_OT_select_linked(struct wmOperatorType *ot); void MESH_OT_select_linked_pick(struct wmOperatorType *ot); void MESH_OT_select_face_by_sides(struct wmOperatorType *ot); -void MESH_OT_select_loose_verts(struct wmOperatorType *ot); +void MESH_OT_select_loose(struct wmOperatorType *ot); void MESH_OT_select_mirror(struct wmOperatorType *ot); void MESH_OT_select_more(struct wmOperatorType *ot); void MESH_OT_select_less(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 303212d5a58..45902ed47a3 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -57,7 +57,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_hide); WM_operatortype_append(MESH_OT_reveal); WM_operatortype_append(MESH_OT_select_face_by_sides); - WM_operatortype_append(MESH_OT_select_loose_verts); + WM_operatortype_append(MESH_OT_select_loose); WM_operatortype_append(MESH_OT_select_mirror); WM_operatortype_append(MESH_OT_normals_make_consistent); WM_operatortype_append(MESH_OT_merge); -- cgit v1.2.3