[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18259] branches/bmesh/bmesh: cleaned up bmesh flags.

Joseph Eagar joeedh at gmail.com
Fri Jan 2 11:59:19 CET 2009


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

Log Message:
-----------
cleaned up bmesh flags.  current design is the first 16 bits of BMHeader->flag are reserved for the originial element flags; the next 5 are used by various flags that replace single-variable flags, with the temporary flags coming after this.  further work may be warranted.  also, renamed all BMESH_ macros to BM_ ones, since this inconsistency was kindof confusing.

Modified Paths:
--------------
    branches/bmesh/bmesh/bmesh.h
    branches/bmesh/bmesh/bmesh_filters.h
    branches/bmesh/bmesh/bmesh_iterators.h
    branches/bmesh/bmesh/bmesh_marking.h
    branches/bmesh/bmesh/bmesh_operators.h
    branches/bmesh/bmesh/bmesh_walkers.h
    branches/bmesh/bmesh/intern/bmesh_construct.c
    branches/bmesh/bmesh/intern/bmesh_marking.c
    branches/bmesh/bmesh/intern/bmesh_mesh.c
    branches/bmesh/bmesh/intern/bmesh_mods.c
    branches/bmesh/bmesh/intern/bmesh_operators.c
    branches/bmesh/bmesh/intern/bmesh_operators_private.h
    branches/bmesh/bmesh/intern/bmesh_queries.c
    branches/bmesh/bmesh/intern/bmesh_structure.c
    branches/bmesh/bmesh/intern/bmesh_structure.h
    branches/bmesh/bmesh/intern/bmesh_to_editmesh.c
    branches/bmesh/bmesh/intern/bmesh_walkers.c
    branches/bmesh/bmesh/intern/editmesh_to_bmesh.c
    branches/bmesh/bmesh/operators/bmesh_dupeops.c

Modified: branches/bmesh/bmesh/bmesh.h
===================================================================
--- branches/bmesh/bmesh/bmesh.h	2009-01-02 10:58:30 UTC (rev 18258)
+++ branches/bmesh/bmesh/bmesh.h	2009-01-02 10:59:19 UTC (rev 18259)
@@ -34,8 +34,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BMESH_H
-#define BMESH_H
+#ifndef BM_H
+#define BM_H
 
 #include "DNA_listBase.h"
 #include "DNA_customdata_types.h"
@@ -58,45 +58,46 @@
 	struct BMFlagLayer *flags;
 */
 
-/*auxillery bmesh flags.  note, these should
-  become internal to the api eventually.*/
-//start at 17th flag
-#define BM_SEAM		(1<<16)
-#define BM_FGON		(1<<17)
-#define BM_HIDDEN	(1<<18)
-#define BM_SHARP	(1<<19)
-#define BM_SMOOTH	(1<<20)
-
 /* Defines for BMHeader->type*/
-#define BMESH_VERT 					1
-#define BMESH_EDGE 					2
-#define BMESH_FACE 					4
-#define BMESH_LOOP 					8
-#define BMESH_ALL					BMESH_VERT | BMESH_EDGE | BMESH_FACE | BMESH_LOOP
+#define BM_VERT 					1
+#define BM_EDGE 					2
+#define BM_FACE 					4
+#define BM_LOOP 					8
+#define BM_ALL					BM_VERT | BM_EDGE | BM_FACE | BM_LOOP
 
 /*Masks for BMHeader->flag
 	Note: Its entirely possible that any temporal flags should be moved
 	into the dynamically allocated flag layers and only reserve BMHeader->flag
-	for things like select, hide, ect
+	for things like select, hide, ect.
+
+	The first 16 bits are reserved for the original element flags.
+	The next 5 (till BM_SMOOTH) are bmesh-added ones that replace
+	single variable flags.  The rest after that are temporary flags.
 */	
-#define BMESH_SELECT				1
-#define BMESH_HIDDEN				2
-#define BMESH_DIRTY					4			/*Not used yet*/
-#define BMESH_NEW					8			
-#define BMESH_OVERLAP				16			/*used by bmesh_verts_in_face*/
-#define BMESH_EDGEVERT 				32 			/*used by bmesh_make_ngon*/
-#define BMESH_DELETE				64
-#define BMESH_AUX1					128 			/*different for edges/verts/faces/ect*/
-#define BMESH_AUX2					256 			/*different for edges/verts/faces/ect*/
-#define BMESH_AUX3					512 			/*different for edges/verts/faces/ect*/
 
