svn merge -r41371:41420 ^/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Tue, 1 Nov 2011 02:01:09 +0000 (02:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 1 Nov 2011 02:01:09 +0000 (02:01 +0000)
1  2 
CMakeLists.txt
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenlib/BLI_threads.h
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/threads.c
source/blender/editors/mesh/editface.c
source/blender/makesrna/intern/rna_ui_api.c
source/blender/modifiers/intern/MOD_solidify.c

diff --cc CMakeLists.txt
Simple merge
index 429848f3dcb4637b48ed3da3e8cc73eee8c63658,83eda86051053d8459c186f1d75bf34cf192b155..0ac806f68a9fed6d24a754477ccd8fe065043554
@@@ -497,15 -494,15 +497,15 @@@ MDeformWeight *defvert_verify_index(MDe
        if(newdw)
                return newdw;
  
-       newdw = BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
 -      newdw= MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
 -      if (dv->dw) {
++      newdw= BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
 +      if(dv->dw) {
                memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
 -              MEM_freeN(dv->dw);
 +              BLI_cellalloc_free(dv->dw);
        }
-       dv->dw=newdw;
-       dv->dw[dv->totweight].weight=0.0f;
-       dv->dw[dv->totweight].def_nr=defgroup;
+       dv->dw= newdw;
+       newdw += dv->totweight;
+       newdw->weight= 0.0f;
+       newdw->def_nr= defgroup;
        /* Group index */
  
        dv->totweight++;
index 7c5db6cedfa24eed97b487c2f4d05b58c5c2d0dd,6f66e189dcf7b527f5504ddfae0053160950c861..77ef0b809ac6246567093e327584505eb2f24748
@@@ -541,19 -229,9 +541,19 @@@ Mesh *copy_mesh(Mesh *me
                                        id_lib_extern((ID*)tface->tpage);
                }
        }
+       
 +      for(i=0; i<me->pdata.totlayer; i++) {
 +              if(me->pdata.layers[i].type == CD_MTEXPOLY) {
 +                      txface= (MTexPoly*)me->pdata.layers[i].data;
 +
 +                      for(a=0; a<me->totpoly; a++, txface++)
 +                              if(txface->tpage)
 +                                      id_lib_extern((ID*)txface->tpage);
 +              }
 +      }
 +
        men->mselect= NULL;
 -      men->edit_mesh= NULL;
 +      men->edit_btmesh= NULL;
        men->pv= NULL; /* looks like this is no-longer supported but NULL just incase */
  
        men->bb= MEM_dupallocN(men->bb);
@@@ -1997,14 -1323,14 +1997,14 @@@ UvVertMap *make_uv_vert_map(struct MPol
        totuv = 0;
  
        /* generate UvMapVert array */
 -      mf= mface;
 -      for(a=0; a<totface; a++, mf++)
 -              if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL)))
 -                      totuv += (mf->v4)? 4: 3;
 -              
 +      mp= mpoly;
 +      for(a=0; a<totpoly; a++, mp++)
 +              if(!selected || (!(mp->flag & ME_HIDE) && (mp->flag & ME_FACE_SEL)))
 +                      totuv += mp->totloop;
 +
        if(totuv==0)
                return NULL;
+       
        vmap= (UvVertMap*)MEM_callocN(sizeof(*vmap), "UvVertMap");
        if (!vmap)
                return NULL;
index 973bb57bb42d09fae0e19eb0044116c66a53f578,8826e9a993697acdbbcd329e51f121116b297cd8..bd911adeba27d5957e7ea54d007fb51e60d15e73
@@@ -70,7 -70,7 +70,8 @@@ int           BLI_system_thread_count(void); /* 
  #define LOCK_CUSTOM1  3
  #define LOCK_RCACHE           4
  #define LOCK_OPENGL           5
- #define LOCK_SCANFILL 6
+ #define LOCK_NODES            6
++#define LOCK_SCANFILL 7
  
  void  BLI_lock_thread(int type);
  void  BLI_unlock_thread(int type);
index 37f37887688a442246596abdf90a99bba492f69b,7b156a3ac52b5248fc3107c05eba1a278ef7956f..f80458682e186c39c485edbedf7a8f560d4496c7
@@@ -113,7 -113,7 +113,8 @@@ static pthread_mutex_t _viewer_lock = P
  static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER;
  static pthread_mutex_t _rcache_lock = PTHREAD_MUTEX_INITIALIZER;
  static pthread_mutex_t _opengl_lock = PTHREAD_MUTEX_INITIALIZER;
+ static pthread_mutex_t _nodes_lock = PTHREAD_MUTEX_INITIALIZER;
 +static pthread_mutex_t _scanfill_lock = PTHREAD_MUTEX_INITIALIZER;
  static pthread_t mainid;
  static int thread_levels= 0;  /* threads can be invoked inside threads */
  
@@@ -348,8 -348,8 +349,10 @@@ void BLI_lock_thread(int type
                pthread_mutex_lock(&_rcache_lock);
        else if (type==LOCK_OPENGL)
                pthread_mutex_lock(&_opengl_lock);
+       else if (type==LOCK_NODES)
+               pthread_mutex_lock(&_nodes_lock);
 +      else if (type == LOCK_SCANFILL) 
 +              pthread_mutex_lock(&_scanfill_lock);
  }
  
  void BLI_unlock_thread(int type)
                pthread_mutex_unlock(&_rcache_lock);
        else if(type==LOCK_OPENGL)
                pthread_mutex_unlock(&_opengl_lock);
+       else if(type==LOCK_NODES)
+               pthread_mutex_unlock(&_nodes_lock);
 +      else if(type == LOCK_SCANFILL)
 +              pthread_mutex_unlock(&_scanfill_lock);
  }
  
  /* Mutex Locks */
