[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36627] branches/bmesh/blender/source/ blender: =bmesh=

Joseph Eagar joeedh at gmail.com
Thu May 12 03:55:09 CEST 2011


Revision: 36627
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36627
Author:   joeedh
Date:     2011-05-12 01:55:08 +0000 (Thu, 12 May 2011)
Log Message:
-----------
=bmesh=

1. Removed pinning, at least until after trunk
reintegration (it's a usefull feature, but
incomplete).

2. Ripped out the subclassing code I originally
wrote so bmesh would be more usable for modifiers 
(I ended up improving CDDM instead).

3. Inlined some of the macros in bmesh.h, still need to
do the macros in bmesh_operator_api.h.

4. Removed the BMESH_ITER_*** macros (except for BMESH_ITER_INDEX).
   They were too clunkly to be worth it.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/CMakeLists.txt
    branches/bmesh/blender/source/blender/bmesh/bmesh.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_class.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c
    branches/bmesh/blender/source/blender/editors/include/ED_mesh.h
    branches/bmesh/blender/source/blender/editors/include/UI_resources.h
    branches/bmesh/blender/source/blender/editors/interface/resources.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_select.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
    branches/bmesh/blender/source/blender/editors/mesh/mesh_intern.h
    branches/bmesh/blender/source/blender/editors/space_view3d/drawobject.c
    branches/bmesh/blender/source/blender/editors/transform/transform_conversions.c
    branches/bmesh/blender/source/blender/makesdna/DNA_mesh_types.h
    branches/bmesh/blender/source/blender/makesdna/DNA_meshdata_types.h
    branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh.c

Added Paths:
-----------
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_inline.c

Modified: branches/bmesh/blender/source/blender/bmesh/CMakeLists.txt
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/CMakeLists.txt	2011-05-12 00:20:35 UTC (rev 36626)
+++ branches/bmesh/blender/source/blender/bmesh/CMakeLists.txt	2011-05-12 01:55:08 UTC (rev 36627)
@@ -98,6 +98,7 @@
 	intern/bmesh_walkers.c
 	intern/bmesh_walkers_impl.c
 	intern/bmesh_walkers_private.h
+	intern/bmesh_inline.c
 	bmesh_error.h
 	bmesh_queries.h
 	bmesh.h

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh.h	2011-05-12 00:20:35 UTC (rev 36626)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh.h	2011-05-12 01:55:08 UTC (rev 36627)
@@ -3,7 +3,7 @@
  *
  *	BMesh API.
  *
- * $Id: BKE_bmesh.h,v 1.00 2007/01/17 17:42:01 Briggs Exp $
+ * $Id: bmesh.h,v 1.00 2007/01/17 17:42:01 Briggs Exp $
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -42,6 +42,8 @@
 
 #include "BKE_customdata.h"
 
+#include "BLI_utildefines.h"
+	
 /*
 short introduction:
 
@@ -106,8 +108,7 @@
 #define BM_SMOOTH	(1<<5)
 #define BM_ACTIVE	(1<<6)
 #define BM_NONORMCALC	(1<<7)
-#define BM_PINNED	(1<<8)
-#define BM_FLIPPED	(1<<9) /*internal flag, used for ensuring correct normals during multires interpolation*/
+#define BM_FLIPPED	(1<<8) /*internal flag, used for ensuring correct normals during multires interpolation*/
 
 #include "bmesh_class.h"
 
@@ -142,15 +143,19 @@
 struct BMFace *BM_Make_Ngon ( struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, struct BMEdge **edges, int len, int nodouble );
 
 /*stuff for dealing with header flags*/
-#define BM_TestHFlag(ele, f) (ele && (((BMHeader*)ele)->flag & (f)))
-#define BM_SetHFlag(ele, f) (((BMHeader*)ele)->flag = ((BMHeader*)ele)->flag | (f))
-#define BM_ClearHFlag(ele, f) (((BMHeader*)ele)->flag = ((BMHeader*)ele)->flag & ~(f))
-#define BM_ToggleHFlag(ele, f) (((BMHeader*)ele)->flag = ((BMHeader*)ele)->flag ^ (f))
+BM_INLINE int BM_TestHFlag(void *element, int flag);
 
