merge with 2.5 at r20783
authorJoseph Eagar <joeedh@gmail.com>
Wed, 10 Jun 2009 19:15:27 +0000 (19:15 +0000)
committerJoseph Eagar <joeedh@gmail.com>
Wed, 10 Jun 2009 19:15:27 +0000 (19:15 +0000)
47 files changed:
1  2 
SConstruct
config/win32-vc-config.py
intern/guardedalloc/intern/mmap_win.c
projectfiles_vc9/blender/blender.sln
projectfiles_vc9/blender/editors/ED_editors.vcproj
source/blender/SConscript
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/BKE_modifier.h
source/blender/blenkernel/BKE_multires.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/exotic.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenlib/BLI_arithb.h
source/blender/blenlib/intern/arithb.c
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/intern/bmesh_opdefines.c
source/blender/editors/armature/reeb.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_edit.c
source/blender/editors/physics/editparticle.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_image/image_header.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/makesrna/intern/makesrna.c
source/blender/python/intern/bpy_rna.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/shadeoutput.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp
tools/Blender.py
tools/btools.py

diff --cc SConstruct
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -513,14 -445,17 +513,17 @@@ DerivedMesh *mesh_create_derived_no_def
  DerivedMesh *mesh_create_derived_no_deform_render(struct Scene *scene, struct Object *ob,
                                                    float (*vertCos)[3],
                                                    CustomDataMask dataMask);
+ /* for gameengine */
+ DerivedMesh *mesh_create_derived_no_virtual(struct Scene *scene, struct Object *ob, float (*vertCos)[3],
+                                             CustomDataMask dataMask);
  
 -DerivedMesh *editmesh_get_derived_base(struct Object *, struct EditMesh *em);
 -DerivedMesh *editmesh_get_derived_cage(struct Scene *scene, struct Object *, 
 -                                                                         struct EditMesh *em, CustomDataMask dataMask);
 -DerivedMesh *editmesh_get_derived_cage_and_final(struct Scene *scene, struct Object *, 
 -                                                                                               struct EditMesh *em, DerivedMesh **final_r,
 +DerivedMesh *editbmesh_get_derived_base(struct Object *, struct BMEditMesh *em);
 +DerivedMesh *editbmesh_get_derived_cage(struct Scene *scene, struct Object *, 
 +                                                                         struct BMEditMesh *em, CustomDataMask dataMask);
 +DerivedMesh *editbmesh_get_derived_cage_and_final(struct Scene *scene, struct Object *, 
 +                                               struct BMEditMesh *em, DerivedMesh **final_r,
                                                   CustomDataMask dataMask);
 -void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em, CustomDataMask dataMask);
 +void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct BMEditMesh *em, CustomDataMask dataMask);
  
  /* returns an array of deform matrices for crazyspace correction, and the
     number of modifiers left */
@@@ -1067,316 -1033,6 +1067,316 @@@ DerivedMesh *CDDM_from_editmesh(EditMes
        return dm;
  }
  
