From 53160bd508f1c5640258377c2941b1e624119a3d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 1 Nov 2012 05:07:15 +0000 Subject: [PATCH] minor edits to mesh operators - Rename 'mesh.select_nth' operator menu item 'Every N Number of Verts' to 'Checker Deselect', since its not just de-selecting verts (works on edges and faces too) and the term 'checker' gives a better description of the result. - Rename 'mesh.select_by_number_vertices' to 'mesh.select_face_by_sides', since this is a face selection tool, which wasnt obvious from its name. also remove dissolve by type menu since the option has been removed from the operator and was giving an error. --- release/scripts/startup/bl_ui/space_view3d.py | 8 +--- source/blender/editors/curve/editcurve.c | 4 +- source/blender/editors/mesh/editmesh_select.c | 4 +- source/blender/editors/mesh/editmesh_tools.c | 46 +++++++++++-------- source/blender/editors/mesh/mesh_intern.h | 2 +- source/blender/editors/mesh/mesh_ops.c | 2 +- 6 files changed, 34 insertions(+), 32 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index d44213c199a..c5f54fc2eeb 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -571,7 +571,7 @@ class VIEW3D_MT_select_edit_mesh(Menu): layout.separator() layout.operator("mesh.select_random", text="Random") - layout.operator("mesh.select_nth", text="Every N Number of Verts") + layout.operator("mesh.select_nth") layout.operator("mesh.edges_select_sharp", text="Sharp Edges") layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces") layout.operator("mesh.select_interior_faces", text="Interior Faces") @@ -579,7 +579,7 @@ class VIEW3D_MT_select_edit_mesh(Menu): layout.separator() - layout.operator("mesh.select_by_number_vertices", text="By Number of Verts") + 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") @@ -1941,10 +1941,6 @@ class VIEW3D_MT_edit_mesh_dissolve(Menu): layout.separator() - layout.operator_enum("mesh.dissolve", "type") - - layout.separator() - layout.operator("mesh.dissolve_limited") diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 9ae5d3ca557..485d73974cd 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5641,8 +5641,8 @@ static int select_nth_exec(bContext *C, wmOperator *op) void CURVE_OT_select_nth(wmOperatorType *ot) { /* identifiers */ - ot->name = "Select Nth"; - ot->description = ""; + ot->name = "Checker Deselect"; + ot->description = "Deselect every other vertex"; ot->idname = "CURVE_OT_select_nth"; /* api callbacks */ diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index d0ca9a78abd..0379068afd9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2308,9 +2308,9 @@ static int edbm_select_nth_exec(bContext *C, wmOperator *op) void MESH_OT_select_nth(wmOperatorType *ot) { /* identifiers */ - ot->name = "Select Nth"; + ot->name = "Checker Deselect"; ot->idname = "MESH_OT_select_nth"; - ot->description = "Select every Nth element starting from a selected vertex, edge or face"; + ot->description = "Deselect every Nth element starting from a selected vertex, edge or face"; /* api callbacks */ ot->exec = edbm_select_nth_exec; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index fd3eabdaec3..f10faddc169 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3808,30 +3808,36 @@ void MESH_OT_screw(wmOperatorType *ot) "Axis", "Axis in global view space", -1.0f, 1.0f); } -static int edbm_select_by_number_vertices_exec(bContext *C, wmOperator *op) +static int edbm_select_face_by_sides_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; BMIter iter; - int numverts = RNA_int_get(op->ptr, "number"); - int type = RNA_enum_get(op->ptr, "type"); + const int numverts = RNA_int_get(op->ptr, "number"); + const int type = RNA_enum_get(op->ptr, "type"); BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - int select = 0; + int select; - if (type == 0 && efa->len < numverts) { - select = 1; - } - else if (type == 1 && efa->len == numverts) { - select = 1; - } - else if (type == 2 && efa->len > numverts) { - select = 1; - } - else if (type == 3 && efa->len != numverts) { - select = 1; + switch (type) { + case 0: + select = (efa->len < numverts); + break; + case 1: + select = (efa->len == numverts); + break; + case 2: + select = (efa->len > numverts); + break; + case 3: + select = (efa->len != numverts); + break; + default: + BLI_assert(0); + select = FALSE; + break; } if (select) { @@ -3845,7 +3851,7 @@ static int edbm_select_by_number_vertices_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void MESH_OT_select_by_number_vertices(wmOperatorType *ot) +void MESH_OT_select_face_by_sides(wmOperatorType *ot) { static const EnumPropertyItem type_items[] = { {0, "LESS", 0, "Less Than", ""}, @@ -3856,12 +3862,12 @@ void MESH_OT_select_by_number_vertices(wmOperatorType *ot) }; /* identifiers */ - ot->name = "Select by Number of Vertices"; - ot->description = "Select vertices or faces by vertex count"; - ot->idname = "MESH_OT_select_by_number_vertices"; + ot->name = "Select Faces by Sides"; + ot->description = "Select vertices or faces by the number of polygon sides"; + ot->idname = "MESH_OT_select_face_by_sides"; /* api callbacks */ - ot->exec = edbm_select_by_number_vertices_exec; + ot->exec = edbm_select_face_by_sides_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 8b56109202a..82b785e5785 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -121,7 +121,7 @@ void MESH_OT_select_linked(struct wmOperatorType *ot); void MESH_OT_select_linked_pick(struct wmOperatorType *ot); void MESH_OT_hide(struct wmOperatorType *ot); void MESH_OT_reveal(struct wmOperatorType *ot); -void MESH_OT_select_by_number_vertices(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_mirror(struct wmOperatorType *ot); void MESH_OT_normals_make_consistent(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 716af1d938b..d319fdcca26 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -68,7 +68,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_select_random); WM_operatortype_append(MESH_OT_hide); WM_operatortype_append(MESH_OT_reveal); - WM_operatortype_append(MESH_OT_select_by_number_vertices); + WM_operatortype_append(MESH_OT_select_face_by_sides); WM_operatortype_append(MESH_OT_select_loose_verts); WM_operatortype_append(MESH_OT_select_mirror); WM_operatortype_append(MESH_OT_normals_make_consistent);