From 6fd597b30446f23513ce6481219863c4abed3b7e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 28 Mar 2009 05:51:18 +0000 Subject: removed unneeded arg from makeknots() and replaced some numbers with defines --- source/blender/blenkernel/BKE_curve.h | 2 +- source/blender/blenkernel/intern/curve.c | 14 +++--- source/blender/python/api2_2x/CurNurb.c | 8 ++-- source/blender/python/api2_2x/SurfNurb.c | 14 +++--- source/blender/src/buttons_editing.c | 8 ++-- source/blender/src/drawobject.c | 4 +- source/blender/src/drawview.c | 2 +- source/blender/src/editcurve.c | 80 ++++++++++++++++---------------- source/blender/src/editobject.c | 4 +- 9 files changed, 68 insertions(+), 68 deletions(-) diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 25d6d78c4aa..a6619958797 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -63,7 +63,7 @@ void duplicateNurblist( struct ListBase *lb1, struct ListBase *lb2); void test2DNurb( struct Nurb *nu); void minmaxNurb( struct Nurb *nu, float *min, float *max); -void makeknots( struct Nurb *nu, short uv, short type); +void makeknots( struct Nurb *nu, short uv); void makeNurbfaces(struct Nurb *nu, float *coord_array, int rowstride); void makeNurbcurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, int resolu); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 7fa4f406c7b..e303f78b163 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -554,8 +554,8 @@ static void makecyclicknots(float *knots, short pnts, short order) } -/* type - 0: uniform, 1: endpoints, 2: bezier, note, cyclic nurbs are always uniform */ -void makeknots(Nurb *nu, short uv, short type) + +void makeknots(Nurb *nu, short uv) { if( (nu->type & 7)==CU_NURBS ) { if(uv == 1) { @@ -566,7 +566,7 @@ void makeknots(Nurb *nu, short uv, short type) calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */ makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu); } else { - calcknots(nu->knotsu, nu->pntsu, nu->orderu, type); + calcknots(nu->knotsu, nu->pntsu, nu->orderu, nu->flagu>>1); } } else nu->knotsu= NULL; @@ -579,7 +579,7 @@ void makeknots(Nurb *nu, short uv, short type) calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */ makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv); } else { - calcknots(nu->knotsv, nu->pntsv, nu->orderv, type); + calcknots(nu->knotsv, nu->pntsv, nu->orderv, nu->flagv>>1); } } else nu->knotsv= NULL; @@ -2333,7 +2333,7 @@ void sethandlesNurb(short code) if(code==1 || code==2) { nu= editNurb.first; while(nu) { - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { @@ -2363,7 +2363,7 @@ void sethandlesNurb(short code) } else { /* Toggle */ while(nu) { - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { @@ -2380,7 +2380,7 @@ void sethandlesNurb(short code) } nu= editNurb.first; while(nu) { - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c index 456f11e4a54..a32fce8cc48 100644 --- a/source/blender/python/api2_2x/CurNurb.c +++ b/source/blender/python/api2_2x/CurNurb.c @@ -564,7 +564,7 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value ) tmp->radius = radius; tmp->weight = 0.0; /* softbody weight TODO - add access to this, is zero elsewhere but through blender is 1.0 by default */ - makeknots( nurb, 1, nurb->flagu >> 1 ); + makeknots(nurb, 1); } else { /* bail with error */ @@ -649,7 +649,7 @@ static int CurNurb_setFlagU( BPy_CurNurb * self, PyObject * args ) if( self->nurb->flagu != value ) { self->nurb->flagu = (short)value; - makeknots( self->nurb, 1, self->nurb->flagu >> 1 ); + makeknots(self->nurb, 1); } return 0; @@ -698,7 +698,7 @@ static int CurNurb_setFlagV( BPy_CurNurb * self, PyObject * args ) if( self->nurb->flagv != value ) { self->nurb->flagv = (short)value; - makeknots( self->nurb, 2, self->nurb->flagv >> 1 ); + makeknots( self->nurb, 2); } return 0; @@ -728,7 +728,7 @@ static int CurNurb_setOrderU( BPy_CurNurb * self, PyObject * args ) order = self->nurb->pntsu; self->nurb->orderu = (short)order; - makeknots( self->nurb, 1, self->nurb->flagu >> 1 ); + makeknots(self->nurb, 1); return 0; } diff --git a/source/blender/python/api2_2x/SurfNurb.c b/source/blender/python/api2_2x/SurfNurb.c index deee6c07793..e75bb340272 100644 --- a/source/blender/python/api2_2x/SurfNurb.c +++ b/source/blender/python/api2_2x/SurfNurb.c @@ -195,7 +195,7 @@ static PyObject *SurfNurb_appendPointToNurb( Nurb * nurb, PyObject * args ) nurb->bp[npoints].alfa = 0.0f; } - makeknots( nurb, 1, nurb->flagu >> 1 ); + makeknots(nurb, 1); } else { return EXPP_ReturnPyObjError( PyExc_TypeError, @@ -322,7 +322,7 @@ static int SurfNurb_setFlagU( BPy_SurfNurb * self, PyObject * args ) flagu = (flagu << 1) | (self->nurb->flagu & CU_CYCLIC); if( self->nurb->flagu != flagu ) { self->nurb->flagu = (short)flagu; - makeknots( self->nurb, 1, self->nurb->flagu >> 1 ); + makeknots(self->nurb, 1); } return 0; @@ -366,7 +366,7 @@ static int SurfNurb_setFlagV( BPy_SurfNurb * self, PyObject * args ) flagv = (flagv << 1) | (self->nurb->flagv & CU_CYCLIC); if( self->nurb->flagv != flagv ) { self->nurb->flagv = (short)flagv; - makeknots( self->nurb, 2, self->nurb->flagv >> 1 ); + makeknots(self->nurb, 2); } return 0; @@ -402,7 +402,7 @@ static int SurfNurb_setOrderU( BPy_SurfNurb * self, PyObject * args ) order = self->nurb->pntsu; self->nurb->orderu = (short)order; - makeknots( self->nurb, 1, self->nurb->flagu >> 1 ); + makeknots(self->nurb, 1); return 0; } @@ -431,7 +431,7 @@ static int SurfNurb_setOrderV( BPy_SurfNurb * self, PyObject * args ) order = self->nurb->pntsv; self->nurb->orderv = (short)order; - makeknots( self->nurb, 2, self->nurb->flagv >> 1 ); + makeknots(self->nurb, 2); return 0; } @@ -467,7 +467,7 @@ static int SurfNurb_setCyclicU( BPy_SurfNurb * self, PyObject * value ) self->nurb->flagu |= CU_CYCLIC; else self->nurb->flagu &= ~CU_CYCLIC; - makeknots( self->nurb, 1, self->nurb->flagu >> 1 ); + makeknots(self->nurb, 1); return 0; } @@ -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->flagv >> 1 ); + makeknots(self->nurb, 2); return 0; } diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 134f794af93..2f77e3659ee 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -3311,13 +3311,13 @@ void do_curvebuts(unsigned short event) nu->flagu &= CU_CYCLIC; /* disable all flags except for CU_CYCLIC */ nu->flagu |= ((event-B_UNIFU)<<1); clamp_nurb_order_u(nu); - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } else if(nu->pntsv>1) { nu->flagv &= CU_CYCLIC; /* disable all flags except for CU_CYCLIC */ nu->flagv |= ((event-B_UNIFV)<<1); clamp_nurb_order_v(nu); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } } } @@ -3359,11 +3359,11 @@ void do_curvebuts(unsigned short event) if(clamp_nurb_order_u(nu)) { scrarea_queue_winredraw(curarea); } - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); if(clamp_nurb_order_v(nu)) { scrarea_queue_winredraw(curarea); } - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } BIF_undo_push("Make knots"); DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 43991194658..2063ac42bb1 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -3777,7 +3777,7 @@ static void tekenhandlesN(Nurb *nu, short sel) glBegin(GL_LINES); - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { if(sel) col= nurbcol+4; else col= nurbcol; @@ -3834,7 +3834,7 @@ static void tekenvertsN(Nurb *nu, short sel) bglBegin(GL_POINTS); - if((nu->type & 7)==1) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 2cc8a9510a6..cd40b5e0ae2 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -1773,7 +1773,7 @@ static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim) nu= editNurb.first; while(nu) { - if((nu->type & 7)==1) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c index 594ff816ec1..0e697c5c5c4 100644 --- a/source/blender/src/editcurve.c +++ b/source/blender/src/editcurve.c @@ -691,7 +691,7 @@ void deleteflagNurb(short flag) nu->bp= newbp; clamp_nurb_order_v(nu); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } else { /* is the nurb in V direction selected */ @@ -737,7 +737,7 @@ void deleteflagNurb(short flag) nu->pntsu= newu; clamp_nurb_order_u(nu); } - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } } } @@ -785,7 +785,7 @@ short extrudeflagNurb(int flag) nu->pntsv= 2; nu->orderv= 2; - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } } else { @@ -828,7 +828,7 @@ short extrudeflagNurb(int flag) MEM_freeN(nu->bp); nu->bp= newbp; nu->pntsv++; - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } else if(v==0 || v== nu->pntsu-1) { /* collumn in v-direction selected */ ok= 1; @@ -855,7 +855,7 @@ short extrudeflagNurb(int flag) MEM_freeN(nu->bp); nu->bp= newbp; nu->pntsu++; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } } } @@ -949,7 +949,7 @@ void adduplicateflagNurb(short flag) /* knots */ newnu->knotsu= NULL; - makeknots(newnu, 1, newnu->flagu>>1); + makeknots(newnu, 1); } bp++; } @@ -1013,14 +1013,14 @@ void adduplicateflagNurb(short flag) if(nu->pntsu==newnu->pntsu && nu->knotsu) { newnu->knotsu= MEM_dupallocN( nu->knotsu ); } else { - makeknots(newnu, 1, newnu->flagu>>1); + makeknots(newnu, 1); } } if (check_valid_nurb_v(newnu)) { if(nu->pntsv==newnu->pntsv && nu->knotsv) { newnu->knotsv= MEM_dupallocN( nu->knotsv ); } else { - makeknots(newnu, 2, newnu->flagv>>1); + makeknots(newnu, 2); } } } @@ -1779,8 +1779,8 @@ void subdivideNurb() nu->bp= bpnew; nu->pntsu+= amount; - if(nu->type & 4) { - makeknots(nu, 1, nu->flagu>>1); + if(nu->type & CU_NURBS) { + makeknots(nu, 1); } } } /* End of 'else if(nu->pntsv==1)' */ @@ -1891,8 +1891,8 @@ void subdivideNurb() nu->bp= bpnew; nu->pntsu= 2*nu->pntsu-1; nu->pntsv= 2*nu->pntsv-1; - makeknots(nu, 1, nu->flagu>>1); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 1); + makeknots(nu, 2); } /* End of 'if(sel== nu->pntsu*nu->pntsv)' (subdivide entire NURB) */ else { /* subdivide in v direction? */ @@ -1935,7 +1935,7 @@ void subdivideNurb() MEM_freeN(nu->bp); nu->bp= bpnew; nu->pntsv+= sel; - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } else { /* or in u direction? */ @@ -1975,7 +1975,7 @@ void subdivideNurb() MEM_freeN(nu->bp); nu->bp= bpnew; nu->pntsu+= sel; - makeknots(nu, 1, nu->flagu>>1); /* shift knots + makeknots(nu, 1); /* shift knots forward */ } } @@ -2119,7 +2119,7 @@ int convertspline(short type, Nurb *nu) BPoint *bp; int a, c, nr; - if((nu->type & 7)==0) { /* Poly */ + if((nu->type & 7)==CU_POLY) { if(type==CU_BEZIER) { /* to Bezier with vecthandles */ nr= nu->pntsu; bezt = @@ -2140,16 +2140,16 @@ int convertspline(short type, Nurb *nu) nu->bp= 0; nu->pntsu= nr; nu->type &= ~7; - nu->type |= 1; + nu->type |= CU_BEZIER; calchandlesNurb(nu); } else if(type==CU_NURBS) { nu->type &= ~7; - nu->type+= 4; + nu->type |= CU_NURBS; nu->orderu= 4; nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ nu->flagu += 4; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); a= nu->pntsu*nu->pntsv; bp= nu->bp; while(a--) { @@ -2203,7 +2203,7 @@ int convertspline(short type, Nurb *nu) if(type== 4) { nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ nu->flagu += 4; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } } } @@ -2245,7 +2245,7 @@ int convertspline(short type, Nurb *nu) nu->knotsu= NULL; nu->pntsu= nr; nu->type &= ~7; - nu->type+= 1; + nu->type |= CU_BEZIER; } } } @@ -2493,12 +2493,12 @@ void merge_2_nurb(Nurb *nu1, Nurb *nu2) } } - if((nu1->type & 7)==4) { + if((nu1->type & 7)==CU_NURBS) { /* merge knots */ - makeknots(nu1, 1, nu1->flagu>>1); + makeknots(nu1, 1); /* make knots, for merged curved for example */ - makeknots(nu1, 2, nu1->flagv>>1); + makeknots(nu1, 2); } MEM_freeN(temp); @@ -2681,9 +2681,9 @@ void addsegment_nurb() BLI_remlink(&editNurb, nu2); /* now join the knots */ - if((nu1->type & 7)==4) { + if((nu1->type & 7)==CU_NURBS) { if(nu1->knotsu==NULL) { - makeknots(nu1, 1, nu1->flagu>>1); + makeknots(nu1, 1); } else { fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3"); @@ -2879,7 +2879,7 @@ static void spin_nurb(float *dvec, short mode) if(isNurbsel(nu)) { nu->orderv= 4; nu->flagv |= CU_CYCLIC; - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } } } @@ -2993,7 +2993,7 @@ void addvert_Nurb(int mode) if(bp) { nu->pntsu++; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); if(mode=='e') { VECCOPY(newbp->vec, bp->vec); @@ -3070,7 +3070,7 @@ void makecyclicNurb() for(nu= editNurb.first; nu; nu= nu->next) { if( nu->pntsu>1 || nu->pntsv>1) { - if( (nu->type & 7)==0 ) { + if( (nu->type & 7)==CU_POLY ) { a= nu->pntsu; bp= nu->bp; while(a--) { @@ -3100,7 +3100,7 @@ void makecyclicNurb() while(a--) { if( bp->f1 & SELECT ) { nu->flagu ^= CU_CYCLIC; - makeknots(nu, 1, nu->flagu>>1); /* 1==u type is ignored for cyclic curves */ + makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */ break; } bp++; @@ -3119,11 +3119,11 @@ void makecyclicNurb() if( bp->f1 & SELECT) { if(cyclmode==1 && nu->pntsu>1) { nu->flagu ^= CU_CYCLIC; - makeknots(nu, 1, nu->flagu>>1); /* 1==u type is ignored for cyclic curves */ + makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */ } if(cyclmode==2 && nu->pntsv>1) { nu->flagv ^= CU_CYCLIC; - makeknots(nu, 2, nu->flagv>>1); /* 2==v type is ignored for cyclic curves */ + makeknots(nu, 2); /* 2==v type is ignored for cyclic curves */ } break; } @@ -3760,7 +3760,7 @@ void delNurb() clamp_nurb_order_u(nu); }*/ } - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } nu= next; } @@ -4148,9 +4148,9 @@ Nurb *addNurbprim(int type, int stype, int newname) bp= nu->bp; for(a=0;a<4;a++, bp++) Mat3MulVecfl(imat,bp->vec); - if((type & 7)==4) { + if((type & 7)==CU_NURBS) { nu->knotsu= 0; /* makeknots allocates */ - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } } @@ -4185,7 +4185,7 @@ Nurb *addNurbprim(int type, int stype, int newname) if((type & 7)==4) { nu->knotsu= 0; /* makeknots allocates */ - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } break; @@ -4270,7 +4270,7 @@ Nurb *addNurbprim(int type, int stype, int newname) bp++; } - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } break; case 2: /* 4x4 patch */ @@ -4307,8 +4307,8 @@ Nurb *addNurbprim(int type, int stype, int newname) } } - makeknots(nu, 1, nu->flagu>>1); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 1); + makeknots(nu, 2); } break; case 3: /* tube */ @@ -4370,7 +4370,7 @@ Nurb *addNurbprim(int type, int stype, int newname) bp++; } nu->flagu= 4; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); BLI_addtail(&editNurb, nu); /* temporal for spin */ if(newname && (U.flag & USER_ADD_VIEWALIGNED) == 0) @@ -4378,7 +4378,7 @@ Nurb *addNurbprim(int type, int stype, int newname) else spin_nurb(0, 0); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); a= nu->pntsu*nu->pntsv; bp= nu->bp; diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 2a1d508bf59..bb9be49c347 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -2034,7 +2034,7 @@ void docenter(int centermode) nu= nu1; while(nu) { - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { a= nu->pntsu; while (a--) { VecSubf(nu->bezt[a].vec[0], nu->bezt[a].vec[0], cent); @@ -4076,7 +4076,7 @@ static void apply_objects_internal( int apply_scale, int apply_rot ) nu= cu->nurb.first; while(nu) { - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { a= nu->pntsu; bezt= nu->bezt; while(a--) { -- cgit v1.2.3