Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2003-11-20 01:00:14 +0300
committerTon Roosendaal <ton@blender.org>2003-11-20 01:00:14 +0300
commit4a5ae4a55f7bf4f4bc4355899ec5eaaa0af32d0c (patch)
tree336ccad8951553545b13c2b2285e0ee8f4795364 /source/blender
parent4347b1a7526d57703dc9213af71d402fd8f8a572 (diff)
Fix for undo... it didn't do the UV coords (tface) nor the vertexpaint
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...
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/subsurf.c6
-rw-r--r--source/blender/blenlib/BLI_editVert.h4
-rw-r--r--source/blender/blenlib/intern/scanfill.c1
-rw-r--r--source/blender/src/buttons_logic.c1
-rw-r--r--source/blender/src/drawimage.c1
-rw-r--r--source/blender/src/drawmesh.c1
-rw-r--r--source/blender/src/drawobject.c7
-rw-r--r--source/blender/src/drawoops.c1
-rw-r--r--source/blender/src/drawscene.c1
-rw-r--r--source/blender/src/drawseq.c1
-rw-r--r--source/blender/src/drawsound.c1
-rw-r--r--source/blender/src/drawtext.c1
-rw-r--r--source/blender/src/drawview.c9
-rw-r--r--source/blender/src/edit.c8
-rw-r--r--source/blender/src/editarmature.c10
-rw-r--r--source/blender/src/editcurve.c1
-rw-r--r--source/blender/src/editdeform.c6
-rw-r--r--source/blender/src/editfont.c1
-rw-r--r--source/blender/src/editgroup.c1
-rw-r--r--source/blender/src/editika.c1
-rw-r--r--source/blender/src/editimasel.c1
-rw-r--r--source/blender/src/editipo.c1
-rw-r--r--source/blender/src/editkey.c1
-rw-r--r--source/blender/src/editlattice.c1
-rw-r--r--source/blender/src/editmball.c1
-rw-r--r--source/blender/src/editmesh.c274
-rw-r--r--source/blender/src/editobject.c9
-rw-r--r--source/blender/src/editoops.c1
-rw-r--r--source/blender/src/editseq.c1
-rw-r--r--source/blender/src/editsima.c1
-rw-r--r--source/blender/src/editview.c9
-rw-r--r--source/blender/src/filesel.c1
-rw-r--r--source/blender/src/headerbuttons.c1
-rw-r--r--source/blender/src/imasel.c1
-rw-r--r--source/blender/src/interface.c1
-rw-r--r--source/blender/src/keyval.c1
-rw-r--r--source/blender/src/mywindow.c1
-rw-r--r--source/blender/src/oops.c1
-rw-r--r--source/blender/src/playanim.c1
-rw-r--r--source/blender/src/seqaudio.c1
-rw-r--r--source/blender/src/sequence.c1
-rw-r--r--source/blender/src/space.c1
-rw-r--r--source/blender/src/toets.c1
-rw-r--r--source/blender/src/toolbox.c1
-rw-r--r--source/blender/src/usiblender.c1
-rw-r--r--source/blender/src/view.c1
-rw-r--r--source/blender/src/vpaint.c1
47 files changed, 164 insertions, 215 deletions
diff --git a/source/blender/blenkernel/intern/subsurf.c b/source/blender/blenkernel/intern/subsurf.c
index c04a8bf7369..c00ba066761 100644
--- a/source/blender/blenkernel/intern/subsurf.c
+++ b/source/blender/blenkernel/intern/subsurf.c
@@ -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]);
diff --git a/source/blender/blenlib/BLI_editVert.h b/source/blender/blenlib/BLI_editVert.h
index 8dcb19ab214..757306ed7cb 100644
--- a/source/blender/blenlib/BLI_editVert.h
+++ b/source/blender/blenlib/BLI_editVert.h
@@ -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;
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 4b89694a795..ea51cebf9fe 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -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"
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index 46190719af9..024b164f524 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -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"
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index cd13b7eb920..9dd3bb37590 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -46,7 +46,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c
index 1e69a438f30..225556e63af 100644
--- a/source/blender/src/drawmesh.c
+++ b/source/blender/src/drawmesh.c
@@ -45,7 +45,6 @@
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
-#include "BLI_editVert.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 45a90581704..cf0d29f4d73 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -46,9 +46,6 @@
#include "IMB_imbuf.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
#include "MTC_matrixops.h"
@@ -69,6 +66,10 @@
#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
diff --git a/source/blender/src/drawoops.c b/source/blender/src/drawoops.c
index 5297f260d38..e96360f45ea 100644
--- a/source/blender/src/drawoops.c
+++ b/source/blender/src/drawoops.c
@@ -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"
diff --git a/source/blender/src/drawscene.c b/source/blender/src/drawscene.c
index 1ee6499fbe9..06453f6dc0e 100644
--- a/source/blender/src/drawscene.c
+++ b/source/blender/src/drawscene.c
@@ -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"
diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c
index 81da1d40b9f..28b3d4126db 100644
--- a/source/blender/src/drawseq.c
+++ b/source/blender/src/drawseq.c
@@ -47,7 +47,6 @@
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
-#include "BLI_editVert.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/src/drawsound.c b/source/blender/src/drawsound.c
index bafd27f0833..77ad7eb6efc 100644
--- a/source/blender/src/drawsound.c
+++ b/source/blender/src/drawsound.c
@@ -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"
diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c
index 0e00824b7e3..f6935a75373 100644
--- a/source/blender/src/drawtext.c
+++ b/source/blender/src/drawtext.c
@@ -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"
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 8bad0b262ef..00a781e1a9b 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -53,10 +53,6 @@
#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"
@@ -73,6 +70,10 @@
#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"
diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c
index 81dedcf0aeb..3fa195c1cb5 100644
--- a/source/blender/src/edit.c
+++ b/source/blender/src/edit.c
@@ -46,10 +46,6 @@
#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"
@@ -61,6 +57,10 @@
#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"
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 1df6d71750c..634a00be34d 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -47,18 +47,18 @@
#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"
diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c
index 467f550e198..ceaaf27a12e 100644
--- a/source/blender/src/editcurve.c
+++ b/source/blender/src/editcurve.c
@@ -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"
diff --git a/source/blender/src/editdeform.c b/source/blender/src/editdeform.c
index 42b88556214..73bc4d73318 100644
--- a/source/blender/src/editdeform.c
+++ b/source/blender/src/editdeform.c
@@ -35,12 +35,12 @@
#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"
diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c
index 2b7a484f57b..b72ef190d77 100644
--- a/source/blender/src/editfont.c
+++ b/source/blender/src/editfont.c
@@ -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"
diff --git a/source/blender/src/editgroup.c b/source/blender/src/editgroup.c
index 1338fb998b2..f55f07986a4 100644
--- a/source/blender/src/editgroup.c
+++ b/source/blender/src/editgroup.c
@@ -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"
diff --git a/source/blender/src/editika.c b/source/blender/src/editika.c
index bf94f3db3c9..9c090f7eae1 100644
--- a/source/blender/src/editika.c
+++ b/source/blender/src/editika.c
@@ -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"
diff --git a/source/blender/src/editimasel.c b/source/blender/src/editimasel.c
index 3c32dfb7e1d..d8e7b0453f9 100644
--- a/source/blender/src/editimasel.c
+++ b/source/blender/src/editimasel.c
@@ -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"
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 3f98ec4a496..9d99c73b085 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -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"
diff --git a/source/blender/src/editkey.c b/source/blender/src/editkey.c
index c554d212977..c7c5a0d2416 100644
--- a/source/blender/src/editkey.c
+++ b/source/blender/src/editkey.c
@@ -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"
diff --git a/source/blender/src/editlattice.c b/source/blender/src/editlattice.c
index 2c958d92110..4c5f660249e 100644
--- a/source/blender/src/editlattice.c
+++ b/source/blender/src/editlattice.c
@@ -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"
diff --git a/source/blender/src/editmball.c b/source/blender/src/editmball.c
index 3244c04c903..32ef9cacb54 100644
--- a/source/blender/src/editmball.c
+++ b/source/blender/src/editmball.c
@@ -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"
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index ee2055ad823..7b6b51dc775 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -48,11 +48,6 @@
#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"
@@ -65,6 +60,11 @@
#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;
}
}
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 379bd003277..d87307071d7 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -54,10 +54,6 @@
#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"
@@ -83,6 +79,11 @@
#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"
diff --git a/source/blender/src/editoops.c b/source/blender/src/editoops.c
index b747a21e5b0..787167ca038 100644
--- a/source/blender/src/editoops.c
+++ b/source/blender/src/editoops.c
@@ -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"
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c
index a8bbc01dc2a..9efc120f065 100644
--- a/source/blender/src/editseq.c
+++ b/source/blender/src/editseq.c
@@ -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"
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
index 41f28870d5b..856eb8255ab 100644
--- a/source/blender/src/editsima.c
+++ b/source/blender/src/editsima.c
@@ -47,7 +47,6 @@
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
-#include "BLI_editVert.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index 946585a6794..b8585f0059c 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -44,15 +44,12 @@
#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"
@@ -61,6 +58,10 @@
#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"
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index c0bbc6f1b3e..1f5a212dec4 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -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"
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index 936bd2bb6af..0efd9d392ac 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -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"
diff --git a/source/blender/src/imasel.c b/source/blender/src/imasel.c
index 5ad53e15bf6..2c233bfe613 100644
--- a/source/blender/src/imasel.c
+++ b/source/blender/src/imasel.c
@@ -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"
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 1ce9f582063..17610e08579 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -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"
diff --git a/source/blender/src/keyval.c b/source/blender/src/keyval.c
index 3b2a48e4ea5..79445fa7aa2 100644
--- a/source/blender/src/keyval.c
+++ b/source/blender/src/keyval.c
@@ -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"
diff --git a/source/blender/src/mywindow.c b/source/blender/src/mywindow.c
index 988d8c6dd72..ab7697e2fc5 100644
--- a/source/blender/src/mywindow.c
+++ b/source/blender/src/mywindow.c
@@ -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"
diff --git a/source/blender/src/oops.c b/source/blender/src/oops.c
index 75b41312d41..fa6f1f3e992 100644
--- a/source/blender/src/oops.c
+++ b/source/blender/src/oops.c
@@ -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"
diff --git a/source/blender/src/playanim.c b/source/blender/src/playanim.c
index 77b64ddcb2d..8fb67cc64f6 100644
--- a/source/blender/src/playanim.c
+++ b/source/blender/src/playanim.c
@@ -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"
diff --git a/source/blender/src/seqaudio.c b/source/blender/src/seqaudio.c
index a9c0d3d5b32..7a2d9167167 100644
--- a/source/blender/src/seqaudio.c
+++ b/source/blender/src/seqaudio.c
@@ -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"
diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c
index 6db18a7ed19..14370cafb1c 100644
--- a/source/blender/src/sequence.c
+++ b/source/blender/src/sequence.c
@@ -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"
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 098dc6e0cc3..0e4f004443f 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -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"
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index 7c689e1abd6..a7f884b620d 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -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"
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index 73d6a25a082..25e7a5a961d 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -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"
diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c
index 04eaa6caffc..b2e0f0a171c 100644
--- a/source/blender/src/usiblender.c
+++ b/source/blender/src/usiblender.c
@@ -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"
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index 2d45884d6cd..7f0526b6b51 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -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"
diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c
index 6d780e6eb31..e1222394518 100644
--- a/source/blender/src/vpaint.c
+++ b/source/blender/src/vpaint.c
@@ -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"