-       for (i=0; eve; eve=BMIter_Step(&iter), i++) {
 +
 +static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata,
 +                                    int cdindex, BMLoop *l3[3],
 +                                    int numCol, int numTex)
 +{
 +      int i, j;
 +      BMLoop *l;
 +      BMFace *f = l3[0]->f;
 +      MTFace *texface;
 +      MTexPoly *texpoly;
 +      MCol *mcol;
 +      MLoopCol *mloopcol;
 +      MLoopUV *mloopuv;
 +
 +      for(i=0; i < numTex; i++){
 +              texface = CustomData_get_n(facedata, CD_MTFACE, cdindex, i);
 +              texpoly = CustomData_bmesh_get_n(&bm->pdata, f->data, CD_MTEXPOLY, i);
 +              
 +              texface->tpage = texpoly->tpage;
 +              texface->flag = texpoly->flag;
 +              texface->transp = texpoly->transp;
 +              texface->mode = texpoly->mode;
 +              texface->tile = texpoly->tile;
 +              texface->unwrap = texpoly->unwrap;
 +      
 +              for (j=0; j<3; i++) {
 +                      l = l3[j];
 +                      mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPUV, i);
 +                      texface->uv[j][0] = mloopuv->uv[0];
 +                      texface->uv[j][1] = mloopuv->uv[1];
 +              }
 +      }
 +
 +      for(i=0; i < numCol; i++){
 +              mcol = CustomData_get_n(facedata, CD_MCOL, cdindex, i);
 +              
 +              for (j=0; j<3; j++) {
 +                      l = l3[j];
 +                      mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPCOL, i);
 +                      mcol[j].r = mloopcol->r;
 +                      mcol[j].g = mloopcol->g;
 +                      mcol[j].b = mloopcol->b;
 +                      mcol[j].a = mloopcol->a;
 +              }
 +      }
 +}
 +
 +DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *me)
 +{
 +      DerivedMesh *dm = CDDM_new(em->bm->totvert, em->bm->totedge, 
 +                             em->tottri, em->bm->totloop, em->bm->totface);
 +      CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
 +      BMesh *bm = em->bm;
 +      BMIter iter, liter;
 +      BMVert *eve;
 +      BMEdge *eed;
 +      BMFace *efa;
 +      MVert *mvert = cddm->mvert;
 +      MEdge *medge = cddm->medge;
 +      MFace *mface = cddm->mface;
 +      MLoop *mloop = cddm->mloop;
 +      MPoly *mpoly = cddm->mpoly;
 +      int numCol = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL);
 +      int numTex = CustomData_number_of_layers(&em->bm->pdata, CD_MTEXPOLY);
 +      int i, j, *index;
 +
 +      dm->deformedOnly = 1;
 +
 +      CustomData_merge(&em->bm->vdata, &dm->vertData, CD_MASK_DERIVEDMESH,
 +                       CD_CALLOC, dm->numVertData);
 +      /* CustomData_merge(&em->edata, &dm->edgeData, CD_MASK_DERIVEDMESH,
 +                       CD_CALLOC, dm->numEdgeData); */
 +      CustomData_merge(&em->bm->pdata, &dm->faceData, CD_MASK_DERIVEDMESH,
 +                       CD_CALLOC, dm->numFaceData);
 +      CustomData_merge(&em->bm->ldata, &dm->loopData, CD_MASK_DERIVEDMESH,
 +                       CD_CALLOC, dm->numLoopData);
 +      CustomData_merge(&em->bm->pdata, &dm->polyData, CD_MASK_DERIVEDMESH,
 +                       CD_CALLOC, dm->numPolyData);
 +      
 +      /*add tesselation mface and mcol layers as necassary*/
 +      for (i=0; i<numTex; i++) {
 +              CustomData_add_layer(&dm->faceData, CD_MTFACE, CD_CALLOC, NULL, em->tottri);
 +      }
 +
 +      for (i=0; i<numCol; i++) {
 +              CustomData_add_layer(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, em->tottri);
 +      }
 +
 +      /* set vert index */
 +      eve = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL);
 +      for (i=0; eve; eve=BMIter_Step(&iter), i++)
 +              BMINDEX_SET(eve, i);
 +
 +      index = dm->getVertDataArray(dm, CD_ORIGINDEX);
 +
 +      eve = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL);