-/*stuff for setting indices in elements.*/
-#define BMINDEX_SET(ele, i) (((BMHeader*)ele)->index = i)
-#define BMINDEX_GET(ele) (((BMHeader*)ele)->index)
+/*stuff for dealing with header flags*/
+BM_INLINE void BM_SetHFlag(void *element, int flag);
 
+/*stuff for dealing with header flags*/
+BM_INLINE void BM_ClearHFlag(void *element, int flag);
+
+/*stuff for dealing BM_ToggleHFlag header flags*/
+BM_INLINE void BM_ToggleHFlag(void *element, int flag);
+BM_INLINE void BMINDEX_SET(void *element, int index);
+BM_INLINE int BMINDEX_GET(void *element);
+
 /*copies loop data from adjacent faces*/
 void BM_Face_CopyShared ( BMesh *bm, BMFace *f );
 
@@ -309,126 +314,10 @@
 #include "bmesh_error.h"
 #include "bmesh_queries.h"
 #include "bmesh_walkers.h"
+#include "intern/bmesh_inline.c"
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* BMESH_H */
-
-/*old structures*/
-#if 0
-
-typedef struct BMHeader
-{
-    struct BMHeader *next, *prev;
-    int 		EID;  /*Consider removing this/making it ifdeffed for debugging*/
-
-    /*don't confuse this with tool flags.  this flag
-      member is what "header flag" means.*/
-    int		flag;
-    int		type; /*the element type, can be BM_VERT, BM_EDGE, BM_LOOP, or BM_FACE*/
-    int		eflag1, eflag2;	/*Flags used by eulers. Try and get rid of/minimize some of these*/
-
-    /*this is only used to store temporary integers.
-      don't use it for anything else.
-      use the BMINDEX_GET and BMINDEX_SET macros to access it*/
-    int index;
-    struct BMFlagLayer *flags; /*Dynamically allocated block of flag layers for operators to use*/
-    void *data; /*customdata block*/
-} BMHeader;
-
-typedef struct BMFlagLayer
-{
-    int f1;
-    short mask, pflag;
-} BMFlagLayer;
-
-#define BM_OVERLAP	(1<<14) /*used by bmesh_verts_in_face*/
-#define BM_EDGEVERT	(1<<15) /*used by bmesh_make_ngon*/
-
-/*
- * BMNode
- *
- * Used for circular/linked list functions that form basis of
- * adjacency system in BMesh. This should probably be hidden
- * somewhere since tool authors never need to know about it.
- *
-*/
-
-typedef struct BMNode
-{
-    struct BMNode *next, *prev;
-    void *data;
-} BMNode;
-
-typedef struct BMesh
-{
-    ListBase verts, edges, polys;
-    struct BLI_mempool *vpool;
-    struct BLI_mempool *epool;
-    struct BLI_mempool *lpool;
-    struct BLI_mempool *ppool;
-    struct BMVert **vtar;
-    struct BMEdge **edar;
-    struct BMLoop **lpar;
-    struct BMFace **plar;
-    int vtarlen, edarlen, lparlen, plarlen;
-    int totvert, totedge, totface, totloop;
-    int totvertsel, totedgesel, totfacesel;
-    int nextv, nexte, nextp, nextl;
-    struct CustomData vdata, edata, pdata, ldata;
-    int selectmode; /*now uses defines in DNA_scene_types.h*/
-    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;
-
-    /*selection order list*/
-    ListBase selected;
-
-    /*active face pointer*/
-    struct BMFace *act_face;
-
-    /*active shape key number, should really be in BMEditMesh, not here*/
-    int shapenr;
-} BMesh;
-
-typedef struct BMVert
-{
-    struct BMHeader head;
-    float co[3];
-    float no[3];
-    struct BMEdge *edge;
-    float bweight;			/*please, someone just get rid of me...*/
-} BMVert;
-
-typedef struct BMEdge
-{
-    struct BMHeader head;
-    struct BMVert *v1, *v2;
-    struct BMNode d1, d2;
-    struct BMLoop *loop;
-    float crease, bweight; /*make these custom data.... no really, please....*/
-} BMEdge;
-
-typedef struct BMLoop
-{
-    struct BMHeader head;
-    struct BMNode radial;
-    struct BMVert *v;
-    struct BMEdge *e;
-    struct BMFace *f;
-} BMLoop;
-
-typedef struct BMFace
-{
-    struct BMHeader head;
-    struct BMLoop *loopbase;
-    int len;
-    float no[3];
-
-    /*custom data again*/
-    short mat_nr;
-} BMFace;
-#endif

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_class.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_class.h	2011-05-12 00:20:35 UTC (rev 36626)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_class.h	2011-05-12 01:55:08 UTC (rev 36627)
@@ -1,6 +1,39 @@
+/**
+ *  bmesh_class.h    september 2010
+ *
+ *	BMesh API.
+ *
+ * $Id: $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License.  See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * Contributor(s): Geoffrey Bantle, Levi Schooley, Joseph Eagar.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
 #ifndef _BMESH_CLASS_H
 #define _BMESH_CLASS_H
 
+/*bmesh data structures*/
+
 #include "DNA_listBase.h"
 
 #include "BKE_utildefines.h"
