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:
authorCampbell Barton <ideasman42@gmail.com>2009-12-22 22:01:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-22 22:01:51 +0300
commitd74bbcdd852da9a17a6cf088469ebd3eb2167a9a (patch)
treee48c881b52a8a6b0c04ae8d66aee6c03be562a7b /source/blender/editors/mesh/editmesh_mods.c
parent8c72e1835416187891cc893b8e573fdf56e4f03d (diff)
select nth (face/edge/vertex) - depending on which was last selected, useful for colapsing every other edge for eg.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_mods.c')
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index d1dde75771d..827b28f954b 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -2081,6 +2081,11 @@ static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring
EM_selectmode_flush(em);
// if (EM_texFaceCheck())
+ /* sets as active, useful for other tools */
+ if(select && em->selectmode & SCE_SELECT_EDGE) {
+ EM_store_selection(em, eed, EDITEDGE);
+ }
+
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
}
}
@@ -4535,3 +4540,41 @@ void MESH_OT_solidify(wmOperatorType *ot)
prop= RNA_def_float(ot->srna, "thickness", 0.01f, -FLT_MAX, FLT_MAX, "thickness", "", -10.0f, 10.0f);
RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
}
+
+static int mesh_select_nth_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit= CTX_data_edit_object(C);
+ EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
+ int nth = RNA_int_get(op->ptr, "nth");
+
+ if(EM_deselect_nth(em, nth) == 0) {
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no active vert/edge/face.");
+ return OPERATOR_CANCELLED;
+ }
+
+ BKE_mesh_end_editmesh(obedit->data, em);
+
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+
+ return OPERATOR_FINISHED;
+}
+
+
+void MESH_OT_select_nth(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Select Nth";
+ ot->description= "";
+ ot->idname= "MESH_OT_select_nth";
+
+ /* api callbacks */
+ ot->exec= mesh_select_nth_exec;
+ ot->poll= ED_operator_editmesh;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ RNA_def_int(ot->srna, "nth", 2, 2, 100, "Nth Selection", "", 1, INT_MAX);
+}
+