Quite a large one this time... but now we have:
authorTon Roosendaal <ton@blender.org>
Thu, 8 Jul 2004 20:38:27 +0000 (20:38 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 8 Jul 2004 20:38:27 +0000 (20:38 +0000)
Edges in Mesh
- adds automatic when you use creases. For other situations; call the
  void make_edges(Mesh *me) in mesh.c. Of course, once in editmode the
  edges are automatically recreated.
- in F9 buttons you can add/remove edges too
- both for Mesh and DisplistMesh, so it speeds up drawing quite some in
  wireframe
- render for edges can't work... edges have no material nor tface nor col..
  so here still the faces are rendered in wire

Creases in Subsurf
- based on the code by Chris McFarlen
- main changes is that now edges are used, saving quite some data in file
- use SHIFT+E in editmode to set edges-sharpness. values go from 0-1
- in F9 buttons you can set draw-crease mode. It draws now blended from
  wire color to edge-select color (as provided in Theme)

Known issue: setting sharpness on 1 cube (subdiv 2) gives weird results
with some values... Chris, can you check?

Further; code cleanups, changing 0 in NULL when needed, no warnings, etc etc

32 files changed:
source/blender/blenkernel/BKE_displist.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/subsurf.c
source/blender/blenlib/BLI_editVert.h
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/include/BDR_editobject.h
source/blender/include/BIF_editmesh.h
source/blender/include/butspace.h
source/blender/makesdna/DNA_curve_types.h
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesdna/DNA_meshdata_types.h
source/blender/render/intern/source/renderHelp.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/texture.c
source/blender/render/intern/source/zbuf.c
source/blender/renderconverter/intern/convertBlenderScene.c
source/blender/src/buttons_editing.c
source/blender/src/drawmesh.c
source/blender/src/drawobject.c
source/blender/src/editcurve.c
source/blender/src/editmesh.c
source/blender/src/editobject.c
source/blender/src/interface_draw.c
source/blender/src/space.c
source/blender/yafray/intern/yafray_Render.h

index 18b421f17807fece8f00795ddb9f8618926f59a3..8b258a69862b6f9cb058cd957d350b246b277901 100644 (file)
@@ -64,8 +64,9 @@ struct EditMesh;
 
 typedef struct DispListMesh DispListMesh;
 struct DispListMesh {
 
 typedef struct DispListMesh DispListMesh;
 struct DispListMesh {
-       int totvert, totface;
+       int totvert, totedge, totface;
        struct MVert *mvert;
        struct MVert *mvert;
+       struct MEdge *medge;
        struct MCol *mcol;
        struct MFace *mface;
        struct TFace *tface;
        struct MCol *mcol;
        struct MFace *mface;
        struct TFace *tface;
@@ -102,11 +103,6 @@ typedef struct DispList {
        unsigned int *col1, *col2;
        struct DispListMesh *mesh;
        
        unsigned int *col1, *col2;
        struct DispListMesh *mesh;
        
-       /* Begin NASTY_NLA_STUFF */
-//     int *offset, *run;      /* Used to index into the bone & weight lists */
-//     struct Bone *bones;
-//     float *weights;
-       /* End NASTY_NLA_STUFF */
 } DispList;
 
 extern void copy_displist(struct ListBase *lbn, struct ListBase *lb);
 } DispList;
 
 extern void copy_displist(struct ListBase *lbn, struct ListBase *lb);
index 66b103d571a5a6665935f16c8ab1dcf91e86a46b..7586f14c894a40d8a721411a9b3f2fb5d74a18e4 100644 (file)
@@ -186,6 +186,7 @@ typedef struct Global {
 #define G_TEXTUREPAINT 65536
 #define G_NOFROZEN     (1 << 17) // frozen modules inactive
 #define G_DRAWEDGES    (1 << 18)
 #define G_TEXTUREPAINT 65536
 #define G_NOFROZEN     (1 << 17) // frozen modules inactive
 #define G_DRAWEDGES    (1 << 18)
+#define G_DRAWCREASES  (1 << 19)
 
 /* G.fileflags */
 
 
 /* G.fileflags */
 
index e9edf8a770a4f1a00778dadc47440efe4b82eeb5..2bbe0a5fdca668e74728031445b0df297dca5f11 100644 (file)
@@ -78,6 +78,8 @@ int update_realtime_texture(struct TFace *tface, double time);
 void mesh_delete_material_index(struct Mesh *me, int index);
 void mesh_set_smooth_flag(struct Mesh *me, int enableSmooth);
 
 void mesh_delete_material_index(struct Mesh *me, int index);
 void mesh_set_smooth_flag(struct Mesh *me, int enableSmooth);
 
+void make_edges(struct Mesh *me);
+
        /** Generate the mesh vertex normals by averaging over connected faces.
         *
         * @param me The mesh to update.
        /** Generate the mesh vertex normals by averaging over connected faces.
         *
         * @param me The mesh to update.
index d0a90c33350c4a608644a1d64a5a156e3954c9bf..fc7953c051d03cf0de47a9043ca4bd607192376a 100644 (file)
@@ -494,7 +494,7 @@ void free_duplilist()
 {
        Object *ob;
        
 {
        Object *ob;
        
-       while( ob= duplilist.first) {
+       while( (ob= duplilist.first) ) {
                BLI_remlink(&duplilist, ob);
                MEM_freeN(ob);
        }
                BLI_remlink(&duplilist, ob);
                MEM_freeN(ob);
        }
@@ -509,7 +509,7 @@ void make_duplilist(Scene *sce, Object *ob)
                if(ob->transflag & OB_DUPLIVERTS) {
                        if(ob->type==OB_MESH) {
                                if(ob->transflag & OB_DUPLIVERTS) {
                if(ob->transflag & OB_DUPLIVERTS) {
                        if(ob->type==OB_MESH) {
                                if(ob->transflag & OB_DUPLIVERTS) {
-                                       if( paf=give_parteff(ob) ) particle_duplilist(sce, ob, paf);
+                                       if( (paf=give_parteff(ob)) ) particle_duplilist(sce, ob, paf);
                                        else vertex_duplilist(sce, ob);
                                }
                        }
                                        else vertex_duplilist(sce, ob);
                                }
                        }
index 4ffb18eb8d3bdf7014c49b6655e1ccd48baf5703..530442f03a9e58cb7e1d6db9f2eff44d6238812a 100644 (file)
@@ -210,6 +210,7 @@ void displistmesh_free(DispListMesh *dlm)
 {
        // also check on mvert and mface, can be NULL after decimator (ton)
        if( dlm->mvert) MEM_freeN(dlm->mvert);
 {
        // also check on mvert and mface, can be NULL after decimator (ton)
        if( dlm->mvert) MEM_freeN(dlm->mvert);
+       if( dlm->medge) MEM_freeN(dlm->medge);
        if (dlm->mface) MEM_freeN(dlm->mface);
        if (dlm->mcol) MEM_freeN(dlm->mcol);
        if (dlm->tface) MEM_freeN(dlm->tface);
        if (dlm->mface) MEM_freeN(dlm->mface);
        if (dlm->mcol) MEM_freeN(dlm->mcol);
        if (dlm->tface) MEM_freeN(dlm->tface);
index 3369611a5b0200480916ef8897eff15089297dd4..4e9096b9768370933d19cba883ddd753281c7de3 100644 (file)
@@ -1120,11 +1120,6 @@ void build_particle_system(Object *ob)
        /* init */
        give_mesh_mvert(me, totpart, co, no,paf->seed);
 
        /* init */
        give_mesh_mvert(me, totpart, co, no,paf->seed);
 
-       if(me->disp.first) {
-               DispList *dl= me->disp.first;
-               if(dl->type==DL_MESH) printf("from disp\n");
-       }
-
        printf("\n");
        printf("Calculating particles......... \n");
 
        printf("\n");
        printf("Calculating particles......... \n");
 
index 539468fd81f3af9879906b05d04c0d906ab7ec3b..eb52689019a429383a9cadffd9087ddb654ffd55 100644 (file)
@@ -53,7 +53,6 @@
 
 #include "DNA_packedFile_types.h"
 #include "DNA_curve_types.h"
 
 #include "DNA_packedFile_types.h"
 #include "DNA_curve_types.h"
-#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_view3d_types.h"
 #include "DNA_vfont_types.h"
 #include "DNA_object_types.h"
 #include "DNA_view3d_types.h"
 #include "DNA_vfont_types.h"
@@ -241,7 +240,7 @@ static void buildchar(Curve *cu, unsigned char ascii, float ofsx, float ofsy, fl
                        nu2->resolu= cu->resolu;
                        nu2->bp = 0;
                        nu2->knotsu = nu2->knotsv = 0;
                        nu2->resolu= cu->resolu;
                        nu2->bp = 0;
                        nu2->knotsu = nu2->knotsv = 0;
-                       nu2->flag= ME_SMOOTH;
+                       nu2->flag= CU_SMOOTH;
                        /* nu2->trim.first = 0; */
                        /* nu2->trim.last = 0; */
                        i = nu2->pntsu;
                        /* nu2->trim.first = 0; */
                        /* nu2->trim.last = 0; */
                        i = nu2->pntsu;
index b8fb750e74cfd3d314db7f5895e8f4668734ac51..d920961798d6041d96bdbe59b913408aecbbf036 100644 (file)
@@ -162,14 +162,18 @@ void free_mesh(Mesh *me)
 
        unlink_mesh(me);
 
 
        unlink_mesh(me);
 
-       if(me->mat) MEM_freeN(me->mat);
-       if(me->orco) MEM_freeN(me->orco);
+       if(me->mvert) MEM_freeN(me->mvert);
+       if(me->medge) MEM_freeN(me->medge);
        if(me->mface) MEM_freeN(me->mface);
        if(me->mface) MEM_freeN(me->mface);
+       
        if(me->tface) MEM_freeN(me->tface);
        if(me->tface) MEM_freeN(me->tface);
-       if(me->mvert) MEM_freeN(me->mvert);
        if(me->dvert) free_dverts(me->dvert, me->totvert);
        if(me->mcol) MEM_freeN(me->mcol);
        if(me->msticky) MEM_freeN(me->msticky);
        if(me->dvert) free_dverts(me->dvert, me->totvert);
        if(me->mcol) MEM_freeN(me->mcol);
        if(me->msticky) MEM_freeN(me->msticky);
+
+       if(me->mat) MEM_freeN(me->mat);
+       if(me->orco) MEM_freeN(me->orco);
+
        if(me->bb) MEM_freeN(me->bb);
        if(me->disp.first) freedisplist(&me->disp);
 }
        if(me->bb) MEM_freeN(me->bb);
        if(me->disp.first) freedisplist(&me->disp);
 }
@@ -238,13 +242,13 @@ Mesh *copy_mesh(Mesh *me)
                id_us_plus((ID *)men->mat[a]);
        }
        id_us_plus((ID *)men->texcomesh);
                id_us_plus((ID *)men->mat[a]);
        }
        id_us_plus((ID *)men->texcomesh);
-       men->mface= MEM_dupallocN(me->mface);
 
 
+       men->mvert= MEM_dupallocN(me->mvert);
+       men->medge= MEM_dupallocN(me->medge);
+       men->mface= MEM_dupallocN(me->mface);
        men->tface= MEM_dupallocN(me->tface);
        men->tface= MEM_dupallocN(me->tface);
+       men->dface= NULL;
 
 
-       men->dface= 0;
-       men->mvert= MEM_dupallocN(me->mvert);
-       memcpy (men->mvert, me->mvert, sizeof (MVert)*me->totvert);
        if (me->dvert){
                men->dvert = MEM_mallocN (sizeof (MDeformVert)*me->totvert, "MDeformVert");
                copy_dverts(men->dvert, me->dvert, me->totvert);
        if (me->dvert){
                men->dvert = MEM_mallocN (sizeof (MDeformVert)*me->totvert, "MDeformVert");
                copy_dverts(men->dvert, me->dvert, me->totvert);
@@ -252,8 +256,8 @@ Mesh *copy_mesh(Mesh *me)
 
        men->mcol= MEM_dupallocN(me->mcol);
        men->msticky= MEM_dupallocN(me->msticky);
 
        men->mcol= MEM_dupallocN(me->mcol);
        men->msticky= MEM_dupallocN(me->msticky);
-       men->texcomesh= 0;
-       men->orco= 0;
+       men->texcomesh= NULL;
+       men->orco= NULL;
        men->bb= MEM_dupallocN(men->bb);
        
        copy_displist(&men->disp, &me->disp);
        men->bb= MEM_dupallocN(men->bb);
        
        copy_displist(&men->disp, &me->disp);
@@ -784,6 +788,113 @@ void set_mesh(Object *ob, Mesh *me)
        test_object_materials((ID *)me);
 }
 
        test_object_materials((ID *)me);
 }
 
+/* ************** make edges in a Mesh, for outside of editmode */
+
+struct edgesort {
+       int v1, v2;
+       int flag;
+};
+
+/* edges have to be added with lowest index first for sorting */
+static void to_edgesort(struct edgesort *ed, int v1, int v2, int flag)
+{
+       if(v1<v2) {
+               ed->v1= v1; ed->v2= v2;
+       }
+       else {
+               ed->v1= v2; ed->v2= v1;
+       }
+       ed->flag= flag;
+}
+
+static int vergedgesort(const void *v1, const void *v2)
+{
+       const struct edgesort *x1=v1, *x2=v2;
+
+       if( x1->v1 > x2->v1) return 1;
+       else if( x1->v1 < x2->v1) return -1;
+       else if( x1->v2 > x2->v2) return 1;
+       else if( x1->v2 < x2->v2) return -1;
+       
+       return 0;
+}
+
+
+void make_edges(Mesh *me)
+{
+       MFace *mface;
+       MEdge *medge;
+       struct edgesort *edsort, *ed;
+       int a, totedge=0, final=0;
+       
+       /* we put all edges in array, sort them, and detect doubles that way */
+       
+       for(a= me->totface, mface= me->mface; a>0; a--, mface++) {
+               if(mface->v4) totedge+=4;
+               else if(mface->v3) totedge+=3;
+               else totedge+=1;
+       }
+       
+       if(totedge==0) return;
+       
+       ed= edsort= MEM_mallocN(totedge*sizeof(struct edgesort), "edgesort");
+       
+       for(a= me->totface, mface= me->mface; a>0; a--, mface++) {
+               
+               to_edgesort(ed, mface->v1, mface->v2, mface->edcode & ME_V1V2);
+               ed++;
+               if(mface->v4) {
+                       to_edgesort(ed, mface->v2, mface->v3, mface->edcode & ME_V2V3);
+                       ed++;
+                       to_edgesort(ed, mface->v3, mface->v4, mface->edcode & ME_V3V4);
+                       ed++;
+                       to_edgesort(ed, mface->v4, mface->v1, mface->edcode & ME_V4V1);
+                       ed++;
+               }
+               else if(mface->v3) {
+                       to_edgesort(ed, mface->v2, mface->v3, mface->edcode & ME_V2V3);
+                       ed++;
+                       to_edgesort(ed, mface->v3, mface->v1, mface->edcode & ME_V3V1);
+                       ed++;
+               }
+       }
+       
+       qsort(edsort, totedge, sizeof(struct edgesort), vergedgesort);
+       
+       /* count final amount */
+       for(a=totedge, ed=edsort; a>1; a--, ed++) {
+               /* edge is unique when it differs from next edge, or is last */
+               if(ed->v1 != (ed+1)->v1 || ed->v2 != (ed+1)->v2) final++;
+               else {
+                       /* this makes sure identical edges both get draw flag */
+                       if(ed->flag) (ed+1)->flag= 1;
+                       else if((ed+1)->flag) ed->flag= 1;
+               }
+       }
+       final++;
+       
+       medge= me->medge= MEM_callocN(final*sizeof(MEdge), "make mesh edges");
+       me->totedge= final;
+       
+       for(a=totedge, ed=edsort; a>1; a--, ed++) {
+               /* edge is unique when it differs from next edge, or is last */
+               if(ed->v1 != (ed+1)->v1 || ed->v2 != (ed+1)->v2) {
+                       medge->v1= ed->v1;
+                       medge->v2= ed->v2;
+                       if(ed->flag) medge->flag= ME_EDGEDRAW;
+                       medge++;
+               }
+       }
+       /* last edge */
+       medge->v1= ed->v1;
+       medge->v2= ed->v2;
+       if(ed->flag) medge->flag= ME_EDGEDRAW;
+
+       MEM_freeN(edsort);
+}
+
+
+
 void mball_to_mesh(ListBase *lb, Mesh *me)
 {
        DispList *dl;
 void mball_to_mesh(ListBase *lb, Mesh *me)
 {
        DispList *dl;
index 759b458ba637615712f46b5ab0ebc2d01d2b2acf..6b069782336d1210c1f3c69767b1666f68e2e87c 100644 (file)
@@ -176,12 +176,16 @@ struct _HyperVert {
        LinkNode *edges, *faces;
 };
 
        LinkNode *edges, *faces;
 };
 
+/* hyper edge flag */
+#define DR_OPTIM       1
+
 struct _HyperEdge {
        HyperEdge *next;
 
        HyperVert *v[2];
        HyperVert *ep;
 struct _HyperEdge {
        HyperEdge *next;
 
        HyperVert *v[2];
        HyperVert *ep;
-       int flag;               // added for drawing optim
+       int flag;               // added for drawing optimal
+       float sharp;    // sharpness weight
        LinkNode *faces;
 };
 
        LinkNode *faces;
 };
 
@@ -264,16 +268,17 @@ static HyperVert *hypermesh_add_vert(HyperMesh *hme, float *co, float *orig) {
        return hv;
 }
 
        return hv;
 }
 
