=bmesh=
authorJoseph Eagar <joeedh@gmail.com>
Thu, 12 May 2011 01:55:08 +0000 (01:55 +0000)
committerJoseph Eagar <joeedh@gmail.com>
Thu, 12 May 2011 01:55:08 +0000 (01:55 +0000)
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.

20 files changed:
source/blender/bmesh/CMakeLists.txt
source/blender/bmesh/bmesh.h
source/blender/bmesh/bmesh_class.h
source/blender/bmesh/bmesh_iterators.h
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_inline.c [new file with mode: 0644]
source/blender/bmesh/intern/bmesh_marking.c
source/blender/bmesh/intern/bmesh_mesh.c
source/blender/bmesh/intern/bmesh_newcore.c
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/resources.c
source/blender/editors/mesh/bmesh_select.c
source/blender/editors/mesh/bmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/transform/transform_conversions.c
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesdna/DNA_meshdata_types.h
source/blender/makesrna/intern/rna_mesh.c

index c1e0b2ad2e2d3958d7a6577ca080021f9ff6cb23..b377e7612d493c106fc7a4eab3701c14e2fd1132 100644 (file)
@@ -98,6 +98,7 @@ set(SRC
        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
index 4aaf1e20de253e5b034353789ca8d46f8d86e1c4..48b54a21140f0db90bdefd32192eab3bdb659120 100644 (file)
@@ -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 @@ extern "C" {
 
 #include "BKE_customdata.h"
 
+#include "BLI_utildefines.h"
+       
 /*
 short introduction:
 
@@ -106,8 +108,7 @@ struct EditMesh;
 #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,14 +143,18 @@ defining edges[0], and define the winding of the new face.*/
 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 @@ void bmesh_end_edit(struct BMesh *bm, int flag);
 #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
index 164aae59b1117b68ca9a8011e71be652d323595b..6a3e0ac566b6ce5b57763622b28503dba4ba7228 100644 (file)
@@ -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 BMVert;
 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;
-
-#define BM_BASE_EHEAD(vtype)\
-       BMHeader head;\
-       struct vtype *v1, *v2;
+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;
+       } dlink2;
+} BMEdge;
 
-typedef struct BMBaseEdge {
-       BM_BASE_EHEAD(BMBaseVert)
-} BMBaseEdge;
+typedef struct BMLoop {
+       BMHeader head;
+       struct BMVert *v;
+       struct BMEdge *e;
+       struct BMFace *f;
 
-#define BM_BASE_LHEAD(vtype, etype, ltype)\
-       BMHeader head;\
-       struct vtype *v;\
-       struct etype *e;\
-       struct ltype *next, *prev; /*won't be able to use listbase API, ger, due to head*/\
+       struct BMLoop *radial_next, *radial_prev;
+       
+       /*private variables*/
+       struct BMLoop *next, *prev; /*won't be able to use listbase API, ger, due to head*/\
        int _index; /*used for sorting during tesselation*/
+} BMLoop;
 
-typedef struct BMBaseLoop {
-       BM_BASE_LHEAD(BMBaseVert, BMBaseEdge, BMBaseLoop)
-} BMBaseLoop;
-
-#define BM_BASE_LSTHEAD(listtype, looptype)\
-       struct listtype *next, *prev;\
-       struct looptype *first, *last;
-
-typedef struct BMBaseLoopList {
-       BM_BASE_LSTHEAD(BMBaseLoopList, BMBaseLoop)
-} BMBaseLoopList;
+typedef struct BMLoopList {
+       struct BMLoopList *next, *prev;
+       struct BMLoop *first, *last;
+} BMLoopList;
 
-#define BM_BASE_FHEAD\
-       BMHeader head;\
+typedef struct BMFace {
+       BMHeader head;
        int len; /*includes all boundary loops*/\
        int totbounds; /*total boundaries, is one plus the number of holes in the face*/\
-       ListBase loops;\
+       ListBase loops;
        float no[3]; /*yes, we do store this here*/\
        short mat_nr;
-       
-typedef struct BMBaseFace {
-       BM_BASE_FHEAD
-} BMBaseFace;
+} BMFace;
 
 typedef struct BMFlagLayer {
        short f, pflag; /*flags*/
        int index; /*generic index*/
 } BMFlagLayer;
 