@@ -11,212 +44,87 @@
 struct BMEdge;
 struct BMLoop;
 struct BMFace;
-struct BMBaseVert;
-struct BMBaseEdge;
-struct BMBaseLoop;
-struct BMBaseFace;
+struct BMVert;
+struct BMEdge;
+struct BMLoop;
+struct BMFace;
 struct BMLayerType;
 struct BMSubClassLayer;
 struct BMFlagLayer;
 struct BLI_mempool;
 struct Object;
 
-/*
- UPDATE: ok, this hasn't been all that useful.  Need to rip this out and just go with original 
-         structs. 
-       
-        well, much of the actual code was great, but this inheritance thing isn't so
-        useful, need to just make CDDM better.
-*/
-/*
-ok: we have a simple subclassing system, to layer in bmesh api features (and
-let people subclass the api).  There's also a separate, compile-time system
-that will end up being the back-end to a "lite" bmesh API for modifiers.
-
-there are two seperate and distinct subtyping strategies here.  one is with
-macros and struct inheritence, and the other is more dynamic.  this is because
-of two competing motivations for subclassing: the ability to code faster,
-less memory intensive BMTools that don't use adjacency info, and the ability
-to hook into higher-level API functions for things like multires interpolation,
-which needs much more then what is provided in the CustomData API.
-
-The first strategy is part of a plan to replace CDDM with a bmesh-like API
-(which is much easier for me then rewriting array, mirror, in CDDM, which
-would be a huge pain).
-*/
-
 /*note: it is very important for BMHeader to start with two
   pointers. this is a requirement of mempool's method of
   iteration.
 */
 typedef struct BMHeader {
 	void *data; /*customdata layers*/
-	void *layerdata; /*dynamic subclass data, doesn't include BMTool and adjacency which use a static compile-time method */
+	struct BMFlagLayer *flags;
 	int eid; /*element id*/
 	short type; /*element geometric type (verts/edges/loops/faces)*/
 	short flag; /*this would be a CD layer, see below*/
 	short eflag1, eflag2;
 	int sysflag, index; /*note: do *not* touch sysflag! and use BMINDEX_GET/SET macros for index*/
-	struct BMFlagLayer *flags;
 } BMHeader;
 
 /*note: need some way to specify custom locations for custom data layers.  so we can
 make them point directly into structs.  and some way to make it only happen to the
 active layer, and properly update when switching active layers.*/
 
-/*alloc type a: smallest mesh possible*/
-#define BM_BASE_VHEAD\
-	BMHeader head;\
-	float co[3];\
+typedef struct BMVert {
+	BMHeader head;
+	float co[3];
 	float no[3];
+	struct BMEdge *e;
+} BMVert;
 
-typedef struct BMBaseVert {
-	BM_BASE_VHEAD
-} BMBaseVert;
+typedef struct BMEdge {
+	BMHeader head;
+	struct BMVert *v1, *v2;
+	struct BMLoop *l;
+	
+	/*disk cycle pointers*/
+	struct {
+		struct BMEdge *next, *prev;
+	} dlink1;
+	struct {
+		struct BMEdge *next, *prev;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list