Bug fix #1073
authorTon Roosendaal <ton@blender.org>
Wed, 7 Apr 2004 12:46:50 +0000 (12:46 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 7 Apr 2004 12:46:50 +0000 (12:46 +0000)
CTRL+SHIFT+A (apply lattice deform) on a Bezier Curve object was not
implemented yet. Added this.

Little sidenote: when curves are 2D the result will remain 2D, disregarding
deformation in 3rd dimension.

source/blender/blenkernel/intern/lattice.c

index d32d5118a20e4dbf4581b682e6aa7123e83df959..4d36e965e1c1369b43e2f6b6f4dcb5b5b7e57207 100644 (file)
@@ -433,6 +433,7 @@ static int _object_deform(Object *ob, int applyflag)
                        if(applyflag) {
                                Nurb *nu;
                                BPoint *bp;
+                               BezTriple *bezt;
                                
                                nu= cu->nurb.first;
                                while(nu) {
@@ -444,24 +445,36 @@ static int _object_deform(Object *ob, int applyflag)
                                                        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;
                                }
                        }
-                       
-                       /* when apply, do this too, looks more interactive */
-                       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);
+                       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;
                                }
-                               
-                               dl= dl->next;
                        }
                }
                end_latt_deform();