svn merge -r41422:41431 ^/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Tue, 1 Nov 2011 09:05:38 +0000 (09:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 1 Nov 2011 09:05:38 +0000 (09:05 +0000)
14 files changed:
1  2 
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/BKE_deform.h
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/editors/include/ED_mesh.h
source/blender/editors/object/object_vgroup.c
source/blender/makesdna/DNA_object_types.h

index 77ef0b809ac6246567093e327584505eb2f24748,4a8bc34cdf762002ec760a0c8072725d4532f6f0..ea6fd3843dcabafb5967686214e269692cb51448
@@@ -658,6 -301,10 +658,8 @@@ void make_local_mesh(Mesh *me
                Mesh *men= copy_mesh(me);
                men->id.us= 0;
  
 -
 -              /* Remap paths of new ID using old library as base. */
+               BKE_id_lib_local_paths(bmain, &men->id);
                for(ob= bmain->object.first; ob; ob= ob->id.next) {
                        if(me == ob->data) {
                                if(ob->id.lib==NULL) {
index d37b61a2c0c8a5cedf5aaac86987915c3ea987e1,7678da1c7c407199dfa3b545f33a2092db45f7cd..ec20e9390cdd7082bca6997fae1ff8d52057d2fe
@@@ -3634,8 -3632,8 +3634,7 @@@ void make_local_particlesettings(Partic
                expand_local_particlesettings(part);
        }
        else if(is_local && is_lib) {
-               char *bpath_user_data[2]= {bmain->name, part->id.lib->filepath};
                ParticleSettings *partn= psys_copy_settings(part);
 -
                partn->id.us= 0;
  
                /* Remap paths of new ID using old library as base. */
index 975fdecc77e28a4cb8a2a8aeff9c28c88135d9bb,a59ca5ad9541f5c9f5f85754e45a46b48b941bba..8a07d91ea975ab93b6b82dbeb6ffed0fccab622e
@@@ -101,8 -99,7 +101,8 @@@ int ED_vgroup_object_is_edit_mode(Objec
  bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name)
  {
        bDeformGroup *defgroup;
-       if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE))
 +      
+       if(!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
                return NULL;
        
        defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
@@@ -1558,12 -1572,20 +1576,21 @@@ static void dvert_mirror_op(MDeformVer
        }
  }
  
- void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_vgroups)
+ /* TODO, vgroup locking */
+ /* TODO, face masking */
+ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups)
  {
- #define VGROUP_MIRR_OP dvert_mirror_op(dvert, dvert_mirr, sel, sel_mirr, flip_map, flip_map_len, mirror_weights, flip_vgroups)
+ #define VGROUP_MIRR_OP                                                        \
+         dvert_mirror_op(dvert, dvert_mirr,                                    \
+                         sel, sel_mirr,                                        \
+                         flip_map, flip_map_len,                               \
+                         mirror_weights, flip_vgroups,                         \
+                         all_vgroups, act_vgroup                               \
+                         )
  
 -      EditVert *eve, *eve_mirr;
 +      BMVert *eve, *eve_mirr;
 +
        MDeformVert *dvert, *dvert_mirr;
        short sel, sel_mirr;
        int     *flip_map, flip_map_len;
        /* only the active group */
        if(ob->type == OB_MESH) {
                Mesh *me= ob->data;
 -              EditMesh *em = BKE_mesh_get_editmesh(me);
 +              BMEditMesh *em = me->edit_btmesh;
-               BMIter iter;
  
-               if(!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT)) {
-                       MEM_freeN(flip_map);
-                       return;
+               if (em) {
 -                      if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
++                      BMIter iter;
++
++                      if(!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT)) {
+                               MEM_freeN(flip_map);
+                               return;
+                       }
 -                      EM_cache_x_mirror_vert(ob, em);
++                      EDBM_CacheMirrorVerts(em, FALSE);
+                       /* Go through the list of editverts and assign them */
 -                      for(eve=em->verts.first; eve; eve=eve->next){
 -                              if((eve_mirr=eve->tmp.v)) {
 -                                      sel= eve->f & SELECT;
 -                                      sel_mirr= eve_mirr->f & SELECT;
++                      BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
++                              if((eve_mirr= EDBM_GetMirrorVert(em, eve))) {
++                                      sel= BM_TestHFlag(eve, BM_SELECT);
++                                      sel_mirr= BM_TestHFlag(eve_mirr, BM_SELECT);
+                                       if((sel || sel_mirr) && (eve != eve_mirr)) {
 -                                              dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
 -                                              dvert_mirr= CustomData_em_get(&em->vdata, eve_mirr->data, CD_MDEFORMVERT);
++                                              dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
++                                              dvert_mirr= CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
+                                               if(dvert && dvert_mirr) {
+                                                       VGROUP_MIRR_OP;
+                                               }
+                                       }
 -                                      eve->tmp.v= eve_mirr->tmp.v= NULL;
++                                      /* don't use these again */
++                                      EDBM_ClearMirrorVert(em, eve);
++                                      EDBM_ClearMirrorVert(em, eve_mirr);
+                               }
+                       }
 -                      BKE_mesh_end_editmesh(me, em);
++                      EDBM_EndMirrorCache(em);
                }
+               else {
+                       /* object mode / weight paint */
+                       MVert *mv, *mv_mirr;
+                       int vidx, vidx_mirr;
+                       const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+                       if (me->dvert == NULL) {
+                               MEM_freeN(flip_map);
+                               return;
+                       }
  
-               EDBM_CacheMirrorVerts(em, FALSE);
+                       if (!use_vert_sel) {
+                               sel= sel_mirr= TRUE;
+                       }
+                       /* tag verts we have used */
+                       for(vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+                               mv->flag &= ~ME_VERT_TMP_TAG;
+                       }
+                       for(vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+                               if (    ((mv->flag & ME_VERT_TMP_TAG) == 0) &&
+                                       ((vidx_mirr= mesh_get_x_mirror_vert(ob, vidx)) != -1) &&
+                                       (vidx != vidx_mirr) &&
+                                       ((((mv_mirr= me->mvert + vidx_mirr)->flag) & ME_VERT_TMP_TAG) == 0))
+                               {
+                                       if (use_vert_sel) {
+                                               sel= mv->flag & SELECT;
+                                               sel_mirr= mv_mirr->flag & SELECT;
+                                       }
+                                       if (sel || sel_mirr) {
+                                               dvert= &me->dvert[vidx];
+                                               dvert_mirr= &me->dvert[vidx_mirr];
  
-               /* Go through the list of editverts and assign them */
-               BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       if((eve_mirr= EDBM_GetMirrorVert(em, eve))) {
-                               sel= BM_TestHFlag(eve, BM_SELECT);
-                               sel_mirr= BM_TestHFlag(eve_mirr, BM_SELECT);
-                               if((sel || sel_mirr) && (eve != eve_mirr)) {
-                                       dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
-                                       dvert_mirr= CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
-                                       if(dvert && dvert_mirr) {
                                                VGROUP_MIRR_OP;
                                        }
-                               }
  
-                               /* don't use these again */
-                               EDBM_ClearMirrorVert(em, eve);
-                               EDBM_ClearMirrorVert(em, eve_mirr);
+                                       mv->flag |= ME_VERT_TMP_TAG;
+                                       mv_mirr->flag |= ME_VERT_TMP_TAG;
+                               }
                        }
                }
-               EDBM_EndMirrorCache(em);
        }
        else if (ob->type == OB_LATTICE) {
                Lattice *lt= ob->data;