-#define BM_ADJ_VHEAD(etype)\
-       BM_BASE_VHEAD\
-       struct etype *e;
-
-typedef struct BMVert {
-       BM_ADJ_VHEAD(BMEdge)
-} BMVert;
-
-#define BM_ADJ_EHEAD(vtype, etype, ltype)\
-       BM_BASE_EHEAD(vtype)\
-       struct ltype *l;\
-       /*disk cycle pointers*/\
-       struct {\
-               struct etype *next, *prev;\
-       } dlink1;\
-       struct {\
-               struct etype *next, *prev;\
-       } dlink2;
-
-typedef struct BMEdge {
-       BM_ADJ_EHEAD(BMVert, BMEdge, BMLoop)
-} BMEdge;
-
-#define BM_ADJ_LHEAD(vtype, etype, ltype, ftype)\
-       BM_BASE_LHEAD(vtype, etype, ltype)\
-       struct ltype *radial_next, *radial_prev;\
-       struct ftype *f;
-
-typedef struct BMLoop {
-       BM_ADJ_LHEAD(BMVert, BMEdge, BMLoop, BMFace)
-} BMLoop;
-
-typedef struct BMLoopList {
-       BM_BASE_LSTHEAD(BMLoopList, BMLoop)
-} BMLoopList;
-
-#define BM_ADJ_FHEAD\
-       BM_BASE_FHEAD
-typedef struct BMFace {
-       BM_ADJ_FHEAD
-} BMFace;
-
-/*this is part of the lower-level face splitting API, higer-level
-stuff will be preferred*/
-typedef struct BMFaceCut {
-       BMLoop *l1, *l2;
-       ListBase origface_loops;
-       ListBase newface_loops;
-       BMFace *new_f; /*empty new face to be filled by api*/
-} BMFaceCut;
-
-/*ok, in nearly (if not all) cases the subclasses will use CustomData to store stuff, but they store things
-here as well (except it's not saved in files obviously, or interpolating, or all the other things the CD
-system does)*/
-#define BMSC_GETSELF(bm, e, type) (void*)(((char*)((BMHeader*)(e))->layerdata) + bm->layer_offsets[(type)->__index])
-
-#define BM_SUBCLASS_HEAD       struct BMLayerType *type; int __index;
-
-typedef struct BMSubClassLayer {
-       BM_SUBCLASS_HEAD
-} BMSubClassLayer;
-
-typedef struct BMLayerType {
-       int vsize, esize, lsize, fsize;
-       int meshsize; /*size of custom mesh structure, if exists*/
-       
-       /*note that allocation is done entirely outside of the subclass functions, thus the need for
-         the above struct size parameters*/
-       void (*new_mesh)(struct BMesh *bm, void *self);
-       void (*free_mesh)(struct BMesh *bm, void *self);
-       
-       /*these functions may return NULL if this child class doesn't need to store anything
-       outside of the CustomData API*/
-       void (*new_vert)(struct BMesh *bm, BMBaseVert *v, void *self);
-       void (*new_edge)(struct BMesh *bm, BMBaseEdge *e, void *self); 
-       void (*new_loop)(struct BMesh *bm, BMBaseLoop *l, void *self, BMBaseFace *f);
-       void (*new_face)(struct BMesh *bm, BMBaseFace *f, void *self);
-       
-       void (*free_vert)(struct BMesh *bm, BMBaseVert *v);
-       void (*free_edge)(struct BMesh *bm, BMBaseEdge *e);
-       void (*free_loop)(struct BMesh *bm, BMBaseLoop *l);
-       void (*free_face)(struct BMesh *bm, BMBaseFace *f);
-
-       void (*copy_vert)(struct BMesh *bm, BMBaseVert *v);
-       void (*copy_edge)(struct BMesh *bm, BMBaseEdge *e);
-       void (*copy_loop)(struct BMesh *bm, BMBaseLoop *l);
-       void (*copy_face)(struct BMesh *bm, BMBaseFace *f);
-
-       /*hrm, I wonder if I should have this at all, faces_from_faces might be
-         better all by itself*/
-       void (*split_face)(struct BMesh *bm, void *f, BMFaceCut *cuts, int totcut);
-
-       /*interpolates non-CustomData-stored data.  faces in dest overlap some or all faces in source*/
-       void (*faces_from_faces)(struct BMesh *bm, BMFace **sources, int totsource, BMFace **dests, int totdest);
-       
-       int required_base_layers; /*sets if BMTool flags or adjacency data layers are needed*/
-       int customdata_required_layers; /*mask of required CD layers*/
-} BMLayerType;
-
 typedef struct BMesh {
        int totvert, totedge, totloop, totface;
        int totvertsel, totedgesel, totfacesel;
@@ -224,9 +132,6 @@ typedef struct BMesh {
        /*element pools*/
        struct BLI_mempool *vpool, *epool, *lpool, *fpool;
 
-       /*subclass data layer pools*/
-       struct BLI_mempool *svpool, *sepool, *slpool, *sfpool;
-
        /*operator api stuff*/
        struct BLI_mempool *toolflagpool;
        int stackdepth;
@@ -236,11 +141,6 @@ typedef struct BMesh {
 
        struct BLI_mempool *looplistpool;
        
-       /*stuff for compile-time subclassing*/
-       int baselevel, totlayer;
-       BMSubClassLayer *layers; /*does not include base types*/
-       int *layer_offsets;
-       
        /*should be copy of scene select mode*/
        int selectmode;
        
@@ -260,11 +160,6 @@ typedef struct BMesh {
 
 BMFace *BM_Copy_Face(BMesh *bm, BMFace *f, int copyedges, int copyverts);
 
-#define LAYER_BASE     1
-#define LAYER_TOOL     2
-#define LAYER_ADJ      4
-#define MAX_LAYERS     2 /*does not include base*/
-
 #define BM_VERT                1
 #define BM_EDGE                2
 #define BM_LOOP                4
index 6d80949163121e598da4667084dad60bdccaa1e0..49920a77074fff1336f60ed636896d093b00adf9 100644 (file)
@@ -55,18 +55,6 @@ a different face hole boundary*/
        ele = BMIter_New(iter, bm, type, data); \
        for (indexvar=0; ele; indexvar++, ele=BMIter_Step(iter))
 
-#define BM_ITER_SELECT(ele, iter, bm, type, data)\
-for (ele = BMIter_New(iter, bm, type, data); ele; ele=BMIter_Step(iter)) {\
-       if (BM_TestHFlag(ele, BM_HIDDEN) || !BM_TestHFlag(ele, BM_SELECT)) continue;
-
-#define BM_ITER_VISIBLE(ele, iter, bm, type, data)\
-for (ele = BMIter_New(iter, bm, type, data); ele; ele=BMIter_Step(iter)) {\
-       if (BM_TestHFlag(ele, BM_HIDDEN)) continue;
-               
-#define BM_ITER_NOTSELECT(ele, iter, bm, type, data)\
-for (ele = BMIter_New(iter, bm, type, data); ele; ele=BMIter_Step(iter)) {\
-       if (BM_TestHFlag(ele, BM_HIDDEN) || BM_TestHFlag(ele, BM_SELECT)) continue;
-
 /*Iterator Structure*/
 typedef struct BMIter {
        BLI_mempool_iter pooliter;
index 4d98712421d48c81f4f705bd84f185cc9d4b6e19..d52af69f300adfb61d0c5e8f43bfc9acbb063e37 100644 (file)
@@ -596,7 +596,6 @@ int BMFlags_To_MEFlags(void *element) {
        BMHeader *h = element;
        int f = 0;
 
-       if (h->flag & BM_PINNED) f |= ME_PIN;
        if (h->flag & BM_HIDDEN) f |= ME_HIDE;
 
        if (h->type == BM_FACE) {
@@ -626,7 +625,6 @@ int BMFlags_To_MEFlags(void *element) {
 */
 int MEFlags_To_BMFlags(int flag, int type) {
        int f = 0;
-       if (flag & ME_PIN) f |= BM_PINNED;
 
        if (type == BM_FACE) {
                if (flag & ME_FACE_SEL) f |= BM_SELECT;
diff --git a/source/blender/bmesh/intern/bmesh_inline.c b/source/blender/bmesh/intern/bmesh_inline.c
new file mode 100644 (file)
index 0000000..bec403d
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef BM_INLINE_C
+#define BM_INLINE_C
+
+#include "bmesh.h"
+
+BM_INLINE int BM_TestHFlag(void *element, int flag)
+{
+       BMHeader *e = element;
+       return e->flag & flag;
+}
+
+/*stuff for dealing with header flags*/
+BM_INLINE void BM_SetHFlag(void *element, int flag)
+{
+       BMHeader *e = element;
+       e->flag |= flag;
+}
+
+/*stuff for dealing with header flags*/
+BM_INLINE void BM_ClearHFlag(void *element, int flag)
+{
+       BMHeader *e = element;
+       e->flag &= ~flag;
+}
+
+/*stuff for dealing BM_ToggleHFlag header flags*/
+BM_INLINE void BM_ToggleHFlag(void *element, int flag)
+{
+       BMHeader *e = element;
+       e->flag ^= flag;
+}
+
+BM_INLINE void BMINDEX_SET(void *element, int index)
+{
+       BMHeader *e = element;
+       e->index = index;
+}
+
+BM_INLINE int BMINDEX_GET(void *element)
+{
+       BMHeader *e = element;
+       return e->index;
+}
+
+#endif /*BM_INLINE_C*/
+
index 7cd39a388bfde41ec1fcfffa12d79bbab452866d..a733f2018a17c36f70e08a0447080706aa33da61 100644 (file)
@@ -563,51 +563,6 @@ void BM_clear_flag_all(BMesh *bm, int flag)
 }
 
 
-/***************** Pinning **************/
-
-#define SETPIN(ele) pin ? BM_SetHFlag(ele, BM_PINNED) : BM_ClearHFlag(ele, BM_PINNED);
-
-
-void BM_Pin_Vert(BMesh *UNUSED(bm), BMVert *v, int pin)
-{
-       SETPIN(v);
-}
-
-void BM_Pin_Edge(BMesh *UNUSED(bm), BMEdge *e, int pin)
-{
-       SETPIN(e->v1);
-       SETPIN(e->v2);
-}
-
-void BM_Pin_Face(BMesh *bm, BMFace *f, int pin)
-{
-       BMIter vfiter;
-       BMVert *vf;
-
-       BM_ITER(vf, &vfiter, bm, BM_VERTS_OF_FACE, f) {
-               SETPIN(vf);
-       }
-}
-
-void BM_Pin(BMesh *bm, void *element, int pin)
-{
-       BMHeader *h = element;
-
-       switch (h->type) {
-               case BM_VERT:
-                       BM_Pin_Vert(bm, element, pin);
-                       break;
-               case BM_EDGE:
-                       BM_Pin_Edge(bm, element, pin);
-                       break;
-               case BM_FACE:
-                       BM_Pin_Face(bm, element, pin);
-                       break;
-       }
-}
-
-
-
 /***************** Mesh Hiding stuff *************/
 
 #define SETHIDE(ele) hide ? BM_SetHFlag(ele, BM_HIDDEN) : BM_ClearHFlag(ele, BM_HIDDEN);
index 3fa34aafe8af1c815fd5e8e550358a92e1e200b5..60688dee616613392dc4bc7cb8ba3261f1540424 100644 (file)
@@ -115,23 +115,13 @@ BMesh *BM_Make_Mesh(struct Object *ob, int allocsize[4])
        /*allocate the structure*/
        BMesh *bm = MEM_callocN(sizeof(BMesh),"BM");
        int vsize, esize, lsize, fsize, lstsize;
-       int baselevel = LAYER_ADJ;
-
-       if (baselevel == LAYER_BASE) {
-               vsize = sizeof(BMBaseVert);
-               esize = sizeof(BMBaseEdge);
-               lsize = sizeof(BMBaseLoop);
-               fsize = sizeof(BMBaseFace);
-               lstsize = sizeof(BMBaseLoopList);
-       } else {
-               vsize = sizeof(BMVert);
-               esize = sizeof(BMEdge);
-               lsize = sizeof(BMLoop);
-               fsize = sizeof(BMFace);
-               lstsize = sizeof(BMLoopList);
-       }
 
-       bm->baselevel = baselevel;
+       vsize = sizeof(BMVert);
+       esize = sizeof(BMEdge);
+       lsize = sizeof(BMLoop);
+       fsize = sizeof(BMFace);
+       lstsize = sizeof(BMLoopList);
+
        bm->ob = ob;
        
 /*allocate the memory pools for the mesh elements*/
@@ -193,15 +183,6 @@ void BM_Free_Mesh_Data(BMesh *bm)
        BLI_mempool_destroy(bm->lpool);
        BLI_mempool_destroy(bm->fpool);
 
-       if (bm->svpool)
-               BLI_mempool_destroy(bm->svpool);
-       if (bm->sepool)
-               BLI_mempool_destroy(bm->sepool);
-       if (bm->slpool)
-               BLI_mempool_destroy(bm->slpool);
-       if (bm->sfpool)
-               BLI_mempool_destroy(bm->sfpool);
-
        /*destroy flag pool*/
        BLI_mempool_destroy(bm->toolflagpool);
        BLI_mempool_destroy(bm->looplistpool);
index 82ad96db0386b5e1e18ef7a19e58803514d1732f..ab4eab476f49690158e41fbf1e4f49dd4c1b86b4 100644 (file)
 #include "bmesh_iterators.h"
 #include "bmesh_private.h"
 
-/*note: first three layers, base through adjacency, do *not* use the
-  LayerType system for speed/memory cache efficiency and whatnot*/
-
-static void inherit_vert(BMesh *bm, BMBaseVert *v)
-{
-       int i;
-       
-       for (i=0; i<bm->totlayer; i++) {
-               void *ldata = BMSC_GETSELF(bm, v, bm->layers+i);
-               bm->layers[i].type->new_vert(bm, v, ldata);
-       }
-       
-       if (bm->baselevel >= LAYER_ADJ) {
-               /*not sure anything is needed here either, verts generally come first before all else*/
-       }   
-}
-
-static void inherit_edge(BMesh *bm, BMBaseEdge *ebase)
-{
-       int i;
-       
-       if (bm->baselevel >= LAYER_ADJ) {
-               BMEdge *e = (BMEdge*)ebase;
-
-               bmesh_disk_append_edge(e, e->v1);
-               bmesh_disk_append_edge(e, e->v2);
-       }
-
-       for (i=0; i<bm->totlayer; i++) {
-               void *ldata = BMSC_GETSELF(bm, ebase, bm->layers+i);
-               bm->layers[i].type->new_edge(bm, ebase, ldata);
-       }
-}
-
-static void inherit_loop(BMesh *bm, BMBaseLoop *l, BMBaseFace *f)
-{
-       int i;
-
-       for (i=0; i<bm->totlayer; i++) {
-               void *self;
-
-               if (!bm->layers[i].type->new_loop) continue;
-
-               self = BMSC_GETSELF(bm, l, &bm->layers[i]);
-               bm->layers[i].type->new_loop(bm, (BMBaseLoop*)l, self, (BMBaseFace*)f);
-       }
-}
-
-/*
-static void inherit_face(BMesh *bm, BMBaseFace *basef)
-{
-       int i;
-       
-       for (i=0; i<bm->totlayer; i++) {
-               void *fdata = BMSC_GETSELF(bm, basef, bm->layers+i);
-               bm->layers[i].type->new_face(bm, basef, fdata);
-       }
-}
-*/
-
-static void BM_SubClass(BMesh *UNUSED(bm), BMLayerType *UNUSED(type))
-{
-}
-
 BMVert *BM_Make_Vert(BMesh *bm, float co[3], struct BMVert *example) {
-       BMBaseVert *v = BLI_mempool_calloc(bm->vpool);
+       BMVert *v = BLI_mempool_calloc(bm->vpool);
        
        bm->totvert += 1;
 
        v->head.type = BM_VERT;
-       if (bm->svpool)
-               v->head.layerdata = BLI_mempool_calloc(bm->svpool);
 
        if (co) copy_v3_v3(v->co, co);
        
-       if (bm->baselevel >= LAYER_TOOL) {
-               BMBaseVert *tv = (BMBaseVert*)v;
-
-               /*allocate flags*/
-               tv->head.flags = BLI_mempool_calloc(bm->toolflagpool);
-       }
+       /*allocate flags*/
+       v->head.flags = BLI_mempool_calloc(bm->toolflagpool);
 
        CustomData_bmesh_set_default(&bm->vdata, &v->head.data);
        
-       inherit_vert(bm, v);
-       
        if (example) {
                BM_Copy_Attributes(bm, bm, (BMVert*)example, (BMVert*)v);
        }
@@ -139,31 +67,27 @@ BMEdge *BM_Edge_Exist(BMVert *v1, BMVert *v2)
 }
 
 BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge *example, int nodouble) {
-       BMBaseEdge *e;
+       BMEdge *e;
        
-       if (nodouble && (e=(BMBaseEdge*)BM_Edge_Exist(v1, v2)))
+       if (nodouble && (e=(BMEdge*)BM_Edge_Exist(v1, v2)))
                return (BMEdge*)e;
        
        e = BLI_mempool_calloc(bm->epool);
        bm->totedge += 1;
        e->head.type = BM_EDGE;
-       if (bm->sepool)
-               e->head.layerdata = BLI_mempool_calloc(bm->sepool);
        
-       if (bm->baselevel >= LAYER_TOOL) {
-               BMBaseEdge *te = (BMBaseEdge*)e;
-               
-               /*allocate flags*/
-               te->head.flags = BLI_mempool_calloc(bm->toolflagpool);
-       }
+       /*allocate flags*/
+       e->head.flags = BLI_mempool_calloc(bm->toolflagpool);
 
-       e->v1 = (BMBaseVert*) v1;
-       e->v2 = (BMBaseVert*) v2;
+       e->v1 = (BMVert*) v1;
+       e->v2 = (BMVert*) v2;
+       
        
        CustomData_bmesh_set_default(&bm->edata, &e->head.data);
        
-       inherit_edge(bm, e);
-
+       bmesh_disk_append_edge(e, e->v1);
+       bmesh_disk_append_edge(e, e->v2);
+       
        if (example)
                BM_Copy_Attributes(bm, bm, (BMEdge*)example, (BMEdge*)e);
        
@@ -179,20 +103,13 @@ static BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, BML
        l->next = l->prev = NULL;
        l->v = v;
        l->e = e;
-       if (bm->baselevel >= LAYER_ADJ) {
-               l->f = f;
-               l->radial_next = l->radial_prev = NULL;
-       }
+       l->f = f;
+       l->radial_next = l->radial_prev = NULL;
        l->head.data = NULL;
        l->head.type = BM_LOOP;
 
        bm->totloop++;
 
-       if (bm->slpool)
-               l->head.layerdata = BLI_mempool_calloc(bm->slpool);
-
-       inherit_loop(bm, (BMBaseLoop *)l, (BMBaseFace *)f);
-
        if(example)
                CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, example->head.data, &l->head.data);
        else
@@ -202,23 +119,16 @@ static BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, BML
 }
 
 static BMLoop *BM_Add_FaceBoundary(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte) {
-       BMBaseLoopList *lst = BLI_mempool_calloc(bm->looplistpool);
+       BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool);
        BMLoop *l = (BMLoop*)bmesh_create_loop(bm, startv, starte, f, NULL);
        int i;
        
        bmesh_radial_append(starte, l);
 
-       lst->first = lst->last = (BMBaseLoop*)l;
+       lst->first = lst->last = (BMLoop*)l;
        BLI_addtail(&f->loops, lst);
        
-       if (bm->baselevel >= LAYER_ADJ)
-               l->f = f;
-       
-       for (i=0; i<bm->totlayer; i++) {
-               void *self = BMSC_GETSELF(bm, l, (&bm->layers[i]));
-               
-               bm->layers[i].type->new_loop(bm, (BMBaseLoop*)l, self, (BMBaseFace*)f);
-       }
+       l->f = f;
        
        return l;       
 }
@@ -285,8 +195,8 @@ BMFace *BM_Copy_Face(BMesh *bm, BMFace *f, int copyedges, int copyverts)
 }
 
 BMFace *BM_Make_Face(BMesh *bm, BMVert **verts, BMEdge **edges, int len) {
-       BMBaseFace *f;
-       BMBaseLoop *l, *startl, *lastl;
+       BMFace *f;
+       BMLoop *l, *startl, *lastl;
        int i;
        
        if (len == 0) {
@@ -298,33 +208,23 @@ BMFace *BM_Make_Face(BMesh *bm, BMVert **verts, BMEdge **edges, int len) {
        bm->totface += 1;
        f->head.type = BM_FACE;
 
-       if (bm->sfpool)
-               f->head.layerdata = BLI_mempool_calloc(bm->sfpool);
-
-       startl = lastl = (BMBaseLoop*) BM_Add_FaceBoundary(bm, (BMFace*)f, verts[0], edges[0]);
+       startl = lastl = (BMLoop*) BM_Add_FaceBoundary(bm, (BMFace*)f, verts[0], edges[0]);
        
-       startl->v = (BMBaseVert*) verts[0];
-       startl->e = (BMBaseEdge*) edges[0];
+       startl->v = (BMVert*) verts[0];
+       startl->e = (BMEdge*) edges[0];
        for (i=1; i<len; i++) {
-               l = (BMBaseLoop *)bmesh_create_loop(bm, verts[i], edges[i], (BMFace *)f, edges[i]->l);
+               l = (BMLoop *)bmesh_create_loop(bm, verts[i], edges[i], (BMFace *)f, edges[i]->l);
                
-               if (bm->baselevel >= LAYER_ADJ) {
-                       BMLoop *bl = (BMLoop*)l;
-                       bl->f = (BMFace*) f;
-                       bmesh_radial_append(edges[i], bl);
-               }
+               l->f = (BMFace*) f;
+               bmesh_radial_append(edges[i], l);
 
                l->prev = lastl;
                lastl->next = l;
                lastl = l;
        }
        
-       if (bm->baselevel >= LAYER_TOOL) {
-               BMBaseFace *tf = (BMBaseFace*) f;
-               
-               /*allocate flags*/
-               tf->head.flags = BLI_mempool_calloc(bm->toolflagpool);
-       }
+       /*allocate flags*/
+       f->head.flags = BLI_mempool_calloc(bm->toolflagpool);
 
        CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
        
@@ -334,15 +234,6 @@ BMFace *BM_Make_Face(BMesh *bm, BMVert **verts, BMEdge **edges, int len) {
        f->len = len;
        f->totbounds = 0;
        
-       for (i=0; i<bm->totlayer; i++) {
-               void *self;
-               
-               if (!bm->layers[i].type->new_face) continue;
-               
-               self = BMSC_GETSELF(bm, f, &bm->layers[i]);
-               bm->layers[i].type->new_face(bm, f, self);
-       }
-       
        CHECK_ELEMENT(bm, f);
 
        return (BMFace*) f;
@@ -467,18 +358,12 @@ int bmesh_check_element(BMesh *UNUSED(bm), void *element, int type) {
 static void bmesh_kill_loop(BMesh *bm, BMLoop *l) {
        int i;
        
-       for (i=0; i<bm->totlayer; i++) {
-               bm->layers[i].type->free_loop(bm, (BMBaseLoop*)l);
-       }
-
        bm->totloop--;
        if (l->head.data)
                CustomData_bmesh_free_block(&bm->ldata, &l->head.data);
 
-       if (bm->baselevel >= LAYER_TOOL && l->head.flags) {
+       if (l->head.flags)
                BLI_mempool_free(bm->toolflagpool, l->head.flags);
-       }
-
        BLI_mempool_free(bm->lpool, l);
 }
 
@@ -521,25 +406,20 @@ void BM_Kill_Face_Verts(BMesh *bm, BMFace *f) {
 }
 
 void BM_Kill_Face(BMesh *bm, BMFace *f) {
-       BMBaseLoopList *ls, *lsnext;
+       BMLoopList *ls, *lsnext;
        int i;
        
        CHECK_ELEMENT(bm, f);
 
-       for (i=0; i<bm->totlayer; i++) {
-               bm->layers[i].type->free_face(bm, (BMBaseFace*)f);
-       }
-
        for (ls=f->loops.first; ls; ls=lsnext) {
-               BMBaseLoop *l, *lnext;
+               BMLoop *l, *lnext;
 
                lsnext = ls->next;
                l = ls->first;
                do {
                        lnext = l->next;
 
-                       if (bm->baselevel >= LAYER_ADJ)
-                               bmesh_radial_remove_loop((BMLoop*)l, (BMEdge *)l->e);
+                       bmesh_radial_remove_loop((BMLoop*)l, (BMEdge *)l->e);
                        bmesh_kill_loop(bm, (BMLoop*)l);
 
                        l = lnext;
@@ -556,9 +436,7 @@ void BM_Kill_Face(BMesh *bm, BMFace *f) {
        if (f->head.data)
                CustomData_bmesh_free_block(&bm->pdata, &f->head.data);
 
-       if (bm->baselevel >= LAYER_TOOL) {
-               BLI_mempool_free(bm->toolflagpool, f->head.flags);
-       }
+       BLI_mempool_free(bm->toolflagpool, f->head.flags);
 
        BLI_mempool_free(bm->fpool, f);
 }
@@ -566,31 +444,25 @@ void BM_Kill_Face(BMesh *bm, BMFace *f) {
 void BM_Kill_Edge(BMesh *bm, BMEdge *e) {
        int i;
        
-       for (i=0; i<bm->totlayer; i++) {
-               bm->layers[i].type->free_edge(bm, (BMBaseEdge*)e);
-       }
-       
-       if (bm->baselevel >= LAYER_ADJ) {
-               bmesh_disk_remove_edge(e, e->v1);
-               bmesh_disk_remove_edge(e, e->v2);
+       bmesh_disk_remove_edge(e, e->v1);
+       bmesh_disk_remove_edge(e, e->v2);
                
-               if (e->l) {
-                       BMLoop *l = e->l, *lnext, *startl=e->l;
+       if (e->l) {
+               BMLoop *l = e->l, *lnext, *startl=e->l;
                        
-                       do {
-                               lnext = l->radial_next;
-                               if (lnext->f == l->f) {
-                                       BM_Kill_Face(bm, l->f);
-                                       break;                                  
-                               }
-                               
+               do {
+                       lnext = l->radial_next;
+                       if (lnext->f == l->f) {
                                BM_Kill_Face(bm, l->f);
+                               break;                                  
+                       }
                        
-                               if (l == lnext)
-                                       break;
-                               l = lnext;
-                       } while (l != startl);
-               }
+                       BM_Kill_Face(bm, l->f);
+               
+                       if (l == lnext)
+                               break;
+                       l = lnext;
+               } while (l != startl);
        }
        
        bm->totedge--;
@@ -598,43 +470,28 @@ void BM_Kill_Edge(BMesh *bm, BMEdge *e) {
        if (e->head.data)
                CustomData_bmesh_free_block(&bm->edata, &e->head.data);
 
-       if (bm->baselevel >= LAYER_TOOL) {
-               BLI_mempool_free(bm->toolflagpool, e->head.flags);
-       }
-       
+       BLI_mempool_free(bm->toolflagpool, e->head.flags);
        BLI_mempool_free(bm->epool, e);
 }
 
 void BM_Kill_Vert(BMesh *bm, BMVert *v) {
-       int i;
-
-       for (i=0; i<bm->totlayer; i++) {
-               bm->layers[i].type->free_vert(bm, (BMBaseVert*)v);
-       }
-       
-       if (bm->baselevel >= LAYER_ADJ) {
-               if (v->e) {
-                       BMEdge *e, *nexte;
-                       
-                       e = v->e;
-                       while (v->e) {
-                               nexte=bmesh_disk_nextedge(e, v);
-
-                               BM_Kill_Edge(bm, (BMEdge*)e);
-                               e = nexte;
-                       }
+       if (v->e) {
+               BMEdge *e, *nexte;
+               
+               e = v->e;
+               while (v->e) {
+                       nexte=bmesh_disk_nextedge(e, v);
+                       BM_Kill_Edge(bm, (BMEdge*)e);
+                       e = nexte;
                }
-       }    
+       }
 
        bm->totvert--;
        BM_remove_selection(bm, v);
        if (v->head.data)
                CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
 
-       if (bm->baselevel >= LAYER_TOOL) {
-               BLI_mempool_free(bm->toolflagpool, v->head.flags);
-       }
-
+       BLI_mempool_free(bm->toolflagpool, v->head.flags);
        BLI_mempool_free(bm->vpool, v);
 }
 
@@ -937,13 +794,6 @@ BMFace *BM_Join_Faces(BMesh *bm, BMFace **faces, int totface)
                goto error;
        }
 
-       for (i=0; i<bm->totlayer; i++) {
-               BMFace *faces2[2] = {newf, NULL};
-
-               if (bm->layers[i].type->faces_from_faces)
-                       bm->layers[i].type->faces_from_faces(bm, faces, totface, faces2, 1);
-       }
-
        /*copy over loop data*/
        l = bm_firstfaceloop(newf);
        do {
@@ -1024,8 +874,8 @@ error:
 }
 
 static BMFace *bmesh_addpolylist(BMesh *bm, BMFace *UNUSED(example)) {
-       BMBaseFace *f;
-       BMBaseLoopList *lst;
+       BMFace *f;
+       BMLoopList *lst;
 
        f = BLI_mempool_calloc(bm->fpool);
        lst = BLI_mempool_calloc(bm->looplistpool);
@@ -1034,32 +884,14 @@ static BMFace *bmesh_addpolylist(BMesh *bm, BMFace *UNUSED(example)) {
        BLI_addtail(&f->loops, lst);
        bm->totface++;
 
-       if (bm->baselevel >= LAYER_TOOL) {
-               BMBaseFace *tf = (BMBaseFace*)f;
-
-               /*allocate flags*/
-               tf->head.flags = BLI_mempool_calloc(bm->toolflagpool);
-       }
-
-       if (bm->sfpool)
-               f->head.layerdata = BLI_mempool_calloc(f->head.layerdata);
+       /*allocate flags*/
+       f->head.flags = BLI_mempool_calloc(bm->toolflagpool);
 
        CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
 
        f->len = 0;
        f->totbounds = 1;
 
-       /*okkaay not sure what to do here
-       for (i=0; i<bm->totlayer; i++) {
-               void *self;
-
-               if (!bm->layers[i].type->new_face) continue;
-
-               self = BMSC_GETSELF(bm, f, &bm->layers[i]);
-               bm->layers[i].type->new_face(bm, f, self);
-       }
-       */
-
        return (BMFace*) f;
 }
 
index 7d9390980ba2d9a0c2ea0cfe68f63e184dac96a1..b39b7338d3d1054f70f4a00eb57090ef1e5d2d96 100644 (file)
@@ -169,9 +169,6 @@ void EDBM_editselection_normal(float *normal, struct BMEditSelection *ese);
 int EDBM_vertColorCheck(struct BMEditMesh *em);
 void EDBM_validate_selections(struct BMEditMesh *em);
 
-void EDBM_pin_mesh(struct BMEditMesh *em, int swap);
-void EDBM_unpin_mesh(struct BMEditMesh *em, int swap);
-
 void EDBM_hide_mesh(struct BMEditMesh *em, int swap);
 void EDBM_reveal_mesh(struct BMEditMesh *em);
 
index e5ae09cd8e18ea52835bf80592d361c99558b66b..2311aafbb17f523c5cdd7bb1bd9c7d0dc9fc63e3 100644 (file)
@@ -235,9 +235,6 @@ enum {
        
        TH_DOPESHEET_CHANNELOB,
        TH_DOPESHEET_CHANNELSUBOB,
-
-       TH_PIN,
-       TH_PIN_OPAC,
        
        TH_PREVIEW_BACK,
        
index 4b458969b91db9bebe7951308c4ae0b4bfda371e..def3340a81fe812b72ad765de0c20e5f5e41dbfe 100644 (file)
@@ -404,12 +404,6 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
                        case TH_DOPESHEET_CHANNELSUBOB:
                                cp= ts->ds_subchannel;
                                break;  
-
-                       case TH_PIN:
-                               cp= ts->pin; break;
-                       case TH_PIN_OPAC:
-                               //cp= &ts->pin_opac; break; /*XXX BMESH_TODO*/
-                                       
                        case TH_PREVIEW_BACK:
                                cp= ts->preview_back;
                                break;  
index 175b63514b42a925e8efae6effdea4b686156f86..de02277e8c33e4147750f9984cbf0e8d3d364319 100644 (file)
@@ -1507,8 +1507,8 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
        int i, tot;
 
        tot = 0;
-               BM_ITER_SELECT(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL)
-               if (BM_TestHFlag(v, BM_SELECT)) {
+       BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
+               if (BM_TestHFlag(v, BM_SELECT) && !BM_TestHFlag(v, BM_HIDDEN)) {
                        BLI_array_growone(verts);
                        verts[tot++] = v;
                }
index b4f95375a0548e9fc203fd6dacec593757ab2327..5324ccb953eb6c2daa788803b734df83f6c1701b 100644 (file)
@@ -1243,12 +1243,17 @@ static int editbmesh_mark_seam(bContext *C, wmOperator *op)
        }
 
        if(clear) {
-               BM_ITER_SELECT(eed, &iter, bm, BM_EDGES_OF_MESH, NULL)
+               BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+                       if (!BM_TestHFlag(eed, BM_SELECT) || BM_TestHFlag(eed, BM_HIDDEN))
+                               continue;
+                       
                        BM_ClearHFlag(eed, BM_SEAM);
                }
        }
        else {
-               BM_ITER_SELECT(eed, &iter, bm, BM_EDGES_OF_MESH, NULL)
+               BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+                       if (!BM_TestHFlag(eed, BM_SELECT) || BM_TestHFlag(eed, BM_HIDDEN))
+                               continue;
                        BM_SetHFlag(eed, BM_SEAM);
                }
        }
@@ -1292,11 +1297,17 @@ static int editbmesh_mark_sharp(bContext *C, wmOperator *op)
        }
 
        if(!clear) {
-               BM_ITER_SELECT(eed, &iter, bm, BM_EDGES_OF_MESH, NULL)
+               BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+                       if (!BM_TestHFlag(eed, BM_SELECT) || BM_TestHFlag(eed, BM_HIDDEN))
+                               continue;
+                       
                        BM_SetHFlag(eed, BM_SHARP);
                }
        } else {
-               BM_ITER_SELECT(eed, &iter, bm, BM_EDGES_OF_MESH, NULL)
+               BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+                       if (!BM_TestHFlag(eed, BM_SELECT) || BM_TestHFlag(eed, BM_HIDDEN))
+                               continue;
+                       
                        BM_ClearHFlag(eed, BM_SHARP);
                }
        }
@@ -1519,8 +1530,8 @@ static int edge_rotate_selected(bContext *C, wmOperator *op)
        }
 
        if (!eed) {
-               BM_ITER_SELECT(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL)
-                       if (BM_TestHFlag(eed, BM_SELECT))
+               BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
+                       if (BM_TestHFlag(eed, BM_SELECT) && !BM_TestHFlag(eed, BM_HIDDEN))
                                break;
                }
        }
@@ -1561,122 +1572,6 @@ void MESH_OT_edge_rotate(wmOperatorType *ot)
        RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "direction", "direction to rotate edge around.");
 }
 
-/* pinning code */
-
-/* swap is 0 or 1, if 1 it pins not selected */
-void EDBM_pin_mesh(BMEditMesh *em, int swap)
-{
-       BMIter iter;
-       BMHeader *h;
-       int itermode;
-
-       if(em==NULL) return;
-       
-       if (em->selectmode & SCE_SELECT_VERTEX)
-               itermode = BM_VERTS_OF_MESH;
-       else if (em->selectmode & SCE_SELECT_EDGE)
-               itermode = BM_EDGES_OF_MESH;
-       else
-               itermode = BM_FACES_OF_MESH;
-
-       BM_ITER(h, &iter, em->bm, itermode, NULL) {
-               if (BM_TestHFlag(h, BM_SELECT) ^ swap)
-                       BM_Pin(em->bm, h, 1);
-       }
-
-       EDBM_selectmode_flush(em);
-}
-
-static int pin_mesh_exec(bContext *C, wmOperator *op)
-{
-       Object *obedit= CTX_data_edit_object(C);
-       BMEditMesh *em= (((Mesh *)obedit->data))->edit_btmesh;
-       Mesh *me= ((Mesh *)obedit->data);
-
-       me->drawflag |= ME_DRAW_PINS;
-       
-       EDBM_pin_mesh(em, RNA_boolean_get(op->ptr, "unselected"));
-               
-       DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-       return OPERATOR_FINISHED;       
-}
-
-void MESH_OT_pin(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Pin Selection";
-       ot->idname= "MESH_OT_pin";
-       
-       /* api callbacks */
-       ot->exec= pin_mesh_exec;
-       ot->poll= ED_operator_editmesh;
-       ot->description= "Pin (un)selected vertices, edges or faces.";
-
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-       
-       /* props */
-       RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Pin unselected rather than selected.");
-}
-
-/* swap is 0 or 1, if 1 it unhides not selected */
-void EDBM_unpin_mesh(BMEditMesh *em, int swap)
-{
-       BMIter iter;
-       BMHeader *ele;
-       int itermode;
-       
-       if(em==NULL) return;
-       
-       if (em->selectmode & SCE_SELECT_VERTEX)
-               itermode = BM_VERTS_OF_MESH;
-       else if (em->selectmode & SCE_SELECT_EDGE)
-               itermode = BM_EDGES_OF_MESH;
-       else
-               itermode = BM_FACES_OF_MESH;
-
-       BM_ITER(ele, &iter, em->bm, itermode, NULL) {
-               if (BM_TestHFlag(ele, BM_SELECT) ^ swap)
-                       BM_Pin(em->bm, ele, 0);
-       }
-
-       EDBM_selectmode_flush(em);
-}
-
-static int unpin_mesh_exec(bContext *C, wmOperator *op)
-{
-       Object *obedit= CTX_data_edit_object(C);
-       BMEditMesh *em= (((Mesh *)obedit->data))->edit_btmesh;
-       
-       EDBM_unpin_mesh(em, RNA_boolean_get(op->ptr, "unselected"));
-
-       DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-       return OPERATOR_FINISHED;       
-}
-
-void MESH_OT_unpin(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Unpin Selection";
-       ot->idname= "MESH_OT_unpin";
-       ot->description= "Unpin (un)selected vertices, edges or faces.";
-       
-       /* api callbacks */
-       ot->exec= unpin_mesh_exec;
-       ot->poll= ED_operator_editmesh;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-       /* props */
-       RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Unpin unselected rather than selected.");
-}
-
-
 /* swap is 0 or 1, if 1 it hides not selected */
 void EDBM_hide_mesh(BMEditMesh *em, int swap)
 {
index e7290601372b90c03aa71aa3a2124e568c65c24b..f4d86ae455ef332ecf8a74025ef60b0eae8348ee 100644 (file)
@@ -213,8 +213,6 @@ void MESH_OT_select_inverse(struct wmOperatorType *ot);
 void MESH_OT_select_non_manifold(struct wmOperatorType *ot);
 void MESH_OT_select_linked(struct wmOperatorType *ot);
 void MESH_OT_select_linked_pick(struct wmOperatorType *ot);
-void MESH_OT_pin(struct wmOperatorType *ot);
-void MESH_OT_unpin(struct wmOperatorType *ot);
 void MESH_OT_hide(struct wmOperatorType *ot);
 void MESH_OT_reveal(struct wmOperatorType *ot);
 void MESH_OT_select_by_number_vertices(struct wmOperatorType *ot);
index f5b34b2c4fa263cbfc73ac96e6d46e49a1f9bf55..856d5f0199860db07621630f5c963fc10da9110b 100644 (file)
@@ -1884,64 +1884,7 @@ static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
        glEnd();
 }
 
-/* check if all verts of the face are pinned */
-static int check_pinned_face(BMesh *bm, BMFace *efa)
-{
-       BMIter vfiter;
-       BMVert *v;
-       int vcount = 0;
-
-       BM_ITER(v, &vfiter, bm, BM_VERTS_OF_FACE, efa) {
-               if(BM_TestHFlag(v, BM_PINNED)) vcount ++;
-       }
-
-       if( vcount == efa->len) return 1;
-       return 0;
-}
-
-static void draw_dm_vert_pins__mapFunc(void *userData, int index, 
-                                       float *co, float *UNUSED(no_f), short *UNUSED(no_s))
-{
-       struct {BMEditMesh *em; Mesh *me;} *data = userData;
-       BMVert *eve = EDBM_get_vert_for_index(data->em, index);
-       BMFace *fv;
-       BMIter fviter;
-       float vsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
-       int small=0;
-
-       if (!BM_TestHFlag(eve, BM_HIDDEN)) {
-               if (BM_TestHFlag(eve, BM_PINNED)) {
-                       BM_ITER(fv, &fviter, data->em->bm, BM_FACES_OF_VERT, eve) {
-                               small += check_pinned_face(data->em->bm, fv);
-                       }
-                       if(small == 0) {
-                               bglEnd();
-                               glPointSize(vsize*1.5);
-                               glBegin(GL_POINTS);
-                               glVertex3fv(co);
-                       }
-                       else {
-                               bglEnd();
-                               glPointSize(vsize*0.5);
-                               glBegin(GL_POINTS);
-                               glVertex3fv(co);
-                       }
-               }
-       }
-}
-
-static void draw_dm_vert_pins(BMEditMesh *em, DerivedMesh *dm, Mesh *me)
-{
-       struct { BMEditMesh *em; Mesh *me;} data;
-
-       data.em = em;
-       data.me = me;
-
-       dm->foreachMappedVert(dm, draw_dm_vert_pins__mapFunc, &data);
-       glEnd();
-}
-
-       /* Draw verts with color set based on selection */
+/* Draw verts with color set based on selection */
 static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
 {
        struct { BMEditMesh *em; int sel; BMVert *eve_act; } *data = userData;
@@ -2075,57 +2018,6 @@ static void draw_dm_edges_seams(BMEditMesh *em, DerivedMesh *dm)
        dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, em);
 }
 
-/* Draw only pinned edges */
-static int draw_dm_edges_pins__setDrawOptions(void *userData, int index)
-{
-       struct {BMEditMesh *em; Mesh *me;} *data = userData;
-
-       BMEdge *eed = EDBM_get_edge_for_index(data->em, index);
-       BMIter feiter;
-       BMFace *fe;
-
-       int fcount = 0, fpcount = 0;
-       int pin = 0;
-
-       /* If pinned faces are drawn then only draw pinned edges at the borders.
-          This looks way better and the user still has all the info he needs. */
-       if(data->me->drawflag & ME_DRAW_PINS) {
-               if( BM_TestHFlag(eed->v1, BM_PINNED) && BM_TestHFlag(eed->v2, BM_PINNED) ) {
-                       pin = 1;
-
-                       fcount = 0;
-                       BM_ITER(fe, &feiter, data->em->bm, BM_FACES_OF_EDGE, eed) {
-                               fcount ++;
-                               fpcount += check_pinned_face(data->em->bm, fe);
-                       }
-               }
-       }
-       else {
-               pin = BM_TestHFlag(eed->v1, BM_PINNED) && BM_TestHFlag(eed->v2, BM_PINNED);
-       }
-
-       if( !BM_TestHFlag(eed, BM_HIDDEN)) {
-               /* Edges with at least one adherent pinned face are considered borders.
-                  If there are more than two adherent faces overall of which at least two are pinned it's also consideres a border. */
-               if( fpcount == 2 && fcount <= 2) {
-                       return 0; }
-               else {
-                       return pin; }
-       }
-       
-       return 0;
-}
-
-static void draw_dm_edges_pins(BMEditMesh *em, DerivedMesh *dm, Mesh *me)
-{
-       struct { BMEditMesh *em; Mesh *me;} data;
-
-       data.em = em;
-       data.me = me;
-
-       dm->drawMappedEdges(dm, draw_dm_edges_pins__setDrawOptions, &data);
-}
-
        /* Draw only sharp edges */
 static int draw_dm_edges_sharp__setDrawOptions(void *userData, int index)
 {
@@ -2146,32 +2038,20 @@ static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNU
        struct { unsigned char *cols[3]; BMEditMesh *em; BMFace *efa_act; Mesh *me;} *data = userData;
        BMFace *efa = EDBM_get_face_for_index(data->em, index);
        unsigned char *col;
-       int pin=0;
-       int opac = UI_GetThemeValue(TH_PIN_OPAC);
        
        if (!efa)
                return 0;
        
        if (!BM_TestHFlag(efa, BM_HIDDEN)) {
-
-               /* Check if all verts of a face are pinned. If so, then display it in a darker shade. */
-               if(data->me->drawflag & ME_DRAW_PINS)
-                       pin = check_pinned_face(data->em->bm, efa);
-
                if (efa == data->efa_act) {
-                       if(pin==0) { glColor4ubv(data->cols[2]); }
-                       else {
-                               col = data->cols[2];
-                               glColor4ub(col[0]-col[0]*0.9, col[1]-col[1]*0.9, col[2]-col[2]*0.9, opac*2.55);
-                       }
-                       
+                       glColor4ubv(data->cols[2]);
+
                        return 2; /* stipple */
                } else {
                        col = data->cols[BM_TestHFlag(efa, BM_SELECT)?1:0];
                        if (col[3]==0) return 0;
 
-                       if(pin==0) { glColor4ubv(col); }
-                       else { glColor4ub(col[0]-col[0]*0.9, col[1]-col[1]*0.9, col[2]-col[2]*0.9, opac*2.55); }
+                       glColor4ubv(col);
 
                        return 1;
                }
@@ -2708,16 +2588,6 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
                        draw_dm_bweights(em, scene, cageDM);
                }
 
-               if(me->drawflag & ME_DRAW_PINS) {
-                       UI_ThemeColor(TH_PIN);
-                       glLineWidth(2);
-       
-                       draw_dm_edges_pins(em, cageDM, me);
-       
-                       glColor3ub(0,0,0);
-                       glLineWidth(1);
-               }
-       
                draw_em_fancy_edges(em, scene, v3d, me, cageDM, 0, eed_act);
        }
        if(em) {
@@ -2733,10 +2603,6 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
                        UI_ThemeColor(TH_VNORMAL);
                        draw_dm_vert_normals(em, scene, cageDM);
                }
-               if(me->drawflag & ME_DRAW_PINS) {
-                       UI_ThemeColor(TH_PIN);
-                       draw_dm_vert_pins(em, cageDM, me);
-               }
 
                if(me->drawflag & (ME_DRAWEXTRA_EDGELEN|ME_DRAWEXTRA_FACEAREA|ME_DRAWEXTRA_FACEANG) && !((v3d->flag2 & V3D_RENDER_OVERRIDE)))
                        draw_em_measure_stats(v3d, rv3d, ob, em, &scene->unit);
index 7939672b23ec7120ae4356216807eebe08cc07e2..4f59602ed03fa2c828b441938e319ba070214f9c 100644 (file)
@@ -2217,9 +2217,6 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
                                
                                VertsToTransData(t, tob, bm, eve, bweight);
 
-                               /* pinned */
-                               if(BM_TestHFlag(eve,BM_PINNED)) tob->flag |= TD_SKIP;
-
                                /* selected */
                                if(selstate[a]) tob->flag |= TD_SELECTED;
 
index f4d64d1a99f46d5db0097caf71cc9104b8b3a358..12237eb3731153150f3135f6d54c81c54671aeba 100644 (file)
@@ -174,8 +174,6 @@ typedef struct TFace {
 #define ME_DRAWEXTRA_FACEAREA (1 << 11)
 #define ME_DRAWEXTRA_FACEANG  (1 << 12)
 
-#define ME_DRAW_PINS (1 << 13)
-
 /* old global flags:
 #define G_DRAWEDGES            (1 << 18)
 #define G_DRAWFACES            (1 <<  7)
index 6acbaf3cc453a475d2da1c6fcb0b24d8f6a48345..688e16e6a93bcf6d7853040be7be6daedf2ed58b 100644 (file)
@@ -213,7 +213,6 @@ typedef struct PartialVisibility {
 #define ME_SPHERETEST          2
 #define ME_VERT_TMP_TAG                4
 #define ME_HIDE                                16
-#define ME_PIN                 64
 #define ME_VERT_MERGED         (1<<6)
 #define ME_VERT_PBVH_UPDATE    (1<<7)
 
index c152509d413cdb51c5e884a4bc59c7a481e9d370..6dc0d38e8a44e8f29fc257686ffe3d3d65612101 100644 (file)
@@ -1897,10 +1897,6 @@ static void rna_def_mesh(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel");
        RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 
-       prop= RNA_def_property(srna, "draw_pins", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_PINS);
-       RNA_def_property_ui_text(prop, "Draw Pins", "Displays pinned mesh elements");
-       RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
        /* editflag */
        prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);