[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45305] trunk/blender/source/blender/bmesh /operators/bmo_dupe.c: Minor code cleanups for bmo_dupe.c.

Nicholas Bishop nicholasbishop at gmail.com
Sat Mar 31 14:29:30 CEST 2012


Revision: 45305
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45305
Author:   nicholasbishop
Date:     2012-03-31 12:29:17 +0000 (Sat, 31 Mar 2012)
Log Message:
-----------
Minor code cleanups for bmo_dupe.c.

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

Modified: trunk/blender/source/blender/bmesh/operators/bmo_dupe.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_dupe.c	2012-03-31 10:17:05 UTC (rev 45304)
+++ trunk/blender/source/blender/bmesh/operators/bmo_dupe.c	2012-03-31 12:29:17 UTC (rev 45305)
@@ -191,22 +191,19 @@
 	BMVert **vtar = NULL;
 	BMEdge **edar = NULL;
 	
-	BMIter verts;
-	BMIter edges;
-	BMIter faces;
-	
-	GHash *vhash;
-	GHash *ehash;
+	BMIter viter, eiter, fiter;
+	GHash *vhash, *ehash;
 
 	/* initialize pointer hashes */
-	vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops v");
-	ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops e");
+	vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp,
+						  "bmesh dupeops v");
+	ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp,
+						  "bmesh dupeops e");
 
 	/* duplicate flagged vertices */
-	for (v = BM_iter_new(&verts, source, BM_VERTS_OF_MESH, source); v; v = BM_iter_step(&verts)) {
-		if ( BMO_elem_flag_test(source, v, DUPE_INPUT) &&
-		    !BMO_elem_flag_test(source, v, DUPE_DONE))
-		{
+	BM_ITER(v, &viter, source, BM_VERTS_OF_MESH, source) {
+		if (BMO_elem_flag_test(source, v, DUPE_INPUT) &&
+			!BMO_elem_flag_test(source, v, DUPE_DONE)) {
 			BMIter iter;
 			int isolated = 1;
 
@@ -237,10 +234,9 @@
 	}
 
 	/* now we dupe all the edges */
-	for (e = BM_iter_new(&edges, source, BM_EDGES_OF_MESH, source); e; e = BM_iter_step(&edges)) {
-		if ( BMO_elem_flag_test(source, e, DUPE_INPUT) &&
-		    !BMO_elem_flag_test(source, e, DUPE_DONE))
-		{
+	BM_ITER(e, &eiter, source, BM_EDGES_OF_MESH, source) {
+		if (BMO_elem_flag_test(source, e, DUPE_INPUT) &&
+			!BMO_elem_flag_test(source, e, DUPE_DONE)) {
 			/* make sure that verts are copied */
 			if (!BMO_elem_flag_test(source, e->v1, DUPE_DONE)) {
 				copy_vertex(source, e->v1, target, vhash);
@@ -257,10 +253,10 @@
 	}
 
 	/* first we dupe all flagged faces and their elements from source */
-	for (f = BM_iter_new(&faces, source, BM_FACES_OF_MESH, source); f; f = BM_iter_step(&faces)) {
+	BM_ITER(f, &fiter, source, BM_FACES_OF_MESH, source) {
 		if (BMO_elem_flag_test(source, f, DUPE_INPUT)) {
 			/* vertex pass */
-			for (v = BM_iter_new(&verts, source, BM_VERTS_OF_FACE, f); v; v = BM_iter_step(&verts)) {
+			BM_ITER(v, &viter, source, BM_VERTS_OF_FACE, f) {
 				if (!BMO_elem_flag_test(source, v, DUPE_DONE)) {
 					copy_vertex(source, v, target, vhash);
 					BMO_elem_flag_enable(source, v, DUPE_DONE);
@@ -268,7 +264,7 @@
 			}
 
 			/* edge pass */
-			for (e = BM_iter_new(&edges, source, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&edges)) {
+			BM_ITER(e, &eiter, source, BM_EDGES_OF_FACE, f) {
 				if (!BMO_elem_flag_test(source, e, DUPE_DONE)) {
 					copy_edge(op, source, e, target,  vhash,  ehash);
 					BMO_elem_flag_enable(source, e, DUPE_DONE);
@@ -325,7 +321,7 @@
 	if (!bm2)
 		bm2 = bm;
 
-	/* flag inpu */
+	/* flag input */
 	BMO_slot_buffer_flag_enable(bm, dupeop, "geom", BM_ALL, DUPE_INPUT);
 
 	/* use the internal copy function */




More information about the Bf-blender-cvs mailing list