Merging r45748 through r45791 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 19 Apr 2012 19:03:35 +0000 (19:03 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 19 Apr 2012 19:03:35 +0000 (19:03 +0000)
1  2 
source/blender/editors/transform/transform_conversions.c

index 94e28af294972106a04e5932d64ed6da1276a89a,ba720ea8087924bb117cbdea2a187da2980741e4..7755b35b2b2db7aa152cb39c13e001290291a52d
@@@ -309,7 -309,7 +309,7 @@@ static void createTransEdge(TransInfo *
        int count=0, countsel=0;
        int propmode = t->flag & T_PROP_EDIT;
  
-       BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
+       BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
                if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
                        if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) countsel++;
                        if (propmode) count++;
        copy_m3_m4(mtx, t->obedit->obmat);
        invert_m3_m3(smtx, mtx);
  
-       BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
+       BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
                if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) { 
                        float *bweight = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_BWEIGHT);
                        float *crease = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE);
@@@ -1888,7 -1888,7 +1888,7 @@@ static void editmesh_set_connectivity_d
  
        BLI_smallhash_init(visit);
  
-       BM_ITER(v, &viter, em->bm, BM_VERTS_OF_MESH, NULL) {
+       BM_ITER_MESH (v, &viter, em->bm, BM_VERTS_OF_MESH) {
                if (BM_elem_flag_test(v, BM_ELEM_SELECT)==0 || BM_elem_flag_test(v, BM_ELEM_HIDDEN))
                        continue;
                        
                v2 = queue[start];
                d = dqueue[start];
                
-               BM_ITER(e, &eiter, em->bm, BM_EDGES_OF_VERT, v2) {
+               BM_ITER_ELEM (e, &eiter, v2, BM_EDGES_OF_VERT) {
                        float d2;
                        v3 = BM_edge_other_vert(e, v2);
                        
  }
  
  /* loop-in-a-loop I know, but we need it! (ton) */
-  static void get_face_center(float cent_r[3], BMesh *bm, BMVert *eve)
+  static void get_face_center(float cent_r[3], BMVert *eve)
  
  {
        BMFace *efa;
        BMIter iter;
  
-       BM_ITER(efa, &iter, bm, BM_FACES_OF_VERT, eve) {
+       BM_ITER_ELEM (efa, &iter, eve, BM_FACES_OF_VERT) {
                if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
-                       BM_face_center_mean_calc(bm, efa, cent_r);
+                       BM_face_center_mean_calc(efa, cent_r);
                        break;
                }
        }
  }
  
- static void get_edge_center(float cent_r[3], BMesh *bm, BMVert *eve)
+ static void get_edge_center(float cent_r[3], BMVert *eve)
  {
        BMEdge *eed;
        BMIter iter;
  
-       BM_ITER(eed, &iter, bm, BM_EDGES_OF_VERT, eve) {
+       BM_ITER_ELEM (eed, &iter, eve, BM_EDGES_OF_VERT) {
                if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
                        mid_v3_v3v3(cent_r, eed->v1->co, eed->v2->co);
                        break;
@@@ -1993,9 -1993,9 +1993,9 @@@ static void VertsToTransData(TransInfo 
  
        if (t->around==V3D_LOCAL) {
                if (em->selectmode & SCE_SELECT_FACE)
-                       get_face_center(td->center, em->bm, eve);
+                       get_face_center(td->center, eve);
                else if (em->selectmode & SCE_SELECT_EDGE)
-                       get_edge_center(td->center, em->bm, eve);
+                       get_edge_center(td->center, eve);
        }
        copy_v3_v3(td->iloc, td->loc);
  
@@@ -2051,7 -2051,7 +2051,7 @@@ static void createTransEditVerts(bConte
  
        // transform now requires awareness for select mode, so we tag the f1 flags in verts
        if (selectmode & SCE_SELECT_VERTEX) {
-               BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
+               BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
                        BM_elem_flag_set(eve, BM_ELEM_TAG, BM_elem_flag_test(eve, BM_ELEM_SELECT));
                }
        }
@@@ -2452,7 -2452,7 +2452,7 @@@ static void createTransUVs(bContext *C
        if (!ED_space_image_show_uvedit(sima, t->obedit)) return;
  
        /* count */
-       BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
+       BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
                tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
  
                if (!uvedit_face_visible(scene, ima, efa, tf)) {
                }
                
                BM_elem_flag_enable(efa, BM_ELEM_TAG);
-               BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
+               BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                        if (uvedit_uv_selected(em, scene, l)) 
                                countsel++;
  
        td= t->data;
        td2d= t->data2d;
  
-       BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
+       BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
                if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
                        continue;
  
-               BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
+               BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                        if (!propmode && !uvedit_uv_selected(em, scene, l))
                                continue;
                        
@@@ -2662,6 -2662,7 +2662,7 @@@ static void createTransNlaData(bContex
        td= t->data;
        t->customData= MEM_callocN(t->total*sizeof(TransDataNla), "TransDataNla (NLA Editor)");
        tdn= t->customData;
+       t->flag |= T_FREE_CUSTOMDATA;
        
        /* loop 2: build transdata array */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@@ -5748,13 -5749,10 +5749,13 @@@ static void createTransTrackingData(bCo
        ARegion *ar = CTX_wm_region(C);
        SpaceClip *sc = CTX_wm_space_clip(C);
        MovieClip *clip = ED_space_clip(sc);
 +      int width, height;
  
        t->total = 0;
  
 -      if (!clip || !BKE_movieclip_has_frame(clip, &sc->user))
 +      BKE_movieclip_get_size(clip, &sc->user, &width, &height);
 +
 +      if (!clip || width == 0 || height == 0)
                return;
  
        if (!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))