[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18622] branches/bmesh/blender/source/ blender/bmesh: destruction of previous slot api.

Joseph Eagar joeedh at gmail.com
Thu Jan 22 14:59:36 CET 2009


Revision: 18622
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18622
Author:   joeedh
Date:     2009-01-22 14:59:30 +0100 (Thu, 22 Jan 2009)

Log Message:
-----------
destruction of previous slot api. if it returns, it'll
be in the form of functions that return pointer
references to the slot data or something.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/bmesh.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c
    branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c
    branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c
    branches/bmesh/blender/source/blender/bmesh/operators/triangulateop.c

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh.h	2009-01-22 12:34:52 UTC (rev 18621)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh.h	2009-01-22 13:59:30 UTC (rev 18622)
@@ -107,7 +107,6 @@
 	void *data;
 } BMNode;
 
-struct bmop_error;
 typedef struct BMesh {
 	ListBase verts, edges, polys;
 	struct BLI_mempool *vpool;
@@ -126,7 +125,7 @@
 	struct BLI_mempool *flagpool;					/*memory pool for dynamically allocated flag layers*/
 	int stackdepth;									/*current depth of operator stack*/
 	int totflags, walkers;							/*total number of tool flag layers*/
-	ListBase errorstack; /*privately used by the operator error reporting system*/
+	ListBase errorstack;
 } BMesh;
 
 typedef struct BMVert {	

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h	2009-01-22 12:34:52 UTC (rev 18621)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h	2009-01-22 13:59:30 UTC (rev 18622)
@@ -30,30 +30,6 @@
 	} data;
 }BMOpSlot;
 
-/*these macros are used for iterating over slot buffers.
-  for example:
-  int i;
-
-  for (ptr=BMOS_IterNewP(i, slot); ptr; ptr=BMOS_IterStepP(i, slot)) {
-  }
-
-  int ival;
-  for (ival=BMOS_IterNewI(i, slot); !BMOS_IterDoneI(i, slot); ival=BMOS_IterStepI(i, slot) {
-  }
-*/
-/*remember, the ',' operator executes all expressions seperated by ','
-  (left to right) but uses the value of the right-most one.*/
-#define BMOS_IterNewP(stateint, slot)	(stateint = 0, slot->len>0 ? *(void**)slot->data.p : NULL)
-#define BMOS_IterStepP(stateint, slot)	(stateint++,stateint>=slot->len ? NULL : ((void**)slot->data.buf)[stateint])
-
-#define BMOS_IterNewF(stateint, slot)	(stateint = 0, slot->len>0 ? *(float*)slot->data.p : NULL)
-#define BMOS_IterDoneF(stateint, slot)	(stateint >= slot->len)
-#define BMOS_IterStepF(stateint, slot)	(stateint++,stateint>=slot->len ? NULL : ((float*)slot->data.buf)[stateint])
-
-#define BMOS_IterNewI(stateint, slot)	(stateint = 0, slot->len>0 ? *(int*)slot->data.p : NULL)
-#define BMOS_IterDoneI(stateint, slot)	(stateint >= slot->len)
-#define BMOS_IterStepI(stateint, slot)	(stateint++,stateint>=slot->len ? NULL : ((int*)slot->data.buf)[stateint])
-
 /*operators represent logical, executable mesh modules.*/
 #define BMOP_MAX_SLOTS			16		/*way more than probably needed*/
 
@@ -108,15 +84,13 @@
 /*------ error code defines -------*/
 
 /*error messages*/
-#define BMERR_SELF_INTERSECTING	1
+#define BMERR_SELF_INTERSECTING        1
 
 static char *bmop_error_messages[] = {
-	0,
-	"Self intersection error",
+       0,
+       "Self intersection error",
 };
 
-#define BMERR_TOTAL (sizeof(error_messages) / sizeof(void*) - 1)
-
 /*------------begin operator defines (see bmesh_opdefines.c too)------------*/
 /*split op*/
 #define BMOP_SPLIT				0

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c	2009-01-22 12:34:52 UTC (rev 18621)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c	2009-01-22 13:59:30 UTC (rev 18622)
@@ -2,7 +2,6 @@
 
 #include "BLI_memarena.h"
 #include "BLI_mempool.h"