index f78211ac807ef1b684f6315328ac27a14910c6bf,b8e95ad4c511df73b93ea6944fe75a1235bbb0af..781ac58b32c2661a7d19651680d7b6f09888ec3d
@@@ -590,77 -583,28 +590,79 @@@ static DerivedMesh *applyModifier(Modif
  
                        /* copy most of the face settings */
                        DM_copy_face_data(dm, result, fidx, (numFaces * 2) + i, 1);
 +                      mp->loopstart = j+numLoops*2;
 +                      mp->flag = mpoly[fidx].flag;
 +                      mp->totloop = 4;
  
-                       } else if (ed->v1 == mloop[mpoly[fidx].loopstart+k1].v) {
 +                      /* ME_HIDE for rim faces should match that of the rim edge, not the face the edge */
 +                      mp->flag &= ~ME_HIDE;
 +                      mp->flag |= ed->flag & ME_HIDE;
 +                      
 +                      ml2 = mloop + mpoly[fidx].loopstart;
 +                      for (k1=0; k1<mpoly[fidx].totloop; k1++, ml2++) {
 +                              if (ml2->e == eidx)
 +                                      break;
 +                      }
 +                      
 +                      if (k1 == mpoly[fidx].totloop) {
 +                              fprintf(stderr, "%s: solidify bad k1==totloop (bmesh internal error)\n", __func__);
 +                      }
 +                      
 +                      if (ed->v2 == mloop[mpoly[fidx].loopstart+k1].v) {
 +                              k2 = (k1 + mp->totloop - 1)%mp->totloop;
 +                              SWAP(int, k1, k2);
-                       } else {
++                      }
++                      else if (ed->v1 == mloop[mpoly[fidx].loopstart+k1].v) {
 +                              k2 = (k1+1)%mp->totloop;
++                      }
++                      else {
 +                              fprintf(stderr, "%s: solidify bad edge/vert\n", __func__);
 +                              k2 = k1;
 +                      }
 +                      
 +                      k1 += mpoly[fidx].loopstart;
 +                      k2 += mpoly[fidx].loopstart;
 +                      
                        if(flip) {
 -                              DM_swap_face_data(result, (numFaces * 2) + i, edge_indices[edge_order[eidx]]);
 -
 -                              mf->v1= ed->v1;
 -                              mf->v2= ed->v2;
 -                              mf->v3= ed->v2 + numVerts;
 -                              mf->v4= ed->v1 + numVerts;
 +                              CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops*2+j, 1);
 +                              CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops*2+j+1, 1);
 +                              CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops*2+j+2, 1);
 +                              CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops*2+j+3, 1);
 +                              
 +                              ml[j].v = ed->v1;
 +                              ml[j++].e = eidx;
 +                              
 +                              ml[j].v = ed->v2;
 +                              ml[j++].e = numEdges*2 + old_vert_arr[ed->v2];
 +                              
 +                              ml[j].v = ed->v2+numVerts;
 +                              ml[j++].e = eidx+numEdges;
 +                              
 +                              ml[j].v = ed->v1+numVerts;
 +                              ml[j++].e = numEdges*2 + old_vert_arr[ed->v1];
                        }
                        else {
 -                              DM_swap_face_data(result, (numFaces * 2) + i, edge_indices[edge_order[eidx]]);
 -
 -                              mf->v1= ed->v2;
 -                              mf->v2= ed->v1;
 -                              mf->v3= ed->v1 + numVerts;
 -                              mf->v4= ed->v2 + numVerts;
 +                              CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops*2+j, 1);
 +                              CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops*2+j+1, 1);
 +                              CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops*2+j+2, 1);
 +                              CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops*2+j+3, 1);
 +
 +                              ml[j].v = ed->v1+numVerts;
 +                              ml[j++].e = eidx+numEdges;
 +
 +                              ml[j].v = ed->v2+numVerts;
 +                              ml[j++].e = numEdges*2 + old_vert_arr[ed->v2];
 +                              
 +                              ml[j].v = ed->v2;
 +                              ml[j++].e = eidx;
 +                              
 +                              ml[j].v = ed->v1;
 +                              ml[j++].e = numEdges*2 + old_vert_arr[ed->v1];
                        }
                        
 -                      /* use the next material index if option enabled */
 -                      if(mat_ofs_rim) {
 -                              mf->mat_nr += mat_ofs_rim;
 -                              CLAMP(mf->mat_nr, 0, mat_nr_max);
 +                      if (edge_origIndex) {
 +                              edge_origIndex[ml[j-3].e] = ORIGINDEX_NONE;
 +                              edge_origIndex[ml[j-1].e] = ORIGINDEX_NONE;
                        }
                        if(crease_outer) {
                                /* crease += crease_outer; without wrapping */
                        add_v3_v3(edge_vert_nos[ed->v1], nor);
                        add_v3_v3(edge_vert_nos[ed->v2], nor);
  #endif
 -                      origindex[numFaces * 2 + i]= fidx;
 +
 +                      if (origindex) {
-                               origindex[numFaces * 2 + i]= ORIGINDEX_NONE;
++                              origindex[numFaces * 2 + i]= fidx;
 +                      }
                }
                
  #ifdef SOLIDIFY_SIDE_NORMALS
        /* must recalculate normals with vgroups since they can displace unevenly [#26888] */
        if(dvert) {
                CDDM_calc_normals(result);
-       } else {
+       }
 -
++      else {
 +              CDDM_recalc_tesselation(result, 1);
 +      }
 +      
 +      if (dm != odm) {
 +              dm->needsFree = 1;
 +              dm->release(dm);
 +      }
 +      
        return result;
  }