svn merge ^/trunk/blender -r43062:43085
authorCampbell Barton <ideasman42@gmail.com>
Tue, 3 Jan 2012 02:16:52 +0000 (02:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 3 Jan 2012 02:16:52 +0000 (02:16 +0000)
12 files changed:
1  2 
CMakeLists.txt
intern/cycles/blender/blender_mesh.cpp
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/intern/particle_system.c
source/blender/editors/armature/editarmature.c
source/blender/editors/include/ED_object.h
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/particle_object.c
source/blender/editors/render/render_shading.c
source/blender/gpu/intern/gpu_buffers.c

diff --cc CMakeLists.txt
Simple merge
@@@ -586,21 -583,45 +587,44 @@@ static void vgroup_select_verts(Object 
  
        if(ob->type == OB_MESH) {
                Mesh *me= ob->data;
-               BMEditMesh *em = me->edit_btmesh;
-               BMIter iter;
-               BMVert *eve;
  
-               BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       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)) {
-                                       BM_Select(em->bm, eve, select);
 -              if (me->edit_mesh) {
 -                      EditMesh *em = BKE_mesh_get_editmesh(me);
 -                      EditVert *eve;
++              if (me->edit_btmesh) {
++                      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) {
++                              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);
+                                       }
+                               }
+                       }
 -                      /* this has to be called, because this function operates on vertices only */
 -                      if(select) EM_select_flush(em); // vertices to edges/faces
 -                      else EM_deselect_flush(em);
 -                      BKE_mesh_end_editmesh(me, em);
++                      /* this has to be called, because this function operates on vertices only */
++                      if(select) EDBM_selectmode_flush(em);   // vertices to edges/faces
++                      else EDBM_deselect_flush(em);
+               }
+               else {
+                       if (me->dvert) {
+                               MVert *mv;
+                               MDeformVert *dv;
+                               int i;
+                               mv = me->mvert;
+                               dv = me->dvert;
+                               for (i=0; i<me->totvert; i++, mv++, dv++) {
+                                       if (defvert_find_index(dv, def_nr)) {
+                                               if (select)  mv->flag |=  SELECT;
+                                               else         mv->flag &= ~SELECT;
+                                       }
                                }
+                               paintvert_flush_flags(ob);
                        }
                }
-               /* this has to be called, because this function operates on vertices only */
-               if(select) EDBM_selectmode_flush(em);   // vertices to edges/faces
-               else EDBM_deselect_flush(em);
        }
        else if(ob->type == OB_LATTICE) {
                Lattice *lt= vgroup_edit_lattice(ob);
@@@ -1752,15 -1768,40 +1775,40 @@@ static void vgroup_active_remove_verts(
  
        if(ob->type == OB_MESH) {
                Mesh *me= ob->data;
-               BMEditMesh *em = me->edit_btmesh;
-               BMIter iter;
  
-               BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 -              if (me->edit_mesh) {
 -                      EditVert *eve;
 -                      EditMesh *em = BKE_mesh_get_editmesh(me);
++              if (me->edit_btmesh) {
++                      BMEditMesh *em = me->edit_btmesh;
++                      BMVert *eve;
++                      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) {
++                              dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
  
-                       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 */
 -                              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 {
+                       MVert *mv;
+                       MDeformVert *dv;
+                       int i;
+                       if (!me->dvert) {
+                               ED_vgroup_data_create(&me->id);
+                       }
+                       mv = me->mvert;
+                       dv = me->dvert;
+                       for (i=0; i<me->totvert; i++, mv++, dv++) {
+                               if (mv->flag & SELECT) {
+                                       if (dv->dw && (allverts || (mv->flag & SELECT))) {
+                                               MDeformWeight *dw = defvert_find_index(dv, def_nr);
+                                               defvert_remove_group(dv, dw); /* dw can be NULL */
+                                       }
+                               }
                        }
                }
        }
@@@ -1867,6 -1908,18 +1915,18 @@@ static int vgroup_object_in_edit_mode(O
        return 0;
  }
  
 -                       (me->edit_mesh == NULL) &&
+ static int vgroup_object_in_wpaint_vert_select(Object *ob)
+ {
+       if (ob->type == OB_MESH) {
+               Mesh *me = ob->data;
+               return ( (ob->mode & OB_MODE_WEIGHT_PAINT) &&
++                       (me->edit_btmesh == NULL) &&
+                        (ME_EDIT_PAINT_SEL_MODE(me) == SCE_SELECT_VERTEX) );
+       }
+       return 0;
+ }
  static void vgroup_delete(Object *ob)
  {
        bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef-1);
@@@ -1913,21 -1966,45 +1973,46 @@@ static void vgroup_assign_verts(Object 
  
        if(ob->type == OB_MESH) {
                Mesh *me= ob->data;
-               BMEditMesh *em = me->edit_btmesh;
-               BMIter iter;
-               BMVert *eve;
 -              if (me->edit_mesh) {
 -                      EditMesh *em = BKE_mesh_get_editmesh(me);
 -                      EditVert *eve;
  
-               if(!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT))
-                       BM_add_data_layer(em->bm, &em->bm->vdata, CD_MDEFORMVERT);
 -                      if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT))
 -                              EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT, NULL);
++              if (me->edit_btmesh) {
++                      BMEditMesh *em = me->edit_btmesh;
++                      BMIter iter;
++                      BMVert *eve;
++
++                      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 */
-               BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       if (BM_TestHFlag(eve, BM_SELECT)) {
-                               MDeformWeight *dw;
-                               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;
+                       /* 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) {
++                              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;
+                                       }
+                               }
+                       }
 -                      BKE_mesh_end_editmesh(me, em);
+               }
+               else {
+                       MVert *mv;
+                       MDeformVert *dv;
+                       int i;
+                       if (!me->dvert) {
+                               ED_vgroup_data_create(&me->id);
+                       }
+                       mv = me->mvert;
+                       dv = me->dvert;
+                       for (i=0; i<me->totvert; i++, mv++, dv++) {
+                               if (mv->flag & SELECT) {
+                                       MDeformWeight *dw;
+                                       dw= defvert_verify_index(dv, def_nr);
+                                       if (dw) {
+                                               dw->weight= weight;
+                                       }
                                }
                        }
                }