[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18233] branches/bmesh/bmesh: replaced hacked circulator loop in dupeops.c with proper iterator

Joseph Eagar joeedh at gmail.com
Fri Jan 2 01:12:43 CET 2009


Revision: 18233
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18233
Author:   joeedh
Date:     2009-01-02 01:12:42 +0100 (Fri, 02 Jan 2009)

Log Message:
-----------
replaced hacked circulator loop in dupeops.c with proper iterator

Modified Paths:
--------------
    branches/bmesh/bmesh/bmesh_operators.h
    branches/bmesh/bmesh/operators/bmesh_dupeops.c
    branches/bmesh/bmesh/tools/BME_bevel.c

Modified: branches/bmesh/bmesh/bmesh_operators.h
===================================================================
--- branches/bmesh/bmesh/bmesh_operators.h	2009-01-01 23:47:32 UTC (rev 18232)
+++ branches/bmesh/bmesh/bmesh_operators.h	2009-01-02 00:12:42 UTC (rev 18233)
@@ -82,7 +82,7 @@
 #define BMOP_SPLIT_FOUTPUT		6
 #define BMOP_SPLIT_TOTSLOT		7
 
-const int BMOP_SPLIT_TYPEINFO[BMOP_SPLIT_TOTSLOT] = {
+static const int BMOP_SPLIT_TYPEINFO[BMOP_SPLIT_TOTSLOT] = {
 	BMOP_OPSLOT_PNT_BUF,
 	BMOP_OPSLOT_PNT_BUF,
 	BMOP_OPSLOT_PNT_BUF,
@@ -108,7 +108,7 @@
 #define BMOP_DUPE_FNEW			8
 #define BMOP_DUPE_TOTSLOT		9
 
-const int BMOP_DUPE_TYPEINFO[BMOP_DUPE_TOTSLOT] = {
+static const int BMOP_DUPE_TYPEINFO[BMOP_DUPE_TOTSLOT] = {
 	BMOP_OPSLOT_PNT_BUF,
 	BMOP_OPSLOT_PNT_BUF,
 	BMOP_OPSLOT_PNT_BUF,
@@ -136,7 +136,7 @@
 #define BMOP_DEL_FACES				4
 #define BMOP_DEL_ALL				5
 
-const int BMOP_DEL_TYPEINFO[BMOP_DEL_TOTSLOT] = {
+static const int BMOP_DEL_TYPEINFO[BMOP_DEL_TOTSLOT] = {
 	BMOP_OPSLOT_PNT_BUF,
 	BMOP_OPSLOT_PNT_BUF,
 	BMOP_OPSLOT_PNT_BUF,
@@ -150,7 +150,7 @@
 #define BMOP_FROM_EDITMESH_EM	0
 #define BMOP_FROM_EDITMESH_TOTSLOT 1
 
-const int BMOP_FROM_EDITMESH_TYPEINFO[BMOP_FROM_EDITMESH_TOTSLOT] = {
+static const int BMOP_FROM_EDITMESH_TYPEINFO[BMOP_FROM_EDITMESH_TOTSLOT] = {
 	BMOP_OPSLOT_PNT
 };
 
@@ -161,7 +161,7 @@
 #define BMOP_TO_EDITMESH_EM		0
 #define BMOP_TO_EDITMESH_TOTSLOT 1
 
-const int BMOP_TO_EDITMESH_TYPEINFO[BMOP_TO_EDITMESH_TOTSLOT] = {
+static const int BMOP_TO_EDITMESH_TYPEINFO[BMOP_TO_EDITMESH_TOTSLOT] = {
 	BMOP_OPSLOT_PNT
 };
 
@@ -171,7 +171,7 @@
 #define BMOP_ESUBDIVIDE_EDGES	0
 #define BMOP_ESUBDIVIDE_TOTSLOT	1
 
-const int BMOP_ESUBDIVIDE_TYPEINFO[] = {
+static const int BMOP_ESUBDIVIDE_TYPEINFO[] = {
 	BMOP_OPSLOT_PNT_BUF
 };
 

Modified: branches/bmesh/bmesh/operators/bmesh_dupeops.c
===================================================================
--- branches/bmesh/bmesh/operators/bmesh_dupeops.c	2009-01-01 23:47:32 UTC (rev 18232)
+++ branches/bmesh/bmesh/operators/bmesh_dupeops.c	2009-01-02 00:12:42 UTC (rev 18233)
@@ -90,20 +90,18 @@
 	BMVert *target_vert1, *target_vert2;
 	BMLoop *source_loop, *target_loop;
 	BMFace *target_face = NULL;
+	BMIter iter, iter2;
 	int i;
 	
 	/*lookup the first and second verts*/
 	target_vert1 = BLI_ghash_lookup(vhash, source_face->loopbase->v);
-	target_vert2 = BLI_ghash_lookup(vhash, source_face->loopbase->radial.next->data);
+	target_vert2 = BLI_ghash_lookup(vhash, source_face->loopbase->head.next);
 	
 	/*lookup edges*/
-	i = 0;
-	source_loop = source_face->loopbase;
-	do{
+	for (i=0,source_loop=BMIter_New(source_mesh, &iter, BM_LOOPS_OF_FACE, source_face); 
+		     source_loop; source_loop=BMIter_Step(&iter), i++) {
 		edar[i] = BLI_ghash_lookup(ehash, source_loop->e);
-		i++;
-		source_loop = source_loop->radial.next->data;
-	}while(source_loop != source_face->loopbase);
+	}
 	
 	/*create new face*/
 	target_face = BM_Make_Ngon(target_mesh, target_vert1, target_vert2, edar, source_face->len, 0);	
@@ -119,14 +117,12 @@
 	BMO_SetFlag(target_mesh, (BMHeader*)target_face, DUPE_NEW);
 	
 	/*copy per-loop custom data*/
-	source_loop = source_face->loopbase;
-	target_loop = target_face->loopbase;
-	do{
+	for (i=0,source_loop=BMIter_New(source_mesh, &iter, BM_LOOPS_OF_FACE, source_face),
+	  target_loop=BMIter_New(target_mesh, &iter2, BM_LOOPS_OF_FACE, target_face);
+	  source_loop && target_loop; source_loop=BMIter_Step(&iter), target_loop=BMIter_Step(&iter2),
+	  i++) {
 		CustomData_bmesh_copy_data(&source_mesh->ldata, &target_mesh->ldata, source_loop->data, &target_loop->data);		
-		source_loop = source_loop->radial.next->data;
-		target_loop = target_loop->radial.next->data;
-	}while(source_loop != source_face->loopbase);
-	
+	}	
 	return target_face;
 }
 	/*

Modified: branches/bmesh/bmesh/tools/BME_bevel.c
===================================================================
--- branches/bmesh/bmesh/tools/BME_bevel.c	2009-01-01 23:47:32 UTC (rev 18232)
+++ branches/bmesh/bmesh/tools/BME_bevel.c	2009-01-02 00:12:42 UTC (rev 18233)
@@ -235,7 +235,7 @@
 			e1 = e2;
 		}
 		ov = BM_OtherEdgeVert(e1,v);
-		sv = BM_Split_Face(bm,v,e1,&ne,0);
+		sv = BM_Split_Edge(bm,v,e1,&ne,0);
 		//BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /*this is technically wrong...*/
 		//BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25);
 		//BME_data_interp_from_faceverts(bm, ov, v, sv, 0.25);
@@ -278,7 +278,7 @@
 		else {
 			is_split_vert = 0;
 			ov = BM_OtherEdgeVert(l->e,v);
-			sv = BM_Split_Face(bm,v,l->e,&ne,0);
+			sv = BM_Split_Edge(bm,v,l->e,&ne,0);
 			//BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /*this is technically wrong...*/
 			//BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25);
 			//BME_data_interp_from_faceverts(bm, ov, v, sv, 0.25);





More information about the Bf-blender-cvs mailing list