svn merge ^/trunk/blender -r42617:42655
authorCampbell Barton <ideasman42@gmail.com>
Thu, 15 Dec 2011 23:59:02 +0000 (23:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 15 Dec 2011 23:59:02 +0000 (23:59 +0000)
19 files changed:
1  2 
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/deform.c
source/blender/blenlib/BLI_math_geom.h
source/blender/blenlib/intern/math_geom.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/curve/editcurve.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/modifiers/intern/MOD_cast.c
source/blender/modifiers/intern/MOD_hook.c
source/blender/modifiers/intern/MOD_meshdeform.c
source/blender/modifiers/intern/MOD_smooth.c
source/blender/render/intern/source/render_texture.c
source/blender/windowmanager/intern/wm_init_exit.c

index 8405a3922e6b285113db76321a7f265516ab67dc,06f29b95825b550c51dc47c81cf14890ea239ac2..768e18b98719cda746ba5ad6643122ea04bf22f2
@@@ -2389,16 -1996,18 +2389,11 @@@ void DM_vertex_attributes_from_gpu(Deri
        memset(attribs, 0, sizeof(DMVertexAttribs));
  
        vdata = &dm->vertData;
 -      fdata = &dm->faceData;
 -
 -      /* ugly hack, editmesh derivedmesh doesn't copy face data, this way we
 -       * can use offsets instead */
 -      if(dm->type == DM_TYPE_EDITMESH)
 -              tfdata = &((EditMeshDerivedMesh*)dm)->em->fdata;
 -      else
 -              tfdata = fdata;
 -
 +      fdata = tfdata = dm->getTessFaceDataLayout(dm);
 +      
        /* calc auto bump scale if necessary */
- #if 0
        if(dm->auto_bump_scale<=0.0f)
                DM_calc_auto_bump_scale(dm);
- #else
-       dm->auto_bump_scale = 1.0f; // will revert this after release
- #endif
  
        /* add a tangent layer if necessary */
        for(b = 0; b < gattribs->totlayer; b++)
index 8967dcdbd0ef7b56f758ec468d38776373adb842,f7f10276ee49b8eab9072a9998a590b9b8375cd0..5e10fbb70c065c601ded28a3022e77fe3bea6df4
@@@ -628,11 -643,18 +646,18 @@@ void defvert_remove_group(MDeformVert *
                 * this deform weight, and reshuffle the others.
                 */
                if (dvert->totweight) {
 -                      dw_new = MEM_mallocN(sizeof(MDeformWeight)*(dvert->totweight), __func__);
 +                      dw_new = BLI_cellalloc_malloc(sizeof(MDeformWeight)*(dvert->totweight), __func__);
-                       if (dvert->dw){
+                       if (dvert->dw) {
+ #if 1                 /* since we dont care about order, swap this with the last, save a memcpy */
+                               if (i != dvert->totweight) {
+                                       dvert->dw[i]= dvert->dw[dvert->totweight];
+                               }
+                               memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
 -                              MEM_freeN(dvert->dw);
+ #else
                                memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*i);
                                memcpy(dw_new+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
+ #endif
 +                              BLI_cellalloc_free(dvert->dw);
                        }
                        dvert->dw = dw_new;
                }
index dda33689180b1c35bca105caa3dcd2a8bb06c7c3,50fe9d26cf9c1202a60ca7bece06ee35d4705c2f..5930e66e9fe3181322430b1ca1d79586d16acc2c
@@@ -204,9 -201,17 +204,18 @@@ static int ED_vgroup_give_parray(ID *id
                                        *dvert_tot = i;
  
                                        i = 0;
-                                       BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                                               (*dvert_arr)[i] = CustomData_em_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
-                                               i++;
 -
+                                       if (use_vert_sel) {
 -                                              for (eve=em->verts.first; eve; eve=eve->next, i++) {
 -                                                      (*dvert_arr)[i] = (eve->f & SELECT) ?
 -                                                                                         CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT) : NULL;
++                                              BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
++                                                      (*dvert_arr)[i] = BM_TestHFlag(eve, BM_SELECT) ?
++                                                                        CustomData_em_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT) : NULL;
++                                                      i++;
+                                               }
+                                       }
+                                       else {
 -                                              for (eve=em->verts.first; eve; eve=eve->next, i++) {
 -                                                      (*dvert_arr)[i] = CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
++                                              BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
++                                                      (*dvert_arr)[i] = CustomData_em_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
++                                                      i++;
+                                               }
                                        }
  
                                        return 1;
@@@ -537,19 -484,34 +488,34 @@@ void ED_vgroup_vert_remove(Object *ob, 
        /* This routine removes the vertex from the specified
         * deform group.
         */
-       const int def_nr= defgroup_find_index(ob, dg);
-       if(def_nr < 0)
-               return;
  
-       ED_vgroup_nr_vert_remove(ob, def_nr, vertnum);
+       /* TODO, this is slow in a loop, better pass def_nr directly, but leave for later... - campbell */
+       const int def_nr= BLI_findindex(&ob->defbase, dg);
+       if(def_nr != -1) {
+               MDeformVert *dvert= NULL;
+               int tot;
+               /* get the deform vertices corresponding to the
+                * vertnum
+                */
+               ED_vgroup_give_array(ob->data, &dvert, &tot);
+               if(dvert) {
+                       MDeformVert *dv= &dvert[vertnum];
+                       MDeformWeight *dw;
+                       dw= defvert_find_index(dv, def_nr);
+                       defvert_remove_group(dv, dw); /* dw can be NULL */
+               }
+       }
  }
  
- static float get_vert_def_nr(Object *ob, int def_nr, int vertnum)
+ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
  {
-       MDeformVert *dvert= NULL;
+       MDeformVert *dv= NULL;
 -      EditVert *eve;
 +      BMVert *eve;
        Mesh *me;
-       int i;
  
        /* get the deform vertices corresponding to the vertnum */
        if(ob->type==OB_MESH) {
                        if(!eve) {
                                return 0.0f;
                        }
-                       dvert= CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
-                       vertnum= 0;
 -                      dv= CustomData_em_get(&me->edit_mesh->vdata, eve->data, CD_MDEFORMVERT);
++                      dv= CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
                }
                else {
                        if(vertnum >= me->totvert) {
@@@ -621,20 -582,15 +586,15 @@@ static void vgroup_select_verts(Object 
  
        if(ob->type == OB_MESH) {
                Mesh *me= ob->data;
 -              EditMesh *em = BKE_mesh_get_editmesh(me);
 -              EditVert *eve;
 +              BMEditMesh *em = me->edit_btmesh;
 +              BMIter iter;
++              BMVert *eve;
  
 -              for (eve=em->verts.first; eve; eve=eve->next) {
 -                      if (!eve->h) {
 -                              dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
 +              BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
-                       if(dvert && dvert->totweight){
-                               for(i=0; i<dvert->totweight; i++){
-                                       if(dvert->dw[i].def_nr == (ob->actdef-1)){
-                                               if (!BM_TestHFlag(eve, BM_HIDDEN)) {
-                                                       BM_Select(em->bm, eve, select);
-                                               }
-                                               break;
-                                       }
++                      if (!BM_TestHFlag(eve, BM_HIDDEN)) {
++                              dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+                               if (defvert_find_index(dv, def_nr)) {
 -                                      if (select)  eve->f |=  SELECT;
 -                                      else         eve->f &= ~SELECT;
++                                      BM_Select(em->bm, eve, select);
                                }
                        }
                }
@@@ -1382,33 -1254,31 +1256,31 @@@ static void vgroup_invert(Object *ob, c
  
  static void vgroup_blend(Object *ob)
  {
-       BMEditMesh *em= ((Mesh *)ob->data)->edit_btmesh;
-       bDeformGroup *dg;
        MDeformWeight *dw;
        MDeformVert *dvert_array=NULL, *dvert;
-       int i, def_nr, dvert_tot=0;
+       int i, dvert_tot=0;
+       const int def_nr= ob->actdef-1;
  
 -      EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)ob->data));
++      BMEditMesh *em= ((Mesh *)ob->data)->edit_btmesh;
        // ED_vgroup_give_array(ob->data, &dvert_array, &dvert_tot);
  
-       if(em==NULL)
+       if (em==NULL)
                return;
  
-       dg = BLI_findlink(&ob->defbase, (ob->actdef-1));
-       if(dg) {
+       if (BLI_findlink(&ob->defbase, def_nr)) {
 -              int sel1, sel2;
 +              BMEdge *eed;
 +              BMVert *eve;
 +              BMIter iter;
++
+               int i1, i2;
 -              EditEdge *eed;
 -              EditVert *eve;
                float *vg_weights;
                float *vg_users;
-               int i1, i2;
-               def_nr= ob->actdef-1;
 +              int sel1, sel2;
  
 -              i= 0;
 -              for(eve= em->verts.first; eve; eve= eve->next)
 -                      eve->tmp.l= i++;
 +              BM_ElemIndex_Ensure(em->bm, BM_VERT);
  
 -              dvert_tot= i;
 +              dvert_tot= em->bm->totvert;
  
                vg_weights= MEM_callocN(sizeof(float)*dvert_tot, "vgroup_blend_f");
                vg_users= MEM_callocN(sizeof(int)*dvert_tot, "vgroup_blend_i");
                }
  
                i= 0;
 -              for(eve= em->verts.first; eve; eve= eve->next) {
 -                      if(eve->f & SELECT && vg_users[i] > 0) {
 +              BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
 +                      if(BM_TestHFlag(eve, BM_SELECT) && vg_users[i] > 0) {
                                /* TODO, we may want object mode blending */
-                               if(em)  dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 -                              if(em)  dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
++                              if(em)  dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
                                else    dvert= dvert_array+i;
  
                                dw= defvert_verify_index(dvert, def_nr);
@@@ -1611,8 -1486,7 +1488,7 @@@ void ED_vgroup_mirror(Object *ob, cons
                          all_vgroups, def_nr                                   \
                          )
  
 -      EditVert *eve, *eve_mirr;
 +      BMVert *eve, *eve_mirr;
        MDeformVert *dvert, *dvert_mirr;
        short sel, sel_mirr;
        int     *flip_map, flip_map_len;
@@@ -1868,45 -1740,23 +1746,23 @@@ static void vgroup_delete_object_mode(O
  /* removes from active defgroup, if allverts==0 only selected vertices */
  static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGroup *dg)
  {
 -      EditVert *eve;
 +      BMVert *eve;
-       MDeformVert *dvert;
-       MDeformWeight *newdw;
-       bDeformGroup *eg;
-       int     i;
+       MDeformVert *dv;
+       const int def_nr= BLI_findindex(&ob->defbase, dg);
  
        if(ob->type == OB_MESH) {
                Mesh *me= ob->data;
 -              EditMesh *em = BKE_mesh_get_editmesh(me);
 +              BMEditMesh *em = me->edit_btmesh;
 +              BMIter iter;
  
 -              for(eve=em->verts.first; eve; eve=eve->next){
 -                      dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
 +              BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
-               
-                       if(dvert && dvert->dw && (BM_TestHFlag(eve, BM_SELECT) || allverts)){
-                               for(i=0; i<dvert->totweight; i++){
-                                       /* Find group */
-                                       eg = BLI_findlink(&ob->defbase, dvert->dw[i].def_nr);
-                                       if(eg == dg){
-                                               dvert->totweight--;
-                                               if (dvert->totweight){
-                                                       newdw = BLI_cellalloc_malloc (sizeof(MDeformWeight)*(dvert->totweight), "deformWeight");
-                                                       
-                                                       if(dvert->dw){
-                                                               memcpy(newdw, dvert->dw, sizeof(MDeformWeight)*i);
-                                                               memcpy(newdw+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
-                                                               BLI_cellalloc_free(dvert->dw);
-                                                       }
-                                                       dvert->dw=newdw;
-                                               }
-                                               else{
-                                                       BLI_cellalloc_free (dvert->dw);
-                                                       dvert->dw=NULL;
-                                                       break;
-                                               }
-                                       }
-                               }
++                      dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 -                      if(dv && dv->dw && (allverts || (eve->f & SELECT))){
++                      if(dv && dv->dw && (allverts || BM_TestHFlag(eve, BM_SELECT))) {
+                               MDeformWeight *dw = defvert_find_index(dv, def_nr);
+                               defvert_remove_group(dv, dw); /* dw can be NULL */
                        }
                }
 -              BKE_mesh_end_editmesh(me, em);
        }
        else if(ob->type == OB_LATTICE) {
                Lattice *lt= vgroup_edit_lattice(ob);
@@@ -2055,43 -1907,20 +1913,21 @@@ static void vgroup_assign_verts(Object 
  
        if(ob->type == OB_MESH) {
                Mesh *me= ob->data;
 -              EditMesh *em = BKE_mesh_get_editmesh(me);
 -              EditVert *eve;
 +              BMEditMesh *em = me->edit_btmesh;
 +              BMIter iter;
++              BMVert *eve;
  
 -              if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT))
 -                      EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT, NULL);
 +              if(!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT))
 +                      BM_add_data_layer(em->bm, &em->bm->vdata, CD_MDEFORMVERT);
  
                /* Go through the list of editverts and assign them */
 -              for (eve=em->verts.first; eve; eve=eve->next) {
 -                      if (eve->f & SELECT) {
 +              BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
-                       if(dvert && BM_TestHFlag(eve, BM_SELECT)) {
-                               /* See if this vert already has a reference to this group */
-                               /*              If so: Change its weight */
-                               done=0;
-                               for(i=0; i<dvert->totweight; i++){
-                                       eg = BLI_findlink(&ob->defbase, dvert->dw[i].def_nr);
-                                       /* Find the actual group */
-                                       if(eg==dg){
-                                               dvert->dw[i].weight= weight;
-                                               done=1;
-                                               break;
-                                       }
-                                }
-                               /*              If not: Add the group and set its weight */
-                               if(!done){
-                                       newdw = BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dvert->totweight+1), "deformWeight");
-                                       if(dvert->dw){
-                                               memcpy(newdw, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
-                                               BLI_cellalloc_free(dvert->dw);
-                                       }
-                                       dvert->dw=newdw;
-                                       dvert->dw[dvert->totweight].weight= weight;
-                                       dvert->dw[dvert->totweight].def_nr= ob->actdef-1;
-                                       dvert->totweight++;
++                      if (BM_TestHFlag(eve, BM_SELECT)) {
+                               MDeformWeight *dw;
 -                              dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT); /* can be NULL */
++                              dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); /* can be NULL */
+                               dw= defvert_verify_index(dv, def_nr);
+                               if (dw) {
+                                       dw->weight= weight;
                                }
                        }
                }
index 1f49a4d526beaac5c401269d03f146eaa9408531,d2689fad8c2fa98d2192c0fe2f396faeee609350..469452697c5c033367833f0a0450931c13f10305
@@@ -703,59 -688,51 +703,51 @@@ static void vgroup_copy_active_to_sel(O
        }
  }
  
- static void vgroup_copy_active_to_sel_single(Object *ob, int def_nr)
+ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
  {
 -      EditVert *eve_act;
 +      BMVert *eve_act;
-       MDeformVert *dvert_act;
+       MDeformVert *dv_act;
  
-       act_vert_def(ob, &eve_act, &dvert_act);
+       act_vert_def(ob, &eve_act, &dv_act);
  
-       if(dvert_act==NULL) {
+       if(dv_act==NULL) {
                return;
        }
        else {
                Mesh *me= ob->data;
 -              EditMesh *em = BKE_mesh_get_editmesh(me);
 -              EditVert *eve;
 +              BMEditMesh *em = me->edit_btmesh;
 +              BMIter iter;
 +              BMVert *eve;
-               MDeformVert *dvert;
+               MDeformVert *dv;
                MDeformWeight *dw;
-               float act_weight = -1.0f;
-               int i;
+               float weight_act;
                int index= 0;
  
-               for(i=0, dw=dvert_act->dw; i < dvert_act->totweight; i++, dw++) {
-                       if(def_nr == dw->def_nr) {
-                               act_weight= dw->weight;
-                               break;
-                       }
-               }
+               dw= defvert_find_index(dv_act, def_nr);
  
-               if(act_weight < -0.5f)
+               if(dw == NULL)
                        return;
 -
 +              
+               weight_act= dw->weight;
 -              for (eve= em->verts.first; eve; eve= eve->next, index++) {
 -                      if (eve->f & SELECT && eve != eve_act) {
 -                              dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
 -                              if(dv) {
 -                                      dw= defvert_find_index(dv, def_nr);
 -                                      if (dw) {
 -                                              dw->weight= weight_act;
 +              eve = BMIter_New(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
 +              for (index=0; eve; eve=BMIter_Step(&iter), index++) {
 +                      if(BM_TestHFlag(eve, BM_SELECT) && eve != eve_act) {
-                               dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
-                               if(dvert) {
-                                       for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) {
-                                               if(def_nr == dw->def_nr) {
-                                                       dw->weight= act_weight;
++                              dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
++                              dw= defvert_find_index(dv, def_nr);
++                              if (dw) {
++                                      dw->weight= weight_act;
  
-                                                       if(me->editflag & ME_EDIT_MIRROR_X)
-                                                               editvert_mirror_update(ob, eve, -1, index);
-                                                       break;
 -                                              if (me->editflag & ME_EDIT_MIRROR_X) {
 -                                                      editvert_mirror_update(ob, eve, -1, index);
--                                              }
++                                      if (me->editflag & ME_EDIT_MIRROR_X) {
++                                              editvert_mirror_update(ob, eve, -1, index);
                                        }
                                }
                        }
                }
  
-               if(me->editflag & ME_EDIT_MIRROR_X)
 -              if (me->editflag & ME_EDIT_MIRROR_X) {
++              if(me->editflag & ME_EDIT_MIRROR_X) {
                        editvert_mirror_update(ob, eve_act, -1, -1);
+               }
        }
  }
  
@@@ -824,15 -801,16 +816,16 @@@ static void view3d_panel_vgroup(const b
        Scene *scene= CTX_data_scene(C);
        Object *ob= OBACT;
  
 -      EditVert *eve;
 +      BMVert *eve;
-       MDeformVert *dvert;
+       MDeformVert *dv;
  
-       act_vert_def(ob, &eve, &dvert);
+       act_vert_def(ob, &eve, &dv);
  
-       if(dvert && dvert->totweight) {
+       if(dv && dv->totweight) {
                uiLayout *col;
                bDeformGroup *dg;
-               int i;
+               MDeformWeight *dw = dv->dw;
+               unsigned int i;
                int yco = 0;
  
                uiBlockSetHandleFunc(block, do_view3d_vgroup_buttons, NULL);
index a6eb9ab1e48b394c9d077110dc8ff3303563f76b,9948a1a462deb4b03538aed4c3ef97e27b9f8ce2..d7546b113036163d00f6ed048c4df88018bac3d6
@@@ -249,11 -249,18 +249,18 @@@ static void deformVerts(ModifierData *m
                          int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
  {
        HookModifierData *hmd = (HookModifierData*) md;
-       
-       deformVerts_do(hmd, ob, derivedData, vertexCos, numVerts);
+       DerivedMesh *dm = derivedData;
+       /* We need a valid dm for meshes when a vgroup is set... */
+       if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
+               dm = get_dm(ob, NULL, dm, NULL, 0);
+       deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
+       if(derivedData != dm)
+               dm->release(dm);
  }
  
 -static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData,
 +static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editData,
                            DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
  {
        HookModifierData *hmd = (HookModifierData*) md;
index 966591a3e56fefb1a6a36f2423a0450cd1d8a1cd,bcbb6c630a6e07175395a688c5f50f72b77bb390..12ccbe1a848a7af7994ea7bb16805cfe49f86386
@@@ -186,10 -185,9 +186,9 @@@ static void meshdeformModifier_do
  {
        MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
        struct Mesh *me= (mmd->object)? mmd->object->data: NULL;
 -      struct EditMesh *em = (me)? BKE_mesh_get_editmesh(me): NULL;
 +      BMEditMesh *em = me ? me->edit_btmesh : NULL;
        DerivedMesh *tmpdm, *cagedm;
        MDeformVert *dvert = NULL;
-       MDeformWeight *dw;
        MDefInfluence *influences;
        int *offsets;
        float imat[4][4], cagemat[4][4], iobmat[4][4], icagemat[3][3], cmat[4][4];