-       for (i=0; eed; eed=BMIter_Step(&iter), i++) {
++      for (i=0; eve; eve=BMIter_Step(&iter), i++, index++) {
 +              MVert *mv = &mvert[i];
 +
 +              VECCOPY(mv->co, eve->co);
 +
 +              mv->no[0] = eve->no[0] * 32767.0;
 +              mv->no[1] = eve->no[1] * 32767.0;
 +              mv->no[2] = eve->no[2] * 32767.0;
 +              mv->bweight = (unsigned char) (eve->bweight * 255.0f);
 +
 +              mv->mat_nr = 0;
 +              mv->flag = BMFlags_To_MEFlags(eve);
 +
 +              *index = i;
 +
 +              CustomData_from_bmesh_block(&bm->vdata, &dm->vertData, eve->data, i);
 +      }
 +
 +      index = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
 +      eed = BMIter_New(&iter, bm, BM_EDGES_OF_MESH, NULL);
-       for (i=0; efa; i++, efa=BMIter_Step(&iter)) {
++      for (i=0; eed; eed=BMIter_Step(&iter), i++, index++) {
 +              MEdge *med = &medge[i];
 +
 +              med->v1 = BMINDEX_GET(eed->v1);
 +              med->v2 = BMINDEX_GET(eed->v2);
 +              med->crease = (unsigned char) (eed->crease * 255.0f);
 +              med->bweight = (unsigned char) (eed->bweight * 255.0f);
 +              med->flag = ME_EDGEDRAW|ME_EDGERENDER;
 +              
 +              med->flag = BMFlags_To_MEFlags(eed);
 +
 +              *index = i;
 +
 +              /* CustomData_from_em_block(&em->edata, &dm->edgeData, eed->data, i); */
 +      }
 +
 +      efa = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL);
 +      for (i=0; efa; i++, efa=BMIter_Step(&iter)) {
 +              BMINDEX_SET(efa, i);
 +      }
 +
 +      index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 +      for(i = 0; i < dm->numFaceData; i++, index++) {
 +              MFace *mf = &mface[i];
 +              BMLoop **l = em->looptris[i];
 +              efa = l[0]->f;
 +
 +              mf->v1 = BMINDEX_GET(l[0]->v);
 +              mf->v2 = BMINDEX_GET(l[1]->v);
 +              mf->v3 = BMINDEX_GET(l[2]->v);
 +              mf->v4 = 0;
 +              mf->mat_nr = efa->mat_nr;
 +              mf->flag = BMFlags_To_MEFlags(efa);
 +
 +              *index = BMINDEX_GET(efa);
 +
 +              loops_to_customdata_corners(bm, &dm->faceData, i, l, numCol, numTex);
 +
 +              test_index_face(mf, &dm->faceData, i, 3);
 +      }
 +      
 +      index = CustomData_get(&dm->polyData, 0, CD_ORIGINDEX);
 +      j = 0;
 +      efa = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL);
-               *(index++) = i;
++      for (i=0; efa; i++, efa=BMIter_Step(&iter), index++) {
 +              BMLoop *l;
 +              MPoly *mp = &mpoly[i];
 +
 +              mp->totloop = efa->len;
 +              mp->flag = BMFlags_To_MEFlags(efa);
 +              mp->loopstart = j;
 +              mp->mat_nr = efa->mat_nr;
 +              
 +              BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, efa) {
 +                      mloop->v = BMINDEX_GET(l->v);
 +                      mloop->e = BMINDEX_GET(l->e);
 +                      CustomData_from_bmesh_block(&bm->ldata, &dm->loopData, l->data, j);
 +
 +                      j++;
 +                      mloop++;
 +              }
 +
