svn merge ^/trunk/blender -r40644:40720
authorCampbell Barton <ideasman42@gmail.com>
Thu, 6 Oct 2011 16:59:58 +0000 (16:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 6 Oct 2011 16:59:58 +0000 (16:59 +0000)
16 files changed:
1  2 
CMakeLists.txt
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/object.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/transform/transform_conversions.c
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_scene.c
source/blender/modifiers/intern/MOD_explode.c
source/blender/windowmanager/intern/wm_init_exit.c

diff --cc CMakeLists.txt
Simple merge
@@@ -1177,9 -1029,9 +1177,9 @@@ static void old_mdisps_convert(MFace *m
        int nvert = (mface->v4)? 4: 3;
        int newtotdisp = multires_grid_tot[newlvl]*nvert;
        int x, y, S;
-       float (*disps)[3], (*out)[3], u, v;
+       float (*disps)[3], (*out)[3], u = 0.0f, v = 0.0f; /* Quite gcc barking. */
  
 -      disps = MEM_callocN(sizeof(float) * 3 * newtotdisp, "multires disps");
 +      disps = BLI_cellalloc_calloc(sizeof(float) * 3 * newtotdisp, "multires disps");
  
        out = disps;
        for(S = 0; S < nvert; S++) {
@@@ -166,15 -164,16 +166,19 @@@ static void v3d_editvertex_buts(uiLayou
                                tot++;
                                add_v3_v3(median, eve->co);
                        }
 -                      eve= eve->next;
                }
 -              eed= em->edges.first;
 -              while(eed) {
 -                      if((eed->f & SELECT)) {
 +
 +              BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
 +                      if(BM_TestHFlag(eed, BM_SELECT)) {
-                               float *f = bm_get_cd_float(&bm->edata, eed->head.data, CD_CREASE);
++                              float *f;
 +
                                totedge++;
 -                              median[3]+= eed->crease;
 -                              median[6]+= eed->bweight;
++                              f = bm_get_cd_float(&bm->edata, eed->head.data, CD_CREASE);
 +                              median[3]+= f ? *f : 0.0f;
++
++                              f = bm_get_cd_float(&bm->edata, eed->head.data, CD_BWEIGHT);
++                              median[6]+= f ? *f : 0.0f;
                        }
 -                      eed= eed->next;
                }
  
                /* check for defgroups */
                                        }
                                }
                        }
-                       
 -
+                       if (median[6] != 0.0f) {
++#if 0 // BMESH_TODO
+                               EditEdge *eed;
+                               const float fixed_bweight= (ve_median[6] <= 0.0f ? 0.0f : (ve_median[6] >= 1.0f ? 1.0f : FLT_MAX));
+                               if(fixed_bweight != FLT_MAX) {
+                                       /* simple case */
+                                       for(eed= em->edges.first; eed; eed= eed->next) {
+                                               if(eed->f & SELECT) {
+                                                       eed->bweight= fixed_bweight;
+                                               }
+                                       }
+                               }
+                               else {
+                                       /* scale crease to target median */
+                                       float median_new= ve_median[6];
+                                       float median_orig= ve_median[6] - median[6]; /* previous median value */
+                                       /* incase of floating point error */
+                                       CLAMP(median_orig, 0.0f, 1.0f);
+                                       CLAMP(median_new, 0.0f, 1.0f);
+                                       if(median_new < median_orig) {
+                                               /* scale down */
+                                               const float sca= median_new / median_orig;
+                                               for(eed= em->edges.first; eed; eed= eed->next) {
+                                                       if(eed->f & SELECT) {
+                                                               eed->bweight *= sca;
+                                                               CLAMP(eed->bweight, 0.0f, 1.0f);
+                                                       }
+                                               }
+                                       }
+                                       else {
+                                               /* scale up */
+                                               const float sca= (1.0f - median_new) / (1.0f - median_orig);
+                                               for(eed= em->edges.first; eed; eed= eed->next) {
+                                                       if(eed->f & SELECT) {
+                                                               eed->bweight = 1.0f - ((1.0f - eed->bweight) * sca);
+                                                               CLAMP(eed->bweight, 0.0f, 1.0f);
+                                                       }
+                                               }
+                                       }
+                               }
++#endif // BMESH_TODO
+                       }
 -                      BKE_mesh_end_editmesh(me, em);
 +                      EDBM_RecalcNormals(em);
                }
                else if(ob->type==OB_CURVE || ob->type==OB_SURF) {
                        Curve *cu= ob->data;