[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44846] trunk/blender/source/blender/bmesh /operators/bmo_create.c: 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.
Campbell Barton
ideasman42 at gmail.com
Tue Mar 13 03:18:58 CET 2012
Revision: 44846
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44846
Author: campbellbarton
Date: 2012-03-13 02:18:46 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
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)
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/operators/bmo_create.c
Modified: trunk/blender/source/blender/bmesh/operators/bmo_create.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_create.c 2012-03-13 01:55:25 UTC (rev 44845)
+++ trunk/blender/source/blender/bmesh/operators/bmo_create.c 2012-03-13 02:18:46 UTC (rev 44846)
@@ -1428,4 +1428,49 @@
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 */
+ }
}
More information about the Bf-blender-cvs
mailing list