++              *index = i;
 +      }
 +
 +      return dm;
 +}
 +
 +typedef struct CDDM_LoopIter {
 +      DMLoopIter head;
 +      CDDerivedMesh *cddm;
 +      int len, i;
 +} CDDM_LoopIter;
 +
 +typedef struct CDDM_FaceIter {
 +      DMFaceIter head;
 +      CDDerivedMesh *cddm;
 +      CDDM_LoopIter liter;
 +} CDDM_FaceIter;
 +
 +void cddm_freeiter(void *self)
 +{
 +      MEM_freeN(self);
 +}
 +
 +void cddm_stepiter(void *self)
 +{
 +      CDDM_FaceIter *iter = self;
 +      MPoly *mp;
 +      
 +      iter->head.index++;
 +      if (iter->head.index >= iter->cddm->dm.numPolyData) {
 +              iter->head.done = 1;
 +              return;
 +      }
 +
 +      mp = iter->cddm->mpoly + iter->head.index;
 +
 +      iter->head.flags = mp->flag;
 +      iter->head.mat_nr = mp->mat_nr;
 +      iter->head.len = mp->totloop;
 +}
 +
 +void *cddm_faceiter_getcddata(void *self, int type, int layer)
 +{
 +      CDDM_FaceIter *iter = self;
 +
 +      if (layer == -1) return CustomData_get(&iter->cddm->dm.polyData, 
 +                                             iter->head.index, type);
 +      else return CustomData_get_n(&iter->cddm->dm.polyData, type, 
 +                                  iter->head.index, layer);
 +}
 +
 +void *cddm_loopiter_getcddata(void *self, int type, int layer)
 +{
 +      CDDM_FaceIter *iter = self;
 +
 +      if (layer == -1) return CustomData_get(&iter->cddm->dm.loopData, 
 +                                             iter->head.index, type);
 +      else return CustomData_get_n(&iter->cddm->dm.loopData, type, 
 +                                   iter->head.index, layer);
 +}
 +
 +void *cddm_loopiter_getvertcddata(void *self, int type, int layer)
 +{
 +      CDDM_FaceIter *iter = self;
 +
 +      if (layer == -1) return CustomData_get(&iter->cddm->dm.vertData, 
 +                                             iter->cddm->mloop[iter->head.index].v,
 +                                             type);
 +      else return CustomData_get_n(&iter->cddm->dm.vertData, type, 
 +                                   iter->cddm->mloop[iter->head.index].v, layer);
 +}
 +
 +DMLoopIter *cddmiter_get_loopiter(void *self)
 +{
 +      CDDM_FaceIter *iter = self;
 +      CDDM_LoopIter *liter = &iter->liter;
 +      MPoly *mp = iter->cddm->mpoly + iter->head.index;
 +
 +      liter->i = -1;
 +      liter->len = iter->head.len;
 +      liter->head.index = mp->loopstart-1;
 +      liter->head.done = 0;
 +
 +      liter->head.step(liter);
 +
 +      return (DMLoopIter*) liter;
 +}
 +
 +void cddm_loopiter_step(void *self)
 +{
 +      CDDM_LoopIter *liter = self;
 +      MLoop *ml;
 +
 +      liter->i++;
 +      liter->head.index++;
 +
 +      if (liter->i == liter->len) {
 +              liter->head.done = 1;
 +              return;
 +      }
 +
 +      ml = liter->cddm->mloop + liter->head.index;
 +
 +      liter->head.eindex = ml->e;
 +      liter->head.v = liter->cddm->mvert[ml->v];
 +      liter->head.vindex = ml->v;
 +
 +      return;
 +}
 +
 +DMFaceIter *cdDM_newFaceIter(DerivedMesh *source)
 +{
 +      CDDerivedMesh *cddm = (CDDerivedMesh*) source;
 +      CDDM_FaceIter *iter = MEM_callocN(sizeof(CDDM_FaceIter), "DMFaceIter from cddm");
 +
 +      iter->head.free = cddm_freeiter;
 +      iter->head.step = cddm_stepiter;
 +      iter->head.getCDData = cddm_faceiter_getcddata;
 +      iter->head.getLoopsIter = cddmiter_get_loopiter;
 +
 +      iter->liter.head.step = cddm_loopiter_step;
 +      iter->liter.head.getLoopCDData = cddm_loopiter_getcddata;
 +      iter->liter.head.getVertCDData = cddm_loopiter_getvertcddata;
 +      iter->liter.cddm = cddm;
 +
 +      iter->cddm = cddm;
 +      iter->head.index = -1;
 +      iter->head.step(iter);
 +
 +      return (DMFaceIter*) iter;
 +}
 +
  DerivedMesh *CDDM_copy(DerivedMesh *source)
  {
        CDDerivedMesh *cddm = cdDM_create("CDDM_copy cddm");
@@@ -1893,8 -1468,7 +1893,8 @@@ int *MultiresDM_get_face_offsets(Derive
        return mrdm->face_offsets;
  }
  
int *MultiresDM_get_flags(DerivedMesh *dm)
void MultiresDM_mark_as_modified(DerivedMesh *dm)
  {
-       return &((MultiresDM*)dm)->flags;
+       ((MultiresDM*)dm)->modified = 1;
  }
 +
@@@ -202,9 -201,9 +202,9 @@@ static void curveModifier_deformVertsEM
  {
        DerivedMesh *dm = derivedData;
  
 -      if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
 +      if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data);
  
-       curveModifier_deformVerts(md, ob, dm, vertexCos, numVerts);
+       curveModifier_deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
  
        if(!derivedData) dm->release(dm);
  }
@@@ -294,9 -293,9 +294,9 @@@ static void latticeModifier_deformVerts
  {
        DerivedMesh *dm = derivedData;
  
 -      if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
 +      if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data);
  
-       latticeModifier_deformVerts(md, ob, dm, vertexCos, numVerts);
+       latticeModifier_deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
  
        if(!derivedData) dm->release(dm);
  }
@@@ -5707,9 -5699,9 +5710,9 @@@ static void hookModifier_deformVertsEM
  {
        DerivedMesh *dm = derivedData;
  
 -      if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
 +      if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data);
  
