[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45743] trunk/blender/source/blender/bmesh /operators/bmo_extrude.c: fix [#30994] Extruding faces gives bad UV's

Campbell Barton ideasman42 at gmail.com
Wed Apr 18 11:56:19 CEST 2012


Revision: 45743
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45743
Author:   campbellbarton
Date:     2012-04-18 09:56:19 +0000 (Wed, 18 Apr 2012)
Log Message:
-----------
fix [#30994] Extruding faces gives bad UV's

this had strange logic, there was no need to loop over all face loops.

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-04-18 09:16:30 UTC (rev 45742)
+++ trunk/blender/source/blender/bmesh/operators/bmo_extrude.c	2012-04-18 09:56:19 UTC (rev 45743)
@@ -120,50 +120,37 @@
 
 static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f, BMEdge *e, BMEdge *newedge)
 {
-	BMIter iter;
-	BMLoop *l, *l_other;
+	/* 'a' is the starting edge #e, 'b' is the final edge #newedge */
+	BMLoop *l_dst_a = BM_face_edge_share_loop(f, e);
+	BMLoop *l_dst_b = newedge->l; /* will only ever be one loop */
+	BMLoop *l_src_a = l_dst_a->radial_next;
+	/* there is no l_src_b */
 
-	/* copy attributes */
-	BM_ITER(l, &iter, bm, BM_LOOPS_OF_FACE, f) {
-		if (l->e != e && l->e != newedge) {
-			continue;
-		}
+	/* sanity */
+	BLI_assert(l_src_a->f != l_dst_a->f);
+	BLI_assert(l_dst_a->f == l_dst_b->f);
 
-		l_other = l->radial_next;
-		
-		if (l_other == l) {
-			l_other = newedge->l;
 
-			if (l_other != l) {
-				BM_elem_attrs_copy(bm, bm, l_other->f, f);
-				BM_elem_flag_disable(f, BM_ELEM_HIDDEN); /* possibly we copy from a hidden face */
+	BM_elem_attrs_copy(bm, bm, l_src_a->f, l_dst_a->f);
+	BM_elem_flag_disable(f, BM_ELEM_HIDDEN); /* possibly we copy from a hidden face */
 
-				BM_elem_attrs_copy(bm, bm, l_other, l);
-				l_other = l_other->next;
-				l = l->next;
-				BM_elem_attrs_copy(bm, bm, l_other, l);
-			}
-		}
-		else {
-			BM_elem_attrs_copy(bm, bm, l_other->f, f);
-			BM_elem_flag_disable(f, BM_ELEM_HIDDEN); /* possibly we copy from a hidden face */
 
-			/* copy data */
-			if (l_other->v == l->v) {
-				BM_elem_attrs_copy(bm, bm, l_other, l);
-				l_other = l_other->next;
-				l = l->next;
-				BM_elem_attrs_copy(bm, bm, l_other, l);
-			}
-			else {
-				l_other = l_other->next;
-				BM_elem_attrs_copy(bm, bm, l_other, l);
-				l_other = l_other->prev;
-				l = l->next;
-				BM_elem_attrs_copy(bm, bm, l_other, l);
-			}
-		}
+	/* copy data */
+	if (l_src_a->v == l_dst_a->v) {
+		BM_elem_attrs_copy(bm, bm, l_src_a, l_dst_a);
+		BM_elem_attrs_copy(bm, bm, l_src_a, l_dst_b->next);
+
+		BM_elem_attrs_copy(bm, bm, l_src_a->next, l_dst_a->next);
+		BM_elem_attrs_copy(bm, bm, l_src_a->next, l_dst_b);
 	}
+	else {
+		l_src_a = l_src_a->next;
+		BM_elem_attrs_copy(bm, bm, l_src_a, l_dst_a);
+		BM_elem_attrs_copy(bm, bm, l_src_a, l_dst_b->next);
+
+		BM_elem_attrs_copy(bm, bm, l_src_a->prev, l_dst_a->next);
+		BM_elem_attrs_copy(bm, bm, l_src_a->prev, l_dst_b);
+	}
 }
 
 void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)




More information about the Bf-blender-cvs mailing list