-static HyperEdge *hypermesh_add_edge(HyperMesh *hme, HyperVert *v1, HyperVert *v2, int flag) {
+static HyperEdge *hypermesh_add_edge(HyperMesh *hme, HyperVert *v1, HyperVert *v2, int flag, float sharp) {
        HyperEdge *he= BLI_memarena_alloc(hme->arena, sizeof(*he));
        
        BLI_linklist_prepend_arena(&v1->edges, he, hme->arena);
        BLI_linklist_prepend_arena(&v2->edges, he, hme->arena);
        HyperEdge *he= BLI_memarena_alloc(hme->arena, sizeof(*he));
        
        BLI_linklist_prepend_arena(&v1->edges, he, hme->arena);
        BLI_linklist_prepend_arena(&v2->edges, he, hme->arena);
-       
+
        he->v[0]= v1;
        he->v[1]= v2;
        he->ep= NULL;
        he->faces= NULL;
        he->v[0]= v1;
        he->v[1]= v2;
        he->ep= NULL;
        he->faces= NULL;
+       he->sharp = sharp;
        he->flag= flag;
        
        he->next= hme->edges;
        he->flag= flag;
        
        he->next= hme->edges;
@@ -301,17 +306,17 @@ static HyperFace *hypermesh_add_face(HyperMesh *hme, HyperVert **verts, int nver
                HyperEdge *e= hypervert_find_edge(v, last);
 
                if (!e)
                HyperEdge *e= hypervert_find_edge(v, last);
 
                if (!e)
-                       e= hypermesh_add_edge(hme, v, last, flag);
+                       e= hypermesh_add_edge(hme, v, last, flag, 0);
 
                f->verts[j]= v;
                f->edges[j]= e;
 
                f->verts[j]= v;
                f->edges[j]= e;
-               
+
                BLI_linklist_prepend_arena(&v->faces, f, hme->arena);
                BLI_linklist_prepend_arena(&e->faces, f, hme->arena);
                
                last= v;
        }
                BLI_linklist_prepend_arena(&v->faces, f, hme->arena);
                BLI_linklist_prepend_arena(&e->faces, f, hme->arena);
                
                last= v;
        }
-       
+
        f->next= hme->faces;
        hme->faces= f;
        
        f->next= hme->faces;
        hme->faces= f;
        
@@ -331,12 +336,14 @@ static HyperMesh *hypermesh_new(void) {
        return hme;
 }
 
        return hme;
 }
 
-static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts) {
+static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts, int subdivLevels) {
        HyperMesh *hme= hypermesh_new();
        HyperVert **vert_tbl;
        MFace *mface= me->mface;
        HyperMesh *hme= hypermesh_new();
        HyperVert **vert_tbl;
        MFace *mface= me->mface;
+       MEdge *medge= me->medge;
+       float creasefac= ((float)subdivLevels)/255.0; // in Mesh sharpness is byte
        int i, j;
        int i, j;
-       
+
        hme->orig_me= me;
        if (me->tface)
                hme->hasvcol= hme->hasuvco= 1;
        hme->orig_me= me;
        if (me->tface)
                hme->hasvcol= hme->hasuvco= 1;
@@ -352,6 +359,15 @@ static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts) {
                        vert_tbl[i]= hypermesh_add_vert(hme, me->mvert[i].co, NULL);
        }
 
                        vert_tbl[i]= hypermesh_add_vert(hme, me->mvert[i].co, NULL);
        }
 
+       if(medge) {
+               for (i=0; i<me->totedge; i++) {
+                       MEdge *med= &medge[i];
+                       
+                       hypermesh_add_edge(hme, vert_tbl[med->v1], vert_tbl[med->v2], DR_OPTIM, 
+                               creasefac*((float)med->crease) );
+               }
+       }
+
        for (i=0; i<me->totface; i++) {
                MFace *mf= &mface[i];
                
        for (i=0; i<me->totface; i++) {
                MFace *mf= &mface[i];
                
@@ -366,7 +382,7 @@ static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts) {
                        if (nverts>3)
                                verts[3]= vert_tbl[mf->v4];
                
                        if (nverts>3)
                                verts[3]= vert_tbl[mf->v4];
                
-                       f= hypermesh_add_face(hme, verts, nverts, 1);
+                       f= hypermesh_add_face(hme, verts, nverts, DR_OPTIM); 
                        f->orig.ind= i;
 
                        if (hme->hasuvco) {
                        f->orig.ind= i;
 
                        if (hme->hasuvco) {
@@ -386,8 +402,8 @@ static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts) {
                                for (j=0; j<nverts; j++)
                                        *((unsigned int*) f->vcol[j])= *((unsigned int*) &mcol[j]);
                        }
                                for (j=0; j<nverts; j++)
                                        *((unsigned int*) f->vcol[j])= *((unsigned int*) &mcol[j]);
                        }
-               } else {
-                       hypermesh_add_edge(hme, vert_tbl[mf->v1], vert_tbl[mf->v2], 1);
+               } else if(medge==NULL) {
+                       hypermesh_add_edge(hme, vert_tbl[mf->v1], vert_tbl[mf->v2], DR_OPTIM, 0.0); 
                }
        }
 
                }
        }
 
@@ -396,11 +412,12 @@ static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts) {
        return hme;
 }
 
        return hme;
 }
 
-static HyperMesh *hypermesh_from_editmesh(EditMesh *em) {
+static HyperMesh *hypermesh_from_editmesh(EditMesh *em, int subdivLevels) {
        HyperMesh *hme= hypermesh_new();
        EditVert *ev, *prevev;
        EditEdge *ee;
        EditVlak *ef;
        HyperMesh *hme= hypermesh_new();
        EditVert *ev, *prevev;
        EditEdge *ee;
        EditVlak *ef;
+       float creasefac= (float)subdivLevels;
 
                /* we only add vertices with edges, 'f1' is a free flag */
                /* added: check for hide flag in vertices */
 
                /* we only add vertices with edges, 'f1' is a free flag */
                /* added: check for hide flag in vertices */
@@ -421,7 +438,8 @@ static HyperMesh *hypermesh_from_editmesh(EditMesh *em) {
                                ee->v2->f1= 0;
                        }
                                
                                ee->v2->f1= 0;
                        }
                                
-                       hypermesh_add_edge(hme, (HyperVert*) ee->v1->prev, (HyperVert*) ee->v2->prev, 1);
+                       hypermesh_add_edge(hme, (HyperVert*) ee->v1->prev, (HyperVert*) ee->v2->prev, DR_OPTIM, 
+                               creasefac*ee->crease);
                }
        }
        for (ef= em->faces.first; ef; ef= ef->next) {
                }
        }
        for (ef= em->faces.first; ef; ef= ef->next) {
@@ -438,7 +456,7 @@ static HyperMesh *hypermesh_from_editmesh(EditMesh *em) {
                        if (nverts>3)
                                verts[3]= (HyperVert*) ef->v4->prev;
        
                        if (nverts>3)
                                verts[3]= (HyperVert*) ef->v4->prev;
        
-                       f= hypermesh_add_face(hme, verts, nverts, 1);
+                       f= hypermesh_add_face(hme, verts, nverts, DR_OPTIM);
                        f->orig.ef= ef;
                }
        }
                        f->orig.ef= ef;
                }
        }
@@ -457,13 +475,151 @@ static void VColAvgT(unsigned char *t, unsigned char *a, unsigned char *b) {
        t[3]= (a[3]+b[3])>>1;
 }
 
        t[3]= (a[3]+b[3])>>1;
 }
 
+static void hypermesh_calc_sharp_edge(HyperEdge *e, float co[3])
+{
+       Vec3AvgT(co, e->v[0]->co, e->v[1]->co);
+}
+
+static void hypermesh_calc_smooth_edge(HyperEdge *e, float co[3])
+{
+       int count;
+       LinkNode *link;
+       HyperFace *f;
+       
+       Vec3AddT(co, e->v[0]->co, e->v[1]->co);
+       for (count=2, link= e->faces; link; count++, link= link->next) {
+               f= (HyperFace *) link->link;
+               Vec3Add(co, f->mid->co);
+       }
+       Vec3MulN(co, (float)(1.0/count));
+}
+
+static void hypermesh_lininterp_vert(float co[3], float co1[3], float co2[3], float w)
+{
+       float codiff[3];
+       
+       codiff[0] = co2[0] - co1[0];
+       codiff[1] = co2[1] - co1[1];
+       codiff[2] = co2[2] - co1[2];
+       
+       Vec3MulN(codiff, w);
+       
+       Vec3AddT(co, co1, codiff);
+}
+
+static void hypermesh_calc_interp_edge(HyperEdge *e, float co[3])
+{
+       float co1[3];
+       float co2[3];
+       
+       hypermesh_calc_smooth_edge(e, co1);
+       hypermesh_calc_sharp_edge(e, co2);
+       
+       hypermesh_lininterp_vert(co, co1, co2, e->sharp);
+}
+
+
+static void hypermesh_calc_smooth_vert(HyperVert *v, float co[3])
+{
+       float q[3], r[3], s[3];
+       LinkNode *link;
+       HyperFace *f;
+       HyperEdge *e;
+       int count = 0;
+       
+       if (hypervert_is_boundary(v)) {
+               Vec3CpyI(r, 0.0, 0.0, 0.0);
+       
+               for (count= 0, link= v->edges; link; link= link->next) {
+                       if (hyperedge_is_boundary(link->link)) {
+                               HyperVert *ov= hyperedge_other_vert(link->link, v);
+               
+                               Vec3Add(r, ov->co);
+                               count++;
+                       }
+               }
+       
+               /* I believe CC give the factors as
+                       3/2k and 1/4k, but that doesn't make
+                       sense (to me) as they don't sum to unity... 
+                       It's rarely important.
+               */
+               Vec3MulNT(s, v->co, 0.75f);
+               Vec3Add(s, Vec3MulN(r, (float)(1.0/(4.0*count))));
+       } else {
+               Vec3Cpy(q, Vec3Cpy(r, Vec3CpyI(s, 0.0f, 0.0f, 0.0f)));
+       
+               for (count=0, link= v->faces; link; count++, link= link->next) {
+                       f= (HyperFace *) link->link;
+                       Vec3Add(q, f->mid->co);
+               }
+               Vec3MulN(q, (float)(1.0/count));
+       
+               for (count=0, link= v->edges; link; count++, link= link->next) {
+                       e= (HyperEdge *) link->link;
+                       Vec3Add(r, hyperedge_other_vert(e, v)->co);
+               }
+               Vec3MulN(r, (float)(1.0/count));
+       
+               Vec3MulNT(s, v->co, (float)(count-2));
+       
+               Vec3Add(s, q);
+               Vec3Add(s, r);
+               Vec3MulN(s, (float)(1.0/count));
+       }
+       
+       Vec3Cpy(co, s);
+       
+}
+
+static void hypermesh_calc_sharp_vert(HyperVert *v, float co[3])
+{
+       co[0] = v->co[0];
+       co[1] = v->co[1];
+       co[2] = v->co[2];
+}
+
+static void hypermesh_calc_creased_vert(HyperVert *v, float co[3])
+{
+       HyperVert *e1v = NULL, *e2v = NULL;
+       HyperEdge *he;
+       LinkNode *link;
+       int count;
+       
+       /* use the crease rule */
+       for (count= 0, link= v->edges; link; link= link->next) {
+               he = (HyperEdge *)link->link;
+               if (he->sharp != 0.0) {
+                       if (e1v)
+                               e2v = hyperedge_other_vert(he, v);
+                       else
+                               e1v = hyperedge_other_vert(he, v);
+               }
+       }
+       
+       co[0] = (e1v->co[0] + 6.0 * v->co[0] + e2v->co[0]) / 8.0;
+       co[1] = (e1v->co[1] + 6.0 * v->co[1] + e2v->co[1]) / 8.0;
+       co[2] = (e1v->co[2] + 6.0 * v->co[2] + e2v->co[2]) / 8.0;
+}
+
+static void hypermesh_calc_interp_vert(HyperVert *v, float co[3], float w)
+{
+       float co1[3];
+       float co2[3];
+       
+       hypermesh_calc_smooth_vert(v, co1);
+       hypermesh_calc_creased_vert(v, co2);
+       
+       hypermesh_lininterp_vert(co, co1, co2, w);
+}
+
 static void hypermesh_subdivide(HyperMesh *me, HyperMesh *nme) {
        HyperVert *v;
        HyperEdge *e;
        HyperFace *f;
        LinkNode *link;
        float co[3];
 static void hypermesh_subdivide(HyperMesh *me, HyperMesh *nme) {
        HyperVert *v;
        HyperEdge *e;
        HyperFace *f;
        LinkNode *link;
        float co[3];
-       int j, k, count;
+       int j, k;
 
        for (f= me->faces; f; f= f->next) {
                Vec3CpyI(co, 0.0, 0.0, 0.0);
 
        for (f= me->faces; f; f= f->next) {
                Vec3CpyI(co, 0.0, 0.0, 0.0);
@@ -475,70 +631,52 @@ static void hypermesh_subdivide(HyperMesh *me, HyperMesh *nme) {
        }
                
        for (e= me->edges; e; e= e->next) {
        }
                
        for (e= me->edges; e; e= e->next) {
-               if (hyperedge_is_boundary(e)) {
-                       Vec3AvgT(co, e->v[0]->co, e->v[1]->co);
-               } else {
-                       Vec3AddT(co, e->v[0]->co, e->v[1]->co);
-                       for (count=2, link= e->faces; link; count++, link= link->next) {
-                               f= (HyperFace *) link->link;
-                               Vec3Add(co, f->mid->co);
-                       }
-                       Vec3MulN(co, (float)(1.0/count));
-               }
+               if (hyperedge_is_boundary(e) || (e->sharp > 1.0)) {
+         hypermesh_calc_sharp_edge(e, co);
+      }
+      else {
+         hypermesh_calc_interp_edge(e, co);
+      }
                
                e->ep= hypermesh_add_vert(nme, co, NULL);
        }
 
        for (v= me->verts; v; v= v->next) {
                
                e->ep= hypermesh_add_vert(nme, co, NULL);
        }
 
        for (v= me->verts; v; v= v->next) {
-               float q[3], r[3], s[3];
-
-               if (hypervert_is_boundary(v)) {
-                       Vec3CpyI(r, 0.0, 0.0, 0.0);
-
-                       for (count= 0, link= v->edges; link; link= link->next) {
-                               if (hyperedge_is_boundary(link->link)) {
-                                       HyperVert *ov= hyperedge_other_vert(link->link, v);
-
-                                       Vec3Add(r, ov->co);
-                                       count++;
-                               }
+               float s[3];
+               int sharpcnt = 0;
+               float avgw = 0.0;
+
+               /* count the sharp edges */
+               for (link= v->edges; link; link= link->next) {
+                       if (((HyperEdge *)link->link)->sharp != 0.0) {
+                               sharpcnt++;
+                               avgw += ((HyperEdge *)link->link)->sharp;
                        }
                        }
-
-                               /* I believe CC give the factors as
-                                       3/2k and 1/4k, but that doesn't make
-                                       sense (to me) as they don't sum to unity... 
-                                       It's rarely important.
-                               */
-                       Vec3MulNT(s, v->co, 0.75f);
-                       Vec3Add(s, Vec3MulN(r, (float)(1.0/(4.0*count))));
-               } else {
-                       Vec3Cpy(q, Vec3Cpy(r, Vec3CpyI(s, 0.0f, 0.0f, 0.0f)));
+               }
                
                
-                       for (count=0, link= v->faces; link; count++, link= link->next) {
-                               f= (HyperFace *) link->link;
-                               Vec3Add(q, f->mid->co);
-                       }
-                       Vec3MulN(q, (float)(1.0/count));
-
-                       for (count=0, link= v->edges; link; count++, link= link->next) {
-                               e= (HyperEdge *) link->link;
-                               Vec3Add(r, hyperedge_other_vert(e, v)->co);
-                       }
-                       Vec3MulN(r, (float)(1.0/count));
+               avgw /= (float)sharpcnt;
+               if (avgw > 1.0)
+                       avgw = 1.0;
                
                
-                       Vec3MulNT(s, v->co, (float)(count-2));
-
-                       Vec3Add(s, q);
-                       Vec3Add(s, r);
-                       Vec3MulN(s, (float)(1.0/count));
+               switch (sharpcnt) {
+               case 0:
+               case 1:
+                       hypermesh_calc_smooth_vert(v, s);
+                       break;
+               case 2:
+                       hypermesh_calc_interp_vert(v, s, avgw);
+                       break;
+               default:
+                       hypermesh_calc_sharp_vert(v, s);
+                       break;
                }
                }
-
+               
                v->nmv= hypermesh_add_vert(nme, s, v->orig);
        }
 
        for (e= me->edges; e; e= e->next) {
                v->nmv= hypermesh_add_vert(nme, s, v->orig);
        }
 
        for (e= me->edges; e; e= e->next) {
-               hypermesh_add_edge(nme, e->v[0]->nmv, e->ep, e->flag);
-               hypermesh_add_edge(nme, e->v[1]->nmv, e->ep, e->flag);
+               hypermesh_add_edge(nme, e->v[0]->nmv, e->ep, e->flag, e->sharp>1.0?e->sharp-1.0:0.0);
+               hypermesh_add_edge(nme, e->v[1]->nmv, e->ep, e->flag, e->sharp>1.0?e->sharp-1.0:0.0);
        }
 
        for (f= me->faces; f; f= f->next) {
        }
 
        for (f= me->faces; f; f= f->next) {
@@ -610,7 +748,7 @@ static void hypermesh_subdivide(HyperMesh *me, HyperMesh *nme) {
        }
 }
 
        }
 }
 
-/* Simple subdivition surface for radio and displacement */
+/* Simple subdivision surface for radio and displacement */
 static void hypermesh_simple_subdivide(HyperMesh *me, HyperMesh *nme) {
        HyperVert *v;
        HyperEdge *e;
 static void hypermesh_simple_subdivide(HyperMesh *me, HyperMesh *nme) {
        HyperVert *v;
        HyperEdge *e;
@@ -635,9 +773,9 @@ static void hypermesh_simple_subdivide(HyperMesh *me, HyperMesh *nme) {
                v->nmv= hypermesh_add_vert(nme, v->co, v->orig);
        }
 
                v->nmv= hypermesh_add_vert(nme, v->co, v->orig);
        }
 
-       for (e= me->edges; e; e= e->next) { /* Add originam edges */
-               hypermesh_add_edge(nme, e->v[0]->nmv, e->ep, e->flag);
-               hypermesh_add_edge(nme, e->v[1]->nmv, e->ep, e->flag);
+       for (e= me->edges; e; e= e->next) { /* Add original edges */
+               hypermesh_add_edge(nme, e->v[0]->nmv, e->ep, e->flag, 0.0);
+               hypermesh_add_edge(nme, e->v[1]->nmv, e->ep, e->flag, 0.0);
        }
 
        for (f= me->faces; f; f= f->next) {
        }
 
        for (f= me->faces; f; f= f->next) {
@@ -748,28 +886,28 @@ static int hypermesh_get_nfaces(HyperMesh *hme) {
        return count;
 }
 
        return count;
 }
 
-static int hypermesh_get_nlines(HyperMesh *hme) {
+static int hypermesh_get_nedges(HyperMesh *hme) {
        HyperEdge *e;
        HyperEdge *e;
-       int n= 0;
+       int count= 0;
        
        for (e= hme->edges; e; e= e->next)
        
        for (e= hme->edges; e; e= e->next)
-               if (!e->faces)
-                       n++;
+                       count++;
        
        
-       return n;
+       return count;
 }
 
 /* flag is me->flag, for handles and 'optim' */
 static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
        int nverts= hypermesh_get_nverts(hme);
 }
 
 /* flag is me->flag, for handles and 'optim' */
 static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
        int nverts= hypermesh_get_nverts(hme);
-       int nfaces= hypermesh_get_nfaces(hme) + hypermesh_get_nlines(hme);
+       int nedges= hypermesh_get_nedges(hme);
+       int nfaces= hypermesh_get_nfaces(hme);
        DispListMesh *dlm= MEM_callocN(sizeof(*dlm), "dlmesh");
        HyperFace *f;
        HyperVert *v;
        HyperEdge *e;
        TFace *tfaces;
        DispListMesh *dlm= MEM_callocN(sizeof(*dlm), "dlmesh");
        HyperFace *f;
        HyperVert *v;
        HyperEdge *e;
        TFace *tfaces;
-       MFace *mfaces;
-       MFace *mf;
+       MEdge *med;
+       MFace *mfaces, *mf;
        int i, j, handles=0;
 
                /* hme->orig_me==NULL if we are working on an editmesh */
        int i, j, handles=0;
 
                /* hme->orig_me==NULL if we are working on an editmesh */
@@ -787,10 +925,14 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
        }
        
        dlm->totvert= nverts+handles;
        }
        
        dlm->totvert= nverts+handles;
-       dlm->totface= nfaces+handles;
+       dlm->totface= nfaces;
+       dlm->totedge= nedges+handles;
+       
        /* calloc for clear flag and nor in mvert */
        dlm->mvert= MEM_callocN(dlm->totvert*sizeof(*dlm->mvert), "dlm->mvert");
        /* calloc for clear flag and nor in mvert */
        dlm->mvert= MEM_callocN(dlm->totvert*sizeof(*dlm->mvert), "dlm->mvert");
+       dlm->medge= MEM_callocN(dlm->totedge*sizeof(*dlm->medge), "dlm->medge");
        dlm->mface= MEM_mallocN(dlm->totface*sizeof(*dlm->mface), "dlm->mface");
        dlm->mface= MEM_mallocN(dlm->totface*sizeof(*dlm->mface), "dlm->mface");
+
        if (hme->orig_me) {
                dlm->flag= hme->orig_me->flag;
        } else {
        if (hme->orig_me) {
                dlm->flag= hme->orig_me->flag;
        } else {
@@ -808,6 +950,37 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
                v->nmv= (void*) i;
        }
        
                v->nmv= (void*) i;
        }
        
+       /* we use by default edges for displistmesh now */
+       med= dlm->medge;
+       for (e= hme->edges; e; e= e->next, med++) {
+               med->v1= (int) e->v[0]->nmv;
+               med->v2= (int) e->v[1]->nmv;
+
+               /* flag only for optimal */
+               if(e->flag) med->flag = ME_EDGEDRAW;
+       }
+       
+       /* and we add the handles (med is re-used) */
+       if(handles) {
+               MVert *mv= dlm->mvert+nverts;
+
+               i= nverts;
+               for (v= hme->verts; v; v= v->next) {
+                       if(v->orig) {
+                               /* new vertex */
+                               Vec3Cpy(mv->co, v->orig);
+
+                               /* new edge */
+                               med->v1= (int) v->nmv;
+                               med->v2= i;
+                               med->flag = ME_EDGEDRAW;
+                               
+                               med++; i++; mv++;
+                       }
+               }
+       }
+
+       /* faces */
        mf= dlm->mface;
        for (i=0, f= hme->faces; f; i++, f= f->next) {
                        /* There is a complicated dependancy here:
        mf= dlm->mface;
        for (i=0, f= hme->faces; f; i++, f= f->next) {
                        /* There is a complicated dependancy here:
@@ -838,6 +1011,7 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
                        mf->puno= 0;
                }
                
                        mf->puno= 0;
                }
                
+               /* although not used by 3d display, still needed for wire-render */
                mf->edcode= 0;
                if (f->edges[0]->flag) mf->edcode|= ME_V4V1;
                if (f->edges[1]->flag) mf->edcode|= ME_V1V2;
                mf->edcode= 0;
                if (f->edges[0]->flag) mf->edcode|= ME_V4V1;
                if (f->edges[1]->flag) mf->edcode|= ME_V1V2;
@@ -870,48 +1044,6 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
                }
                
                mf++;
                }
                
                mf++;
-       }
-
-       for (e= hme->edges; e; e= e->next) {
-               if (!e->faces) {
-                       mf->v1= (int) e->v[0]->nmv;
-                       mf->v2= (int) e->v[1]->nmv;
-                       mf->v3= 0;
-                       mf->v4= 0;
-                       
-                       mf->mat_nr= 0;
-                       mf->flag= 0;
-                       mf->puno= 0;
-                       mf->edcode= ME_V1V2;
-                               
-                       mf++;
-               }
-       }
-       
-       /* and we add the handles */
-       if(handles) {
-               MVert *mv= dlm->mvert+nverts;
-               mf= dlm->mface+nfaces;
-               i= nverts;
-               for (v= hme->verts; v; v= v->next) {
-                       if(v->orig) {
-                               /* new vertex */
-                               Vec3Cpy(mv->co, v->orig);
-
-                               /* new face */
-                               mf->v1= (int) v->nmv;
-                               mf->v2= i;
-                               mf->v3= 0;
-                               mf->v4= 0;
-                               
-                               mf->mat_nr= 0;
-                               mf->flag= 0;
-                               mf->puno= 0;
-                               mf->edcode= ME_V1V2;
-                                       
-                               mf++; i++; mv++;
-                       }
-               }
        }       
        
        displistmesh_calc_vert_normals(dlm);
        }       
        
        displistmesh_calc_vert_normals(dlm);