-       hookModifier_deformVerts(md, ob, derivedData, vertexCos, numVerts);
+       hookModifier_deformVerts(md, ob, derivedData, vertexCos, numVerts, 0, 0);
  
        if(!derivedData) dm->release(dm);
  }
@@@ -6352,11 -6356,10 +6367,10 @@@ static void particleSystemModifier_defo
        /* report change in mesh structure */
        if(psmd->dm->getNumVerts(psmd->dm)!=psmd->totdmvert ||
                  psmd->dm->getNumEdges(psmd->dm)!=psmd->totdmedge ||
 -                psmd->dm->getNumFaces(psmd->dm)!=psmd->totdmface){
 +                psmd->dm->getNumTessFaces(psmd->dm)!=psmd->totdmface){
                /* in file read dm hasn't really changed but just wasn't saved in file */
  
-               psys->recalc |= PSYS_RECALC_HAIR;
-               psys->recalc |= PSYS_DISTR;
+               psys->recalc |= PSYS_RECALC_RESET;
                psmd->flag |= eParticleSystemFlag_DM_changed;
  
                psmd->totdmvert= psmd->dm->getNumVerts(psmd->dm);
@@@ -572,6 -566,6 +572,8 @@@ static DerivedMesh *ss_to_cdderivedmesh
                ++origIndex;
                i++;
  
++
++#if 0 //BMESH_TODO
                for(S = 0; S < numVerts; S++) {
                        int prevS = (S - 1 + numVerts) % numVerts;
                        int nextS = (S + 1) % numVerts;
                                }
                        }
                }
--
++#endif
                *((int*)ccgSubSurf_getFaceUserData(ss, f)) = faceBase;
                faceBase += 1 + numVerts * ((gridSize-2) + (gridSize-2) * (gridSize-2));
        }
  
        // load faces
        i = 0;
 -      mf = CDDM_get_faces(result);
 -      origIndex = result->getFaceData(result, 0, CD_ORIGINDEX);
 +      mf = CDDM_get_tessfaces(result);
 +      origIndex = result->getTessFaceData(result, 0, CD_ORIGINDEX);
  
- #if 0 //BMESH_TODO
        for(index = 0; index < totface; index++) {
                CCGFace *f = faceMap2[index];
                int numVerts = ccgSubSurf_getFaceNumVerts(f);
                                                              edgeSize, gridSize);
                                        mf->mat_nr = mat_nr;
                                        mf->flag = flag;
--
++#if 0 //BMESH_TODO
                                        if(dm) {
                                                int prevS = (S - 1 + numVerts) % numVerts;
                                                int nextS = (S + 1) % numVerts;
                                                                    &w, 1, i);
                                                weight++;
                                        }
++#endif
  
                                        *origIndex = mapIndex;
                                        ++mf;
@@@ -2568,6 -2417,6 +2569,8 @@@ static CCGDerivedMesh *getCCGDerivedMes
                ++vertOrigIndex;
                ++vertNum;
  
++
++#if 0 //BMESH_TODO
                for(S = 0; S < numVerts; S++) {
                        int prevS = (S - 1 + numVerts) % numVerts;
                        int nextS = (S + 1) % numVerts;
                                }
                        }
                }
--
++#endif
                for(i = 0; i < numFinalEdges; ++i)
                        *(int *)DM_get_edge_data(&ccgdm->dm, edgeNum + i,
                                                 CD_ORIGINDEX) = ORIGINDEX_NONE;
