svn merge ^/trunk/blender -r43554:43564
authorCampbell Barton <ideasman42@gmail.com>
Fri, 20 Jan 2012 15:34:40 +0000 (15:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 20 Jan 2012 15:34:40 +0000 (15:34 +0000)
1  2 
source/blender/blenkernel/intern/key.c
source/blender/editors/uvedit/uvedit_smart_stitch.c

index 94868ffee87d95a0031aeb80db20d2615cde0696,b2385a5cdb8a8aaec2ad0f063ceff12d174954c1..670ffd2b7c6888d828b6de5699c825d4cef614c6
@@@ -56,7 -56,6 +56,7 @@@
  #include "BKE_key.h"
  #include "BKE_lattice.h"
  #include "BKE_library.h"
 +#include "BKE_tessmesh.h"
  #include "BKE_main.h"
  #include "BKE_object.h"
  #include "BKE_deform.h"
@@@ -93,20 -92,6 +93,20 @@@ void free_key(Key *key
        
  }
  
 +void free_key_nolib(Key *key)
 +{
 +      KeyBlock *kb;
 +      
 +      while( (kb= key->block.first) ) {
 +              
 +              if(kb->data) MEM_freeN(kb->data);
 +              
 +              BLI_remlink(&key->block, kb);
 +              MEM_freeN(kb);
 +      }
 +      
 +}
 +
  /* GS reads the memory pointed at in a specific ordering. There are,
   * however two definitions for it. I have jotted them down here, both,
   * but I think the first one is actually used. The thing is that
@@@ -129,8 -114,6 +129,8 @@@ Key *add_key(ID *id)       /* common functio
        
        key->type= KEY_NORMAL;
        key->from= id;
 +
 +      key->uidgen = 1;
        
        // XXX the code here uses some defines which will soon be depreceated...
        if( GS(id->name)==ID_ME) {
@@@ -189,32 -172,6 +189,32 @@@ Key *copy_key(Key *key
        return keyn;
  }
  
 +
 +Key *copy_key_nolib(Key *key)
 +{
 +      Key *keyn;
 +      KeyBlock *kbn, *kb;
 +      
 +      if(key==0) return 0;
 +      
 +      keyn= MEM_dupallocN(key);
 +      
 +      BLI_duplicatelist(&keyn->block, &key->block);
 +      
 +      kb= key->block.first;
 +      kbn= keyn->block.first;
 +      while(kbn) {
 +              
 +              if(kbn->data) kbn->data= MEM_dupallocN(kbn->data);
 +              if(kb==key->refkey) keyn->refkey= kbn;
 +              
 +              kbn= kbn->next;
 +              kb= kb->next;
 +      }
 +      
 +      return keyn;
 +}
 +
  void make_local_key(Key *key)
  {
  
@@@ -420,7 -377,7 +420,7 @@@ static int setkeys(float fac, ListBase 
                        if(k1->next==NULL) k[0]=k1;
                        k1=k1->next;
                }
-               k1= k[1];
+               /* k1= k[1]; */ /* UNUSED */
                t[0]= k[0]->pos;
                t[1]+= dpos;
                t[2]= k[2]->pos + dpos;
@@@ -538,21 -495,18 +538,21 @@@ static char *key_block_get_data(Key *ke
                   edit mode with shape keys blending applied */
                if(GS(key->from->name) == ID_ME) {
                        Mesh *me;
 -                      EditVert *eve;
 +                      BMVert *eve;
 +                      BMIter iter;
                        float (*co)[3];
                        int a;
  
                        me= (Mesh*)key->from;
  
 -                      if(me->edit_mesh && me->edit_mesh->totvert == kb->totelem) {
 +                      if(me->edit_btmesh && me->edit_btmesh->bm->totvert == kb->totelem) {
                                a= 0;
 -                              co= MEM_callocN(sizeof(float)*3*me->edit_mesh->totvert, "key_block_get_data");
 +                              co= MEM_callocN(sizeof(float)*3*me->edit_btmesh->bm->totvert, "key_block_get_data");
  
 -                              for(eve=me->edit_mesh->verts.first; eve; eve=eve->next, a++)
 +                              BM_ITER(eve, &iter, me->edit_btmesh->bm, BM_VERTS_OF_MESH, NULL) {
                                        copy_v3_v3(co[a], eve->co);
 +                                      a++;
 +                              }
  
                                *freedata= (char*)co;
                                return (char*)co;
@@@ -1046,9 -1000,8 +1046,9 @@@ static void do_key(const int start, in
  static float *get_weights_array(Object *ob, char *vgroup)
  {
        MDeformVert *dvert= NULL;
 -      EditMesh *em= NULL;
 -      EditVert *eve;
 +      BMEditMesh *em= NULL;
 +      BMIter iter;
 +      BMVert *eve;
        int totvert= 0, defgrp_index= 0;
        
        /* no vgroup string set? */
                dvert= me->dvert;
                totvert= me->totvert;
  
 -              if(me->edit_mesh && me->edit_mesh->totvert == totvert)
 -                      em= me->edit_mesh;
 +              if(me->edit_btmesh && me->edit_btmesh->bm->totvert == totvert)
 +                      em= me->edit_btmesh;
        }
        else if(ob->type==OB_LATTICE) {
                Lattice *lt= ob->data;
                weights= MEM_callocN(totvert*sizeof(float), "weights");
  
                if(em) {
 -                      for(i=0, eve=em->verts.first; eve; eve=eve->next, i++) {
 -                              dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
 +                      eve = BMIter_New(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
 +                      for (i=0; eve; eve=BMIter_Step(&iter), i++) {
 +                              dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
  
                                if(dvert) {
                                        weights[i]= defvert_find_weight(dvert, defgrp_index);
@@@ -1499,8 -1451,7 +1499,8 @@@ KeyBlock *add_keyblock(Key *key, const 
  
        // XXX this is old anim system stuff? (i.e. the 'index' of the shapekey)
        kb->adrcode= tot-1;
 -      
 +      kb->uid = key->uidgen++;
 +
        key->totkey++;
        if(key->totkey==1) key->refkey= kb;
        
index 023d55d053dac8f8ec6a34105c6443544431d6c9,c4716f2e3ca2cf6efd2bdc23f221326b98c5c9e4..346020464482cb84930f8579eaa17041634a72ca
@@@ -1,6 -1,3 +1,6 @@@
 +
 +#if 0 /* BMESH TODO */
 +
  /*
   * ***** BEGIN GPL LICENSE BLOCK *****
   *
@@@ -53,7 -50,6 +53,7 @@@
  #include "BKE_customdata.h"
  #include "BKE_depsgraph.h"
  #include "BKE_mesh.h"
 +#include "BKE_tessmesh.h"
  
  #include "ED_mesh.h"
  #include "ED_uvedit.h"
@@@ -447,7 -443,7 +447,7 @@@ static void stitch_state_delete(StitchS
  {
        if(stitch_state){
                if(stitch_state->element_map){
 -                      EM_free_uv_element_map(stitch_state->element_map);
 +                      EDBM_free_uv_element_map(stitch_state->element_map);
                }
                if(stitch_state->uvs){
                        MEM_freeN(stitch_state->uvs);
@@@ -974,9 -970,9 +974,9 @@@ static int stitch_init(bContext *C, wmO
        state->midpoints = RNA_boolean_get(op->ptr, "midpoint_snap");
        /* in uv synch selection, all uv's are visible */
        if(ts->uv_flag & UV_SYNC_SELECTION){
 -              state->element_map = EM_make_uv_element_map(state->em, 0, 1);
 +              state->element_map = EDBM_make_uv_element_map(state->em, 0, 1);
        }else{
 -              state->element_map = EM_make_uv_element_map(state->em, 1, 1);
 +              state->element_map = EDBM_make_uv_element_map(state->em, 1, 1);
        }
        if(!state->element_map){
                stitch_state_delete(state);
        ghi = BLI_ghashIterator_new(edgeHash);
        total_edges = 0;
        /* fill the edges with data */
-       for(i = 0; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)){
+       for(; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)){
                UvEdge *edge = ((UvEdge *)BLI_ghashIterator_getKey(ghi));
                if(edge->flag & STITCH_BOUNDARY){
                        total_edges++;
@@@ -1467,4 -1463,4 +1467,4 @@@ void UV_OT_stitch(wmOperatorType *ot
        RNA_def_property_flag(prop, PROP_HIDDEN);
  }
  
 -
 +#endif /* BMESH TODO */