bmesh todo. making an image local wasn't dealing with mesh polygon texface data.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 16 Feb 2012 12:19:02 +0000 (12:19 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 16 Feb 2012 12:19:02 +0000 (12:19 +0000)
source/blender/blenkernel/intern/image.c
source/blender/bmesh/operators/bmo_mirror.c

index 584efc2d3dafe8e64faad2ab8d475a3b97db1899..f848ee3a6764ac6154e90c38c99be46d2a00ab71 100644 (file)
@@ -327,8 +327,6 @@ static void extern_local_image(Image *UNUSED(ima))
           match id_make_local pattern. */
 }
 
-/* BMESH_TODO - MTexPoly, currently this function only does 'me->mtface' */
-
 void make_local_image(struct Image *ima)
 {
        Main *bmain= G.main;
@@ -384,6 +382,25 @@ void make_local_image(struct Image *ima)
                                }
                        }
                }
+
+               if(me->mtpoly) {
+                       MTexPoly *mtpoly;
+                       int a, i;
+
+                       for(i=0; i<me->pdata.totlayer; i++) {
+                               if(me->pdata.layers[i].type == CD_MTEXPOLY) {
+                                       mtpoly= (MTexPoly*)me->pdata.layers[i].data;
+
+                                       for(a=0; a<me->totpoly; a++, mtpoly++) {
+                                               if(mtpoly->tpage == ima) {
+                                                       if(me->id.lib) is_lib= TRUE;
+                                                       else is_local= TRUE;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
        }
 
        if(is_local && is_lib == FALSE) {
@@ -445,6 +462,28 @@ void make_local_image(struct Image *ima)
                                        }
                                }
                        }
+
+                       if(me->mtpoly) {
+                               MTexPoly *mtpoly;
+                               int a, i;
+
+                               for(i=0; i<me->pdata.totlayer; i++) {
+                                       if(me->pdata.layers[i].type == CD_MTEXPOLY) {
+                                               mtpoly= (MTexPoly*)me->pdata.layers[i].data;
+
+                                               for(a=0; a<me->totpoly; a++, mtpoly++) {
+                                                       if(mtpoly->tpage == ima) {
+                                                               mtpoly->tpage = ima_new;
+                                                               if(ima_new->id.us == 0) {
+                                                                       mtpoly->tpage->id.us= 1;
+                                                               }
+                                                               id_lib_extern((ID*)ima_new);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+
                        me= me->id.next;
                }
        }
index 29a74b9f02acf33c8e83e7e328f8c4c452c96fab..82e77fc9a96a428a9aed021b64de5d1e57b4dd3b 100644 (file)
@@ -69,7 +69,7 @@ void bmesh_mirror_exec(BMesh *bm, BMOperator *op)
                BLI_array_growone(vmap);
                vmap[i] = v;
 
-               /* BMESH_TODO, double check this is being made dirty, 99% sure it is - campbell */
+               /* BMESH_TODO, double check this is being used, calling following operators will overwrite anyway - campbell */
                BM_elem_index_set(v2, i); /* set_dirty! */
                v2 = BM_iter_step(&iter);