[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19022] trunk/blender/source/blender: [ #18159] Path -> toggle cyclic -> toggle cyclic again == path corrupted
Campbell Barton
ideasman42 at gmail.com
Wed Feb 18 04:14:08 CET 2009
Revision: 19022
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19022
Author: campbellbarton
Date: 2009-02-18 04:13:57 +0100 (Wed, 18 Feb 2009)
Log Message:
-----------
[#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(..) )
Modified Paths:
--------------
trunk/blender/source/blender/python/api2_2x/SurfNurb.c
trunk/blender/source/blender/src/editcurve.c
Modified: trunk/blender/source/blender/python/api2_2x/SurfNurb.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/SurfNurb.c 2009-02-18 03:01:45 UTC (rev 19021)
+++ trunk/blender/source/blender/python/api2_2x/SurfNurb.c 2009-02-18 03:13:57 UTC (rev 19022)
@@ -482,7 +482,7 @@
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;
}
Modified: trunk/blender/source/blender/src/editcurve.c
===================================================================
--- trunk/blender/source/blender/src/editcurve.c 2009-02-18 03:01:45 UTC (rev 19021)
+++ trunk/blender/source/blender/src/editcurve.c 2009-02-18 03:13:57 UTC (rev 19022)
@@ -3065,8 +3065,8 @@
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 @@
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 @@
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 @@
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 @@
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;
}
More information about the Bf-blender-cvs
mailing list