-#define BMESH_SHARP					BMESH_AUX1			/*for edges*/
-#define BMESH_SEAM					BMESH_AUX2			/*for edges*/
-#define BMESH_FGON					BMESH_AUX3			/*for edges, to be depreceated*/
+#define BM_SELECT	1 //redefinition of SELECT
 
-#define BMESH_SMOOTH				BMESH_AUX1			/*for faces*/
-#define BMESH_TEMP_FLAGS			BMESH_DIRTY|BMESH_NEW|BMESH_OVERLAP|BMESH_EDGEVERT|BMESH_DELETE
+/*auxillery bmesh flags.  note, these should
+  become internal to the api eventually.
+  
+  start at the 17th flag.
+ */
+#define BM_SEAM		(1<<16)
+#define BM_FGON		(1<<17)
+#define BM_HIDDEN	(1<<18)
+#define BM_SHARP	(1<<19)
+#define BM_SMOOTH	(1<<20) /* for faces */
 
+#define BM_DIRTY		(1<<21)			/*Not used yet*/
+#define BM_NEW			(1<<22)			
+#define BM_OVERLAP		(1<<23)			/*used by bmesh_verts_in_face*/
+#define BM_EDGEVERT 	(1<<24) 			/*used by bmesh_make_ngon*/
+#define BM_DELETE		(1<<25)
+#define BM_AUX1			(1<<26) 			/*different for edges/verts/faces/ect*/
+#define BM_AUX2			(1<<27) 			/*different for edges/verts/faces/ect*/
+#define BM_AUX3			(1<<28) 			/*different for edges/verts/faces/ect*/
+#define BM_TEMP_FLAGS	BM_DIRTY|BM_NEW|BM_OVERLAP|BM_EDGEVERT|BM_DELETE
+
 /*All Mesh elements start with this structure*/
 typedef struct BMHeader
 {

Modified: branches/bmesh/bmesh/bmesh_filters.h
===================================================================
--- branches/bmesh/bmesh/bmesh_filters.h	2009-01-02 10:58:30 UTC (rev 18258)
+++ branches/bmesh/bmesh/bmesh_filters.h	2009-01-02 10:59:19 UTC (rev 18259)
@@ -1,4 +1,4 @@
-#ifndef BMESH_FILTER_H
-#define BMESH_FILTER_H
+#ifndef BM_FILTER_H
+#define BM_FILTER_H
 
 #endif

Modified: branches/bmesh/bmesh/bmesh_iterators.h
===================================================================
--- branches/bmesh/bmesh/bmesh_iterators.h	2009-01-02 10:58:30 UTC (rev 18258)
+++ branches/bmesh/bmesh/bmesh_iterators.h	2009-01-02 10:59:19 UTC (rev 18259)
@@ -10,8 +10,8 @@
  *
 */
 
-#ifndef BMESH_ITERATORS_H
-#define BMESH_ITERATORS_H
+#ifndef BM_ITERATORS_H
+#define BM_ITERATORS_H
 
 /*Defines for passing to BMIter_New*/
 #define BM_VERTS 			1

Modified: branches/bmesh/bmesh/bmesh_marking.h
===================================================================
--- branches/bmesh/bmesh/bmesh_marking.h	2009-01-02 10:58:30 UTC (rev 18258)
+++ branches/bmesh/bmesh/bmesh_marking.h	2009-01-02 10:59:19 UTC (rev 18259)
@@ -1,5 +1,5 @@
-#ifndef BMESH_MARKING_H
-#define BMESH_MARKING_H
+#ifndef BM_MARKING_H
+#define BM_MARKING_H
 
 /*Selection code*/
 void BM_Select_Vert(struct BMesh *bm, struct BMVert *v, int select);

Modified: branches/bmesh/bmesh/bmesh_operators.h
===================================================================
--- branches/bmesh/bmesh/bmesh_operators.h	2009-01-02 10:58:30 UTC (rev 18258)
+++ branches/bmesh/bmesh/bmesh_operators.h	2009-01-02 10:59:19 UTC (rev 18259)
@@ -1,5 +1,5 @@
-#ifndef BMESH_OPERATORS_H
-#define BMESH_OPERATORS_H
+#ifndef BM_OPERATORS_H
+#define BM_OPERATORS_H
 
 #include "BLI_memarena.h"
 

Modified: branches/bmesh/bmesh/bmesh_walkers.h
===================================================================
--- branches/bmesh/bmesh/bmesh_walkers.h	2009-01-02 10:58:30 UTC (rev 18258)
+++ branches/bmesh/bmesh/bmesh_walkers.h	2009-01-02 10:59:19 UTC (rev 18259)
@@ -1,5 +1,5 @@
-#ifndef BMESH_WALKERS_H
-#define BMESH_WALKERS_H
+#ifndef BM_WALKERS_H
+#define BM_WALKERS_H
 
 /*Walkers*/
 typedef struct BMWalker{
@@ -17,10 +17,10 @@
 void *BMWalker_Step(struct BMWalker *walker);
 void BMWalker_End(struct BMWalker *walker);
 
-#define BMESH_SHELLWALKER	0
-#define BMESH_LOOPWALKER	1
-#define BMESH_RINGWALKER	2
-#define BMESH_UVISLANDS		3
-#define BMESH_MAXWALKERS	4
+#define BM_SHELLWALKER	0
+#define BM_LOOPWALKER	1
+#define BM_RINGWALKER	2
+#define BM_UVISLANDS		3
+#define BM_MAXWALKERS	4
 
 #endif
\ No newline at end of file

Modified: branches/bmesh/bmesh/intern/bmesh_construct.c
===================================================================
--- branches/bmesh/bmesh/intern/bmesh_construct.c	2009-01-02 10:58:30 UTC (rev 18258)
+++ branches/bmesh/bmesh/intern/bmesh_construct.c	2009-01-02 10:59:19 UTC (rev 18259)
@@ -37,7 +37,7 @@
 #include "bmesh_private.h"
 
 /*
- * BMESH_CONSTRUCT.C
+ * BM_CONSTRUCT.C
  *
  * This file contains functions for making and destroying
  * individual elements like verts, edges and faces.
@@ -192,11 +192,11 @@
 		if(len > VERT_BUF_SIZE)
 			verts = MEM_callocN(sizeof(BMVert *) * len, "bmesh make ngon vertex array");
 		for(i = 0; i < len; i++){
-			if(!bmesh_test_sysflag((BMHeader*)(edges[i]->v1), BMESH_EDGEVERT)){
-				bmesh_set_sysflag((BMHeader*)(edges[i]->v1), BMESH_EDGEVERT);
+			if(!bmesh_test_sysflag((BMHeader*)(edges[i]->v1), BM_EDGEVERT)){
+				bmesh_set_sysflag((BMHeader*)(edges[i]->v1), BM_EDGEVERT);
 				verts[i] = edges[i]->v1;
-			} else if(!bmesh_test_sysflag((BMHeader*)(edges[i]->v2), BMESH_EDGEVERT)) {
-				bmesh_set_sysflag((BMHeader*)(edges[i]->v2), BMESH_EDGEVERT);
+			} else if(!bmesh_test_sysflag((BMHeader*)(edges[i]->v2), BM_EDGEVERT)) {
+				bmesh_set_sysflag((BMHeader*)(edges[i]->v2), BM_EDGEVERT);
 				verts[i] = 	edges[i]->v2;
 			}
 		}
@@ -205,8 +205,8 @@
 		
 		/*clear flags*/
 		for(i = 0; i < len; i++){
-			bmesh_clear_sysflag((BMHeader*)(edges[i]->v1), BMESH_EDGEVERT);
-			bmesh_clear_sysflag((BMHeader*)(edges[i]->v2), BMESH_EDGEVERT);
+			bmesh_clear_sysflag((BMHeader*)(edges[i]->v1), BM_EDGEVERT);
+			bmesh_clear_sysflag((BMHeader*)(edges[i]->v2), BM_EDGEVERT);
 		}
 		
 		if(len > VERT_BUF_SIZE)
@@ -308,12 +308,12 @@
 	theader->flag = sheader->flag;
 	
 	/*Copy specific attributes*/
-	if(theader->type == BMESH_VERT)
+	if(theader->type == BM_VERT)
 		bm_copy_vert_attributes(source_mesh, target_mesh, (BMVert*)source, (BMVert*)target);
-	else if(theader->type == BMESH_EDGE)
+	else if(theader->type == BM_EDGE)
 		bm_copy_edge_attributes(source_mesh, target_mesh, (BMEdge*)source, (BMEdge*)target);
-	else if(theader->type == BMESH_LOOP)
+	else if(theader->type == BM_LOOP)
 		bm_copy_loop_attributes(source_mesh, target_mesh, (BMLoop*)source, (BMLoop*)target);
-	else if(theader->type == BMESH_FACE)
+	else if(theader->type == BM_FACE)
 		bm_copy_face_attributes(source_mesh, target_mesh, (BMFace*)source, (BMFace*)target);
 }
\ No newline at end of file

Modified: branches/bmesh/bmesh/intern/bmesh_marking.c
===================================================================
--- branches/bmesh/bmesh/intern/bmesh_marking.c	2009-01-02 10:58:30 UTC (rev 18258)
+++ branches/bmesh/bmesh/intern/bmesh_marking.c	2009-01-02 10:59:19 UTC (rev 18259)
@@ -4,7 +4,7 @@
 
 
 /*
- * BMESH_MARK.C
+ * BM_MARK.C
  *
  * Selection routines for bmesh structures.
  * This is actually all old code ripped from
@@ -38,40 +38,40 @@
 
 	int totsel;
 
-	if(bm->selectmode & BMESH_VERT){
+	if(bm->selectmode & BM_VERT){
 		for(e = BMIter_New(&edges, bm, BM_EDGES, bm ); e; e= BMIter_Step(&edges)){
-			if(bmesh_test_sysflag(&(e->v1->head), BMESH_SELECT) && bmesh_test_sysflag(&(e->v2->head), BMESH_SELECT)) bmesh_set_sysflag(&(e->head), BMESH_SELECT);
-			else bmesh_clear_sysflag(&(e->head), BMESH_SELECT);
+			if(bmesh_test_sysflag(&(e->v1->head), BM_SELECT) && bmesh_test_sysflag(&(e->v2->head), BM_SELECT)) bmesh_set_sysflag(&(e->head), BM_SELECT);
+			else bmesh_clear_sysflag(&(e->head), BM_SELECT);
 		}
 		for(f = BMIter_New(&faces, bm, BM_FACES, bm ); f; f= BMIter_Step(&faces)){
 			totsel = 0;
 			l=f->loopbase;
 			do{
-				if(bmesh_test_sysflag(&(l->v->head), BMESH_SELECT)) 
+				if(bmesh_test_sysflag(&(l->v->head), BM_SELECT)) 
 					totsel++;
 				l = ((BMLoop*)(l->head.next));
 			}while(l!=f->loopbase);
 			
 			if(totsel == f->len) 
-				bmesh_set_sysflag(&(f->head), BMESH_SELECT);
+				bmesh_set_sysflag(&(f->head), BM_SELECT);
 			else
-				bmesh_clear_sysflag(&(f->head), BMESH_SELECT);
+				bmesh_clear_sysflag(&(f->head), BM_SELECT);
 		}
 	}
-	else if(bm->selectmode & BMESH_EDGE) {
+	else if(bm->selectmode & BM_EDGE) {
 		for(f = BMIter_New(&faces, bm, BM_FACES, bm ); f; f= BMIter_Step(&faces)){
 			totsel = 0;
 			l=f->loopbase;
 			do{
-				if(bmesh_test_sysflag(&(l->e->head), BMESH_SELECT)) 
+				if(bmesh_test_sysflag(&(l->e->head), BM_SELECT)) 
 					totsel++;
 				l = ((BMLoop*)(l->head.next));
 			}while(l!=f->loopbase);
 			
 			if(totsel == f->len) 
-				bmesh_set_sysflag(&(f->head), BMESH_SELECT);
+				bmesh_set_sysflag(&(f->head), BM_SELECT);
 			else 
-				bmesh_clear_sysflag(&(f->head), BMESH_SELECT);
+				bmesh_clear_sysflag(&(f->head), BM_SELECT);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list