Simple merge
index 54033ae,0000000..5c2e991
mode 100644,000000..100644
--- /dev/null
@@@ -1,218 -1,0 +1,218 @@@
-       {{BMOP_OPSLOT_PNT, "me"},
 +#include "bmesh.h"
 +#include "bmesh_private.h"
 +
 +#include <stdio.h>
 +
 +/*applies a transform to vertices*/
 +
 +BMOpDefine def_translate= {
 +      "translate",
 +      {{BMOP_OPSLOT_VEC, "vec"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "verts"},
 +      {0, /*null-terminating sentinel*/}},
 +      bmesh_translate_exec,
 +      0,
 +};
 +
 +
 +BMOpDefine def_transform = {
 +      "transform",
 +      {{BMOP_OPSLOT_MAT, "mat"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "verts"},
 +      {0, /*null-terminating sentinel*/}},
 +      bmesh_transform_exec,
 +      0,
 +};
 +
 +/*loads a bmesh into an object*/
 +BMOpDefine def_object_load_bmesh = {
 +      "object_load_bmesh",
 +      {{BMOP_OPSLOT_PNT, "scene"},
 +      {BMOP_OPSLOT_PNT, "object"},
 +      {0, /*null-terminating sentinel*/}},
 +      bmesh_to_mesh_exec,
 +      0,
 +};
 +
 +
 +BMOpDefine def_mesh_to_bmesh = {
 +      "mesh_to_bmesh",
++      {{BMOP_OPSLOT_PNT, "mesh"},
 +      {0, /*null-terminating sentinel*/}},
 +      mesh_to_bmesh_exec,
 +      0
 +};
 +
 +BMOpDefine def_extrudeverts_indiv = {
 +      "extrude_vert_indiv",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "verts"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "vertout"},
 +      {0} /*null-terminating sentinel*/},
 +      extrude_vert_indiv_exec,
 +      0
 +};
 +
 +#if 0
 +BMOpDefine def_makeprim = {
 +      "makeprim",
 +      {{BMOP_OPSLOT_INT, "type"},
 +      {BMOP_OPSLOT_INT, "tot", /*rows/cols also applies to spheres*/
 +      {BMOP_OPSLOT_INT, "seg",
 +      {BMOP_OPSLOT_INT, "subdiv"},
 +      {BMOP_OPSLOT_INT, "ext"},
 +      {BMOP_OPSLOT_INT, "fill"},
 +      {BMOP_OPSLOT_FLT, "dia"},
 +      {BMOP_OPSLOT_FLT, "depth"},
 +      {BMOP_OPSLOT_PNT, "mat"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "geomout"}, //won't be implemented right away
 +      {0}}
 +      makeprim_exec,
 +      0
 +};
 +#endif
 +
 +BMOpDefine def_connectverts = {
 +      "connectverts",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "verts"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"},
 +      {0} /*null-terminating sentinel*/},
 +      connectverts_exec,
 +      0
 +};
 +
 +BMOpDefine def_extrudefaceregion = {
 +      "extrudefaceregion",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "edgefacein"},
 +      {BMOP_OPSLOT_MAPPING, "exclude"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
 +      {0} /*null-terminating sentinel*/},
 +      extrude_edge_context_exec,
 +      0
 +};
 +
 +BMOpDefine def_makefgonsop = {
 +      "makefgon",
 +      {{BMOP_OPSLOT_INT, "trifan"}, /*use triangle fans instead of 
 +                                      real interpolation*/
 +       {0} /*null-terminating sentinel*/},
 +      bmesh_make_fgons_exec,
 +      0
 +};
 +
 +BMOpDefine def_dissolvevertsop = {
 +      "dissolveverts",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "verts"},
 +      {0} /*null-terminating sentinel*/},
 +      dissolveverts_exec,
 +      0
 +};
 +
 +BMOpDefine def_dissolvefacesop = {
 +      "dissolvefaces",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "faces"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "regionout"},
 +      {0} /*null-terminating sentinel*/},
 +      dissolvefaces_exec,
 +      0
 +};
 +
 +
 +BMOpDefine def_triangop = {
 +      "triangulate",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "faces"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "faceout"},
 +      {BMOP_OPSLOT_MAPPING, "facemap"},
 +      {0} /*null-terminating sentinel*/},
 +      triangulate_exec,
 +      0
 +};
 +
 +BMOpDefine def_subdop = {
 +      "esubd",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "edges"},
 +      {BMOP_OPSLOT_INT, "numcuts"},
 +      {BMOP_OPSLOT_INT, "flag"},
 +      {BMOP_OPSLOT_FLT, "radius"},
 +      {BMOP_OPSLOT_MAPPING, "custompatterns"},
 +      {BMOP_OPSLOT_MAPPING, "edgepercents"},
 +      
 +      /*these next two can have multiple types of elements in them.*/
 +      {BMOP_OPSLOT_ELEMENT_BUF, "outinner"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "outsplit"},
 +      {0} /*null-terminating sentinel*/,
 +      },
 +      esubdivide_exec,
 +      0
 +};
 +
 +BMOpDefine def_edit2bmesh = {
 +      "editmesh_to_bmesh",
 +      {{BMOP_OPSLOT_PNT, "em"}, {BMOP_OPSLOT_MAPPING, "map"},
 +      {0} /*null-terminating sentinel*/},
 +      edit2bmesh_exec,
 +      0
 +};
 +
 +BMOpDefine def_bmesh2edit = {
 +      "bmesh_to_editmesh",
 +      {{BMOP_OPSLOT_PNT, "emout"},
 +      {0} /*null-terminating sentinel*/},
 +      bmesh2edit_exec,
 +      0
 +};
 +
 +BMOpDefine def_delop = {
 +      "del",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "geom"}, {BMOP_OPSLOT_INT, "context"},
 +      {0} /*null-terminating sentinel*/},
 +      delop_exec,
 +      0
 +};
 +
 +BMOpDefine def_dupeop = {
 +      "dupe",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "origout"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "newout"},
 +      {BMOP_OPSLOT_MAPPING, "boundarymap"},
 +      {BMOP_OPSLOT_MAPPING, "isovertmap"},
 +      {0} /*null-terminating sentinel*/},
 +      dupeop_exec,
 +      0
 +};
 +
 +BMOpDefine def_splitop = {
 +      "split",
 +      {{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
 +      {BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
 +      {BMOP_OPSLOT_MAPPING, "boundarymap"},
 +      {BMOP_OPSLOT_MAPPING, "isovertmap"},
 +      {0} /*null-terminating sentinel*/},
 +      splitop_exec,
 +      0
 +};
 +
 +BMOpDefine *opdefines[] = {
 +      &def_splitop,
 +      &def_dupeop,
 +      &def_delop,
 +      &def_edit2bmesh,
 +      &def_bmesh2edit,
 +      &def_subdop,
 +      &def_triangop,
 +      &def_dissolvefacesop,
 +      &def_dissolvevertsop,
 +      &def_makefgonsop,
 +      &def_extrudefaceregion,
 +      &def_connectverts,
 +      //&def_makeprim,
 +      &def_extrudeverts_indiv,
 +      &def_mesh_to_bmesh,
 +      &def_object_load_bmesh,
 +      &def_transform,
 +      &def_translate,
 +};
 +
 +int bmesh_total_ops = (sizeof(opdefines) / sizeof(void*));
@@@ -857,19 -843,18 +857,18 @@@ void MESH_OT_extrude_repeat(wmOperatorT
        RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, 100.0f, "Offset", "", 0.0f, FLT_MAX);
        RNA_def_int(ot->srna, "steps", 10, 0, 180, "Steps", "", 0, INT_MAX);
  }
 -
 +#endif
  /* ************************** spin operator ******************** */
-       
- static int spin_mesh(bContext *C, float *dvec, int steps, float degr, int dupli )
+ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float degr, int dupli )
  {
        Object *obedit= CTX_data_edit_object(C);
-       View3D *v3d = CTX_wm_view3d(C);
        Scene *scene = CTX_data_scene(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-       RegionView3D *rv3d= CTX_wm_region_view3d(C);
        EditVert *eve,*nextve;
        float nor[3]= {0.0f, 0.0f, 0.0f};
-       float *curs, si, n[3], q[4], cmat[3][3], imat[3][3], tmat[3][3];
+       float si, n[3], q[4], cmat[3][3], imat[3][3], tmat[3][3];
        float cent[3], bmat[3][3];
        float phi;
        short a, ok= 1;
@@@ -1128,39 -1138,25 +1154,38 @@@ static int delete_mesh(Object *obedit, 
        EditVert *eve,*nextve;
        EditEdge *eed,*nexted;
        int count;
--      char *str="Erase";
 -
        
 -      if(event<1) return;
 +      if(event<1) return OPERATOR_CANCELLED;
 +
 +      if (event != 7 && event !=  5) 
 +              em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
  
        if(event==10 ) {
--              str= "Erase Vertices";
++              //"Erase Vertices";
                erase_edges(em, &em->edges);
                erase_faces(em, &em->faces);
                erase_vertices(em, &em->verts);
 +
 +              EM_fgon_flags(em);      // redo flags and indices for fgons
 +              BKE_mesh_end_editmesh(obedit->data, em);
        } 
 +      else if(event==7) {
++              //"Dissolve Verts"
 +              if (!EDBM_CallOpf(bem, op, "dissolveverts verts=%hv",BM_SELECT))
 +                      return OPERATOR_CANCELLED;
 +      }
        else if(event==6) {
 -              if(!EdgeLoopDelete(em, op))
 -                      return;
++              //"Erase Edge Loop";
 +              if(!EdgeLoopDelete(em, op)) {
 +                      BKE_mesh_end_editmesh(obedit->data, em);
 +                      return OPERATOR_CANCELLED;
 +              }
  
--              str= "Erase Edge Loop";
 +              EM_fgon_flags(em);      // redo flags and indices for fgons
 +              BKE_mesh_end_editmesh(obedit->data, em);
        }
        else if(event==4) {
--              str= "Erase Edges & Faces";
++              //"Erase Edges & Faces";
                efa= em->faces.first;
                while(efa) {
                        nextvl= efa->next;
                                free_editface(em, efa);
                        }
                        efa= nextvl;
 +
                }
 +              EM_fgon_flags(em);      // redo flags and indices for fgons
 +              BKE_mesh_end_editmesh(obedit->data, em);
        } 
        else if(event==1) {
--              str= "Erase Edges";
++              //"Erase Edges";
                // faces first
                efa= em->faces.first;
                while(efa) {
                        eve= nextve;
                }
  
 +              EM_fgon_flags(em);      // redo flags and indices for fgons
 +              BKE_mesh_end_editmesh(obedit->data, em);
        }
        else if(event==2) {
--              str="Erase Faces";
++              //"Erase Faces";
                delfaceflag(em, SELECT);
 +
 +              EM_fgon_flags(em);      // redo flags and indices for fgons
 +              BKE_mesh_end_editmesh(obedit->data, em);
        }
        else if(event==3) {
--              str= "Erase All";
++              //"Erase All";
                if(em->verts.first) free_vertlist(em, &em->verts);
                if(em->edges.first) free_edgelist(em, &em->edges);
                if(em->faces.first) free_facelist(em, &em->faces);
                if(em->selected.first) BLI_freelistN(&(em->selected));
 +
 +              EM_fgon_flags(em);      // redo flags and indices for fgons
 +              BKE_mesh_end_editmesh(obedit->data, em);
        }
        else if(event==5) {
 -              str= "Erase Only Faces";
 -              efa= em->faces.first;
 -              while(efa) {
 -                      nextvl= efa->next;
 -                      if(efa->f & SELECT) {
 -                              BLI_remlink(&em->faces, efa);
 -                              free_editface(em, efa);
 -                      }
 -                      efa= nextvl;
 -              }
++              //"Erase Only Faces";
 +              if (!EDBM_CallOpf(bem, op, "del geom=%hf context=%d",
 +                                BM_SELECT, DEL_ONLYFACES))
 +                      return OPERATOR_CANCELLED;
-               str= "Erase Only Faces";
        }
 +      
 +      DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
  
 -      EM_fgon_flags(em);      // redo flags and indices for fgons
 -
 -//    DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
 +      return OPERATOR_FINISHED;
  }
  
  /* Note, these values must match delete_mesh() event values */
@@@ -5496,7 -5503,9 +5503,7 @@@ void view3d_header_buttons(const bConte
                                xco+= XIC;
                        }
                        uiBlockEndAlign(block);
-                       xco+= 20;
+                       header_xco_step(ar, &xco, &yco, &maxco, XIC);
 -
 -                      BKE_mesh_end_editmesh(obedit->data, em);
                }
                else if(G.f & G_PARTICLEEDIT) {
                        uiBlockBeginAlign(block);
@@@ -1769,10 -1757,10 +1757,10 @@@ static int render_new_particle_system(R
                                num = parent->num_dmcache;
  
                                if(num == DMCACHE_NOTFOUND)
 -                                      if(parent->num < psmd->dm->getNumFaces(psmd->dm))
 +                                      if(parent->num < psmd->dm->getNumTessFaces(psmd->dm))
                                                num = parent->num;
  
-                               get_particle_uvco_mcol(part->from, psmd->dm, pa->fuv, num, &sd);
+                               get_particle_uvco_mcol(part->from, psmd->dm, parent->fuv, num, &sd);
                        }
  
                        dosimplify = psys_render_simplify_params(psys, cpa, simplify);
Simple merge
diff --cc tools/btools.py
Simple merge