Fix for bug #13224: vertex parenting didn't work correct with
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 28 May 2008 18:11:45 +0000 (18:11 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 28 May 2008 18:11:45 +0000 (18:11 +0000)
multiple unconnected curves.

source/blender/blenkernel/intern/object.c

index ab1bc5a2265be412d4ebea2c5fc2f0ea4ad2d9ed..4f901ba72163c688b84a243211260a29e657bebc 100644 (file)
@@ -1614,7 +1614,7 @@ static void give_parvert(Object *par, int nr, float *vec)
                        
                        for(eve= em->verts.first; eve; eve= eve->next) {
                                if(eve->keyindex==nr) {
-                                       memcpy(vec, eve->co, 12);
+                                       memcpy(vec, eve->co, sizeof(float)*3);
                                        break;
                                }
                        }
@@ -1652,18 +1652,20 @@ static void give_parvert(Object *par, int nr, float *vec)
                Curve *cu;
                BPoint *bp;
                BezTriple *bezt;
+               int found= 0;
                
                cu= par->data;
                nu= cu->nurb.first;
                if(par==G.obedit) nu= editNurb.first;
                
                count= 0;
-               while(nu) {
+               while(nu && !found) {
                        if((nu->type & 7)==CU_BEZIER) {
                                bezt= nu->bezt;
                                a= nu->pntsu;
                                while(a--) {
                                        if(count==nr) {
+                                               found= 1;
                                                VECCOPY(vec, bezt->vec[1]);
                                                break;
                                        }
@@ -1676,7 +1678,8 @@ static void give_parvert(Object *par, int nr, float *vec)
                                a= nu->pntsu*nu->pntsv;
                                while(a--) {
                                        if(count==nr) {
-                                               memcpy(vec, bp->vec, 12);
+                                               found= 1;
+                                               memcpy(vec, bp->vec, sizeof(float)*3);
                                                break;
                                        }
                                        count++;