@@ -948,7 +1080,7 @@ DispListMesh *subsurf_make_dispListMesh_from_editmesh(EditMesh *em, int subdivLe
        if (subdivLevels<1) {
                return displistmesh_from_editmesh(em);
        } else {
        if (subdivLevels<1) {
                return displistmesh_from_editmesh(em);
        } else {
-               HyperMesh *hme= hypermesh_from_editmesh(em);
+               HyperMesh *hme= hypermesh_from_editmesh(em, subdivLevels);
        
                return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags, type);
        }
        
                return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags, type);
        }
@@ -958,7 +1090,7 @@ DispListMesh *subsurf_make_dispListMesh_from_mesh(Mesh *me, float *extverts, int
        if (subdivLevels<1) {
                return displistmesh_from_mesh(me, extverts);
        } else {
        if (subdivLevels<1) {
                return displistmesh_from_mesh(me, extverts);
        } else {
-               HyperMesh *hme= hypermesh_from_mesh(me, extverts);
+               HyperMesh *hme= hypermesh_from_mesh(me, extverts, subdivLevels);
 
                return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags, me->subsurftype);
        }
 
                return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags, me->subsurftype);
        }
@@ -972,7 +1104,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
         * calculated vert positions is incorrect for the verts 
         * on the boundary of the mesh.
         */
         * calculated vert positions is incorrect for the verts 
         * on the boundary of the mesh.
         */
-       HyperMesh *hme= hypermesh_from_mesh(me, NULL);
+       HyperMesh *hme= hypermesh_from_mesh(me, NULL, 1);       // 1=subdivlevel
        HyperMesh *nme= hypermesh_new();
        float edge_sum[3], face_sum[3];
        HyperVert *hv;
        HyperMesh *nme= hypermesh_new();
        float edge_sum[3], face_sum[3];
        HyperVert *hv;
@@ -1005,3 +1137,4 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
        hypermesh_free(nme);
        hypermesh_free(hme);
 }
        hypermesh_free(nme);
        hypermesh_free(hme);
 }
+
index a8e2123c6df33bc298e3df80aa7e2a3c0f2f0af4..568aa6b65ae5e122e049969d3052a1085efca0b4 100644 (file)
@@ -60,6 +60,7 @@ typedef struct EditEdge
        struct EditVert *v1, *v2, *vn;
        short f,h;
        short f1, dir;
        struct EditVert *v1, *v2, *vn;
        short f,h;
        short f1, dir;
+       float  crease;
 } EditEdge;
 
 typedef struct EditVlak
 } EditEdge;
 
 typedef struct EditVlak
index 2cb99493daf7cd7205e9c85d275cbec498c6a003..9740ee738ca1f115dc56e95570e53445878669c7 100644 (file)
@@ -1991,21 +1991,22 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
 {
        mesh->mat= newdataadr(fd, mesh->mat);
        test_pointer_array(fd, (void **)&mesh->mat);
 {
        mesh->mat= newdataadr(fd, mesh->mat);
        test_pointer_array(fd, (void **)&mesh->mat);
-       mesh->mvert= newdataadr(fd, mesh->mvert);
-
-       mesh->dvert= newdataadr(fd, mesh->dvert);
-       direct_link_dverts(fd, mesh->totvert, mesh->dvert);
 
 
+       mesh->mvert= newdataadr(fd, mesh->mvert);
+       mesh->medge= newdataadr(fd, mesh->medge);
        mesh->mface= newdataadr(fd, mesh->mface);
        mesh->tface= newdataadr(fd, mesh->tface);
        mesh->mcol= newdataadr(fd, mesh->mcol);
        mesh->msticky= newdataadr(fd, mesh->msticky);
 
        mesh->mface= newdataadr(fd, mesh->mface);
        mesh->tface= newdataadr(fd, mesh->tface);
        mesh->mcol= newdataadr(fd, mesh->mcol);
        mesh->msticky= newdataadr(fd, mesh->msticky);
 
-       mesh->disp.first= mesh->disp.last= 0;
-       mesh->bb= 0;
+       mesh->dvert= newdataadr(fd, mesh->dvert);
+       direct_link_dverts(fd, mesh->totvert, mesh->dvert);
+
+       mesh->disp.first= mesh->disp.last= NULL;
+       mesh->bb= NULL;
        mesh->oc= 0;
        mesh->oc= 0;
-       mesh->dface= 0;
-       mesh->orco= 0;
+       mesh->dface= NULL;
+       mesh->orco= NULL;
 
        if (mesh->tface) {
                TFace *tfaces= mesh->tface;
 
        if (mesh->tface) {
                TFace *tfaces= mesh->tface;
index d1d66ae2e631fcf89260423e399eee27ebc49369..7c25e12f3bc395ab7f69654fc88f9433a359c05c 100644 (file)
@@ -846,13 +846,16 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
 
                        /* direct data */
                        writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
 
                        /* direct data */
                        writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
+
                        writestruct(wd, DATA, "MVert", mesh->totvert, mesh->mvert);
                        writestruct(wd, DATA, "MVert", mesh->totvert, mesh->mvert);
-                       write_dverts(wd, mesh->totvert, mesh->dvert);
+                       writestruct(wd, DATA, "MEdge", mesh->totedge, mesh->medge);
                        writestruct(wd, DATA, "MFace", mesh->totface, mesh->mface);
                        writestruct(wd, DATA, "TFace", mesh->totface, mesh->tface);
                        writestruct(wd, DATA, "MCol", 4*mesh->totface, mesh->mcol);
                        writestruct(wd, DATA, "MSticky", mesh->totvert, mesh->msticky);
 
                        writestruct(wd, DATA, "MFace", mesh->totface, mesh->mface);
                        writestruct(wd, DATA, "TFace", mesh->totface, mesh->tface);
                        writestruct(wd, DATA, "MCol", 4*mesh->totface, mesh->mcol);
                        writestruct(wd, DATA, "MSticky", mesh->totvert, mesh->msticky);
 
+                       write_dverts(wd, mesh->totvert, mesh->dvert);
+
                }
                mesh= mesh->id.next;
        }
                }
                mesh= mesh->id.next;
        }
index f376161cb7a8d2fa6c6800cab38629793823e437..5b1fe2552aa97d20f962c935d7f64e45cab07e7e 100644 (file)
@@ -118,6 +118,7 @@ void flip_subdivison(struct Object *ob, int);
 void mirrormenu(void);
 void mirror_edit(short mode);
 void mirror_object(short mode);
 void mirrormenu(void);
 void mirror_edit(short mode);
 void mirror_object(short mode);
+void flag_edge_crease(void);
 
 #endif /*  BDR_EDITOBJECT_H */
 
 
 #endif /*  BDR_EDITOBJECT_H */
 
index ff7416411e49819a1af9b49bfb2b764693b816d9..09dcd69dc9f8b8eaaae9eca83a056f01fd6cfd26 100644 (file)
@@ -81,7 +81,7 @@ void faceselect_align_view_to_selected(struct View3D *v3d, struct Mesh *me, int
 void editmesh_align_view_to_selected(struct View3D *v3d, int axis);
 
 struct EditVert *addvertlist(float *vec);
 void editmesh_align_view_to_selected(struct View3D *v3d, int axis);
 
 struct EditVert *addvertlist(float *vec);
-struct EditEdge *addedgelist(struct EditVert *v1, struct EditVert *v2);
+struct EditEdge *addedgelist(struct EditVert *v1, struct EditVert *v2, struct EditEdge *example);
 struct EditVlak *addvlaklist(struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditVlak *example);
 struct EditEdge *findedgelist(struct EditVert *v1, struct EditVert *v2);
 
 struct EditVlak *addvlaklist(struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditVlak *example);
 struct EditEdge *findedgelist(struct EditVert *v1, struct EditVert *v2);
 
index 0797699794ec0123eb4a3b21ce0e5f7010f42a82..55fac76e7fbb1de6e3a082b97eab2d0e3967975e 100644 (file)
@@ -337,6 +337,8 @@ enum {
 #define B_MAKESTICKY   2082
 #define B_MAKEVERTCOL  2083
 #define B_CHROMADEPTH  2084
 #define B_MAKESTICKY   2082
 #define B_MAKEVERTCOL  2083
 #define B_CHROMADEPTH  2084
+#define B_MAKEEDGES            2085
+#define B_DELEDGES             2086
 
 /* *********************** */
 #define B_CURVEBUTS            2200
 
 /* *********************** */
 #define B_CURVEBUTS            2200
index 734b090410239203487efca1eabe6948d04e635d..2caff861bc1558262bbb4f36b4b459fb4d28527c 100644 (file)
@@ -181,7 +181,7 @@ typedef struct IpoCurve {
 #define CU_FLUSH               3
 
 /* flag (nurb) */
 #define CU_FLUSH               3
 
 /* flag (nurb) */
-#define CU_SMOOTH              ME_SMOOTH
+#define CU_SMOOTH              1
 
 /* type (nurb) */
 #define CU_POLY                        0
 
 /* type (nurb) */
 #define CU_POLY                        0
index b80bdf62b2c73514e4f0d658e85b24eaf1362e74..674c144923d14713553e42d7c6d0acd329dc18c5 100644 (file)
@@ -39,6 +39,7 @@ struct Ipo;
 struct Key;
 struct Material;
 struct MVert;
 struct Key;
 struct Material;
 struct MVert;
+struct MEdge;
 struct MCol;
 struct MSticky;
 struct Mesh;
 struct MCol;
 struct MSticky;
 struct Mesh;
@@ -69,6 +70,7 @@ typedef struct Mesh {
 
        void *mface, *dface, *tface;
        struct MVert *mvert;
 
        void *mface, *dface, *tface;
        struct MVert *mvert;
+       struct MEdge *medge;
        struct MDeformVert *dvert;      /* __NLA */
        struct MCol *mcol;
        struct MSticky *msticky;
        struct MDeformVert *dvert;      /* __NLA */
        struct MCol *mcol;
        struct MSticky *msticky;
@@ -78,20 +80,21 @@ typedef struct Mesh {
        struct OcInfo *oc;              /* not written in file */
        void *sumohandle;
 
        struct OcInfo *oc;              /* not written in file */
        void *sumohandle;
 
-       int totvert, totface;
-
+       int totvert, totedge, totface;
        int texflag;
        int texflag;
+       
        float loc[3];
        float size[3];
        float rot[3];
        
        short smoothresh, flag;
        float loc[3];
        float size[3];
        float rot[3];
        
        short smoothresh, flag;
+
        short subdiv, subdivr, subdivdone;
        short totcol;
        short subsurftype; 
        short reserved1;        /* Padding */
 
        short subdiv, subdivr, subdivdone;
        short totcol;
        short subsurftype; 
        short reserved1;        /* Padding */
 
-       float cubemapsize, rtf;
+       float cubemapsize;
 
 } Mesh;
 
 
 } Mesh;
 
@@ -117,25 +120,6 @@ typedef struct Mesh {
 #define ME_CC_SUBSURF          0
 #define ME_SIMPLE_SUBSURF      1
 
 #define ME_CC_SUBSURF          0
 #define ME_SIMPLE_SUBSURF      1
 
-/* puno = vertexnormal (mface) */
-#define ME_FLIPV1              1
-#define ME_FLIPV2              2
-#define ME_FLIPV3              4
-#define ME_FLIPV4              8
-#define ME_PROJXY              16
-#define ME_PROJXZ              32
-#define ME_PROJYZ              64
-
-/* edcode (mface) */
-#define ME_V1V2                        1
-#define ME_V2V3                        2
-#define ME_V3V1                        4
-#define ME_V3V4                        4
-#define ME_V4V1                        8
-
-/* flag (mface) */
-#define ME_SMOOTH              1
-
 
 #define TF_DYNAMIC             1
 /* #define TF_INVISIBLE        2 */
 
 #define TF_DYNAMIC             1
 /* #define TF_INVISIBLE        2 */
@@ -169,11 +153,6 @@ typedef struct Mesh {
 #define TF_ALPHA       2
 #define TF_SUB         3
 
 #define TF_ALPHA       2
 #define TF_SUB         3
 
-/* mvert->flag (1=select) */
-#define ME_SPHERETEST  2
-#define ME_SPHERETEMP  4
-#define ME_HIDE                        16
-
 #define MESH_MAX_VERTS 2000000000L
 
 #endif
 #define MESH_MAX_VERTS 2000000000L
 
 #endif
index 5eaba97fc63b512d2d4533844a692f75fccdbc06..04de27f58b06abd01f521a90982132de3b8d5100 100644 (file)
@@ -40,6 +40,12 @@ typedef struct MFace {
        char edcode, flag;
 } MFace;
 
        char edcode, flag;
 } MFace;
 
+typedef struct MEdge {
+       unsigned int v1, v2;
+       char crease, pad;
+       short flag;
+} MEdge;
+
 typedef struct MDeformWeight {
        int                             def_nr;
        float                   weight;
 typedef struct MDeformWeight {
        int                             def_nr;
        float                   weight;
@@ -66,4 +72,33 @@ typedef struct MSticky {
        float co[2];
 } MSticky;
 
        float co[2];
 } MSticky;
 
+/* mvert->flag (1=SELECT) */
+#define ME_SPHERETEST  2
+#define ME_SPHERETEMP  4
+#define ME_HIDE                        16
+
+/* medge->flag (1=SELECT)*/
+#define ME_EDGEDRAW            2
+
+
+/* puno = vertexnormal (mface) */
+#define ME_FLIPV1              1
+#define ME_FLIPV2              2
+#define ME_FLIPV3              4
+#define ME_FLIPV4              8
+#define ME_PROJXY              16
+#define ME_PROJXZ              32
+#define ME_PROJYZ              64
+
+/* edcode (mface) */
+#define ME_V1V2                        1
+#define ME_V2V3                        2
+#define ME_V3V1                        4
+#define ME_V3V4                        4
+#define ME_V4V1                        8
+
+/* flag (mface) */
+#define ME_SMOOTH              1
+
+
 #endif
 #endif
index 532c55da9975ecf8a31257e440de0054bfae275f..29463a8c2eaf63849fbbf04855cf3b9a20d30c13 100644 (file)
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 
 #include "DNA_mesh_types.h"
 #include <stdlib.h>
 
 #include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 #include "BLI_arithb.h"
 
 #include "render.h" 
 #include "BLI_arithb.h"
 
 #include "render.h" 
index bd977c66e23a27ba828064b496c51f9ccba3e89f..e4a76ca5707933b90e7b7be18da9324b94258423 100644 (file)
@@ -40,6 +40,7 @@
 #include "BKE_utildefines.h"
 
 #include "DNA_mesh_types.h"
 #include "BKE_utildefines.h"
 
 #include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_image_types.h"
 #include "DNA_object_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_image_types.h"
 #include "DNA_object_types.h"
 #include "DNA_camera_types.h"
index 8b8da348ae1c03116a05272e57fa26bf070d4c80..9b3639bf17971910bf05917dae3e009128884f36 100644 (file)
@@ -55,6 +55,7 @@
 #include "DNA_object_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_material_types.h"
 #include "DNA_image_types.h"
 
 #include "DNA_material_types.h"
 #include "DNA_image_types.h"
 
index 26f9f9316f430ba619efc56f44f9e9a6cec59f77..8b6ecc9cc0c1dd4641912feb468b4e208490ea00 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "DNA_lamp_types.h"
 #include "DNA_mesh_types.h"
 
 #include "DNA_lamp_types.h"
 #include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 
 #include "radio_types.h"
 #include "radio.h"  /* needs RG, some root data for radiosity                */
 
 #include "radio_types.h"
 #include "radio.h"  /* needs RG, some root data for radiosity                */
@@ -2193,8 +2194,8 @@ extern unsigned short usegamtab;
 void abufsetrow(int y)
 {
        APixstr *ap, *apn;
 void abufsetrow(int y)
 {
        APixstr *ap, *apn;
-       float xs, ys;
-       int x, part, a, b, zrow[100][3], totvlak, alpha[32], tempgam, nr, intcol[4];
+       float ys;
+       int x, part, a, zrow[100][3], totvlak, alpha[32], tempgam, nr, intcol[4];
        int sval, tempRf;
        unsigned short *col, shortcol[4], tempcol[4], sampcol[16*4], *scol;
        
        int sval, tempRf;
        unsigned short *col, shortcol[4], tempcol[4], sampcol[16*4], *scol;
        
index 24d6bcf92c6391bbdd0b8817a321240b64809f78..06c8ef2767596cfddf4fe2ef4474951908f9e023 100644 (file)
@@ -1239,7 +1239,6 @@ static void init_render_mesh(Object *ob)
        VlakRen *vlr, *vlr1;
        VertRen *ver;
        Material *ma;
        VlakRen *vlr, *vlr1;
        VertRen *ver;
        Material *ma;
-       MFace *mfaceint = NULL;
        MSticky *ms;
        PartEff *paf;
        DispList *dl;
        MSticky *ms;
        PartEff *paf;
        DispList *dl;
@@ -1426,7 +1425,7 @@ static void init_render_mesh(Object *ob)
                                end= dlm?dlm->totface:me->totface;
                                set_buildvars(ob, &start, &end);
                                if (dlm) {
                                end= dlm?dlm->totface:me->totface;
                                set_buildvars(ob, &start, &end);
                                if (dlm) {
-                                       mfaceint= dlm->mface + start;
+                                       mface= dlm->mface + start;
                                        if (dlm->tface) {
                                                tface= dlm->tface + start;
                                                vertcol= dlm->tface->col;
                                        if (dlm->tface) {
                                                tface= dlm->tface + start;
                                                vertcol= dlm->tface->col;
@@ -1436,7 +1435,6 @@ static void init_render_mesh(Object *ob)
                                                vertcol= NULL;
                                        }
                                } else {
                                                vertcol= NULL;
                                        }
                                } else {
-                                       mfaceint= NULL;
                                        mface= ((MFace*) me->mface) + start;
                                        if (me->tface) {
                                                tface= ((TFace*) me->tface) + start;
                                        mface= ((MFace*) me->mface) + start;
                                        if (me->tface) {
                                                tface= ((TFace*) me->tface) + start;
@@ -1449,30 +1447,19 @@ static void init_render_mesh(Object *ob)
                                }
                                
                                for(a=start; a<end; a++) {
                                }
                                
                                for(a=start; a<end; a++) {
-                                       int mat_nr;
                                        int v1, v2, v3, v4, edcode, flag;
                                        int v1, v2, v3, v4, edcode, flag;
-                                       if (mfaceint) {
-                                               mat_nr= mfaceint->mat_nr;
-                                               v1= mfaceint->v1;
-                                               v2= mfaceint->v2;
-                                               v3= mfaceint->v3;
-                                               v4= mfaceint->v4;
-                                               flag= mfaceint->flag;
-                                               /* if mfaceint, then dlm is not NULL too */
-                                               if(dlm->flag & ME_OPT_EDGES) edcode= mfaceint->edcode;
-                                               else edcode= ME_V1V2|ME_V2V3|ME_V3V4|ME_V4V1;
-                                       } 
-                                       else {
-                                               mat_nr= mface->mat_nr;
+                                       
+                                       if( mface->mat_nr==a1 ) {
                                                v1= mface->v1;
                                                v2= mface->v2;
                                                v3= mface->v3;
                                                v4= mface->v4;
                                                flag= mface->flag;
                                                edcode= mface->edcode;
                                                v1= mface->v1;
                                                v2= mface->v2;
                                                v3= mface->v3;
                                                v4= mface->v4;
                                                flag= mface->flag;
                                                edcode= mface->edcode;
-                                       }
-                                       if( mat_nr==a1 ) {
-
+                                               
+                                               /* cannot use edges data for render, this has no vcol or tface... */
+                                               if(dlm && (dlm->flag & ME_OPT_EDGES)==0) edcode= ME_V1V2|ME_V2V3|ME_V3V4|ME_V4V1;
+                                               
                                                if(v3) {
 
                                                        vlr= RE_findOrAddVlak(R.totvlak++);
                                                if(v3) {
 
                                                        vlr= RE_findOrAddVlak(R.totvlak++);
@@ -1527,11 +1514,7 @@ static void init_render_mesh(Object *ob)
                                                }
                                        }
 
                                                }
                                        }
 
-                                       if (mfaceint) {
-                                               mfaceint++;
-                                       } else {
-                                               mface++;
-                                       }
+                                       mface++;
                                        if(tface) tface++;
                                }
                        }
                                        if(tface) tface++;
                                }
                        }
index bd61a98829a2d4074d5b370cc251de76d7803e8b..ab811055f20305c9fe1b811c4308a1417ec917a5 100644 (file)
@@ -642,41 +642,48 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
 
        uiBlockBeginAlign(block);
        uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Auto Smooth",10,180,154,19, &me->flag, 0, 0, 0, 0, "Treats all faces with angles less than Degr: as 'smooth' during render");
 
        uiBlockBeginAlign(block);
        uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Auto Smooth",10,180,154,19, &me->flag, 0, 0, 0, 0, "Treats all faces with angles less than Degr: as 'smooth' during render");
-       uiDefButS(block, NUM, B_DIFF, "Degr:",                                  10,160,154,19, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
+       uiDefButS(block, NUM, B_DIFF, "Degr:",                          10,160,154,19, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
 
        uiBlockBeginAlign(block);
        uiBlockSetCol(block, TH_BUT_SETTING1);
 
        uiBlockBeginAlign(block);
        uiBlockSetCol(block, TH_BUT_SETTING1);
-       uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf",              10,124,70,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Subdivision Surface");
-       uiDefButS(block, MENU, B_MAKEDISP, subsurfmenu,         80,124,84,19, &(me->subsurftype), 0, 0, 0, 0, "Selects type of Subsurf algorithm.");
+       uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf",      10,134,70,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Subdivision Surface");
+       uiDefButS(block, MENU, B_MAKEDISP, subsurfmenu,         80,134,84,19, &(me->subsurftype), 0, 0, 0, 0, "Selects type of Subsurf algorithm.");
        uiBlockSetCol(block, TH_AUTO);
        uiBlockSetCol(block, TH_AUTO);
-       uiDefButS(block, NUM, B_MAKEDISP, "Subdiv:",                    10,104,110,19, &me->subdiv, 0, 6, 0, 0, "Defines the level of subdivision to display in real time interactively");
-       uiDefButS(block, NUM, B_MAKEDISP, "",                                   120, 104, 44, 19, &me->subdivr, 0, 6, 0, 0, "Defines the level of subdivision to apply during rendering");
-       uiDefButS(block, TOG|BIT|8, B_MAKEDISP, "Optimal",              10,84,154,19, &me->flag, 0, 0, 0, 0, "Only draws optimal wireframe");
-
+       uiDefButS(block, NUM, B_MAKEDISP, "Subdiv:",            10, 114,110,19, &me->subdiv, 0, 6, 0, 0, "Defines the level of subdivision to display in real time interactively");
+       uiDefButS(block, NUM, B_DIFF, "",                               120,114, 44, 19, &me->subdivr, 0, 6, 0, 0, "Defines the level of subdivision to apply during rendering");
+       uiDefButS(block, TOG|BIT|8, B_MAKEDISP, "Optimal",      10, 94,154,19, &me->flag, 0, 0, 0, 0, "Only draws optimal wireframe");
 
        uiBlockBeginAlign(block);
 
        uiBlockBeginAlign(block);
-       if(me->msticky) val= 1.0; else val= 0.0;
-       uiDefBut(block, LABEL, 0, "Sticky", 10,50,70,20, 0, val, 0, 0, 0, "");
-       if(me->msticky==0) {
-               uiDefBut(block, BUT, B_MAKESTICKY, "Make",      80,50,84,19, 0, 0, 0, 0, 0, "Creates Sticky coordinates for the active object from the current camera view background picture");
+
+       if(me->medge) val= 1.0; else val= 0.0;
+       uiDefBut(block, LABEL, 0, "Edges",                                      10,70,70,20, 0, val, 0, 0, 0, "");
+       if(me->medge==NULL) {
+               uiDefBut(block, BUT, B_MAKEEDGES, "Make",               80,70,84,19, 0, 0, 0, 0, 0, "Adds edges data to active Mesh object, enables creases/seams and faster wireframe draw");
        }
        }
-       else uiDefBut(block, BUT, B_DELSTICKY, "Delete", 80,50,84,19, 0, 0, 0, 0, 0, "Deletes Sticky texture coordinates");
+       else uiDefBut(block, BUT, B_DELEDGES, "Delete",         80,70,84,19, 0, 0, 0, 0, 0, "Deletes edges data from active Mesh object");
 
        if(me->mcol) val= 1.0; else val= 0.0;
 
        if(me->mcol) val= 1.0; else val= 0.0;
-       uiDefBut(block, LABEL, 0, "VertCol", 10,30,70,20, 0, val, 0, 0, 0, "");
-       if(me->mcol==0) {
-               uiDefBut(block, BUT, B_MAKEVERTCOL, "Make",     80,30,84,19, 0, 0, 0, 0, 0, "Enables vertex colour painting on active object");
+       uiDefBut(block, LABEL, 0, "VertCol",                            10,50,70,20, 0, val, 0, 0, 0, "");
+       if(me->mcol==NULL) {
+               uiDefBut(block, BUT, B_MAKEVERTCOL, "Make",             80,50,84,19, 0, 0, 0, 0, 0, "Enables vertex colour painting on active object");
        }
        }
-       else uiDefBut(block, BUT, B_DELVERTCOL, "Delete", 80,30,84,19, 0, 0, 0, 0, 0, "Deletes vertex colours on active object");
+       else uiDefBut(block, BUT, B_DELVERTCOL, "Delete",       80,50,84,19, 0, 0, 0, 0, 0, "Deletes vertex colours on active object");
 
        if(me->tface) val= 1.0; else val= 0.0;
 
        if(me->tface) val= 1.0; else val= 0.0;
-       uiDefBut(block, LABEL, 0, "TexFace", 10,10,70,20, 0, val, 0, 0, 0, "");
-       if(me->tface==0) {
-               uiDefBut(block, BUT, B_MAKE_TFACES, "Make",     80,10,84,19, 0, 0, 0, 0, 0, "Enables the active object's faces for UV coordinate mapping");
+       uiDefBut(block, LABEL, 0, "TexFace",                            10,30,70,20, 0, val, 0, 0, 0, "");
+       if(me->tface==NULL) {
+               uiDefBut(block, BUT, B_MAKE_TFACES, "Make",             80,30,84,19, 0, 0, 0, 0, 0, "Enables the active object's faces for UV coordinate mapping");
        }
        }
-       else uiDefBut(block, BUT, B_DEL_TFACES, "Delete", 80,10,84,19, 0, 0, 0, 0, 0, "Deletes UV coordinates for active object's faces");
+       else uiDefBut(block, BUT, B_DEL_TFACES, "Delete",       80,30,84,19, 0, 0, 0, 0, 0, "Deletes UV coordinates for active object's faces");
        uiBlockEndAlign(block);
 
        uiBlockEndAlign(block);
 
+       if(me->msticky) val= 1.0; else val= 0.0;
+       uiDefBut(block, LABEL, 0, "Sticky",                             10,10,70,20, 0, val, 0, 0, 0, "");
+       if(me->msticky==NULL) {
+               uiDefBut(block, BUT, B_MAKESTICKY, "Make",              80,10,84,19, 0, 0, 0, 0, 0, "Creates Sticky coordinates for the active object from the current camera view background picture");
+       }
+       else uiDefBut(block, BUT, B_DELSTICKY, "Delete",        80,10,84,19, 0, 0, 0, 0, 0, "Deletes Sticky texture coordinates");
+
 
        /* decimator */
        if(G.obedit==NULL) {
 
        /* decimator */
        if(G.obedit==NULL) {
@@ -1485,7 +1492,8 @@ static void parnr_to_editbone_cb(void *bonev, void *arg2_unused)
        parnr_to_editbone(curBone);
 }
 
        parnr_to_editbone(curBone);
 }
 
-static void build_bonestring (char *string, EditBone *bone){
+static void build_bonestring (char *string, EditBone *bone)
+{
        EditBone *curBone;
        EditBone *pBone;
        int             skip=0;
        EditBone *curBone;
        EditBone *pBone;
        int             skip=0;
@@ -1550,7 +1558,8 @@ static void constraint_ebone_name_fix(ListBase *conlist, EditBone *eBone)
        }
 }
 
        }
 }
 
-static void validate_editbonebutton(EditBone *eBone){
+static void validate_editbonebutton(EditBone *eBone)
+{
        EditBone        *prev;
        bAction         *act=NULL;
        bActionChannel *chan;
        EditBone        *prev;
        bAction         *act=NULL;
        bActionChannel *chan;
@@ -1642,7 +1651,8 @@ static void validate_editbonebutton_cb(void *bonev, void *arg2_unused)
        validate_editbonebutton(curBone);
 }
 
        validate_editbonebutton(curBone);
 }
 
-static void armature_rest_pos_func(void *notused1, void *notused2) {
+static void armature_rest_pos_func(void *notused1, void *notused2) 
+{
        clear_object_constraint_status(OBACT);
        make_displists_by_armature(OBACT);
 }
        clear_object_constraint_status(OBACT);
        make_displists_by_armature(OBACT);
 }
@@ -1764,8 +1774,6 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm)
 
 /* *************************** MESH ******************************** */
 
 
 /* *************************** MESH ******************************** */
 
-
-
 void do_meshbuts(unsigned short event)
 {
        void decimate_faces(void);
 void do_meshbuts(unsigned short event)
 {
        void decimate_faces(void);
@@ -1823,18 +1831,34 @@ void do_meshbuts(unsigned short event)
                case B_DELSTICKY:
 
                        if(me->msticky) MEM_freeN(me->msticky);
                case B_DELSTICKY:
 
                        if(me->msticky) MEM_freeN(me->msticky);
-                       me->msticky= 0;
+                       me->msticky= NULL;
                        allqueue(REDRAWBUTSEDIT, 0);
                        break;
                case B_MAKESTICKY:
                        make_sticky();
                        break;
                        allqueue(REDRAWBUTSEDIT, 0);
                        break;
                case B_MAKESTICKY:
                        make_sticky();
                        break;
+               
+               case B_MAKEEDGES:
+                       /* in editmode we only have to set edge pointer */
+                       if(ob==G.obedit) me->medge= MEM_callocN(sizeof(MEdge), "fake mesh edge");
+                       else make_edges(me);
+                       allqueue(REDRAWBUTSEDIT, 0);
+                       break;
+               case B_DELEDGES:
+                       if(me->medge) MEM_freeN(me->medge);
+                       me->medge= NULL;
+                       me->totedge= 0;
+                       makeDispList(ob);
+                       allqueue(REDRAWBUTSEDIT, 0);
+                       allqueue(REDRAWVIEW3D, 0);
+                       break;
+                       
                case B_MAKEVERTCOL:
                        make_vertexcol();
                        break;
                case B_DELVERTCOL:
                        if(me->mcol) MEM_freeN(me->mcol);
                case B_MAKEVERTCOL:
                        make_vertexcol();
                        break;
                case B_DELVERTCOL:
                        if(me->mcol) MEM_freeN(me->mcol);
-                       me->mcol= 0;
+                       me->mcol= NULL;
                        G.f &= ~G_VERTEXPAINT;
                        freedisplist(&(ob->disp));
                        allqueue(REDRAWBUTSEDIT, 0);
                        G.f &= ~G_VERTEXPAINT;
                        freedisplist(&(ob->disp));
                        allqueue(REDRAWBUTSEDIT, 0);
@@ -2016,10 +2040,11 @@ static void editing_panel_mesh_tools1(Object *ob, Mesh *me)
        uiDefBut(block, BUT,B_REVEAL,   "Reveal",       1171,155,86,24, 0, 0, 0, 0, 0, "Reveals selected faces");
        uiBlockEndAlign(block);
 
        uiDefBut(block, BUT,B_REVEAL,   "Reveal",       1171,155,86,24, 0, 0, 0, 0, 0, "Reveals selected faces");
        uiBlockEndAlign(block);
 
-       uiDefBut(block, BUT,B_SELSWAP,  "Select Swap",  1091,124,166,24, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
+       uiDefBut(block, BUT,B_SELSWAP,  "Select Swap",  1091,130,166,24, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
 
        uiBlockBeginAlign(block);
 
        uiBlockBeginAlign(block);
-       uiDefButF(block, NUM,             REDRAWVIEW3D, "NSize:",               1090, 90, 164, 19, &editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
+       uiDefButF(block, NUM,             REDRAWVIEW3D, "NSize:",               1090, 110, 164, 19, &editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
+       uiDefButI(block, TOG|BIT|19, REDRAWVIEW3D, "Draw Creases",      1090,90,164,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
        uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals",       1090,70,164,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
        uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces", 1090,50,164,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
        uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges", 1090,30,164,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
        uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals",       1090,70,164,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
        uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces", 1090,50,164,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
        uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges", 1090,30,164,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
index 854f474f6bb395168f0964ec9ba38b2471d64f19..0f9f8c3cfaa1dbbca899bee2e2f96200f6593a88 100644 (file)
@@ -392,7 +392,7 @@ int set_tpage(TFace *tface)
                        printf("name: %d, tpx: %d\n", *bind, tpx);
                        printf("tile: %d, mode: %d\n", fCurtile, tilemode);
                        if (error)
                        printf("name: %d, tpx: %d\n", *bind, tpx);
                        printf("tile: %d, mode: %d\n", fCurtile, tilemode);
                        if (error)
-                               printf("error: %d\n", error);
+                               printf("error: %d\n", (int)error);
                }
                glBindTexture( GL_TEXTURE_2D, *bind);
 
                }
                glBindTexture( GL_TEXTURE_2D, *bind);
 
index bd293d28fc7d22c404a77c1405f3502854d6b7e1..78e5460b38e901fa7b84cfcc7a8b584bbb647f2a 100644 (file)
@@ -1102,38 +1102,32 @@ void tekenvertices(short sel)
 
 /* ************** DRAW DISPLIST ****************** */
 
 
 /* ************** DRAW DISPLIST ****************** */
 
-       /* DispListMesh */
+/* DispListMesh, comes from subsurf or decimator */
+
+static void displistmesh_draw_wire(DispListMesh *dlm) 
+{
+       MVert *mvert= dlm->mvert;
+       MEdge *medge;
+       int i, optim;
        
        
-static void displistmesh_draw_wire(DispListMesh *dlm) {
-       int i;
+       if(dlm->medge) {
+               optim= dlm->flag & ME_OPT_EDGES;
+               medge= dlm->medge;
        
        
-       for (i=0; i<dlm->totface; i++) {
-               MFace *mf= &dlm->mface[i];
-               
-               if(dlm->flag & ME_OPT_EDGES) {
-                       int test= mf->edcode;
-                       if(test) {
-                               glBegin(GL_LINES);
-                               if(test & ME_V1V2) {
-                                       glVertex3fv(dlm->mvert[mf->v1].co); 
-                                       glVertex3fv(dlm->mvert[mf->v2].co);
-                               }
-                               if(test & ME_V2V3) {
-                                       glVertex3fv(dlm->mvert[mf->v2].co); 
-                                       glVertex3fv(dlm->mvert[mf->v3].co);
-                               }
-                               if(test & ME_V3V4) {
-                                       glVertex3fv(dlm->mvert[mf->v3].co); 
-                                       glVertex3fv(dlm->mvert[mf->v4].co);
-                               }
-                               if(test & ME_V4V1) {
-                                       glVertex3fv(dlm->mvert[mf->v4].co); 
-                                       glVertex3fv(dlm->mvert[mf->v1].co);
-                               }
-                               glEnd();
+               glBegin(GL_LINES);
+               for (i=0; i<dlm->totedge; i++, medge++) {
+                       if(optim==0 || (medge->flag & ME_EDGEDRAW)) {
+                               glVertex3fv(mvert[medge->v1].co); 
+                               glVertex3fv(mvert[medge->v2].co);
                        }
                        }
+       
                }
                }
-               else {  // old method
+               glEnd();
+       }
+       else {
+               for (i=0; i<dlm->totface; i++) {
+                       MFace *mf= &dlm->mface[i];
+                       
                        glBegin(GL_LINE_LOOP);
                        glVertex3fv(dlm->mvert[mf->v1].co);
                        glVertex3fv(dlm->mvert[mf->v2].co);
                        glBegin(GL_LINE_LOOP);
                        glVertex3fv(dlm->mvert[mf->v1].co);
                        glVertex3fv(dlm->mvert[mf->v2].co);
@@ -1147,7 +1141,8 @@ static void displistmesh_draw_wire(DispListMesh *dlm) {
        }
 }
 
        }
 }
 
-static void displistmesh_draw_solid(DispListMesh *dlm, int drawsmooth, float *nors) {
+static void displistmesh_draw_solid(DispListMesh *dlm, int drawsmooth, float *nors) 
+{
        int lmode, lshademodel= -1, lmat_nr= -1;
        int i;
 
        int lmode, lshademodel= -1, lmat_nr= -1;
        int i;
 
@@ -1200,7 +1195,8 @@ static void displistmesh_draw_solid(DispListMesh *dlm, int drawsmooth, float *no
 #undef PASSVERT
 }
 
 #undef PASSVERT
 }
 
-static void displistmesh_draw_shaded(DispListMesh *dlm, unsigned char *vcols1, unsigned char *vcols2) {
+static void displistmesh_draw_shaded(DispListMesh *dlm, unsigned char *vcols1, unsigned char *vcols2) 
+{
        int i, lmode;
        
        glShadeModel(GL_SMOOTH);
        int i, lmode;
        
        glShadeModel(GL_SMOOTH);
@@ -2437,20 +2433,42 @@ static void drawmeshwire(Object *ob)
                                drawDispListwire(&me->disp);
                        }
                }
                                drawDispListwire(&me->disp);
                        }
                }
-               BIF_ThemeColor(TH_WIRE);
                
                
-               if(handles==0 && (G.f & G_DRAWEDGES)) { /* Use edge Highlighting */
-                       char col[4];
-                       BIF_GetThemeColor3ubv(TH_EDGE_SELECT, col);
-                       glShadeModel(GL_SMOOTH);
+               if(handles==0 && (G.f & G_DRAWCREASES)) {       /* Use crease edge Highlighting */
+
+                       eed= em->edges.first;
+                       glBegin(GL_LINES);
+                       while(eed) {
+                               if(eed->h==0) {
+                                       BIF_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, eed->crease);
+                                       glVertex3fv(eed->v1->co);
+                                       glVertex3fv(eed->v2->co);
+                               }
+                               eed= eed->next;
+                       }
+                       glEnd();
+               }
+               else if(handles==0 && (G.f & G_DRAWEDGES)) {    /* Use edge Highlighting */
+                       char col[4], colhi[4];
                        
                        
+                       BIF_GetThemeColor3ubv(TH_EDGE_SELECT, colhi);
+                       BIF_GetThemeColor3ubv(TH_WIRE, col);
+
+                       glShadeModel(GL_SMOOTH);
+
                        eed= em->edges.first;
                        glBegin(GL_LINES);
                        while(eed) {
                                if(eed->h==0) {
                        eed= em->edges.first;
                        glBegin(GL_LINES);
                        while(eed) {
                                if(eed->h==0) {
-                                       if(eed->v1->f & 1) glColor3ub(col[0], col[1], col[2]); else BIF_ThemeColor(TH_WIRE);
+                               
+                                       if(eed->v1->f & 1) glColor3ub(colhi[0], colhi[1], colhi[2]);
+                                       else glColor3ub(col[0], col[1], col[2]);
+                               
                                        glVertex3fv(eed->v1->co);
                                        glVertex3fv(eed->v1->co);
-                                       if(eed->v2->f & 1) glColor3ub(col[0], col[1], col[2]); else BIF_ThemeColor(TH_WIRE);
+                                       
+                                       if(eed->v2->f & 1) glColor3ub(colhi[0], colhi[1], colhi[2]);
+                                       else glColor3ub(col[0], col[1], col[2]);
+
                                        glVertex3fv(eed->v2->co);
                                }
                                eed= eed->next;
                                        glVertex3fv(eed->v2->co);
                                }
                                eed= eed->next;
@@ -2459,6 +2477,7 @@ static void drawmeshwire(Object *ob)
                        glShadeModel(GL_FLAT);
                }
                else if(handles==0) {
                        glShadeModel(GL_FLAT);
                }
                else if(handles==0) {
+                       BIF_ThemeColor(TH_WIRE);
                        eed= em->edges.first;
                        glBegin(GL_LINES);
                        while(eed) {
                        eed= em->edges.first;
                        glBegin(GL_LINES);
                        while(eed) {
@@ -2505,12 +2524,12 @@ static void drawmeshwire(Object *ob)
                
                if(me==NULL) return;
                
                
                if(me==NULL) return;
                
-               if(me->bb==0) tex_space_mesh(me);
+               if(me->bb==NULL) tex_space_mesh(me);
                if(me->totface>4) if(boundbox_clip(ob->obmat, me->bb)==0) return;
                
                /* check for drawing vertices only */
                ok= 0;
                if(me->totface>4) if(boundbox_clip(ob->obmat, me->bb)==0) return;
                
                /* check for drawing vertices only */
                ok= 0;
-               if(me->totface==0) ok= 1;
+               if(me->totface==0 && me->totedge==0) ok= 1;
                else {
                        ma= give_current_material(ob, 1);
                        if(ma && (ma->mode & MA_HALO)) ok= 1;
                else {
                        ma= give_current_material(ob, 1);
                        if(ma && (ma->mode & MA_HALO)) ok= 1;
@@ -2548,142 +2567,166 @@ static void drawmeshwire(Object *ob)
                        if(mesh_uses_displist(me)) drawDispListwire(&me->disp); /* Subsurf */
                        else {
                                
                        if(mesh_uses_displist(me)) drawDispListwire(&me->disp); /* Subsurf */
                        else {
                                
+                               /* build effect only works on faces */
                                start= 0; end= me->totface;
                                set_buildvars(ob, &start, &end);
                                mface+= start;
                                
                                start= 0; end= me->totface;
                                set_buildvars(ob, &start, &end);
                                mface+= start;
                                
-                               for(a=start; a<end; a++, mface++) {
-                                       test= mface->edcode;
+                               /* now decide whether to draw edges block */
+                               if(me->medge && start==0 && end==me->totface) {
+                                       MEdge *medge= me->medge;
                                        
                                        
-                                       if(test) {
-                                               if(extverts) {
-                                                       f1= extverts+3*mface->v1;
-                                                       f2= extverts+3*mface->v2;
-                                               }
-                                               else {
-                                                       f1= (mvert+mface->v1)->co;
-                                                       f2= (mvert+mface->v2)->co;
+                                       glBegin(GL_LINES);
+                                       for(a=me->totedge; a>0; a--, medge++) {
+                                               if(medge->flag & ME_EDGEDRAW) {
+                                                       if(extverts) {
+                                                               f1= extverts+3*medge->v1;
+                                                               f2= extverts+3*medge->v2;
+                                                       }
+                                                       else {
+                                                               f1= (mvert+medge->v1)->co;
+                                                               f2= (mvert+medge->v2)->co;
+                                                       }
+                                                       glVertex3fv(f1); glVertex3fv(f2); 
                                                }
                                                }
+                                       }
+                                       glEnd();
+                               }
+                               else {
+                               
+                                       for(a=start; a<end; a++, mface++) {
+                                               test= mface->edcode;
                                                
                                                
-                                               if(mface->v4) {
+                                               if(test) {
                                                        if(extverts) {
                                                        if(extverts) {
-                                                               f3= extverts+3*mface->v3;
-                                                               f4= extverts+3*mface->v4;
+                                                               f1= extverts+3*mface->v1;
+                                                               f2= extverts+3*mface->v2;
                                                        }
                                                        else {
                                                        }
                                                        else {
-                                                               f3= (mvert+mface->v3)->co;
-                                                               f4= (mvert+mface->v4)->co;
+                                                               f1= (mvert+mface->v1)->co;
+                                                               f2= (mvert+mface->v2)->co;
                                                        }
                                                        
                                                        }
                                                        
-                                                       if(test== ME_V1V2+ME_V2V3+ME_V3V4+ME_V4V1) {
-                                                               glBegin(GL_LINE_LOOP);
-                                                                       glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3); glVertex3fv(f4);
-                                                               glEnd();
-                                                       }
-                                                       else if(test== ME_V1V2+ME_V2V3+ME_V3V4) {
-       
-                                                               glBegin(GL_LINE_STRIP);
-                                                                       glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3); glVertex3fv(f4);
-                                                               glEnd();
-                                                       }
-                                                       else if(test== ME_V2V3+ME_V3V4+ME_V4V1) {
-       
-                                                               glBegin(GL_LINE_STRIP);
-                                                                       glVertex3fv(f2); glVertex3fv(f3); glVertex3fv(f4); glVertex3fv(f1);
-                                                               glEnd();
-                                                       }
-                                                       else if(test== ME_V3V4+ME_V4V1+ME_V1V2) {
-       
-                                                               glBegin(GL_LINE_STRIP);
-                                                                       glVertex3fv(f3); glVertex3fv(f4); glVertex3fv(f1); glVertex3fv(f2);
-                                                               glEnd();
-                                                       }
-                                                       else if(test== ME_V4V1+ME_V1V2+ME_V2V3) {
-       
-                                                               glBegin(GL_LINE_STRIP);
-                                                                       glVertex3fv(f4); glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3);
-                                                               glEnd();
-                                                       }
-                                                       else {
-                                                               if(test & ME_V1V2) {
-       
+                                                       if(mface->v4) {
+                                                               if(extverts) {
+                                                                       f3= extverts+3*mface->v3;
+                                                                       f4= extverts+3*mface->v4;
+                                                               }
+                                                               else {
+                                                                       f3= (mvert+mface->v3)->co;
+                                                                       f4= (mvert+mface->v4)->co;
+                                                               }
+                                                               
+                                                               if(test== ME_V1V2+ME_V2V3+ME_V3V4+ME_V4V1) {
+                                                                       glBegin(GL_LINE_LOOP);
+                                                                               glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3); glVertex3fv(f4);
+                                                                       glEnd();
+                                                               }
+                                                               else if(test== ME_V1V2+ME_V2V3+ME_V3V4) {
+               
                                                                        glBegin(GL_LINE_STRIP);
                                                                        glBegin(GL_LINE_STRIP);
-                                                                               glVertex3fv(f1); glVertex3fv(f2);
+                                                                               glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3); glVertex3fv(f4);
                                                                        glEnd();
                                                                }
                                                                        glEnd();
                                                                }
-                                                               if(test & ME_V2V3) {
-       
+                                                               else if(test== ME_V2V3+ME_V3V4+ME_V4V1) {
+               
                                                                        glBegin(GL_LINE_STRIP);
                                                                        glBegin(GL_LINE_STRIP);
-                                                                               glVertex3fv(f2); glVertex3fv(f3);
+                                                                               glVertex3fv(f2); glVertex3fv(f3); glVertex3fv(f4); glVertex3fv(f1);
                                                                        glEnd();
                                                                }
                                                                        glEnd();
                                                                }
-                                                               if(test & ME_V3V4) {
-       
+                                                               else if(test== ME_V3V4+ME_V4V1+ME_V1V2) {
+               
                                                                        glBegin(GL_LINE_STRIP);
                                                                        glBegin(GL_LINE_STRIP);
-                                                                               glVertex3fv(f3); glVertex3fv(f4);
+                                                                               glVertex3fv(f3); glVertex3fv(f4); glVertex3fv(f1); glVertex3fv(f2);
                                                                        glEnd();
                                                                }
                                                                        glEnd();
                                                                }
-                                                               if(test & ME_V4V1) {
-       
+                                                               else if(test== ME_V4V1+ME_V1V2+ME_V2V3) {
+               
                                                                        glBegin(GL_LINE_STRIP);
                                                                        glBegin(GL_LINE_STRIP);
-                                                                               glVertex3fv(f4); glVertex3fv(f1);
+                                                                               glVertex3fv(f4); glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3);
                                                                        glEnd();
                                                                }
                                                                        glEnd();
                                                                }
-                                                       }
-                                               }
-                                               else if(mface->v3) {
-                                                       if(extverts) f3= extverts+3*mface->v3;
-                                                       else f3= (mvert+mface->v3)->co;
+                                                               else {
+                                                                       if(test & ME_V1V2) {
                
                
-                                                       if(test== ME_V1V2+ME_V2V3+ME_V3V1) {
-                                                               glBegin(GL_LINE_LOOP);
-                                                                       glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3);
-                                                               glEnd();
-                                                       }
-                                                       else if(test== ME_V1V2+ME_V2V3) {
-       
-                                                               glBegin(GL_LINE_STRIP);
-                                                                       glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3);
-                                                               glEnd();
-                                                       }
-                                                       else if(test== ME_V2V3+ME_V3V1) {
-       
-                                                               glBegin(GL_LINE_STRIP);
-                                                                       glVertex3fv(f2); glVertex3fv(f3); glVertex3fv(f1);
-                                                               glEnd();
-                                                       }
-                                                       else if(test== ME_V1V2+ME_V3V1) {
-       
-                                                               glBegin(GL_LINE_STRIP);
-                                                                       glVertex3fv(f3); glVertex3fv(f1); glVertex3fv(f2);
-                                                               glEnd();
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                                       glVertex3fv(f1); glVertex3fv(f2);
+                                                                               glEnd();
+                                                                       }
+                                                                       if(test & ME_V2V3) {
+               
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                                       glVertex3fv(f2); glVertex3fv(f3);
+                                                                               glEnd();
+                                                                       }
+                                                                       if(test & ME_V3V4) {
+               
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                                       glVertex3fv(f3); glVertex3fv(f4);
+                                                                               glEnd();
+                                                                       }
+                                                                       if(test & ME_V4V1) {
+               
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                                       glVertex3fv(f4); glVertex3fv(f1);
+                                                                               glEnd();
+                                                                       }
+                                                               }
                                                        }
                                                        }
-                                                       else {
-                                                               if(test & ME_V1V2) {
-       
+                                                       else if(mface->v3) {
+                                                               if(extverts) f3= extverts+3*mface->v3;
+                                                               else f3= (mvert+mface->v3)->co;
+                       
+                                                               if(test== ME_V1V2+ME_V2V3+ME_V3V1) {
+                                                                       glBegin(GL_LINE_LOOP);
+                                                                               glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3);
+                                                                       glEnd();
+                                                               }
+                                                               else if(test== ME_V1V2+ME_V2V3) {
+               
                                                                        glBegin(GL_LINE_STRIP);
                                                                        glBegin(GL_LINE_STRIP);
-                                                                               glVertex3fv(f1); glVertex3fv(f2);
+                                                                               glVertex3fv(f1); glVertex3fv(f2); glVertex3fv(f3);
                                                                        glEnd();
                                                                }
                                                                        glEnd();
                                                                }
-                                                               if(test & ME_V2V3) {
-       
+                                                               else if(test== ME_V2V3+ME_V3V1) {
+               
                                                                        glBegin(GL_LINE_STRIP);
                                                                        glBegin(GL_LINE_STRIP);
-                                                                               glVertex3fv(f2); glVertex3fv(f3);
+                                                                               glVertex3fv(f2); glVertex3fv(f3); glVertex3fv(f1);
                                                                        glEnd();
                                                                }
                                                                        glEnd();
                                                                }
-                                                               if(test & ME_V3V1) {
-       
+                                                               else if(test== ME_V1V2+ME_V3V1) {
+               
                                                                        glBegin(GL_LINE_STRIP);
                                                                        glBegin(GL_LINE_STRIP);
-                                                                               glVertex3fv(f3); glVertex3fv(f1);
+                                                                               glVertex3fv(f3); glVertex3fv(f1); glVertex3fv(f2);
                                                                        glEnd();
                                                                }
                                                                        glEnd();
                                                                }
+                                                               else {
+                                                                       if(test & ME_V1V2) {
+               
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                                       glVertex3fv(f1); glVertex3fv(f2);
+                                                                               glEnd();
+                                                                       }
+                                                                       if(test & ME_V2V3) {
+               
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                                       glVertex3fv(f2); glVertex3fv(f3);
+                                                                               glEnd();
+                                                                       }
+                                                                       if(test & ME_V3V1) {
+               
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                                       glVertex3fv(f3); glVertex3fv(f1);
+                                                                               glEnd();
+                                                                       }
+                                                               }
+                                                       }
+                                                       else if(test & ME_V1V2) {
+               
+                                                               glBegin(GL_LINE_STRIP);
+                                                                       glVertex3fv(f1); glVertex3fv(f2);
+                                                               glEnd();
                                                        }
                                                        }
-                                               }
-                                               else if(test & ME_V1V2) {
-       
-                                                       glBegin(GL_LINE_STRIP);
-                                                               glVertex3fv(f1); glVertex3fv(f2);
-                                                       glEnd();
                                                }
                                        }
                                }
                                                }
                                        }
                                }
index 16fa866e0703c59ea3545e988ab4916ba3e6ab06..081544072dbad2e5f9e928392dc5816b0c00c92e 100644 (file)
@@ -3588,7 +3588,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
                        nu->pntsv= 4;
                        nu->orderu= 4;
                        nu->orderv= 4;
                        nu->pntsv= 4;
                        nu->orderu= 4;
                        nu->orderv= 4;
-                       nu->flag= ME_SMOOTH;
+                       nu->flag= CU_SMOOTH;
                        nu->bp= callocstructN(BPoint, 4*4, "addNurbprim6");
                        nu->flagu= 0;
                        nu->flagv= 0;
                        nu->bp= callocstructN(BPoint, 4*4, "addNurbprim6");
                        nu->flagu= 0;
                        nu->flagv= 0;
@@ -3624,7 +3624,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
 
                        nu= addNurbprim(4, 1, 0);  /* circle */
                        nu->resolu= 32;
 
                        nu= addNurbprim(4, 1, 0);  /* circle */
                        nu->resolu= 32;
-                       nu->flag= ME_SMOOTH;
+                       nu->flag= CU_SMOOTH;
                        BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
                        vec[0]=vec[1]= 0.0;
                        vec[2]= -G.vd->grid;
                        BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
                        vec[0]=vec[1]= 0.0;
                        vec[2]= -G.vd->grid;
@@ -3658,7 +3658,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
                        nu->orderu= 3;
                        nu->resolu= 24;
                        nu->resolv= 32;
                        nu->orderu= 3;
                        nu->resolu= 24;
                        nu->resolv= 32;
-                       nu->flag= ME_SMOOTH;
+                       nu->flag= CU_SMOOTH;
                        nu->bp= callocstructN(BPoint, 5, "addNurbprim6");
                        nu->flagu= 0;
                        bp= nu->bp;
                        nu->bp= callocstructN(BPoint, 5, "addNurbprim6");
                        nu->flagu= 0;
                        bp= nu->bp;
@@ -3702,7 +3702,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
                        xzproj= 0;
                        nu->resolu= 24;
                        nu->resolv= 32;
                        xzproj= 0;
                        nu->resolu= 24;
                        nu->resolv= 32;
-                       nu->flag= ME_SMOOTH;
+                       nu->flag= CU_SMOOTH;
                        BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
                        spinNurb(0, 0);
 
                        BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
                        spinNurb(0, 0);
 
@@ -3720,7 +3720,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
        }
        
        /* always do: */
        }
        
        /* always do: */
-       nu->flag= ME_SMOOTH;
+       nu->flag= CU_SMOOTH;
        
        test2DNurb(nu);
        
        
        test2DNurb(nu);
        
index c9340bd56540b512e601dcb2d5758b1a488eeabd..f3b797ba8ffd0a46921d4c73cc7dd924e0d709a4 100644 (file)
@@ -343,13 +343,16 @@ void free_hashedgetab(void)
        }
 }
 
        }
 }
 
-EditEdge *addedgelist(EditVert *v1, EditVert *v2)
+EditEdge *addedgelist(EditVert *v1, EditVert *v2, EditEdge *example)
 {
        EditMesh *em = G.editMesh;
        EditVert *v3;
        EditEdge *eed;
        int swap= 0;
        
 {
        EditMesh *em = G.editMesh;
        EditVert *v3;
        EditEdge *eed;
        int swap= 0;
        
+       if(v1==v2) return NULL;
+       if(v1==NULL || v2==NULL) return NULL;
+
        /* swap ? */
        if(v1>v2) {
                v3= v2; 
        /* swap ? */
        if(v1>v2) {
                v3= v2; 
@@ -357,14 +360,11 @@ EditEdge *addedgelist(EditVert *v1, EditVert *v2)
                v1= v3;
                swap= 1;
        }
                v1= v3;
                swap= 1;
        }
-
-       if(v1==v2) return 0;
-       if(v1==0 || v2==0) return 0;
        
        /* find in hashlist */
        eed= findedgelist(v1, v2);
        
        
        /* find in hashlist */
        eed= findedgelist(v1, v2);
        
-       if(eed==0) {
+       if(eed==NULL) {
 
                eed= (EditEdge *)calloc(sizeof(EditEdge), 1);
                eed->v1= v1;
 
                eed= (EditEdge *)calloc(sizeof(EditEdge), 1);
                eed->v1= v1;
@@ -373,6 +373,12 @@ EditEdge *addedgelist(EditVert *v1, EditVert *v2)
                eed->dir= swap;
                insert_hashedge(eed);
        }
                eed->dir= swap;
                insert_hashedge(eed);
        }
+
+       /* copy crease data, seam flag? */
+       if(example) {
+               eed->crease = example->crease;
+       }
+
        return eed;
 }
 
        return eed;
 }
 
@@ -449,13 +455,14 @@ EditVlak *addvlaklist(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, Ed
        
 
        /* add face to list and do the edges */
        
 
        /* add face to list and do the edges */
-       e1= addedgelist(v1, v2);
-       if(v3) e2= addedgelist(v2, v3);
-       if(v4) e3= addedgelist(v3, v4); else e3= addedgelist(v3, v1);
-       if(v4) e4= addedgelist(v4, v1);
+       e1= addedgelist(v1, v2, example?example->e1:NULL);
+       e2= addedgelist(v2, v3, example?example->e2:NULL);
+       if(v4) e3= addedgelist(v3, v4, example?example->e3:NULL); 
+       else e3= addedgelist(v3, v1, example?example->e3:NULL);
+       if(v4) e4= addedgelist(v4, v1, example?example->e4:NULL);
        
        
-       if(v1==v2 || v2==v3 || v1==v3) return 0;
-       if(e2==0) return 0;
+       if(v1==v2 || v2==v3 || v1==v3) return NULL;
+       if(e2==0) return NULL;
 
        evl= (EditVlak *)calloc(sizeof(EditVlak), 1);
        evl->v1= v1;
 
        evl= (EditVlak *)calloc(sizeof(EditVlak), 1);
        evl->v1= v1;
@@ -941,7 +948,7 @@ void make_editMesh_real(Mesh *me)
        EditEdge *eed;
        int tot, a;
 
        EditEdge *eed;
        int tot, a;
 
-       if(G.obedit==0) return;
+       if(G.obedit==NULL) return;
 
        /* because of reload */
        free_editMesh();
 
        /* because of reload */
        free_editMesh();
@@ -994,16 +1001,6 @@ void make_editMesh_real(Mesh *me)
 
 #ifdef __NLA
 
 
 #ifdef __NLA
 
-               /* OLD VERSION */
-               /*
-               eve->totweight = mvert->totweight;
-               if (mvert->dw){
-                       eve->dw = BLI_callocN (sizeof(MDeformWeight) * mvert->totweight, "deformWeight");
-                       memcpy (eve->dw, mvert->dw, sizeof(MDeformWeight) * mvert->totweight);
-               }
-               */
-
-               /* NEW VERSION */
                if (me->dvert){
                        eve->totweight = me->dvert[a].totweight;
                        if (me->dvert[a].dw){
                if (me->dvert){
                        eve->totweight = me->dvert[a].totweight;
                        if (me->dvert[a].dw){
@@ -1019,7 +1016,18 @@ void make_editMesh_real(Mesh *me)
        else {
                unsigned int *mcol;
                
        else {
                unsigned int *mcol;
                
-               /* make edges and faces */
+               /* make edges */
+               if(me->medge) {
+                       MEdge *medge= me->medge;
+                       
+                       for(a=0; a<me->totedge; a++, medge++) {
+                               eed= addedgelist(evlist[medge->v1], evlist[medge->v2], NULL);
+                               eed->crease= ((float)medge->crease)/255.0;
+                       }
+
+               }
+               
+               /* make faces */
                mface= me->mface;
                tface= me->tface;
                mcol= (unsigned int *)me->mcol;
                mface= me->mface;
                tface= me->tface;
                mcol= (unsigned int *)me->mcol;
@@ -1027,12 +1035,13 @@ void make_editMesh_real(Mesh *me)
                for(a=0; a<me->totface; a++, mface++) {
                        eve1= evlist[mface->v1];
                        eve2= evlist[mface->v2];
                for(a=0; a<me->totface; a++, mface++) {
                        eve1= evlist[mface->v1];
                        eve2= evlist[mface->v2];
-                       if(mface->v3) eve3= evlist[mface->v3]; else eve3= 0;
-                       if(mface->v4) eve4= evlist[mface->v4]; else eve4= 0;
+                       if(mface->v3) eve3= evlist[mface->v3]; else eve3= NULL;
+                       if(mface->v4) eve4= evlist[mface->v4]; else eve4= NULL;
                        
                        evl= addvlaklist(eve1, eve2, eve3, eve4, NULL);
                        
                        evl= addvlaklist(eve1, eve2, eve3, eve4, NULL);
-                       
+
                        if(evl) {
                        if(evl) {
+                       
                                if(mcol) memcpy(evl->tf.col, mcol, 4*sizeof(int));
 
                                if(me->tface) {
                                if(mcol) memcpy(evl->tf.col, mcol, 4*sizeof(int));
 
                                if(me->tface) {
@@ -1142,6 +1151,7 @@ static void fix_faceindices(MFace *mface, EditVlak *evl, int nr)
                        if(a & ME_FLIPV1) mface->puno |= ME_FLIPV2;
                        if(a & ME_FLIPV2) mface->puno |= ME_FLIPV3;
                        if(a & ME_FLIPV3) mface->puno |= ME_FLIPV1;
                        if(a & ME_FLIPV1) mface->puno |= ME_FLIPV2;
                        if(a & ME_FLIPV2) mface->puno |= ME_FLIPV3;
                        if(a & ME_FLIPV3) mface->puno |= ME_FLIPV1;
+
                }
        }
        else if(nr==4) {
                }
        }
        else if(nr==4) {
@@ -1176,9 +1186,9 @@ static void fix_faceindices(MFace *mface, EditVlak *evl, int nr)
                        if(a & ME_FLIPV2) mface->puno |= ME_FLIPV4;
                        if(a & ME_FLIPV3) mface->puno |= ME_FLIPV1;
                        if(a & ME_FLIPV4) mface->puno |= ME_FLIPV2;
                        if(a & ME_FLIPV2) mface->puno |= ME_FLIPV4;
                        if(a & ME_FLIPV3) mface->puno |= ME_FLIPV1;
                        if(a & ME_FLIPV4) mface->puno |= ME_FLIPV2;
+
                }
        }
                }
        }
-
 }
 
 
 }
 
 
@@ -1200,26 +1210,21 @@ void load_editMesh()
 void load_editMesh_real(Mesh *me, int undo)
 {
        EditMesh *em = G.editMesh;
 void load_editMesh_real(Mesh *me, int undo)
 {
        EditMesh *em = G.editMesh;
-       MFace *mface;
        MVert *mvert, *oldverts;
        MVert *mvert, *oldverts;
+       MEdge *medge=NULL;
+       MFace *mface;
        MSticky *ms;
        MSticky *ms;
-       KeyBlock *actkey=0, *currkey;
+       KeyBlock *actkey=NULL, *currkey;
        EditVert *eve;
        EditVlak *evl;
        EditEdge *eed;
        float *fp, *newkey, *oldkey, nor[3];
        EditVert *eve;
        EditVlak *evl;
        EditEdge *eed;
        float *fp, *newkey, *oldkey, nor[3];
-       int i, a, ototvert;
+       int i, a, ototvert, totedge=0;
 #ifdef __NLA
        MDeformVert *dvert;
        int     usedDvert = 0;
 #endif
 
 #ifdef __NLA
        MDeformVert *dvert;
        int     usedDvert = 0;
 #endif
 
-       ototvert= me->totvert;
-
-       /* lets save the old verts just in case we are actually working on
-        * a key ... we now do processing of the keys at the end*/
-       oldverts = me->mvert;
-
        /* this one also tests of edges are not in faces: */
        /* eed->f==0: not in face, f==1: draw it */
        /* eed->f1 : flag for dynaface (cylindertest, old engine) */
        /* this one also tests of edges are not in faces: */
        /* eed->f==0: not in face, f==1: draw it */
        /* eed->f1 : flag for dynaface (cylindertest, old engine) */
@@ -1228,38 +1233,57 @@ void load_editMesh_real(Mesh *me, int undo)
        
        /* WATCH IT: in evl->f is punoflag (for vertex normal) */
        vertexnormals( (me->flag & ME_NOPUNOFLIP)==0 );
        
        /* WATCH IT: in evl->f is punoflag (for vertex normal) */
        vertexnormals( (me->flag & ME_NOPUNOFLIP)==0 );
-       
+               
        eed= em->edges.first;
        while(eed) {
        eed= em->edges.first;
        while(eed) {
-               if(eed->f==0) G.totface++;
+               totedge++;
+               if(me->medge==NULL && (eed->f==0)) G.totface++;
                eed= eed->next;
        }
        
                eed= eed->next;
        }
        
+       /* new Vertex block */
+       if(G.totvert==0) mvert= NULL;
+       else mvert= MEM_callocN(G.totvert*sizeof(MVert), "loadeditMesh vert");
+
+       /* new Edge block */
+       if(me->medge && totedge) {
+               medge= MEM_callocN(totedge*sizeof(MEdge), "loadeditMesh edge");
+       }
+       
        /* new Face block */
        /* new Face block */
-       if(G.totface==0) mface= 0;
-       else mface= MEM_callocN(G.totface*sizeof(MFace), "loadeditMesh1");
-       /* nieuw Vertex block */
-       if(G.totvert==0) mvert= 0;
-       else mvert= MEM_callocN(G.totvert*sizeof(MVert), "loadeditMesh2");
+       if(G.totface==0) mface= NULL;
+       else mface= MEM_callocN(G.totface*sizeof(MFace), "loadeditMesh face");
+       
 
 #ifdef __NLA
 
 #ifdef __NLA
-       if (G.totvert==0) dvert=0;
+       if (G.totvert==0) dvert= NULL;
        else dvert = MEM_callocN(G.totvert*sizeof(MDeformVert), "loadeditMesh3");
 
        if (me->dvert) free_dverts(me->dvert, me->totvert);
        me->dvert=dvert;
 #endif         
 
        else dvert = MEM_callocN(G.totvert*sizeof(MDeformVert), "loadeditMesh3");
 
        if (me->dvert) free_dverts(me->dvert, me->totvert);
        me->dvert=dvert;
 #endif         
 
+
+       /* lets save the old verts just in case we are actually working on
+        * a key ... we now do processing of the keys at the end */
+       oldverts = me->mvert;
+       ototvert= me->totvert;
+
+       /* put new data in Mesh */
        me->mvert= mvert;
        me->mvert= mvert;
+       me->totvert= G.totvert;
 
 
+       if(me->medge) MEM_freeN(me->medge);
+       me->medge= medge;
+       me->totedge= totedge;
+       
        if(me->mface) MEM_freeN(me->mface);
        me->mface= mface;
        if(me->mface) MEM_freeN(me->mface);
        me->mface= mface;
-       me->totvert= G.totvert;
        me->totface= G.totface;
                
        /* the vertices, abuse ->vn as counter */
        eve= em->verts.first;
        me->totface= G.totface;
                
        /* the vertices, abuse ->vn as counter */
        eve= em->verts.first;
-       a=0;
+       a= 0;
 
        while(eve) {
                VECCOPY(mvert->co, eve->co);
 
        while(eve) {
                VECCOPY(mvert->co, eve->co);
@@ -1307,12 +1331,26 @@ void load_editMesh_real(Mesh *me, int undo)
        }
 #endif
 
        }
 #endif
 
+       /* the edges */
+       if(medge) {
+               eed= em->edges.first;
+               while(eed) {
+                       medge->v1= (unsigned int) eed->v1->vn;
+                       medge->v2= (unsigned int) eed->v2->vn;
+                       if(eed->f<2) medge->flag = ME_EDGEDRAW;
+                       medge->crease= (char)(255.0*eed->crease);
+                       
+                       medge++;
+                       eed= eed->next;
+               }
+       }
+
        /* the faces */
        evl= em->faces.first;
        i = 0;
        while(evl) {
                mface= &((MFace *) me->mface)[i];
        /* the faces */
        evl= em->faces.first;
        i = 0;
        while(evl) {
                mface= &((MFace *) me->mface)[i];
-                       
+               
                mface->v1= (unsigned int) evl->v1->vn;
                mface->v2= (unsigned int) evl->v2->vn;
                mface->v3= (unsigned int) evl->v3->vn;
                mface->v1= (unsigned int) evl->v1->vn;
                mface->v2= (unsigned int) evl->v2->vn;
                mface->v3= (unsigned int) evl->v3->vn;
@@ -1359,7 +1397,8 @@ void load_editMesh_real(Mesh *me, int undo)
                        mface->edcode |= ME_V4V1; 
                        evl->e4->f= 2;
                }
                        mface->edcode |= ME_V4V1; 
                        evl->e4->f= 2;
                }
-                       
+
+
                /* no index '0' at location 3 or 4 */
                if(evl->v4) fix_faceindices(mface, evl, 4);
                else fix_faceindices(mface, evl, 3);
                /* no index '0' at location 3 or 4 */
                if(evl->v4) fix_faceindices(mface, evl, 4);
                else fix_faceindices(mface, evl, 3);
@@ -1369,19 +1408,21 @@ void load_editMesh_real(Mesh *me, int undo)
        }
                
        /* add loose edges as a face */
        }
                
        /* add loose edges as a face */
-       eed= em->edges.first;
-       while(eed) {
-               if( eed->f==0 ) {
-                       mface= &((MFace *) me->mface)[i];
-                       mface->v1= (unsigned int) eed->v1->vn;
-                       mface->v2= (unsigned int) eed->v2->vn;
-                       test_index_mface(mface, 2);
-                       mface->edcode= ME_V1V2;
-                       i++;
+       if(medge==NULL) {
+               eed= em->edges.first;
+               while(eed) {
+                       if( eed->f==0 ) {
+                               mface= &((MFace *) me->mface)[i];
+                               mface->v1= (unsigned int) eed->v1->vn;
+                               mface->v2= (unsigned int) eed->v2->vn;
+                               test_index_mface(mface, 2);
+                               mface->edcode= ME_V1V2;
+                               i++;
+                       }
+                       eed= eed->next;
                }
                }
-               eed= eed->next;
        }
        }
-               
+       
        tex_space_mesh(me);
 
        /* tface block, always when undo even when it wasnt used, 
        tex_space_mesh(me);
 
        /* tface block, always when undo even when it wasnt used, 
@@ -3643,6 +3684,12 @@ short extrudeflag(short flag,short type)
                        if(eed->dir==1) evl2= addvlaklist(eed->v1, eed->v2, eed->v2->vn, eed->v1->vn, NULL);
                        else evl2= addvlaklist(eed->v2, eed->v1, eed->v1->vn, eed->v2->vn, NULL);
                        if (smooth) evl2->flag |= ME_SMOOTH;
                        if(eed->dir==1) evl2= addvlaklist(eed->v1, eed->v2, eed->v2->vn, eed->v1->vn, NULL);
                        else evl2= addvlaklist(eed->v2, eed->v1, eed->v1->vn, eed->v2->vn, NULL);
                        if (smooth) evl2->flag |= ME_SMOOTH;
+                       
+                       /* new edges, needs copied from old edge. actually we should find face that has this edge */
+                       evl2->e1->crease= eed->crease;
+                       evl2->e2->crease= eed->crease;
+                       evl2->e3->crease= eed->crease;
+                       if(evl2->e4) evl2->e4->crease= eed->crease;
                }
 
                eed= nexted;
                }
 
                eed= nexted;
@@ -3687,7 +3734,7 @@ short extrudeflag(short flag,short type)
        while(eve) {
                nextve= eve->prev;
                if(eve->vn) {
        while(eve) {
                nextve= eve->prev;
                if(eve->vn) {
-                       if(eve->f1==1) addedgelist(eve,eve->vn);
+                       if(eve->f1==1) addedgelist(eve, eve->vn, NULL);
                        else if( (eve->f & 128)==0) {
                                if(deloud) {
                                        BLI_remlink(&em->verts,eve);
                        else if( (eve->f & 128)==0) {
                                if(deloud) {
                                        BLI_remlink(&em->verts,eve);
@@ -3828,7 +3875,7 @@ short removedoublesflag(short flag, float limit)          /* return amount */
                                if(eed->v1->f & 128) eed->v1= eed->v1->vn;
                                if(eed->v2->f & 128) eed->v2= eed->v2->vn;
 
                                if(eed->v1->f & 128) eed->v1= eed->v1->vn;
                                if(eed->v2->f & 128) eed->v2= eed->v2->vn;
 
-                               e1= addedgelist(eed->v1,eed->v2);
+                               e1= addedgelist(eed->v1, eed->v2, eed);
                                
                                if(e1) e1->f= 1;
                                if(e1!=eed) free_editedge(eed);
                                
                                if(e1) e1->f= 1;
                                if(e1!=eed) free_editedge(eed);
@@ -4550,9 +4597,9 @@ void subdivideflag(int flag, float rad, int beauty)
                                                evl->v1= e3->vn;
                                                set_wuv(3, evl, 3+4, 2, 3, 0);
                                        }
                                                evl->v1= e3->vn;
                                                set_wuv(3, evl, 3+4, 2, 3, 0);
                                        }
-                                       evl->e1= addedgelist(evl->v1, evl->v2);
-                                       evl->e2= addedgelist(evl->v2, evl->v3);
-                                       evl->e3= addedgelist(evl->v3, evl->v1);
+                                       evl->e1= addedgelist(evl->v1, evl->v2, evl->e1);
+                                       evl->e2= addedgelist(evl->v2, evl->v3, evl->e2);
+                                       evl->e3= addedgelist(evl->v3, evl->v1, evl->e3);
                                        
                                }
                                else {  /* All the permutations of 4 faces */
                                        
                                }
                                else {  /* All the permutations of 4 faces */
@@ -4725,12 +4772,12 @@ void subdivideflag(int flag, float rad, int beauty)
                                                        set_wuv(4, evl, 4+4, 2+4, 3, 4);
                                                }
                                        }
                                                        set_wuv(4, evl, 4+4, 2+4, 3, 4);
                                                }
                                        }
-                                       evl->e1= addedgelist(evl->v1, evl->v2);
-                                       evl->e2= addedgelist(evl->v2, evl->v3);                                 
-                                       if(evl->v4) evl->e3= addedgelist(evl->v3, evl->v4);
-                                       else evl->e3= addedgelist(evl->v3, evl->v1);
-                                       if(evl->v4) evl->e4= addedgelist(evl->v4, evl->v1);
-                                       else evl->e4= 0;
+                                       evl->e1= addedgelist(evl->v1, evl->v2, evl->e1);
+                                       evl->e2= addedgelist(evl->v2, evl->v3, evl->e2);                                        
+                                       if(evl->v4) evl->e3= addedgelist(evl->v3, evl->v4, evl->e3);
+                                       else evl->e3= addedgelist(evl->v3, evl->v1, evl->e3);
+                                       if(evl->v4) evl->e4= addedgelist(evl->v4, evl->v1, evl->e4);
+                                       else evl->e4= NULL;
                                }
                        }
                }
                                }
                        }
                }
@@ -4744,8 +4791,8 @@ void subdivideflag(int flag, float rad, int beauty)
                if( eed->vn ) {
                        eed->vn->f |= 16;                       
                        if(eed->f==0) {  /* not used in face */                         
                if( eed->vn ) {
                        eed->vn->f |= 16;                       
                        if(eed->f==0) {  /* not used in face */                         
-                               addedgelist(eed->v1,eed->vn);
-                               addedgelist(eed->vn,eed->v2);
+                               addedgelist(eed->v1, eed->vn, eed);
+                               addedgelist(eed->vn, eed->v2, eed);
                        }                                               
                        remedge(eed);
                        free_editedge(eed);
                        }                                               
                        remedge(eed);
                        free_editedge(eed);
@@ -4794,7 +4841,7 @@ void adduplicateflag(int flag)
                if( (eed->v1->f & 128) && (eed->v2->f & 128) ) {
                        v1= eed->v1->vn;
                        v2= eed->v2->vn;
                if( (eed->v1->f & 128) && (eed->v2->f & 128) ) {
                        v1= eed->v1->vn;
                        v2= eed->v2->vn;
-                       addedgelist(v1,v2);
+                       addedgelist(v1, v2, eed);
                }
                eed= eed->next;
        }
                }
                eed= eed->next;
        }
@@ -5559,7 +5606,7 @@ void addvert_mesh(void)
        eve->f= 1;
 
        if(v1) {
        eve->f= 1;
 
        if(v1) {
-               addedgelist(v1, eve);
+               addedgelist(v1, eve, NULL);
                v1->f= 0;
        }
        countall();
                v1->f= 0;
        }
        countall();
@@ -5591,7 +5638,7 @@ void addedgevlak_mesh(void)
                eve= eve->next;
        }
        if(aantal==2) {
                eve= eve->next;
        }
        if(aantal==2) {
-               addedgelist(neweve[0], neweve[1]);
+               addedgelist(neweve[0], neweve[1], NULL);
                allqueue(REDRAWVIEW3D, 0);
                makeDispList(G.obedit);
                return;
                allqueue(REDRAWVIEW3D, 0);
                makeDispList(G.obedit);
                return;
@@ -6039,10 +6086,10 @@ void add_primitiveMesh(int type)
                else if(type==4) {  /* we need edges for a circle */
                        v3= v1;
                        for(a=1;a<tot;a++) {
                else if(type==4) {  /* we need edges for a circle */
                        v3= v1;
                        for(a=1;a<tot;a++) {
-                               addedgelist(v3,v3->next);
+                               addedgelist(v3, v3->next, NULL);
                                v3= v3->next;
                        }
                                v3= v3->next;
                        }
-                       addedgelist(v3,v1);
+                       addedgelist(v3, v1, NULL);
                }
                /* side faces */
                if(ext) {
                }
                /* side faces */
                if(ext) {
@@ -6085,7 +6132,7 @@ void add_primitiveMesh(int type)
                        Mat3MulVecfl(imat,vec);
                        eve= addvertlist(vec);
                        eve->f= 1+2+4;
                        Mat3MulVecfl(imat,vec);
                        eve= addvertlist(vec);
                        eve->f= 1+2+4;
-                       if (a) addedgelist(eve->prev,eve);
+                       if (a) addedgelist(eve->prev, eve, NULL);
                        phi+=phid;
                }
                /* extrude and translate */
                        phi+=phid;
                }
                /* extrude and translate */
@@ -6118,7 +6165,7 @@ void add_primitiveMesh(int type)
                        eve= addvertlist(vec);
                        eve->f= 1+2+4;
                        if(a==0) v1= eve;
                        eve= addvertlist(vec);
                        eve->f= 1+2+4;
                        if(a==0) v1= eve;
-                       else addedgelist(eve->prev, eve);
+                       else addedgelist(eve->prev, eve, NULL);
                        phi+= phid;
                }
                
                        phi+= phid;
                }
                
@@ -7038,11 +7085,13 @@ void join_mesh(void)
        Material **matar, *ma;
        Mesh *me;
        MVert *mvert, *mvertmain;
        Material **matar, *ma;
        Mesh *me;
        MVert *mvert, *mvertmain;
+       MEdge *medge = NULL, *medgemain;
        MFace *mface = NULL, *mfacemain;
        TFace *tface = NULL, *tfacemain;
        unsigned int *mcol=NULL, *mcolmain;
        float imat[4][4], cmat[4][4];
        MFace *mface = NULL, *mfacemain;
        TFace *tface = NULL, *tfacemain;
        unsigned int *mcol=NULL, *mcolmain;
        float imat[4][4], cmat[4][4];
-       int a, b, totcol, totvert=0, totface=0, ok=0, vertofs, map[MAXMAT];
+       int a, b, totcol, totedge=0, totvert=0, totface=0, ok=0, vertofs, map[MAXMAT];
+       int hasedges=0;
 #ifdef __NLA
        int     i, j, index, haskey=0;
        bDeformGroup *dg, *odg;
 #ifdef __NLA
        int     i, j, index, haskey=0;
        bDeformGroup *dg, *odg;
@@ -7055,7 +7104,6 @@ void join_mesh(void)
        if(!ob || ob->type!=OB_MESH) return;
        
        /* count */
        if(!ob || ob->type!=OB_MESH) return;
        
        /* count */
-       
        base= FIRSTBASE;
        while(base) {
                if TESTBASE(base) {
        base= FIRSTBASE;
        while(base) {
                if TESTBASE(base) {
@@ -7063,8 +7111,10 @@ void join_mesh(void)
                                me= base->object->data;
                                totvert+= me->totvert;
                                totface+= me->totface;
                                me= base->object->data;
                                totvert+= me->totvert;
                                totface+= me->totface;
-                               
+                               if(me->medge) hasedges= 1;
+
                                if(base->object == ob) ok= 1;
                                if(base->object == ob) ok= 1;
+
                                if(me->key) {
                                        haskey= 1;
                                        break;
                                if(me->key) {
                                        haskey= 1;
                                        break;
@@ -7084,6 +7134,20 @@ void join_mesh(void)
        if(totvert==0 || totvert>MESH_MAX_VERTS) return;
        
        if(okee("Join selected meshes")==0) return;
        if(totvert==0 || totvert>MESH_MAX_VERTS) return;
        
        if(okee("Join selected meshes")==0) return;
+
+
+       /* if needed add edges to other meshes */
+       if(hasedges) {
+               for(base= FIRSTBASE; base; base= base->next) {
+                       if TESTBASE(base) {
+                               if(base->object->type==OB_MESH) {
+                                       me= base->object->data;
+                                       if(me->medge==NULL) make_edges(me);
+                                       totedge += me->totedge;
+                               }
+                       }
+               }
+       }
        
        /* new material indices and material array */
        matar= MEM_callocN(sizeof(void *)*MAXMAT, "join_mesh");
        
        /* new material indices and material array */
        matar= MEM_callocN(sizeof(void *)*MAXMAT, "join_mesh");
@@ -7143,20 +7207,22 @@ void join_mesh(void)
        }
 
        me= ob->data;
        }
 
        me= ob->data;
-       mvert= mvertmain= MEM_mallocN(totvert*sizeof(MVert), "joinmesh1");
+       mvert= mvertmain= MEM_mallocN(totvert*sizeof(MVert), "joinmesh vert");
 
 
-       if (totface) mface= mfacemain= MEM_mallocN(totface*sizeof(MFace), "joinmesh2");
-       else mfacemain= 0;
+       if(totedge) medge= medgemain= MEM_callocN(totedge*sizeof(MEdge), "joinmesh edge");
+       else medgemain= NULL;
+       
+       if (totface) mface= mfacemain= MEM_mallocN(totface*sizeof(MFace), "joinmesh face");
+       else mfacemain= NULL;
 
 
-       if(me->mcol) mcol= mcolmain= MEM_callocN(totface*4*sizeof(int), "joinmesh3");
-       else mcolmain= 0;
+       if(me->mcol) mcol= mcolmain= MEM_callocN(totface*4*sizeof(int), "joinmesh mcol");
+       else mcolmain= NULL;
 
        /* if active object doesn't have Tfaces, but one in the selection does,
           make TFaces for active, so we don't lose texture information in the
           join process */
        if(me->tface || testSelected_TfaceMesh()) tface= tfacemain= MEM_callocN(totface*4*sizeof(TFace), "joinmesh4");
 
        /* if active object doesn't have Tfaces, but one in the selection does,
           make TFaces for active, so we don't lose texture information in the
           join process */
        if(me->tface || testSelected_TfaceMesh()) tface= tfacemain= MEM_callocN(totface*4*sizeof(TFace), "joinmesh4");
-       else
-               tfacemain= 0;
+       else tfacemain= NULL;
 
 #ifdef __NLA
        if(me->dvert)
 
 #ifdef __NLA
        if(me->dvert)
@@ -7258,6 +7324,18 @@ void join_mesh(void)
                                        }
                                        
                                }
                                        }
                                        
                                }
+                               
+                               if(me->totedge) {
+                                       memcpy(medge, me->medge, me->totedge*sizeof(MEdge));
+                                       
+                                       a= me->totedge;
+                                       while(a--) {
+                                               medge->v1+= vertofs;
+                                               medge->v2+= vertofs;
+                                               medge++;
+                                       }
+                               }
+                               
                                vertofs+= me->totvert;
                                
                                if(base->object!=ob) {
                                vertofs+= me->totvert;
                                
                                if(base->object!=ob) {
@@ -7270,19 +7348,28 @@ void join_mesh(void)
        
        me= ob->data;
        
        
        me= ob->data;
        
+       if(me->mvert) MEM_freeN(me->mvert);
+       me->mvert= mvertmain;
+
+       if(me->medge) MEM_freeN(me->medge);
+       me->medge= medgemain;
+
        if(me->mface) MEM_freeN(me->mface);
        me->mface= mfacemain;
        if(me->mface) MEM_freeN(me->mface);
        me->mface= mfacemain;
-       if(me->mvert) MEM_freeN(me->mvert);
+
 #ifdef __NLA
        if(me->dvert) free_dverts(me->dvert, me->totvert);
        me->dvert = dvertmain;
 #endif
 #ifdef __NLA
        if(me->dvert) free_dverts(me->dvert, me->totvert);
        me->dvert = dvertmain;
 #endif
-       me->mvert= mvertmain;
+
        if(me->mcol) MEM_freeN(me->mcol);
        me->mcol= (MCol *)mcolmain;
        if(me->mcol) MEM_freeN(me->mcol);
        me->mcol= (MCol *)mcolmain;
+       
        if(me->tface) MEM_freeN(me->tface);
        me->tface= tfacemain;
        if(me->tface) MEM_freeN(me->tface);
        me->tface= tfacemain;
+       
        me->totvert= totvert;
        me->totvert= totvert;
+       me->totedge= totedge;
        me->totface= totface;
        
        /* old material array */
        me->totface= totface;
        
        /* old material array */
@@ -8801,10 +8888,10 @@ void bevel_mesh(float bsize, int allfaces)
 #endif
                        }
 
 #endif
                        }
 
-                       addedgelist(evl->e1->v1->vn,evl->e1->v2->vn);
-                       addedgelist(evl->e2->v1->vn,evl->e2->v2->vn);                           
-                       addedgelist(evl->e3->v1->vn,evl->e3->v2->vn);                           
-                       if (evl->e4) addedgelist(evl->e4->v1->vn,evl->e4->v2->vn);                                              
+                       addedgelist(evl->e1->v1->vn, evl->e1->v2->vn, evl->e1);
+                       addedgelist(evl->e2->v1->vn,evl->e2->v2->vn, evl->e2);                          
+                       addedgelist(evl->e3->v1->vn,evl->e3->v2->vn, evl->e3);                          
+                       if (evl->e4) addedgelist(evl->e4->v1->vn,evl->e4->v2->vn, evl->e4);  
 
                        if(evl->v4) {
                                v1= evl->v1->vn;
 
                        if(evl->v4) {
                                v1= evl->v1->vn;
index 7edf910816b07ddcad0b12d5797b5dfbd896d57c..9a3da2c7ca6fb8b999c563c92caf4a7e5123ec1a 100644 (file)
@@ -4458,6 +4458,7 @@ static char *transform_mode_to_string(int mode)
 'w'            -> Warp
 'N'            -> Shrink/Fatten
 'V'            -> Snap vertice
 'w'            -> Warp
 'N'            -> Shrink/Fatten
 'V'            -> Snap vertice
+'e'     -> Edge crease edit
 */
 void transform(int mode)
 {
 */
 void transform(int mode)
 {
@@ -4470,10 +4471,10 @@ void transform(int mode)
        float persinv[3][3], persmat[3][3], viewinv[4][4], imat4[4][4];
        float *curs, dx1, dx2, dy1, dy2, eul[3], quat[4], rot[3], phi0, phi1, deler, rad = 0.0;
        float sizefac, size[3], sizelo[3], smat[3][3], xref=1.0, yref=1.0, zref= 1.0;
        float persinv[3][3], persmat[3][3], viewinv[4][4], imat4[4][4];
        float *curs, dx1, dx2, dy1, dy2, eul[3], quat[4], rot[3], phi0, phi1, deler, rad = 0.0;
        float sizefac, size[3], sizelo[3], smat[3][3], xref=1.0, yref=1.0, zref= 1.0;
-       float si, co, dist, startomtrekfac = 0.0, omtrekfac, oldval[3];
-       int axismode=0, time, fast=0, a, midtog=0, firsttime=1, fout= 0, cameragrab= 0, gridflag;
+       float si, co, dist=0.0, startcircumfac = 0.0, circumfac, oldval[3];
+       int axismode=0, time, fast=0, a, midtog=0, firsttime=1, wrong= 0, cameragrab= 0, gridflag;
        unsigned short event=0;
        unsigned short event=0;
-       short mval[2], afbreek=0, doit, xn, yn, xc, yc, xo, yo = 0, val;
+       short mval[2], breakloop=0, doit, xn, yn, xc, yc, xo, yo = 0, val;
        char str[100];
        int     keyflags = 0;
 
        char str[100];
        int     keyflags = 0;
 
@@ -4669,7 +4670,7 @@ void transform(int mode)
        
        if((mode=='r' || mode=='s' || mode=='S') && xc==32000) {
                error("Centre far out of view");
        
        if((mode=='r' || mode=='s' || mode=='S') && xc==32000) {
                error("Centre far out of view");
-               fout= 1;
+               wrong= 1;
        }
 
        if(mode=='w' && G.obedit) {
        }
 
        if(mode=='w' && G.obedit) {
@@ -4688,13 +4689,13 @@ void transform(int mode)
                Mat4MulVecfl(G.vd->viewmat, axis);
                rad= sqrt( (axis[0]-centre[0])*(axis[0]-centre[0])+(axis[1]-centre[1])*(axis[1]-centre[1]) );
                dist= max[0]-centre[0];
                Mat4MulVecfl(G.vd->viewmat, axis);
                rad= sqrt( (axis[0]-centre[0])*(axis[0]-centre[0])+(axis[1]-centre[1])*(axis[1]-centre[1]) );
                dist= max[0]-centre[0];
-               if(dist==0.0) fout= 1;
-               else startomtrekfac= (90*rad*M_PI)/(360.0*dist);
+               if(dist==0.0) wrong= 1;
+               else startcircumfac= (90*rad*M_PI)/(360.0*dist);
        }
 
        getmouseco_areawin(mval);
        xn=xo= mval[0];
        }
 
        getmouseco_areawin(mval);
        xn=xo= mval[0];
-       yn=xo= mval[1];
+       yn=yo= mval[1];
        dx1= xc-xn; 
        dy1= yc-yn;
        phi= phi0= phi1= 0.0;
        dx1= xc-xn; 
        dy1= yc-yn;
        phi= phi0= phi1= 0.0;
@@ -4704,7 +4705,7 @@ void transform(int mode)
 
        gridflag= U.flag;
        
 
        gridflag= U.flag;
        
-       while(fout==0 && afbreek==0) {
+       while(wrong==0 && breakloop==0) {
                
                getmouseco_areawin(mval);
                if(mval[0]!=xo || mval[1]!=yo || firsttime) {
                
                getmouseco_areawin(mval);
                if(mval[0]!=xo || mval[1]!=yo || firsttime) {
@@ -5439,12 +5440,12 @@ void transform(int mode)
                                
                                window_to_3d(dvec, 1, 1);
                                
                                
                                window_to_3d(dvec, 1, 1);
                                
-                               omtrekfac= startomtrekfac+ 0.05*( mval[1] - yn)*Normalise(dvec);
+                               circumfac= startcircumfac+ 0.05*( mval[1] - yn)*Normalise(dvec);
        
                                /* calc angle for print */
                                dist= max[0]-centre[0];
                                Dist1 = dist;
        
                                /* calc angle for print */
                                dist= max[0]-centre[0];
                                Dist1 = dist;
-                               phi0= 360*omtrekfac*dist/(rad*M_PI);
+                               phi0= 360*circumfac*dist/(rad*M_PI);
 
                                if ((typemode) && (addvec[0])){
                                        phi0 = addvec[0];
 
                                if ((typemode) && (addvec[0])){
                                        phi0 = addvec[0];
@@ -5452,7 +5453,7 @@ void transform(int mode)
                                
                                if((G.qual & LR_CTRLKEY) && (typemode == 0)){
                                        phi0= 5.0*floor(phi0/5.0);
                                
                                if((G.qual & LR_CTRLKEY) && (typemode == 0)){
                                        phi0= 5.0*floor(phi0/5.0);
-                                       omtrekfac= (phi0*rad*M_PI)/(360.0*dist);
+                                       circumfac= (phi0*rad*M_PI)/(360.0*dist);
                                }
                                
                                if (typemode && addvec[0])
                                }
                                
                                if (typemode && addvec[0])
@@ -5479,7 +5480,7 @@ void transform(int mode)
                                                if ((typemode) && (addvec[0]))
                                                        phi0= (Dist1*addvec[0]*M_PI/(360.0*dist)) - 0.5*M_PI;
                                                else
                                                if ((typemode) && (addvec[0]))
                                                        phi0= (Dist1*addvec[0]*M_PI/(360.0*dist)) - 0.5*M_PI;
                                                else
-                                                       phi0= (omtrekfac*dist/rad) - 0.5*M_PI;
+                                                       phi0= (circumfac*dist/rad) - 0.5*M_PI;
                                        
                                                co= cos(phi0);
                                                si= sin(phi0);
                                        
                                                co= cos(phi0);
                                                si= sin(phi0);
@@ -5512,8 +5513,61 @@ void transform(int mode)
                                        screen_swapbuffers();
                                }
                        }
                                        screen_swapbuffers();
                                }
                        }
+                       else if(mode=='e') {
+                               /* edge sharpening */
+                               /* only  works in edit mode */
+                               if (G.obedit && G.editMesh) {
+                                       EditMesh *em = G.editMesh;
+                                       EditEdge *ee;
+                                       Mesh *me= G.obedit->data;
+                                       float mincr=10.0, maxcr= 0.0;
+                                       
+                                       /* this is sufficient to invoke edges added in mesh, but only in editmode */
+                                       if(me->medge==NULL) {
+                                               me->medge= MEM_callocN(sizeof(MEdge), "fake medge");
+                                               me->totedge= 1;
+                                               allqueue(REDRAWBUTSEDIT, 0);
+                                       }
+                                       
+                                       dist= (0.005 * (mval[1] - yo));
+                               
+                                       ee = em->edges.first;
+                                       while (ee) {
+                                               if ((ee->v1->f & 1) && (ee->v2->f & 1)) {
+                                                       /* this edge is selected */
+                                                       ee->crease += dist;
+                                                       CLAMP(ee->crease, 0.0, 1.0);
+                                                       if(mincr>ee->crease) mincr= ee->crease;
+                                                       if(maxcr<ee->crease) maxcr= ee->crease;
+                                               }
+                                               ee = ee->next;
+                                       }
+                                       
+                                       if(mincr==10.0) wrong= 1;
+                                       else {
+                                               sprintf(str, "Edge sharpness range: %.3f - %.3f", mincr, maxcr); 
+                                               headerprint(str);
+                                       
+                                               if(G.obedit) calc_trans_verts();
+                                               special_trans_update(keyflags);
+                                       
+                                               if(fast==0) {
+                                                       time= my_clock();
+                                                       force_draw();
+                                                       time= my_clock()-time;
+                                                       if(time>50) fast= 1;
+                                               }
+                                               else {
+                                                       scrarea_do_windraw(curarea);
+                                                       screen_swapbuffers();
+                                               }
+                                       }
+                               }
+                               else {
+                                       wrong = 1;
+                               }
+                       }
                        /* Help line drawing starts here */
                        /* Help line drawing starts here */
-
                }
                
                while( qtest() ) {
                }
                
                while( qtest() ) {
@@ -5532,7 +5586,7 @@ void transform(int mode)
                                case SPACEKEY:
                                case PADENTER:
                                case RETKEY:
                                case SPACEKEY:
                                case PADENTER:
                                case RETKEY:
-                                       afbreek= 1;
+                                       breakloop= 1;
                                        break;
                                case MIDDLEMOUSE:
                                        midtog= ~midtog;
                                        break;
                                case MIDDLEMOUSE:
                                        midtog= ~midtog;
@@ -5957,7 +6011,7 @@ void transform(int mode)
        
                                arrows_move_cursor(event);
                        }
        
                                arrows_move_cursor(event);
                        }
-                       if(event==0 || afbreek) break;
+                       if(event==0 || breakloop) break;
 
                }
                xo= mval[0];
 
                }
                xo= mval[0];
index d2b35be8a1b66c7e0840d0feb1d034409d0bb47e..e80953f084ede9207764e13fb7af03bbbd73326c 100644 (file)
@@ -1436,6 +1436,9 @@ static void ui_draw_text_icon(uiBut *but)
                        if (ok) glColor3ub(255, 255, 0);
                }
                
                        if (ok) glColor3ub(255, 255, 0);
                }
                
+               /* LABEL button exception */
+               if(but->type==LABEL && but->min!=0.0) BIF_ThemeColor(TH_BUT_TEXT_HI);
+               
                glRasterPos2f( 0.375+floor(x), 0.375+floor((but->y1+but->y2- 9.0)/2.0));
                BIF_DrawString(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS));
 
                glRasterPos2f( 0.375+floor(x), 0.375+floor((but->y1+but->y2- 9.0)/2.0));
                BIF_DrawString(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS));
 
