diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-02-18 06:13:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-02-18 06:13:57 +0300 |
commit | f6b0b76fea40394059e575b844e5bf71f255e35f (patch) | |
tree | 9395fb87ae374c40a5dbe6071a6e500bfedb5935 /source | |
parent | 28245a754e6b50aa21db49f27b6ae0ac25295270 (diff) |
[#18159] Path -> toggle cyclic -> toggle cyclic again == path corrupted
was not recalculating the knots when the cyclic flag was disabled so the endpoint flag was being ignored until recalculating (extrude for eg).
Also removed unneeded re-allocation of curve knots which are always reallocated by makeknots.
Fixed another bug with which recalculating knots with the Python surface api. (mixed up u/v args to makeknots(..) )
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/api2_2x/SurfNurb.c | 2 | ||||
-rw-r--r-- | source/blender/src/editcurve.c | 59 |
2 files changed, 11 insertions, 50 deletions
diff --git a/source/blender/python/api2_2x/SurfNurb.c b/source/blender/python/api2_2x/SurfNurb.c index 65bd04de14d..deee6c07793 100644 --- a/source/blender/python/api2_2x/SurfNurb.c +++ b/source/blender/python/api2_2x/SurfNurb.c @@ -482,7 +482,7 @@ static int SurfNurb_setCyclicV( BPy_SurfNurb * self, PyObject * value ) self->nurb->flagv |= CU_CYCLIC; else self->nurb->flagv &= ~CU_CYCLIC; - makeknots( self->nurb, 2, self->nurb->flagu >> 1 ); + makeknots( self->nurb, 2, self->nurb->flagv >> 1 ); return 0; } diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c index c26c44103c0..594ff816ec1 100644 --- a/source/blender/src/editcurve.c +++ b/source/blender/src/editcurve.c @@ -3065,8 +3065,8 @@ void makecyclicNurb() Nurb *nu; BezTriple *bezt; BPoint *bp; - float *fp; - int a, b, cyclmode=0; + + int a, cyclmode=0; for(nu= editNurb.first; nu; nu= nu->next) { if( nu->pntsu>1 || nu->pntsv>1) { @@ -3075,8 +3075,7 @@ void makecyclicNurb() bp= nu->bp; while(a--) { if( bp->f1 & SELECT ) { - if(nu->flagu & CU_CYCLIC) nu->flagu &= ~CU_CYCLIC; - else nu->flagu |= CU_CYCLIC; + nu->flagu ^= CU_CYCLIC; break; } bp++; @@ -3087,8 +3086,7 @@ void makecyclicNurb() bezt= nu->bezt; while(a--) { if( BEZSELECTED_HIDDENHANDLES(bezt) ) { - if(nu->flagu & CU_CYCLIC) nu->flagu &= ~CU_CYCLIC; - else nu->flagu |= CU_CYCLIC; + nu->flagu ^= CU_CYCLIC; break; } bezt++; @@ -3101,19 +3099,8 @@ void makecyclicNurb() bp= nu->bp; while(a--) { if( bp->f1 & SELECT ) { - if(nu->flagu & CU_CYCLIC) nu->flagu &= ~CU_CYCLIC; - else { - nu->flagu |= CU_CYCLIC; - nu->flagu &= ~2; /* endpoint flag, fixme */ - fp= MEM_mallocN(sizeof(float)*KNOTSU(nu), "makecyclicN"); - b= (nu->orderu+nu->pntsu); - memcpy(fp, nu->knotsu, sizeof(float)*b); - MEM_freeN(nu->knotsu); - nu->knotsu= fp; - - makeknots(nu, 1, 0); /* 1==u 0==uniform */ - - } + nu->flagu ^= CU_CYCLIC; + makeknots(nu, 1, nu->flagu>>1); /* 1==u type is ignored for cyclic curves */ break; } bp++; @@ -3131,38 +3118,12 @@ void makecyclicNurb() if( bp->f1 & SELECT) { if(cyclmode==1 && nu->pntsu>1) { - if(nu->flagu & CU_CYCLIC) nu->flagu &= ~CU_CYCLIC; - else { - nu->flagu |= CU_CYCLIC; - if (check_valid_nurb_u(nu)) { - fp= MEM_mallocN(sizeof(float)*KNOTSU(nu), "makecyclicN"); - b= (nu->orderu+nu->pntsu); - if (nu->knotsu) { /* null if check_valid_nurb_u failed before but is valid now */ - memcpy(fp, nu->knotsu, sizeof(float)*b); - MEM_freeN(nu->knotsu); - } - nu->knotsu= fp; - - makeknots(nu, 1, 0); /* 1==u 0==uniform */ - } - } + nu->flagu ^= CU_CYCLIC; + makeknots(nu, 1, nu->flagu>>1); /* 1==u type is ignored for cyclic curves */ } if(cyclmode==2 && nu->pntsv>1) { - if(nu->flagv & 1) nu->flagv--; - else { - nu->flagv++; - if (check_valid_nurb_v(nu)) { - fp= MEM_mallocN(sizeof(float)*KNOTSV(nu), "makecyclicN"); - b= (nu->orderv+nu->pntsv); - if (nu->knotsv) { /* null if check_valid_nurb_v failed before but is valid now */ - memcpy(fp, nu->knotsv, sizeof(float)*b); - MEM_freeN(nu->knotsv); - } - nu->knotsv= fp; - - makeknots(nu, 2, 0); /* 2==v 0==uniform */ - } - } + nu->flagv ^= CU_CYCLIC; + makeknots(nu, 2, nu->flagv>>1); /* 2==v type is ignored for cyclic curves */ } break; } |