Simple re-order of first/last point checking when adding point to
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 17 Feb 2011 19:03:12 +0000 (19:03 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 17 Feb 2011 19:03:12 +0000 (19:03 +0000)
NURBS spline. Need to make new point be last in array.

Beziers already has the same behaviour, so things would be more uniform now.

source/blender/editors/curve/editcurve.c

index 1e551b6469333fdac944a513201ca4bde723850f..857a461e26ef11bcd039383e16e41f0e5c3e5a91 100644 (file)
@@ -4560,20 +4560,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
        }
        else if(!ok && nu->pntsv==1) {
                /* which b-point? */
-               if(bp== nu->bp) {   /* first */
-                       bp->f1= 0;
-                       newbp =
-                               (BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb3");
-                       ED_curve_bpcpy(editnurb, newbp+1, bp, nu->pntsu);
-                       *newbp= *bp;
-                       newbp->f1|= SELECT;
-                       cu->lastsel= newbp;
-                       MEM_freeN(nu->bp);
-                       nu->bp= newbp;
-                       bp= newbp + 1;
-                       ok= 1;
-               }
-               else if(bp== (nu->bp+nu->pntsu-1)) {  /* last */
+               if(bp== (nu->bp+nu->pntsu-1)) {  /* last */
                        bp->f1= 0;
                        newbp =
                                (BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb4");
@@ -4587,6 +4574,19 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
                        bp= newbp - 1;
                        ok= 1;
                }
+               else if(bp== nu->bp) {   /* first */
+                       bp->f1= 0;
+                       newbp =
+                               (BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb3");
+                       ED_curve_bpcpy(editnurb, newbp+1, bp, nu->pntsu);
+                       *newbp= *bp;
+                       newbp->f1|= SELECT;
+                       cu->lastsel= newbp;
+                       MEM_freeN(nu->bp);
+                       nu->bp= newbp;
+                       bp= newbp + 1;
+                       ok= 1;
+               }
                else if(mode!='e') {
                        bp->f1= 0;
                        newbp= (BPoint*)MEM_callocN(sizeof(BPoint), "addvert_Nurb5");