-#include "BLI_blenlib.h"
 
 #include "BKE_utildefines.h"
 
@@ -32,46 +31,6 @@
 	sizeof(void*)	/* pointer buffer */
 };
 
-/*error system*/
-typedef struct bmop_error {
-	struct bmop_error *next, *prev;
-	int errorcode;
-	char *msg;
-} bmop_error;
-
-void BMOP_RaiseError(BMesh *bm, int errcode, char *msg)
-{
-	bmop_error *err = MEM_callocN(sizeof(bmop_error), "bmop_error");
-	err->errorcode = errcode;
-	err->msg = msg;
-	BLI_addhead(&bm->errorstack, err);
-}
-
-/*returns error code or 0 if no error*/
-int BMOP_GetError(BMesh *bm, char **msg)
-{
-	bmop_error *err = bm->errorstack.first;
-	if (!err) return 0;
-	
-	if (msg) *msg = err->msg;
-
-	return err->errorcode;
-}
-
-int BMOP_CheckError(BMesh *bm)
-{
-	return bm->errorstack.first != NULL;
-}
-
-int BMOP_PopError(BMesh *bm, char **msg) 
-{
-	int errorcode = BMOP_GetError(bm, msg);
-	if (errorcode)
-		BLI_remlink(&bm->errorstack, &bm->errorstack.first);
-
-	return errorcode;
-}
-
 /*
  * BMESH OPSTACK PUSH
  *

Modified: branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c	2009-01-22 12:34:52 UTC (rev 18621)
+++ branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c	2009-01-22 13:59:30 UTC (rev 18622)
@@ -43,7 +43,8 @@
 	}
 	*/
 
-	for (vert=BMOS_IterNewP(i, vinput); vert; vert = BMOS_IterStepP(i, vinput)) {
+	for (i=0; i<vinput->len; i++) {
+		vert = ((BMVert**)vinput->data.p)[i];
 		BM_Dissolve_Disk(bmesh, vert);
 	}
 }
\ No newline at end of file

Modified: branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c	2009-01-22 12:34:52 UTC (rev 18621)
+++ branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c	2009-01-22 13:59:30 UTC (rev 18622)
@@ -250,7 +250,8 @@
 	einput = BMO_GetSlot(op, BMOP_ESUBDIVIDE_EDGES);
 
 	/*first go through and split edges*/
-	for (edge=BMOS_IterNewP(i, einput); edge; edge = BMOS_IterStepP(i, einput)) {
+	for (i=0; i<einput->len; i++) {
+		edge = ((BMEdge**)einput->data.p)[i];
 		v1 = BM_Split_Edge(bmesh, edge->v1, edge, &nedge, 0.5, 1);
 		BMO_SetFlag(bmesh, v1, SUBD_SPLIT);
 		BMO_SetFlag(bmesh, nedge, SUBD_SPLIT);

Modified: branches/bmesh/blender/source/blender/bmesh/operators/triangulateop.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/triangulateop.c	2009-01-22 12:34:52 UTC (rev 18621)
+++ branches/bmesh/blender/source/blender/bmesh/operators/triangulateop.c	2009-01-22 13:59:30 UTC (rev 18622)
@@ -19,8 +19,10 @@
 	int i, count = 0;
 	
 	finput = BMO_GetSlot(op, BMOP_ESUBDIVIDE_EDGES);
-	
-	for (face=BMOS_IterNewP(i, finput); face; face=BMOS_IterStepP(i, finput)) {
+
+	for (i=0; i<finput->len; i++) {
+		face = ((BMFace**)finput->data.p)[i];
+
 		/*HACK! need to discuss with Briggs why the function takes an 
 		  externally-allocated array of vert coordinates in the first place.*/
 		if (face->len > 400) projverts = MEM_callocN(sizeof(float)*3*face->len, "projverts");





More information about the Bf-blender-cvs mailing list