- more signedness warning fixes in editsima
authorDaniel Dunbar <daniel@zuster.org>
Fri, 15 Jul 2005 17:31:58 +0000 (17:31 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 15 Jul 2005 17:31:58 +0000 (17:31 +0000)
 - added mesh_get_active_key and replaced code in editmesh to use this
 - removed obsolete code in object_deform

source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/mesh.c
source/blender/src/editmesh.c
source/blender/src/editsima.c

index c20f0fd3e4e4cdaa43efecc757ea93ecec3c3963..89f691af5350eaa15f328fba10ba71f8c7721492 100644 (file)
@@ -80,6 +80,7 @@ void mesh_set_smooth_flag(struct Object *meshOb, int enableSmooth);
 
 struct BoundBox *mesh_get_bb(struct Mesh *me);
 void mesh_get_texspace(struct Mesh *me, float *loc_r, float *rot_r, float *size_r);
+struct KeyBlock *mesh_get_active_key(struct Mesh *me);
 
 void make_edges(struct Mesh *me);
 
index 01b9d0795c583217a159fff63653c8ec2ff83504..12a86dcc65132d713202e544f6520d2af17e0787 100644 (file)
@@ -517,7 +517,7 @@ static void calc_curve_deform(Object *par, float *co, short axis, CurveDeform *c
 }
 
 /* Mesh now applies on mesh itself, others do displist */
-static int _object_deform(Object *ob, int applyflag)
+int object_deform(Object *ob)
 {
        Mesh *me;
        Curve *cu;
@@ -589,53 +589,21 @@ static int _object_deform(Object *ob, int applyflag)
                        }
                }
                else if ELEM(ob->type, OB_CURVE, OB_SURF) {
-               
                        cu= ob->data;
-                       if(applyflag) {
-                               Nurb *nu;
-                               BPoint *bp;
-                               BezTriple *bezt;
+                       /* apply deform on displist */
+                       dl= cu->disp.first;
+                       while(dl) {
                                
-                               nu= cu->nurb.first;
-                               while(nu) {
-                                       if(nu->bp) {
-                                               a= nu->pntsu*nu->pntsv;
-                                               bp= nu->bp;
-                                               while(a--) {
-                                                       calc_latt_deform(bp->vec);
-                                                       bp++;
-                                               }
-                                       }
-                                       else if(nu->bezt) {
-                                               a= nu->pntsu;
-                                               bezt= nu->bezt;
-                                               while(a--) {
-                                                       calc_latt_deform(bezt->vec[0]);
-                                                       calc_latt_deform(bezt->vec[1]);
-                                                       calc_latt_deform(bezt->vec[2]);
-                                                       bezt++;
-                                               }
-                                               test2DNurb(nu);
-                                       }
-                                       nu= nu->next;
-                               }
-                       }
-                       else {
-                               /* apply deform on displist */
-                               dl= cu->disp.first;
-                               while(dl) {
-                                       
-                                       fp= dl->verts;
-                                       
-                                       if(dl->type==DL_INDEX3) tot=dl->parts;
-                                       else tot= dl->nr*dl->parts;
-                                       
-                                       for(a=0; a<tot; a++, fp+=3) {
-                                               calc_latt_deform(fp);
-                                       }
-                                       
-                                       dl= dl->next;
+                               fp= dl->verts;
+                               
+                               if(dl->type==DL_INDEX3) tot=dl->parts;
+                               else tot= dl->nr*dl->parts;
+                               
+                               for(a=0; a<tot; a++, fp+=3) {
+                                       calc_latt_deform(fp);
                                }
+                               
+                               dl= dl->next;
                        }
                }
                end_latt_deform();
@@ -671,12 +639,6 @@ static int _object_deform(Object *ob, int applyflag)
 
 }
 
-int object_deform(Object *ob)
-{
-       return _object_deform(ob, 0);
-}
-
-
 BPoint *latt_bp(Lattice *lt, int u, int v, int w)
 {
        return lt->def+ u + v*lt->pntsu + w*lt->pntsu*lt->pntsv;
index f9f1285a5bef96c3f094d3b22d1c489133718a4a..f9737f1e11bddf758a7032bd7af7d076dd8599e0 100644 (file)
@@ -1287,3 +1287,14 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth) {
 
        DAG_object_flush_update(G.scene, meshOb, OB_RECALC_DATA);
 }
+
+KeyBlock *mesh_get_active_key(Mesh *me) 
+{
+       KeyBlock *key;
+
+       for (key=me->key->block.first; key; key= key->next)
+               if (key->flag&SELECT)
+                       break;
+
+       return key;
+}
index f080baa88d607ea0a677d77d8fd07bf9a7d686fb..7efa55af693662e1a99f1596809055e6f3328176 100644 (file)
@@ -639,7 +639,7 @@ void make_editMesh()
        MFace *mface;
        TFace *tface;
        MVert *mvert;
-       KeyBlock *actkey=0;
+       KeyBlock *actkey;
        EditVert *eve, **evlist, *eve1, *eve2, *eve3, *eve4;
        EditFace *efa;
        EditEdge *eed;
@@ -660,14 +660,7 @@ void make_editMesh()
        /* initialize fastmalloc for editmesh */
        init_editmesh_fastmalloc(G.editMesh, me->totvert, me->totedge, me->totface);
 
-       /* keys? */
-       if(me->key) {
-               actkey= me->key->block.first;
-               while(actkey) {
-                       if(actkey->flag & SELECT) break;
-                       actkey= actkey->next;
-               }
-       }
+       actkey = mesh_get_active_key(me);
 
        if(actkey) {
                key_to_mesh(actkey, me);
@@ -913,7 +906,6 @@ void load_editMesh(void)
        MEdge *medge=NULL;
        MFace *mface;
        MSticky *ms;
-       KeyBlock *actkey=NULL, *currkey;
        EditVert *eve;
        EditFace *efa;
        EditEdge *eed;
@@ -1176,13 +1168,7 @@ void load_editMesh(void)
 
        /* are there keys? */
        if(me->key) {
-
-               /* find the active key */
-               actkey= me->key->block.first;
-               while(actkey) {
-                       if(actkey->flag & SELECT) break;
-                       actkey= actkey->next;
-               }
+               KeyBlock *currkey, *actkey = mesh_get_active_key(me);
 
                /* Lets reorder the key data so that things line up roughly
                 * with the way things were before editmode */
@@ -1230,13 +1216,12 @@ void load_editMesh(void)
                        currkey= currkey->next;
                }
 
+               /* forces update */
+               if(actkey) showkeypos(me->key, actkey);
        }
 
        if(oldverts) MEM_freeN(oldverts);
        
-       /* forces update */
-       if(actkey) showkeypos(me->key, actkey);
-       
        /* to be sure: clear ->vn pointers */
        eve= em->verts.first;
        while(eve) {
index a698446234b54b207c920c94992b0313a823081b..f617509c57d39c82f14b68d12ca19694b942461b 100644 (file)
@@ -1480,8 +1480,7 @@ void stitch_uv_tface(int mode)
        MFace *mf;
        TFace *tf, *tface;
        Mesh *me;
-       int a;
-       unsigned int b, c, vtot, vtot2, tot;
+       int a, b, c, tot, vtot, vtot2;
        float newuv[2], limit[2], *uv, *uv1;
        struct uvvertsort *sortblock, *sb, *sb1, *sb2;
        
@@ -1625,8 +1624,7 @@ void select_linked_tface_uv(int mode)
        TFace *tface, *tf, *nearesttf=NULL;
        Mesh *me;
        char sel, *linkflag;
-       int a, nearestuv, i, nverts;
-       unsigned int b, c, vtot, tot, nearestv;
+       int a, b, c, tot, vtot, nearestv, nearestuv, i, nverts;
        float limit[2], *uv, *uv1;
        struct uvvertsort *sortblock, *sb, *sb1, *sb2;