index ca5e3ec102303587c579d35045b05e5c5e5f8f20..a35de2087f5f00878aa2565f3b48f5148d63e56c 100644 (file)
@@ -1015,6 +1015,11 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                        extrude_ika(ob, 1);
                                        }
                                }
                                                        extrude_ika(ob, 1);
                                        }
                                }
+            if (G.qual == LR_SHIFTKEY) {
+               if (G.obedit && G.obedit->type==OB_MESH) {
+                  transform('e');
+               }
+            }
                                break;
                        case FKEY:
                                if(G.obedit) {
                                break;
                        case FKEY:
                                if(G.obedit) {
@@ -1042,7 +1047,7 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        case GKEY:
                                /* RMGRP if(G.qual & LR_CTRLKEY) add_selected_to_group();
                                else if(G.qual & LR_ALTKEY) rem_selected_from_group(); */
                        case GKEY:
                                /* RMGRP if(G.qual & LR_CTRLKEY) add_selected_to_group();
                                else if(G.qual & LR_ALTKEY) rem_selected_from_group(); */
-                               
+
                                if((G.qual==LR_SHIFTKEY))
                                        select_group_menu();
                                else if(G.qual==LR_ALTKEY)
                                if((G.qual==LR_SHIFTKEY))
                                        select_group_menu();
                                else if(G.qual==LR_ALTKEY)
index 4b6a679aa9d6336e341dc7b6cc08eefa5d8db54a..c65dab58615145d501b7895bda16c6f6836fe76c 100644 (file)
@@ -23,6 +23,7 @@ extern "C" {
 #include "DNA_material_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_material_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_packedFile_types.h"
 #include "DNA_radio_types.h"
 #include "DNA_object_types.h"
 #include "DNA_packedFile_types.h"
 #include "DNA_radio_types.h"