Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-09-08 04:23:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-09-08 04:23:33 +0400
commit8b6b31b41fc6ed07036ea30153131e6824fc7c7e (patch)
tree6e4afbce04f039584cdeea49d3dba3b80b0c822b /source/blender/blenkernel
parent0ab2f675c364f2ca1212b0453bf2ffdce5ebb9ea (diff)
Made Nurb->type only store the type rather then mixing the type with flags.
moved CU_2D to Nurb->flag in do_versions This made simple type checks confusing to read. many... if( (nu->type & 7)==CU_BEZIER) replaced with ... if(nu->type == CU_BEZIER) made setting rna curve_2d clamp the Z values. still more RNA/UI changes to do.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_curve.h2
-rw-r--r--source/blender/blenkernel/intern/anim.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c39
-rw-r--r--source/blender/blenkernel/intern/displist.c6
-rw-r--r--source/blender/blenkernel/intern/font.c3
-rw-r--r--source/blender/blenkernel/intern/object.c2
6 files changed, 29 insertions, 27 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index e5a8df1a932..b9f3ee2dd6e 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -47,7 +47,7 @@ struct BevList;
#define SEGMENTSU(nu) ( ((nu)->flagu & CU_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 )
#define SEGMENTSV(nu) ( ((nu)->flagv & CU_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 )
-#define CU_DO_TILT(cu, nu) (((nu->type & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1)
+#define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1)
#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || cu->bevobj || cu->ext1!=0.0 || cu->ext2!=0.0) ? 1:0)
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 6c1b8eb9000..eb74dc1fbfc 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -271,8 +271,8 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* returns OK
nu= cu->nurb.first;
/* make sure that first and last frame are included in the vectors here */
- if((nu->type & 7)==CU_POLY) set_four_ipo(1.0f-fac, data, KEY_LINEAR);
- else if((nu->type & 7)==CU_BEZIER) set_four_ipo(1.0f-fac, data, KEY_LINEAR);
+ if(nu->type == CU_POLY) set_four_ipo(1.0f-fac, data, KEY_LINEAR);
+ else if(nu->type == CU_BEZIER) set_four_ipo(1.0f-fac, data, KEY_LINEAR);
else if(s0==s1 || p2==p3) set_four_ipo(1.0f-fac, data, KEY_CARDINAL);
else set_four_ipo(1.0f-fac, data, KEY_BSPLINE);
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index ca0d4a5fdc3..58ff601e7f7 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -470,8 +470,11 @@ void test2DNurb(Nurb *nu)
BezTriple *bezt;
BPoint *bp;
int a;
+
+ if((nu->flag & CU_2D)==0)
+ return;
- if( nu->type== CU_BEZIER+CU_2D ) {
+ if(nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
while(a--) {
@@ -481,7 +484,7 @@ void test2DNurb(Nurb *nu)
bezt++;
}
}
- else if(nu->type & CU_2D) {
+ else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
while(a--) {
@@ -497,7 +500,7 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
BPoint *bp;
int a;
- if( (nu->type & 7)==CU_BEZIER ) {
+ if(nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
while(a--) {
@@ -594,7 +597,7 @@ static void makecyclicknots(float *knots, short pnts, short order)
void makeknots(Nurb *nu, short uv)
{
- if( (nu->type & 7)==CU_NURBS ) {
+ if(nu->type == CU_NURBS) {
if(uv == 1) {
if(nu->knotsu) MEM_freeN(nu->knotsu);
if(check_valid_nurb_u(nu)) {
@@ -1587,7 +1590,7 @@ void makeBevelList(Object *ob)
else
resolu= nu->resolu;
- if((nu->type & 7)==CU_POLY) {
+ if(nu->type == CU_POLY) {
len= nu->pntsu;
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList2");
BLI_addtail(&(cu->bev), bl);
@@ -1610,7 +1613,7 @@ void makeBevelList(Object *ob)
bp++;
}
}
- else if((nu->type & 7)==CU_BEZIER) {
+ else if(nu->type == CU_BEZIER) {
len= resolu*(nu->pntsu+ (nu->flagu & CU_CYCLIC) -1)+1; /* in case last point is not cyclic */
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelBPoints");
@@ -1718,7 +1721,7 @@ void makeBevelList(Object *ob)
bl->nr++;
}
}
- else if((nu->type & 7)==CU_NURBS) {
+ else if(nu->type == CU_NURBS) {
if(nu->pntsv==1) {
len= (resolu*SEGMENTSU(nu));
@@ -2311,7 +2314,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
BezTriple *bezt, *prev, *next;
short a;
- if((nu->type & 7)!=CU_BEZIER) return;
+ if(nu->type != CU_BEZIER) return;
if(nu->pntsu<2) return;
a= nu->pntsu;
@@ -2346,7 +2349,7 @@ void testhandlesNurb(Nurb *nu)
BezTriple *bezt;
short flag, a;
- if((nu->type & 7)!=CU_BEZIER) return;
+ if(nu->type != CU_BEZIER) return;
bezt= nu->bezt;
a= nu->pntsu;
@@ -2474,7 +2477,7 @@ void sethandlesNurb(ListBase *editnurb, short code)
if(code==1 || code==2) {
nu= editnurb->first;
while(nu) {
- if( (nu->type & 7)==CU_BEZIER) {
+ if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
@@ -2504,7 +2507,7 @@ void sethandlesNurb(ListBase *editnurb, short code)
} else {
/* Toggle */
while(nu) {
- if( (nu->type & 7)==CU_BEZIER) {
+ if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
@@ -2521,7 +2524,7 @@ void sethandlesNurb(ListBase *editnurb, short code)
}
nu= editnurb->first;
while(nu) {
- if( (nu->type & 7)==CU_BEZIER) {
+ if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
@@ -2569,7 +2572,7 @@ void switchdirectionNurb(Nurb *nu)
if(nu->pntsu==1 && nu->pntsv==1) return;
- if((nu->type & 7)==CU_BEZIER) {
+ if(nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt1= nu->bezt;
bezt2= bezt1+(a-1);
@@ -2608,7 +2611,7 @@ void switchdirectionNurb(Nurb *nu)
bp1++;
bp2--;
}
- if((nu->type & 7)==CU_NURBS) {
+ if(nu->type == CU_NURBS) {
/* inverse knots */
a= KNOTSU(nu);
fp1= nu->knotsu;
@@ -2671,7 +2674,7 @@ float (*curve_getVertexCos(Curve *cu, ListBase *lb, int *numVerts_r))[3]
co = cos[0];
for (nu=lb->first; nu; nu=nu->next) {
- if ((nu->type & 7)==CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
BezTriple *bezt = nu->bezt;
for (i=0; i<nu->pntsu; i++,bezt++) {
@@ -2698,7 +2701,7 @@ void curve_applyVertexCos(Curve *cu, ListBase *lb, float (*vertexCos)[3])
int i;
for (nu=lb->first; nu; nu=nu->next) {
- if ((nu->type & 7)==CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
BezTriple *bezt = nu->bezt;
for (i=0; i<nu->pntsu; i++,bezt++) {
@@ -2720,7 +2723,7 @@ int check_valid_nurb_u( struct Nurb *nu )
{
if (nu==NULL) return 0;
if (nu->pntsu <= 1) return 0;
- if ((nu->type & 7)!=CU_NURBS) return 1; /* not a nurb, lets assume its valid */
+ if (nu->type != CU_NURBS) return 1; /* not a nurb, lets assume its valid */
if (nu->pntsu < nu->orderu) return 0;
if (((nu->flag & CU_CYCLIC)==0) && ((nu->flagu>>1) & 2)) { /* Bezier U Endpoints */
@@ -2734,7 +2737,7 @@ int check_valid_nurb_v( struct Nurb *nu)
{
if (nu==NULL) return 0;
if (nu->pntsv <= 1) return 0;
- if ((nu->type & 7)!=CU_NURBS) return 1; /* not a nurb, lets assume its valid */
+ if (nu->type != CU_NURBS) return 1; /* not a nurb, lets assume its valid */
if (nu->pntsv < nu->orderv) return 0;
if (((nu->flag & CU_CYCLIC)==0) && ((nu->flagv>>1) & 2)) { /* Bezier V Endpoints */
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 069129c15da..de85b0a33f6 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -834,7 +834,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
resolu= nu->resolu;
if(!check_valid_nurb_u(nu));
- else if((nu->type & 7)==CU_BEZIER) {
+ else if(nu->type == CU_BEZIER) {
/* count */
len= 0;
@@ -902,7 +902,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
bezt++;
}
}
- else if((nu->type & 7)==CU_NURBS) {
+ else if(nu->type == CU_NURBS) {
len= (resolu*SEGMENTSU(nu));
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
@@ -919,7 +919,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
else dl->type= DL_SEGM;
makeNurbcurve(nu, data, NULL, NULL, resolu);
}
- else if((nu->type & 7)==CU_POLY) {
+ else if(nu->type == CU_POLY) {
len= nu->pntsu;
dl= MEM_callocN(sizeof(DispList), "makeDispListpoly");
dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 70901778585..5ce021e3931 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -462,7 +462,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
nu2->resolu= cu->resolu;
nu2->bezt = NULL;
nu2->knotsu = nu2->knotsv = NULL;
- nu2->flag= 0;
+ nu2->flag= CU_2D;
nu2->charidx = charidx+1000;
if (mat_nr > 0) nu2->mat_nr= mat_nr-1;
nu2->pntsu = 4;
@@ -495,7 +495,6 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
nu2->bp[3].vec[2] = 0;
nu2->bp[3].vec[3] = 1.0;
- nu2->type = CU_2D;
BLI_addtail(&(cu->nurb), nu2);
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 9a137bdb7e6..f10226f6f6b 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1807,7 +1807,7 @@ static void give_parvert(Object *par, int nr, float *vec)
count= 0;
while(nu && !found) {
- if((nu->type & 7)==CU_BEZIER) {
+ if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {