Fix for undo... it didn't do the UV coords (tface) nor the vertexpaint
authorTon Roosendaal <ton@blender.org>
Wed, 19 Nov 2003 22:00:14 +0000 (22:00 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 19 Nov 2003 22:00:14 +0000 (22:00 +0000)
colors. This because of the pretty weird (ab)use of load & make editmesh...

For each added undo step, the load_editmesh was fed with an empty mesh
to assign data to, without knowledge of what was in the original mesh.
That way UV and color data got lost.

Solved it in 2 steps:

1. removing the ->tface pointer from EditVlak, and make TFace a builtin
  struct inside EditVlak. This didnt cost much extra mem, since it already
  stored UV and color. This enabled some pretty cleanup in editmesh.c as
  well, storing tface pointers was cumbersome.
2. for each undo step, it then generates always a tface and mcol block to
  link to the undo Mesh.
  Even when it wasn't in the actual Mesh, at exit editmode the original
  Mesh is used as reference anyway, and undo-meshes are freed correctly.

The enormous commit is because I had to change the BLI_editVert.h file, and
found it was included in about every file unnecessary. I removed it there.
ALso found out that subsurf has code ready (unfinished) to make UV coords for
the displaylist in EditMode as well, nice to know for later...

47 files changed:
source/blender/blenkernel/intern/subsurf.c
source/blender/blenlib/BLI_editVert.h
source/blender/blenlib/intern/scanfill.c
source/blender/src/buttons_logic.c
source/blender/src/drawimage.c
source/blender/src/drawmesh.c
source/blender/src/drawobject.c
source/blender/src/drawoops.c
source/blender/src/drawscene.c
source/blender/src/drawseq.c
source/blender/src/drawsound.c
source/blender/src/drawtext.c
source/blender/src/drawview.c
source/blender/src/edit.c
source/blender/src/editarmature.c
source/blender/src/editcurve.c
source/blender/src/editdeform.c
source/blender/src/editfont.c
source/blender/src/editgroup.c
source/blender/src/editika.c
source/blender/src/editimasel.c
source/blender/src/editipo.c
source/blender/src/editkey.c
source/blender/src/editlattice.c
source/blender/src/editmball.c
source/blender/src/editmesh.c
source/blender/src/editobject.c
source/blender/src/editoops.c
source/blender/src/editseq.c
source/blender/src/editsima.c
source/blender/src/editview.c
source/blender/src/filesel.c
source/blender/src/headerbuttons.c
source/blender/src/imasel.c
source/blender/src/interface.c
source/blender/src/keyval.c
source/blender/src/mywindow.c
source/blender/src/oops.c
source/blender/src/playanim.c
source/blender/src/seqaudio.c
source/blender/src/sequence.c
source/blender/src/space.c
source/blender/src/toets.c
source/blender/src/toolbox.c
source/blender/src/usiblender.c
source/blender/src/view.c
source/blender/src/vpaint.c

index c04a8bf7369125d81ac315e310ab733eb3af5828..c00ba066761cd16f7b0bd207bb4ececb680fa686 100644 (file)
@@ -830,10 +830,10 @@ static DispList *hypermesh_to_displist(HyperMesh *hme, short flag) {
                if (hme->hasuvco) {
                        TFace *origtf, *tf= &dlm->tface[i];
                        
-                       if (hme->orig_me)
+                       //if (hme->orig_me)
                                origtf= &tfaces[f->orig.ind];
-                       else
-                               origtf= f->orig.ef->tface;
+                       //else          ton: removed, hme->hasuvco doesn't happen in editmode (yet?)
+                       //      origtf= f->orig.ef->tface;
                        
                        for (j=0; j<4; j++) {
                                Vec2Cpy(tf->uv[j], f->uvco[(j+voff)%4]);
index 8dcb19ab21432bda2960df158b1352dc3da8046a..757306ed7cb18b7bf58b8122ea535c627c5f382a 100644 (file)
@@ -63,9 +63,7 @@ typedef struct EditVlak
        struct EditVert *v1, *v2, *v3, *v4;
        struct EditEdge *e1, *e2, *e3, *e4;
        float n[3];
-       float uv[4][2];
-       unsigned int col[4];
-       struct TFace *tface;    /* a pointer to original tface. */
+       struct TFace tf;        /* a copy of original tface. */
        unsigned char mat_nr, flag;
        unsigned char f, f1;
 } EditVlak;
index 4b89694a795b531006c75e6e6ce7a2ca9793b328..ea51cebf9fed098d025b47d3e5af828ab337f349 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "BLI_util.h"
 #include "DNA_listBase.h"
+#include "DNA_mesh_types.h"
 #include "BLI_editVert.h"
 #include "BLI_arithb.h"
 #include "BLI_scanfill.h"
index 46190719af932eb5755e2850ece9d57102eafe59..024b164f524f9c9e8406fc64e244ec877a69c8df 100644 (file)
@@ -49,7 +49,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_action_types.h"
 #include "DNA_material_types.h"
index cd13b7eb920b5053f482f12299f8ed4402762ab6..9dd3bb375901209d53b52df679bfa5fc6a882c36 100644 (file)
@@ -46,7 +46,6 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 
 #include "IMB_imbuf_types.h"
 
index 1e69a438f30d5c86588de4064bf1d592b2b3ea11..225556e63af2ec6e3af519cf57bc80f8cbbcefc5 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "IMB_imbuf_types.h"
 
index 45a90581704a533818f0499f635d0e1d9d7393e7..cf0d29f4d7396aa953fcb856041e324c528c3419 100644 (file)
@@ -46,9 +46,6 @@
 
 #include "IMB_imbuf.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "MTC_matrixops.h"
 
 #include "DNA_view3d_types.h"
 #include "DNA_world_types.h"
 
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_editVert.h"
+
 #include "BKE_utildefines.h"
 #include "BKE_curve.h"
 #include "BKE_constraint.h" // for the get_constraint_target function
index 5297f260d38d1c71e945480b97e6fbad47c2a490..e96360f45eac23128891ae62a6fa9a0ad3f53714 100644 (file)
@@ -46,7 +46,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_ID.h"
 #include "DNA_mesh_types.h"
index 1ee6499fbe9e5b23b0746a23cba30b397cb616ae..06453f6dc0eb15632a11053e90a8b7a7db2336b8 100644 (file)
@@ -35,7 +35,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_scene_types.h"
 #include "DNA_space_types.h"
index 81da1d40b9f025709445cefc9b65377c8ab52aec..28b3d4126db42e446f6eb5265aa6df5014532228 100644 (file)
@@ -47,7 +47,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "IMB_imbuf_types.h"
 
index bafd27f083343f5de717e53f401e3206226f3b8b..77ad7eb6efc89f219c9b755eb365f97e568f16e7 100644 (file)
@@ -43,7 +43,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_scene_types.h"
 #include "DNA_sound_types.h"
index 0e00824b7e3abd7781c9dc9d12d0e60d5fdde96b..f6935a753733a957dbd4154b1fe028f79e52c125 100644 (file)
@@ -52,7 +52,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_text_types.h"
 #include "DNA_space_types.h"
index 8bad0b262ef03403a74a76ef4af647b99ed2128a..00a781e1a9b0be81e76c8722909895bb4c2fb53f 100644 (file)
 
 #include "BMF_Api.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
 #include "IMB_imbuf_types.h"
 
 #include "DNA_action_types.h"
@@ -66,6 +62,7 @@
 #include "DNA_group_types.h"
 #include "DNA_image_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_texture_types.h"
 #include "DNA_userdef_types.h"
 #include "DNA_space_types.h"
 
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_editVert.h"
+
 #include "BKE_action.h"
 #include "BKE_armature.h"
 #include "BKE_anim.h"
index 81dedcf0aeb10c5e325173f8f2872554a7b321f4..3fa195c1cb520f4decce50487131341e61b3c2f1 100644 (file)
 
 #include "BMF_Api.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
 #include "DNA_armature_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_lattice_types.h"
 #include "DNA_space_types.h"
 #include "DNA_view3d_types.h"
 
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_editVert.h"
+
 #include "BKE_utildefines.h"
 #include "BKE_anim.h"
 #include "BKE_object.h"
index 1df6d71750cb3af22a7ce4a10b9111f3d5eacd67..634a00be34db92e3573dbd5d511ddc55e4e1441d 100644 (file)
 
 #include "BMF_Api.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
 #include "DNA_action_types.h"
 #include "DNA_armature_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
 #include "DNA_view3d_types.h"
-#include "DNA_mesh_types.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_editVert.h"
 
 #include "BKE_utildefines.h"
 #include "BKE_action.h"
index 467f550e198d13a786f4d23a21bbd0d4d030f860..ceaaf27a12e373417864e398ab82bba042de0b61 100644 (file)
@@ -50,7 +50,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_curve_types.h"
 #include "DNA_ipo_types.h"
index 42b88556214aaece55450af027f89c83e1b2b985..73bc4d733189da389fdf4dedaf1710633528c4ba 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-
 #include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 
+#include "BLI_blenlib.h"
+#include "BLI_editVert.h"
+
 #include "BKE_global.h"
 #include "BKE_deform.h"
 #include "BKE_mesh.h"
index 2b7a484f57b56a0fdf55cf7b89afbe6a70ce7b16..b72ef190d77ac6691d3f0ca29baeb5bfc64a2c14 100644 (file)
@@ -46,7 +46,6 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 
 #include "DNA_curve_types.h"
 #include "DNA_object_types.h"
index 1338fb998b230f87a534384fc0ad94d95e53d571..f55f07986a427edf781d315cc2c166d18e619656 100644 (file)
@@ -36,7 +36,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_group_types.h"
 #include "DNA_object_types.h"
index bf94f3db3c95baf3d17744b2bda8eb51f4e22910..9c090f7eae1623483ff69bb20287ee82c4dc902a 100644 (file)
@@ -51,7 +51,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_object_types.h"
 #include "DNA_screen_types.h"
index 3c32dfb7e1d079f47b70561984dc77ca656ccd7b..d8e7b0453f93db989876ee62999d4cff6ea79c13 100644 (file)
@@ -49,7 +49,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
index 3f98ec4a4969c45609c88be51c1d70e15df57094..9d99c73b0853fd633d9c547a9b561f92e989fef7 100644 (file)
@@ -58,7 +58,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_constraint_types.h"
 #include "DNA_action_types.h"
index c554d2129775f6fd73f7c42b47d3fe62fbf25141..c7c5a0d2416eb7a0aa4a83acc53a322a6f63c602 100644 (file)
@@ -46,7 +46,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_curve_types.h"
 #include "DNA_ipo_types.h"
index 2c958d9211037ddef98dd3287a207672155bcdcb..4c5f660249eea8fd7f6705bb13015ba433b3a546 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
index 3244c04c903d12180fb352f7fdf53ffc3550a6de..32ef9cacb543e36f94f0639030aaaf949ed3d9be 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_screen_types.h"
 #include "DNA_meta_types.h"
index ee2055ad8234b58072329bfc31e633b77342d0f7..7b6b51dc77589b6fc8d1d95ba83d6b69491bd858 100644 (file)
 
 #include "PIL_time.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_rand.h"
-
 #include "MTC_matrixops.h"
 
 #include "DNA_mesh_types.h"
 #include "DNA_texture_types.h"
 #include "DNA_userdef_types.h"
 
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_editVert.h"
+#include "BLI_rand.h"
+
 #include "BKE_utildefines.h"
 #include "BKE_key.h"
 #include "BKE_object.h"
@@ -457,18 +457,16 @@ EditVlak *addvlaklist(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, Ed
 
        if(example) {
                evl->mat_nr= example->mat_nr;
-               evl->tface= example->tface;
+               evl->tf= example->tf;
                evl->flag= example->flag;
-               memcpy(evl->col, example->col, sizeof(example->col));
-               memcpy(evl->uv, example->uv, sizeof(example->uv));
        }
        else { 
                if (G.obedit && G.obedit->actcol)
                        evl->mat_nr= G.obedit->actcol-1;
-               default_uv(evl->uv, 1.0);
+               default_uv(evl->tf.uv, 1.0);
 
                /* Initialize colors */
-               evl->col[0]= evl->col[1]= evl->col[2]= evl->col[3]= vpaint_get_current_col();
+               evl->tf.col[0]= evl->tf.col[1]= evl->tf.col[2]= evl->tf.col[3]= vpaint_get_current_col();
        }
        
        BLI_addtail(&G.edvl, evl);
@@ -595,21 +593,17 @@ static void flipvlak(EditVlak *evl)
                SWAP(EditVert *, evl->v2, evl->v4);
                SWAP(EditEdge *, evl->e1, evl->e4);
                SWAP(EditEdge *, evl->e2, evl->e3);
-               SWAP(unsigned int, evl->col[1], evl->col[3]);
-               if(evl->tface) {
-                       SWAP(float, evl->uv[1][0], evl->uv[3][0]);
-                       SWAP(float, evl->uv[1][1], evl->uv[3][1]);
-               }
+               SWAP(unsigned int, evl->tf.col[1], evl->tf.col[3]);
+               SWAP(float, evl->tf.uv[1][0], evl->tf.uv[3][0]);
+               SWAP(float, evl->tf.uv[1][1], evl->tf.uv[3][1]);
        }
        else {
                SWAP(EditVert *, evl->v2, evl->v3);
                SWAP(EditEdge *, evl->e1, evl->e3);
-               SWAP(unsigned int, evl->col[1], evl->col[2]);
+               SWAP(unsigned int, evl->tf.col[1], evl->tf.col[2]);
                evl->e2->dir= 1-evl->e2->dir;
-               if(evl->tface) {
-                       SWAP(float, evl->uv[1][0], evl->uv[2][0]);
-                       SWAP(float, evl->uv[1][1], evl->uv[2][1]);
-               }
+               SWAP(float, evl->tf.uv[1][0], evl->tf.uv[2][0]);
+               SWAP(float, evl->tf.uv[1][1], evl->tf.uv[2][1]);
        }
        if(evl->v4) CalcNormFloat4(evl->v1->co, evl->v2->co, evl->v3->co, evl->v4->co, evl->n);
        else CalcNormFloat(evl->v1->co, evl->v2->co, evl->v3->co, evl->n);
@@ -1056,11 +1050,10 @@ void make_editMesh_real(Mesh *me)
                        evl= addvlaklist(eve1, eve2, eve3, eve4, NULL);
                        
                        if(evl) {
-                               if(mcol) memcpy(evl->col, mcol, 4*sizeof(int));
+                               if(mcol) memcpy(evl->tf.col, mcol, 4*sizeof(int));
 
                                if(me->tface) {
-                                       memcpy(evl->col, tface->col, sizeof(tface->col));
-                                       memcpy(evl->uv, tface->uv, sizeof(tface->uv));
+                                       evl->tf= *tface;
 
                                        if( tface->flag & TF_SELECT) {
                                                if(G.f & G_FACESELECT) {
@@ -1074,7 +1067,6 @@ void make_editMesh_real(Mesh *me)
                        
                                evl->mat_nr= mface->mat_nr;
                                evl->flag= mface->flag;
-                               evl->tface= tface;
                        }
 
                        if(me->tface) tface++;
@@ -1145,15 +1137,15 @@ static void fix_faceindices(MFace *mface, EditVlak *evl, int nr)
                        SWAP(int, mface->v1, mface->v2);
                        SWAP(int, mface->v2, mface->v3);
                        /* rotate face UV coordinates, too */
-                       UVCOPY(tmpuv, evl->uv[0]);
-                       UVCOPY(evl->uv[0], evl->uv[1]);
-                       UVCOPY(evl->uv[1], evl->uv[2]);
-                       UVCOPY(evl->uv[2], tmpuv);
+                       UVCOPY(tmpuv, evl->tf.uv[0]);
+                       UVCOPY(evl->tf.uv[0], evl->tf.uv[1]);
+                       UVCOPY(evl->tf.uv[1], evl->tf.uv[2]);
+                       UVCOPY(evl->tf.uv[2], tmpuv);
                        /* same with vertex colours */
-                       tmpcol = evl->col[0];
-                       evl->col[0] = evl->col[1];
-                       evl->col[1] = evl->col[2];
-                       evl->col[2] = tmpcol;
+                       tmpcol = evl->tf.col[0];
+                       evl->tf.col[0] = evl->tf.col[1];
+                       evl->tf.col[1] = evl->tf.col[2];
+                       evl->tf.col[2] = tmpcol;
 
                        
                        a= mface->edcode;
@@ -1174,19 +1166,19 @@ static void fix_faceindices(MFace *mface, EditVlak *evl, int nr)
                        SWAP(int, mface->v1, mface->v3);
                        SWAP(int, mface->v2, mface->v4);
                        /* swap UV coordinates */
-                       UVCOPY(tmpuv, evl->uv[0]);
-                       UVCOPY(evl->uv[0], evl->uv[2]);
-                       UVCOPY(evl->uv[2], tmpuv);
-                       UVCOPY(tmpuv, evl->uv[1]);
-                       UVCOPY(evl->uv[1], evl->uv[3]);
-                       UVCOPY(evl->uv[3], tmpuv);
+                       UVCOPY(tmpuv, evl->tf.uv[0]);
+                       UVCOPY(evl->tf.uv[0], evl->tf.uv[2]);
+                       UVCOPY(evl->tf.uv[2], tmpuv);
+                       UVCOPY(tmpuv, evl->tf.uv[1]);
+                       UVCOPY(evl->tf.uv[1], evl->tf.uv[3]);
+                       UVCOPY(evl->tf.uv[3], tmpuv);
                        /* swap vertex colours */
-                       tmpcol = evl->col[0];
-                       evl->col[0] = evl->col[2];
-                       evl->col[2] = tmpcol;
-                       tmpcol = evl->col[1];
-                       evl->col[1] = evl->col[3];
-                       evl->col[3] = tmpcol;
+                       tmpcol = evl->tf.col[0];
+                       evl->tf.col[0] = evl->tf.col[2];
+                       evl->tf.col[2] = tmpcol;
+                       tmpcol = evl->tf.col[1];
+                       evl->tf.col[1] = evl->tf.col[3];
+                       evl->tf.col[3] = tmpcol;
 
                        a= mface->edcode;
                        mface->edcode= 0;
@@ -1443,60 +1435,53 @@ void load_editMesh_real(Mesh *me, int undo)
                tex_space_mesh(me);
                if(actkey) mesh_to_key(me, actkey);
                
-               /* texmesh: using ->tface remake all */
-               if((me->tface && me->totface)||undo) {
+               /* tface block, always when undo even when it wasnt used, this because of empty me pointer */
+               if( (me->tface || undo) && me->totface ) {
                        TFace *tfn, *tf;
                        
                        tf=tfn= MEM_callocN(sizeof(TFace)*me->totface, "tface");
                        evl= G.edvl.first;
                        while(evl) {
                                
-                               if(evl->tface) *tf= *(evl->tface);
-                               else default_tface(tf);
-                               
-                               memcpy(tf->col, evl->col, sizeof(tf->col));
-                               memcpy(tf->uv, evl->uv, sizeof(tf->uv));
+                               *tf= evl->tf;
                                
                                if(G.f & G_FACESELECT) {
                                        if( vlakselectedAND(evl, 1) ) tf->flag |= TF_SELECT;
                                        else tf->flag &= ~TF_SELECT;
                                }
                                
-                               /* sometimes editmode doesn't free (before render) */
-/*                             evl->tface= tf; intrr: FIXME: Not sure about this one */
-
                                tf++;
                                evl= evl->next;
                        }
-                       
-                       /* MEM_freeN(me->tface); intrr: FIXME: Not sure either :) */
+                       /* if undo, me was empty */
+                       if(me->tface) MEM_freeN(me->tface);
                        me->tface= tfn;
                }
                else if(me->tface) {
-                       /* freeN(me->tface); */
-                       /* me->tface= 0; */
+                       MEM_freeN(me->tface);
+                       me->tface= NULL;
                }
                
-               /* mcol: using index numbers make again */
-               if(me->mcol && me->totface) {
+               /* mcol: same as tface... */
+               if( (me->mcol || undo) && me->totface) {
                        unsigned int *mcn, *mc;
                        
                        mc=mcn= MEM_mallocN(4*sizeof(int)*me->totface, "mcol");
                        evl= G.edvl.first;
                        while(evl) {
                        
-                               memcpy(mc, evl->col, 4*sizeof(int));
+                               memcpy(mc, evl->tf.col, 4*sizeof(int));
                                
                                mc+=4;
                                evl= evl->next;
                        }
                        
-                       MEM_freeN(me->mcol);
+                       if(me->mcol) MEM_freeN(me->mcol);
                        me->mcol= (MCol *)mcn;
                }
                else if(me->mcol) {
                        MEM_freeN(me->mcol);
-                       me->mcol= 0;
+                       me->mcol= NULL;
                }
        }
        
@@ -1711,15 +1696,13 @@ void convert_to_triface(int all)
                                evln= addvlaklist(evl->v1, evl->v2, evl->v3, 0, evl);
                                evln= addvlaklist(evl->v1, evl->v3, evl->v4, 0, evl);
 
-                               if(evl->tface) {
-                                       evln->uv[1][0]= evln->uv[2][0];
-                                       evln->uv[1][1]= evln->uv[2][1];
-                                       evln->uv[2][0]= evln->uv[3][0];
-                                       evln->uv[2][1]= evln->uv[3][1];
-                               }
+                               evln->tf.uv[1][0]= evln->tf.uv[2][0];
+                               evln->tf.uv[1][1]= evln->tf.uv[2][1];
+                               evln->tf.uv[2][0]= evln->tf.uv[3][0];
+                               evln->tf.uv[2][1]= evln->tf.uv[3][1];
                                
-                               evln->col[1]= evln->col[2];
-                               evln->col[2]= evln->col[3];
+                               evln->tf.col[1]= evln->tf.col[2];
+                               evln->tf.col[2]= evln->tf.col[3];
                                
                                BLI_remlink(&G.edvl, evl);
                                freevlak(evl);
@@ -3456,11 +3439,11 @@ static void set_wuv(int tot, EditVlak *evl, int v1, int v2, int v3, int v4)
        int a, v;
                                                /* Numbers corespond to verts (corner points),  */
                                                /* edge->vn's (center edges), the Center        */
-       memcpy(uvo, evl->uv, sizeof(uvo));      /* And the quincunx points of a face            */
-       uv= evl->uv[0];                         /* as shown here:                               */
+       memcpy(uvo, evl->tf.uv, sizeof(uvo));   /* And the quincunx points of a face            */
+       uv= evl->tf.uv[0];                              /* as shown here:                               */
                                                /*           2         5          1             */
-       memcpy(colo, evl->col, sizeof(colo));   /*               10         13                  */
-       col= evl->col;                          /*           6          9          8            */
+       memcpy(colo, evl->tf.col, sizeof(colo));        /*               10         13                  */
+       col= evl->tf.col;                               /*           6          9          8            */
                                                /*               11         12                  */
        if(tot==4) {                            /*           3          7          4            */
                for(a=0; a<4; a++, uv+=2, col++) {
@@ -5725,84 +5708,84 @@ static void givequadverts(EditVlak *evl, EditVlak *evl1, EditVert **v1, EditVert
        //if(evl->v1!=evl1->v1 && evl->v1!=evl1->v2 && evl->v1!=evl1->v3) {
                *v1= evl->v1;
                *v2= evl->v2;
-               uv[0] = evl->uv[0];
-               uv[1] = evl->uv[1];
-               col[0] = evl->col[0];
-               col[1] = evl->col[1];
+               uv[0] = evl->tf.uv[0];
+               uv[1] = evl->tf.uv[1];
+               col[0] = evl->tf.col[0];
+               col[1] = evl->tf.col[1];
        }
        else if VTEST(evl, 2, evl1) {
        //else if(evl->v2!=evl1->v1 && evl->v2!=evl1->v2 && evl->v2!=evl1->v3) {
                *v1= evl->v2;
                *v2= evl->v3;
-               uv[0] = evl->uv[1];
-               uv[1] = evl->uv[2];
-               col[0] = evl->col[1];
-               col[1] = evl->col[2];
+               uv[0] = evl->tf.uv[1];
+               uv[1] = evl->tf.uv[2];
+               col[0] = evl->tf.col[1];
+               col[1] = evl->tf.col[2];
        }
        else if VTEST(evl, 3, evl1) {
        // else if(evl->v3!=evl1->v1 && evl->v3!=evl1->v2 && evl->v3!=evl1->v3) {
                *v1= evl->v3;
                *v2= evl->v1;
-               uv[0] = evl->uv[2];
-               uv[1] = evl->uv[0];
-               col[0] = evl->col[2];
-               col[1] = evl->col[0];
+               uv[0] = evl->tf.uv[2];
+               uv[1] = evl->tf.uv[0];
+               col[0] = evl->tf.col[2];
+               col[1] = evl->tf.col[0];
        }
        
        if VTEST(evl1, 1, evl) {
        // if(evl1->v1!=evl->v1 && evl1->v1!=evl->v2 && evl1->v1!=evl->v3) {
                *v3= evl1->v1;
-               uv[2] = evl1->uv[0];
-               col[2] = evl1->col[0];
+               uv[2] = evl1->tf.uv[0];
+               col[2] = evl1->tf.col[0];
 
                *v4= evl1->v2;
-               uv[3] = evl1->uv[1];
-               col[3] = evl1->col[1];
+               uv[3] = evl1->tf.uv[1];
+               col[3] = evl1->tf.col[1];
 /*
 if(evl1->v2== *v2) {
                        *v4= evl1->v3;
-                       uv[3] = evl1->uv[2];
+                       uv[3] = evl1->tf.uv[2];
                } else {
                        *v4= evl1->v2;
-                       uv[3] = evl1->uv[1];
+                       uv[3] = evl1->tf.uv[1];
                }       
                */
        }
        else if VTEST(evl1, 2, evl) {
        // else if(evl1->v2!=evl->v1 && evl1->v2!=evl->v2 && evl1->v2!=evl->v3) {
                *v3= evl1->v2;
-               uv[2] = evl1->uv[1];
-               col[2] = evl1->col[1];
+               uv[2] = evl1->tf.uv[1];
+               col[2] = evl1->tf.col[1];
 
                *v4= evl1->v3;
-               uv[3] = evl1->uv[2];
-               col[3] = evl1->col[2];
+               uv[3] = evl1->tf.uv[2];
+               col[3] = evl1->tf.col[2];
 /*
 if(evl1->v3== *v2) {
                        *v4= evl1->v1;
-                       uv[3] = evl1->uv[0];
+                       uv[3] = evl1->tf.uv[0];
                } else {        
                        *v4= evl1->v3;
-                       uv[3] = evl1->uv[2];
+                       uv[3] = evl1->tf.uv[2];
                }       
                */
        }
        else if VTEST(evl1, 3, evl) {
        // else if(evl1->v3!=evl->v1 && evl1->v3!=evl->v2 && evl1->v3!=evl->v3) {
                *v3= evl1->v3;
-               uv[2] = evl1->uv[2];
-               col[2] = evl1->col[2];
+               uv[2] = evl1->tf.uv[2];
+               col[2] = evl1->tf.col[2];
 
                *v4= evl1->v1;
-               uv[3] = evl1->uv[0];
-               col[3] = evl1->col[0];
+               uv[3] = evl1->tf.uv[0];
+               col[3] = evl1->tf.col[0];
 /*
 if(evl1->v1== *v2) {
                        *v4= evl1->v2;
-                       uv[3] = evl1->uv[3];
+                       uv[3] = evl1->tf.uv[3];
                } else {        
                        *v4= evl1->v1;
-                       uv[3] = evl1->uv[0];
+                       uv[3] = evl1->tf.uv[0];
                }       
                */
        }
@@ -6003,13 +5986,13 @@ void join_triangles(void)
                                        if(exist_vlak(v1, v2, v3, v4)==0) {
                                                w = addvlaklist(v1, v2, v3, v4, evla[0]);
                                                untag_edges(w);
-                                               if (w->tface) {
-                                                       UVCOPY(w->uv[0], uv[0]);
-                                                       UVCOPY(w->uv[1], uv[1]);
-                                                       UVCOPY(w->uv[2], uv[2]);
-                                                       UVCOPY(w->uv[3], uv[3]);
-                                               }       
-                                               memcpy(w->col, col, sizeof(w->col));
+
+                                               UVCOPY(w->tf.uv[0], uv[0]);
+                                               UVCOPY(w->tf.uv[1], uv[1]);
+                                               UVCOPY(w->tf.uv[2], uv[2]);
+                                               UVCOPY(w->tf.uv[3], uv[3]);
+
+                                               memcpy(w->tf.col, col, sizeof(w->tf.col));
                                        }
                                        /* tag as to-be-removed */
                                        FACE_MARKCLEAR(evla[0]);
@@ -6098,21 +6081,21 @@ void edge_flip(void)
                                                        w = addvlaklist(v1, v2, v3, 0, evla[1]);
                                                        
                                                        untag_edges(w);
-                                                       if (w->tface) {
-                                                               UVCOPY(w->uv[0], uv[0]);
-                                                               UVCOPY(w->uv[1], uv[1]);
-                                                               UVCOPY(w->uv[2], uv[2]);
-                                                       }       
-                                                       w->col[0] = col[0]; w->col[1] = col[1]; w->col[2] = col[2]; 
+
+                                                       UVCOPY(w->tf.uv[0], uv[0]);
+                                                       UVCOPY(w->tf.uv[1], uv[1]);
+                                                       UVCOPY(w->tf.uv[2], uv[2]);
+
+                                                       w->tf.col[0] = col[0]; w->tf.col[1] = col[1]; w->tf.col[2] = col[2]; 
                                                        
                                                        w = addvlaklist(v1, v3, v4, 0, evla[1]);
                                                        untag_edges(w);
-                                                       if (w->tface) {
-                                                               UVCOPY(w->uv[0], uv[0]);
-                                                               UVCOPY(w->uv[1], uv[2]);
-                                                               UVCOPY(w->uv[2], uv[3]);
-                                                       }       
-                                                       w->col[0] = col[0]; w->col[1] = col[2]; w->col[2] = col[3]; 
+
+                                                       UVCOPY(w->tf.uv[0], uv[0]);
+                                                       UVCOPY(w->tf.uv[1], uv[2]);
+                                                       UVCOPY(w->tf.uv[2], uv[3]);
+
+                                                       w->tf.col[0] = col[0]; w->tf.col[1] = col[2]; w->tf.col[2] = col[3]; 
                                                        
                                                        /* erase old faces and edge */
                                                }
@@ -6247,19 +6230,19 @@ void beauty_fill(void)
                                 evl->f1= 1;
 
                                 w= addvlaklist(v1, v2, v3, 0, evl);
-                                if (w->tface) {
-                                    UVCOPY(w->uv[0], uv[0]);
-                                    UVCOPY(w->uv[1], uv[1]);
-                                    UVCOPY(w->uv[2], uv[2]);
-                                }
-                                w->col[0] = col[0]; w->col[1] = col[1]; w->col[2] = col[2];
+
+                                                               UVCOPY(w->tf.uv[0], uv[0]);
+                                                               UVCOPY(w->tf.uv[1], uv[1]);
+                                                               UVCOPY(w->tf.uv[2], uv[2]);
+
+                                w->tf.col[0] = col[0]; w->tf.col[1] = col[1]; w->tf.col[2] = col[2];
                                 w= addvlaklist(v1, v3, v4, 0, evl);
-                                if (w->tface) {
-                                    UVCOPY(w->uv[0], uv[0]);
-                                    UVCOPY(w->uv[1], uv[2]);
-                                    UVCOPY(w->uv[2], uv[3]);
-                                }
-                                w->col[0] = col[0]; w->col[1] = col[2]; w->col[2] = col[3];
+
+                                                               UVCOPY(w->tf.uv[0], uv[0]);
+                                                               UVCOPY(w->tf.uv[1], uv[2]);
+                                                               UVCOPY(w->tf.uv[2], uv[3]);
+
+                                w->tf.col[0] = col[0]; w->tf.col[1] = col[2]; w->tf.col[2] = col[3];
 
                                 onedone= 1;
                             }
@@ -6273,18 +6256,17 @@ void beauty_fill(void)
                                 evl->f1= 1;
 
                                 w= addvlaklist(v2, v3, v4, 0, evl);
-                                if (w->tface) {
-                                    UVCOPY(w->uv[0], uv[1]);
-                                    UVCOPY(w->uv[1], uv[3]);
-                                    UVCOPY(w->uv[2], uv[4]);
-                                }
+
+                                                               UVCOPY(w->tf.uv[0], uv[1]);
+                                                               UVCOPY(w->tf.uv[1], uv[3]);
+                                                               UVCOPY(w->tf.uv[2], uv[4]);
 
                                 w= addvlaklist(v1, v2, v4, 0, evl);
-                                if (w->tface) {
-                                    UVCOPY(w->uv[0], uv[0]);
-                                    UVCOPY(w->uv[1], uv[1]);
-                                    UVCOPY(w->uv[2], uv[3]);
-                                }
+
+                                                               UVCOPY(w->tf.uv[0], uv[0]);
+                                                               UVCOPY(w->tf.uv[1], uv[1]);
+                                                               UVCOPY(w->tf.uv[2], uv[3]);
+
                                 onedone= 1;
                             }
                         }
index 379bd003277c55b44581bc14b88ae037c6e8d5fe..d87307071d7e067af26ea3ccf2395f95d516810d 100644 (file)
 
 #include "BMF_Api.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_ghash.h"
 
 #include "IMB_imbuf_types.h"
 
 #include "DNA_vfont_types.h"
 #include "DNA_constraint_types.h"
 
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_editVert.h"
+#include "BLI_ghash.h"
+
 #include "BKE_nla.h"
 #include "BKE_utildefines.h"
 #include "BKE_anim.h"
index b747a21e5b0c3425a23863d1dc2f028639473096..787167ca038de4d6169496889c3b9b6a7c8229e8 100644 (file)
@@ -49,7 +49,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_material_types.h"
 #include "DNA_object_types.h"
index a8bbc01dc2aea784ad4512f6938a2b764b4dd490..9efc120f0654d5f8d75b97446ebeb677b4504055 100644 (file)
@@ -50,7 +50,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 #include "BLI_storage_types.h"
 
 #include "IMB_imbuf_types.h"
index 41f28870d5b5aab249b7d3694fd107f9246e843a..856eb8255ab55ddb22f9aa725bc5f32348c75bd2 100644 (file)
@@ -47,7 +47,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "IMB_imbuf_types.h"
 
index 946585a67948ee373fc22cdad308eb148984657c..b8585f0059c89d1d3463e1c65f51e483da88d6f3 100644 (file)
 #include "BLI_winstuff.h"
 #endif
 
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
 #include "IMB_imbuf.h"
 #include "PIL_time.h"
 
 #include "DNA_armature_types.h"
 #include "DNA_meta_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_lattice_types.h"
 #include "DNA_object_types.h"
 #include "DNA_view3d_types.h"
 #include "DNA_userdef_types.h"
 
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_editVert.h"
+
 #include "BKE_utildefines.h"
 #include "BKE_global.h"
 #include "BKE_armature.h"
index c0bbc6f1b3e5994c609105fa9022c52f8787cec3..1f5a212dec4b3cf06d6d52b7b8494e67aa1ca0fa 100644 (file)
@@ -55,7 +55,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 #include "BLI_linklist.h"
 #include "BLI_storage_types.h"
 #include "BLI_dynstr.h"
index 936bd2bb6af028181eba52bdef46c223e9be9f7f..0efd9d392acfc2e72cf6343fd1825d232570b697 100644 (file)
@@ -54,7 +54,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 #include "BLI_storage_types.h"
 
 #include "IMB_imbuf_types.h"
index 5ad53e15bf662a1adba62a8ac6fa4ab4b0643217..2c233bfe6138cc752e8bca50d508fbceefb70988 100644 (file)
@@ -50,7 +50,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
index 1ce9f58206364d1f88a428d5709b773ee6542807..17610e0857927040bfafc5b94ab4eac174bcc9f2 100644 (file)
@@ -64,7 +64,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
index 3b2a48e4ea5318c5349b61984c36ccf93931f439..79445fa7aa296d24e6594d4c3cf6c22ca84c86d9 100644 (file)
@@ -32,7 +32,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 #include "BIF_keyval.h"
 #include "blendef.h"
 #include "mydevice.h"
index 988d8c6dd72310d358858b88dd8f885912d1f8e5..ab7697e2fc51715ba47267ece3dc318771528397 100644 (file)
@@ -48,7 +48,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 #include "BLI_gsqueue.h"
 
 #include "DNA_screen_types.h"
index 75b41312d4105aae0499125a5c118d626755e6d1..fa6f1f3e992f0cb1a07691e5eb3ca29988431801 100644 (file)
@@ -35,7 +35,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_curve_types.h"
 #include "DNA_image_types.h"
index 77b64ddcb2d4bbb3bede57488761a05a61c41098..8fb67cc64f6c7d24452babcb2b1ceaa14913ddc1 100644 (file)
@@ -63,7 +63,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
index a9c0d3d5b32f53fa4a4038c98d2cb03d82807027..7a2d916716763c388e2af2e2dd23189c32e1dda3 100644 (file)
@@ -50,7 +50,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_screen_types.h"
 #include "DNA_sound_types.h"
index 6db18a7ed19b1cfd62c160f7969e61d7857e6503..14370cafb1c289c0c2ea8addc8a53925c53d5dae 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
index 098dc6e0cc33dc25e56125402277277c828a9501..0e4f004443faa4f200a0f39958b0190da6639a0e 100644 (file)
@@ -55,7 +55,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 #include "BLI_linklist.h"
 
 #include "DNA_action_types.h"
index 7c689e1abd677e3593899f421077214d60de4c5a..a7f884b620ddaa24242b88792d4aed788efb47e4 100644 (file)
@@ -54,7 +54,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_object_types.h"
 #include "DNA_screen_types.h"
index 73d6a25a082d1cd48d981d92c6d40e6ecd9731ff..25e7a5a961d582c2b389fb447bf1793c2d9c3c18 100644 (file)
@@ -66,7 +66,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "BKE_plugin_types.h"
 #include "BKE_utildefines.h"
index 04eaa6caffc4c8814096fc5f6862375d0a8cbace..b2e0f0a171c2beaecd54d7c59c59ffce483d5b40 100644 (file)
@@ -56,7 +56,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 #include "BLI_linklist.h"
 
 #include "IMB_imbuf_types.h"
index 2d45884d6cd8007ff2c4bd64547eed7d7797d1c3..7f0526b6b51b5e2c1ca76a9b3991a59b1ee3d35e 100644 (file)
@@ -48,7 +48,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 
 #include "DNA_object_types.h"
 #include "DNA_screen_types.h"
index 6d780e6eb312f7aa1676890c118c6d63b65c7ce8..e1222394518da55755df6e3c15fb2354c149a85f 100644 (file)
@@ -50,7 +50,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
-#include "BLI_editVert.h"
 #include "MTC_matrixops.h"
 
 #include "DNA_mesh_types.h"