[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45032] trunk/blender/source/blender/bmesh /operators/bmo_extrude.c: Fix #30600: extrude in vertex select mode did not copy attributes like smooth/flat

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Mar 20 18:02:04 CET 2012


Revision: 45032
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45032
Author:   blendix
Date:     2012-03-20 17:02:03 +0000 (Tue, 20 Mar 2012)
Log Message:
-----------
Fix #30600: extrude in vertex select mode did not copy attributes like smooth/flat
flag from adjacent face. It did work for edge select mode, now uses same code.

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/operators/bmo_extrude.c

Modified: trunk/blender/source/blender/bmesh/operators/bmo_extrude.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_extrude.c	2012-03-20 17:00:25 UTC (rev 45031)
+++ trunk/blender/source/blender/bmesh/operators/bmo_extrude.c	2012-03-20 17:02:03 UTC (rev 45032)
@@ -113,6 +113,54 @@
 	BMO_slot_buffer_from_flag(bm, op, "faceout", BM_FACE, EXT_KEEP);
 }
 
+static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f, BMEdge *e, BMEdge *newedge)
+{
+	BMIter iter;
+	BMLoop *l, *l2;
+
+	/* copy attribute */
+	l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, f);
+	for ( ; l; l = BM_iter_step(&iter)) {
+
+		if (l->e != e && l->e != newedge) {
+			continue;
+		}
+
+		l2 = l->radial_next;
+		
+		if (l2 == l) {
+			l2 = newedge->l;
+
+			if(l2 != l) {
+				BM_elem_attrs_copy(bm, bm, l2->f, l->f);
+
+				BM_elem_attrs_copy(bm, bm, l2, l);
+				l2 = l2->next;
+				l = l->next;
+				BM_elem_attrs_copy(bm, bm, l2, l);
+			}
+		}
+		else {
+			BM_elem_attrs_copy(bm, bm, l2->f, l->f);
+
+			/* copy dat */
+			if (l2->v == l->v) {
+				BM_elem_attrs_copy(bm, bm, l2, l);
+				l2 = l2->next;
+				l = l->next;
+				BM_elem_attrs_copy(bm, bm, l2, l);
+			}
+			else {
+				l2 = l2->next;
+				BM_elem_attrs_copy(bm, bm, l2, l);
+				l2 = l2->prev;
+				l = l->next;
+				BM_elem_attrs_copy(bm, bm, l2, l);
+			}
+		}
+	}
+}
+
 void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
 {
 	BMOIter siter;
@@ -149,6 +197,7 @@
 		}
 		/* not sure what to do about example face, pass NULL for now */
 		f = BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
+		bm_extrude_copy_face_loop_attributes(bm, f, e, e2);
 		
 		if (BMO_elem_flag_test(bm, e, EXT_INPUT))
 			e = e2;
@@ -191,7 +240,6 @@
 	BMOIter siter;
 	BMIter iter, fiter, viter;
 	BMEdge *e, *newedge;
-	BMLoop *l, *l2;
 	BMVert *verts[4], *v, *v2;
 	BMFace *f;
 	int found, fwd, delorig = FALSE;
@@ -331,45 +379,7 @@
 
 		/* not sure what to do about example face, pass NULL for now */
 		f = BM_face_create_quad_tri_v(bm, verts, 4, NULL, FALSE);
-
-		/* copy attribute */
-		l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, f);
-		for ( ; l; l = BM_iter_step(&iter)) {
-
-			if (l->e != e && l->e != newedge) {
-				continue;
-			}
-
-			l2 = l->radial_next;
-			
-			if (l2 == l) {
-				l2 = newedge->l;
-				BM_elem_attrs_copy(bm, bm, l2->f, l->f);
-
-				BM_elem_attrs_copy(bm, bm, l2, l);
-				l2 = l2->next;
-				l = l->next;
-				BM_elem_attrs_copy(bm, bm, l2, l);
-			}
-			else {
-				BM_elem_attrs_copy(bm, bm, l2->f, l->f);
-
-				/* copy dat */
-				if (l2->v == l->v) {
-					BM_elem_attrs_copy(bm, bm, l2, l);
-					l2 = l2->next;
-					l = l->next;
-					BM_elem_attrs_copy(bm, bm, l2, l);
-				}
-				else {
-					l2 = l2->next;
-					BM_elem_attrs_copy(bm, bm, l2, l);
-					l2 = l2->prev;
-					l = l->next;
-					BM_elem_attrs_copy(bm, bm, l2, l);
-				}
-			}
-		}
+		bm_extrude_copy_face_loop_attributes(bm, f, e, newedge);
 	}
 
 	/* link isolated vert */




More information about the Bf-blender-cvs mailing list