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>2012-03-13 06:18:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-13 06:18:46 +0400
commitd25dc3b87232fddfaf56c890b7d112f01b32f1d7 (patch)
tree4dbf67dbb04ccae2f0154aa9204347ea6737d26e /source/blender/bmesh/operators/bmo_create.c
parenta97825dfd71994dde7748ed38f5ce91e16df06ae (diff)
bmesh: Pressing Fkey when a face cant be made falls back to the selection history and creates edges in the order of verts selected, pressing F again will make an NGon.
(fun feature while our bug tracker is down)
Diffstat (limited to 'source/blender/bmesh/operators/bmo_create.c')
-rw-r--r--source/blender/bmesh/operators/bmo_create.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index cb63ad60f17..1f1c8294a9b 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -1428,4 +1428,49 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, f, ELE_OUT);
}
}
+ else {
+ /* tricky feature for making a line/edge from selection history...
+ *
+ * Rather then do nothing, when 5+ verts are selected, check if they are in our history,
+ * when this is so, we can make edges from them, but _not_ a face,
+ * if it is the intention to make a face the user can just hit F again since there will be edges next
+ * time around.
+ *
+ * if all history verts have ELE_NEW flagged and the total number of history verts == totv,
+ * then we know the history contains all verts here and we can continue...
+ */
+
+ BMEditSelection *ese;
+ int tot_ese_v = 0;
+
+ for (ese = bm->selected.first; ese; ese = ese->next) {
+ if (ese->htype == BM_VERT) {
+ if (BMO_elem_flag_test(bm, (BMElemF *)ese->ele, ELE_NEW)) {
+ tot_ese_v++;
+ }
+ else {
+ /* unflagged vert means we are not in sync */
+ tot_ese_v = -1;
+ break;
+ }
+ }
+ }
+
+ if (tot_ese_v == totv) {
+ BMVert *v_prev = NULL;
+ /* yes, all select-history verts are accounted for, now make edges */
+
+ for (ese = bm->selected.first; ese; ese = ese->next) {
+ if (ese->htype == BM_VERT) {
+ v = (BMVert *)ese->ele;
+ if (v_prev) {
+ e = BM_edge_create(bm, v, v_prev, NULL, TRUE);
+ BMO_elem_flag_enable(bm, e, ELE_OUT);
+ }
+ v_prev = v;
+ }
+ }
+ }
+ /* done creating edges */
+ }
}