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.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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--) {
|
||||
|
||||
@@ -146,9 +146,10 @@ void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vfd)
|
||||
bezt = (BezTriple*)MEM_callocN((onpoints[j])* sizeof(BezTriple),"objfnt_bezt") ;
|
||||
BLI_addtail(&che->nurbsbase, nu);
|
||||
|
||||
nu->type= CU_BEZIER+CU_2D;
|
||||
nu->type= CU_BEZIER;
|
||||
nu->pntsu = onpoints[j];
|
||||
nu->resolu= 8;
|
||||
nu->flag= CU_2D;
|
||||
nu->flagu= CU_CYCLIC;
|
||||
nu->bezt = bezt;
|
||||
|
||||
|
||||
@@ -9219,6 +9219,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
Material *ma;
|
||||
Camera *cam;
|
||||
Mesh *me;
|
||||
Curve *cu;
|
||||
Scene *sce;
|
||||
Tex *tx;
|
||||
ParticleSettings *part;
|
||||
@@ -9365,6 +9366,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
|
||||
//BLI_freelistN(&pidlist);
|
||||
}
|
||||
|
||||
/* type was a mixed flag & enum. move the 2d flag elsewhere */
|
||||
for(cu = main->curve.first; cu; cu= cu->id.next) {
|
||||
Nurb *nu;
|
||||
|
||||
for(nu= cu->nurb.first; nu; nu= nu->next) {
|
||||
nu->flag |= (nu->type & CU_2D);
|
||||
nu->type &= CU_TYPE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 1)) {
|
||||
|
||||
@@ -1358,7 +1358,7 @@ static void write_curves(WriteData *wd, ListBase *idbase)
|
||||
}
|
||||
nu= cu->nurb.first;
|
||||
while(nu) {
|
||||
if( (nu->type & 7)==CU_BEZIER)
|
||||
if(nu->type == CU_BEZIER)
|
||||
writestruct(wd, DATA, "BezTriple", nu->pntsu, nu->bezt);
|
||||
else {
|
||||
writestruct(wd, DATA, "BPoint", nu->pntsu*nu->pntsv, nu->bp);
|
||||
|
||||
@@ -194,7 +194,7 @@ int isNurbsel(Nurb *nu)
|
||||
BPoint *bp;
|
||||
int a;
|
||||
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -219,7 +219,7 @@ int isNurbsel_count(Nurb *nu)
|
||||
BPoint *bp;
|
||||
int a, sel=0;
|
||||
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -247,7 +247,7 @@ void printknots(Object *obedit)
|
||||
int a, num;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if(isNurbsel(nu) && (nu->type & 7)==CU_NURBS) {
|
||||
if(isNurbsel(nu) && nu->type == CU_NURBS) {
|
||||
if(nu->knotsu) {
|
||||
num= KNOTSU(nu);
|
||||
for(a=0;a<num;a++) printf("knotu %d: %f\n", a, nu->knotsu[a]);
|
||||
@@ -300,7 +300,7 @@ void load_editNurb(Object *obedit)
|
||||
newnu= duplicateNurb(nu);
|
||||
BLI_addtail(&(cu->nurb), newnu);
|
||||
|
||||
if((nu->type & 7)==CU_NURBS) {
|
||||
if(nu->type == CU_NURBS) {
|
||||
clamp_nurb_order_u(nu);
|
||||
}
|
||||
}
|
||||
@@ -484,7 +484,7 @@ static void setflagsNurb(ListBase *editnurb, short flag)
|
||||
int a;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if( (nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
while(a--) {
|
||||
@@ -511,7 +511,7 @@ static void rotateflagNurb(ListBase *editnurb, short flag, float *cent, float ro
|
||||
int a;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_NURBS) {
|
||||
if(nu->type == CU_NURBS) {
|
||||
bp= nu->bp;
|
||||
a= nu->pntsu*nu->pntsv;
|
||||
|
||||
@@ -540,7 +540,7 @@ static void translateflagNurb(ListBase *editnurb, short flag, float *vec)
|
||||
int a;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if( (nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
while(a--) {
|
||||
@@ -570,7 +570,7 @@ static void weightflagNurb(ListBase *editnurb, short flag, float w, int mode) /*
|
||||
int a;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_NURBS) {
|
||||
if(nu->type == CU_NURBS) {
|
||||
a= nu->pntsu*nu->pntsv;
|
||||
bp= nu->bp;
|
||||
while(a--) {
|
||||
@@ -834,7 +834,7 @@ static void adduplicateflagNurb(Object *obedit, short flag)
|
||||
|
||||
nu= editnurb->last;
|
||||
while(nu) {
|
||||
if( (nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
for(a=0; a<nu->pntsu; a++) {
|
||||
enda= -1;
|
||||
@@ -1381,7 +1381,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
lastsel=0;
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
if(next < 0) bezt= (nu->bezt + (a-1));
|
||||
@@ -1447,7 +1447,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
sel= 0;
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
|
||||
/* which point? */
|
||||
@@ -1546,7 +1546,7 @@ static short nurb_has_selected_cps(ListBase *editnurb)
|
||||
int a;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
while(a--) {
|
||||
@@ -1616,7 +1616,7 @@ static int hide_exec(bContext *C, wmOperator *op)
|
||||
int a, sel, invert= RNA_boolean_get(op->ptr, "unselected");
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
sel= 0;
|
||||
@@ -1690,7 +1690,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
nu->hide= 0;
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -1746,7 +1746,7 @@ static int select_inverse_exec(bContext *C, wmOperator *op)
|
||||
int a;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -1814,7 +1814,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
amount= 0;
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
/*
|
||||
Insert a point into a 2D Bezier curve.
|
||||
Endpoints are preserved. Otherwise, all selected and inserted points are
|
||||
@@ -1895,7 +1895,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
|
||||
|
||||
calchandlesNurb(nu);
|
||||
}
|
||||
} /* End of 'if((nu->type & 7)==CU_BEZIER)' */
|
||||
} /* End of 'if(nu->type == CU_BEZIER)' */
|
||||
else if (nu->pntsv==1) {
|
||||
/*
|
||||
All flat lines (ie. co-planar), except flat Nurbs. Flat NURB curves
|
||||
@@ -1964,7 +1964,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
} /* End of 'else if(nu->pntsv==1)' */
|
||||
else if((nu->type & 7)==CU_NURBS) {
|
||||
else if(nu->type == CU_NURBS) {
|
||||
/* This is a very strange test ... */
|
||||
/**
|
||||
Subdivide NURB surfaces - nzc 30-5-'00 -
|
||||
@@ -2163,7 +2163,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
|
||||
MEM_freeN(usel);
|
||||
MEM_freeN(vsel);
|
||||
|
||||
} /* End of 'if((nu->type & 7)==CU_NURBS)' */
|
||||
} /* End of 'if(nu->type == CU_NURBS)' */
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
|
||||
@@ -2256,7 +2256,7 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt
|
||||
*bezt= 0;
|
||||
*bp= 0;
|
||||
for(nu1= editnurb->first; nu1; nu1= nu1->next) {
|
||||
if((nu1->type & 7)==CU_BEZIER) {
|
||||
if(nu1->type == CU_BEZIER) {
|
||||
bezt1= nu1->bezt;
|
||||
a= nu1->pntsu;
|
||||
while(a--) {
|
||||
@@ -2313,7 +2313,7 @@ static int convertspline(short type, Nurb *nu)
|
||||
BPoint *bp;
|
||||
int a, c, nr;
|
||||
|
||||
if((nu->type & 7)==CU_POLY) {
|
||||
if(nu->type == CU_POLY) {
|
||||
if(type==CU_BEZIER) { /* to Bezier with vecthandles */
|
||||
nr= nu->pntsu;
|
||||
bezt =
|
||||
@@ -2333,13 +2333,11 @@ static int convertspline(short type, Nurb *nu)
|
||||
MEM_freeN(nu->bp);
|
||||
nu->bp= 0;
|
||||
nu->pntsu= nr;
|
||||
nu->type &= ~7;
|
||||
nu->type |= CU_BEZIER;
|
||||
nu->type = CU_BEZIER;
|
||||
calchandlesNurb(nu);
|
||||
}
|
||||
else if(type==CU_NURBS) {
|
||||
nu->type &= ~7;
|
||||
nu->type |= CU_NURBS;
|
||||
nu->type = CU_NURBS;
|
||||
nu->orderu= 4;
|
||||
nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */
|
||||
nu->flagu += 4;
|
||||
@@ -2352,7 +2350,7 @@ static int convertspline(short type, Nurb *nu)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if((nu->type & 7)==CU_BEZIER) { /* Bezier */
|
||||
else if(nu->type == CU_BEZIER) { /* Bezier */
|
||||
if(type==0 || type==4) { /* to Poly or Nurb */
|
||||
nr= 3*nu->pntsu;
|
||||
nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
|
||||
@@ -2390,8 +2388,7 @@ static int convertspline(short type, Nurb *nu)
|
||||
nu->pntsv= 1;
|
||||
nu->orderu= 4;
|
||||
nu->orderv= 1;
|
||||
nu->type &= ~7;
|
||||
nu->type+= type;
|
||||
nu->type |= type;
|
||||
if(nu->flagu & CU_CYCLIC) c= nu->orderu-1;
|
||||
else c= 0;
|
||||
if(type== 4) {
|
||||
@@ -2401,9 +2398,9 @@ static int convertspline(short type, Nurb *nu)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if((nu->type & 7)==CU_NURBS) {
|
||||
if(type==0) { /* to Poly */
|
||||
nu->type &= ~7;
|
||||
else if(nu->type == CU_NURBS) {
|
||||
if(type==CU_POLY) {
|
||||
nu->type = CU_POLY;
|
||||
if(nu->knotsu) MEM_freeN(nu->knotsu); /* python created nurbs have a knotsu of zero */
|
||||
nu->knotsu= NULL;
|
||||
if(nu->knotsv) MEM_freeN(nu->knotsv);
|
||||
@@ -2438,8 +2435,7 @@ static int convertspline(short type, Nurb *nu)
|
||||
MEM_freeN(nu->knotsu);
|
||||
nu->knotsu= NULL;
|
||||
nu->pntsu= nr;
|
||||
nu->type &= ~7;
|
||||
nu->type |= CU_BEZIER;
|
||||
nu->type = CU_BEZIER;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2799,7 +2795,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
|
||||
}
|
||||
}
|
||||
|
||||
if((nu1->type & 7)==CU_NURBS) {
|
||||
if(nu1->type == CU_NURBS) {
|
||||
/* merge knots */
|
||||
makeknots(nu1, 1);
|
||||
|
||||
@@ -2903,7 +2899,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
||||
/* find both nurbs and points, nu1 will be put behind nu2 */
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->flagu & CU_CYCLIC)==0) { /* not cyclic */
|
||||
if( (nu->type & 7)==CU_BEZIER ) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
if(nu1==0) {
|
||||
if( BEZSELECTED_HIDDENHANDLES(bezt) ) nu1= nu;
|
||||
@@ -2960,7 +2956,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if((nu1 && nu2) && (nu1!=nu2)) {
|
||||
if( nu1->type==nu2->type) {
|
||||
if((nu1->type & 7)==CU_BEZIER) {
|
||||
if(nu1->type == CU_BEZIER) {
|
||||
bezt =
|
||||
(BezTriple*)MEM_mallocN((nu1->pntsu+nu2->pntsu) * sizeof(BezTriple), "addsegmentN");
|
||||
memcpy(bezt, nu2->bezt, nu2->pntsu*sizeof(BezTriple));
|
||||
@@ -2986,7 +2982,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
||||
BLI_remlink(editnurb, nu2);
|
||||
|
||||
/* now join the knots */
|
||||
if((nu1->type & 7)==CU_NURBS) {
|
||||
if(nu1->type == CU_NURBS) {
|
||||
if(nu1->knotsu==NULL) {
|
||||
makeknots(nu1, 1);
|
||||
}
|
||||
@@ -3266,7 +3262,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
|
||||
findselectedNurbvert(editnurb, &nu, &bezt, &bp);
|
||||
if(bezt==0 && bp==0) return OPERATOR_CANCELLED;
|
||||
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
/* which bezpoint? */
|
||||
if(bezt== nu->bezt) { /* first */
|
||||
BEZ_DESEL(bezt);
|
||||
@@ -3485,7 +3481,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if( nu->pntsu>1 || nu->pntsv>1) {
|
||||
if( (nu->type & 7)==CU_POLY ) {
|
||||
if(nu->type == CU_POLY) {
|
||||
a= nu->pntsu;
|
||||
bp= nu->bp;
|
||||
while(a--) {
|
||||
@@ -3496,7 +3492,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
|
||||
bp++;
|
||||
}
|
||||
}
|
||||
else if( (nu->type & 7)==CU_BEZIER ) {
|
||||
else if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
while(a--) {
|
||||
@@ -3508,7 +3504,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
calchandlesNurb(nu);
|
||||
}
|
||||
else if(nu->pntsv==1 && (nu->type & 7)==CU_NURBS) {
|
||||
else if(nu->pntsv==1 && nu->type == CU_NURBS) {
|
||||
if (nu->knotsu) { /* if check_valid_nurb_u fails the knotsu can be NULL */
|
||||
a= nu->pntsu;
|
||||
bp= nu->bp;
|
||||
@@ -3959,7 +3955,7 @@ static int select_less_exec(bContext *C, wmOperator *op)
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
lastsel=0;
|
||||
/* check what type of curve/nurb it is */
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
while(a--) {
|
||||
@@ -4105,7 +4101,7 @@ static int select_random_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* select elements */
|
||||
for(i=1, nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -4249,7 +4245,7 @@ static int delete_exec(bContext *C, wmOperator *op)
|
||||
nu= editnurb->first;
|
||||
while(nu) {
|
||||
next= nu->next;
|
||||
if( (nu->type & 7)==CU_BEZIER ) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
if(a) {
|
||||
@@ -4285,7 +4281,7 @@ static int delete_exec(bContext *C, wmOperator *op)
|
||||
/* Never allow the order to exceed the number of points
|
||||
- note, this is ok but changes unselected nurbs, disable for now */
|
||||
/*
|
||||
if ((nu!= NULL) && ((nu->type & 7)==CU_NURBS)) {
|
||||
if ((nu!= NULL) && (nu->type == CU_NURBS)) {
|
||||
clamp_nurb_order_u(nu);
|
||||
}
|
||||
*/
|
||||
@@ -4296,7 +4292,7 @@ static int delete_exec(bContext *C, wmOperator *op)
|
||||
while(nu) {
|
||||
next= nu->next;
|
||||
type= 0;
|
||||
if( (nu->type & 7)==CU_BEZIER ) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
for(a=0;a<nu->pntsu;a++) {
|
||||
if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
|
||||
@@ -4339,7 +4335,7 @@ static int delete_exec(bContext *C, wmOperator *op)
|
||||
/* Never allow the order to exceed the number of points\
|
||||
- note, this is ok but changes unselected nurbs, disable for now */
|
||||
/*
|
||||
if ((nu->type & 7)==CU_NURBS) {
|
||||
if (nu->type == CU_NURBS) {
|
||||
clamp_nurb_order_u(nu);
|
||||
}*/
|
||||
}
|
||||
@@ -4356,7 +4352,7 @@ static int delete_exec(bContext *C, wmOperator *op)
|
||||
nu1= 0;
|
||||
while(nu) {
|
||||
next= nu->next;
|
||||
if( (nu->type & 7)==CU_BEZIER ) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
for(a=0; a<nu->pntsu-1; a++) {
|
||||
if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
|
||||
@@ -4730,7 +4726,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
|
||||
/* these types call this function to return a Nurb */
|
||||
if (stype!=CU_PRIM_TUBE && stype!=CU_PRIM_DONUT) {
|
||||
nu = (Nurb*)MEM_callocN(sizeof(Nurb), "addNurbprim");
|
||||
nu->type= type;
|
||||
nu->type= cutype;
|
||||
nu->resolu= 4;
|
||||
nu->resolv= 4;
|
||||
}
|
||||
@@ -4743,6 +4739,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
|
||||
rename_id((ID *)obedit->data, "Curve");
|
||||
}
|
||||
if(cutype==CU_BEZIER) {
|
||||
nu->flag= CU_2D;
|
||||
nu->pntsu= 2;
|
||||
nu->bezt =
|
||||
(BezTriple*)MEM_callocN(2 * sizeof(BezTriple), "addNurbprim1");
|
||||
@@ -4851,6 +4848,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
|
||||
rename_id((ID *)obedit->data, "CurveCircle");
|
||||
}
|
||||
if(cutype==CU_BEZIER) {
|
||||
nu->flag= CU_2D;
|
||||
nu->pntsu= 4;
|
||||
nu->bezt= callocstructN(BezTriple, 4, "addNurbprim1");
|
||||
nu->flagu= CU_CYCLIC;
|
||||
@@ -5077,7 +5075,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
|
||||
}
|
||||
|
||||
/* always do: */
|
||||
nu->flag= CU_SMOOTH;
|
||||
nu->flag |= CU_SMOOTH;
|
||||
|
||||
test2DNurb(nu);
|
||||
|
||||
|
||||
@@ -406,11 +406,11 @@ void OBJECT_OT_mesh_add(wmOperatorType *ot)
|
||||
}
|
||||
|
||||
static EnumPropertyItem prop_curve_types[] = {
|
||||
{CU_BEZIER|CU_2D|CU_PRIM_CURVE, "BEZIER_CURVE", ICON_CURVE_BEZCURVE, "Bezier Curve", ""},
|
||||
{CU_BEZIER|CU_2D|CU_PRIM_CIRCLE, "BEZIER_CIRCLE", ICON_CURVE_BEZCIRCLE, "Bezier Circle", ""},
|
||||
{CU_NURBS|CU_2D|CU_PRIM_CURVE, "NURBS_CURVE", ICON_CURVE_NCURVE, "NURBS Curve", ""},
|
||||
{CU_NURBS|CU_2D|CU_PRIM_CIRCLE, "NURBS_CIRCLE", ICON_CURVE_NCIRCLE, "NURBS Circle", ""},
|
||||
{CU_NURBS|CU_2D|CU_PRIM_PATH, "PATH", ICON_CURVE_PATH, "Path", ""},
|
||||
{CU_BEZIER|CU_PRIM_CURVE, "BEZIER_CURVE", ICON_CURVE_BEZCURVE, "Bezier Curve", ""},
|
||||
{CU_BEZIER|CU_PRIM_CIRCLE, "BEZIER_CIRCLE", ICON_CURVE_BEZCIRCLE, "Bezier Circle", ""},
|
||||
{CU_NURBS|CU_PRIM_CURVE, "NURBS_CURVE", ICON_CURVE_NCURVE, "NURBS Curve", ""},
|
||||
{CU_NURBS|CU_PRIM_CIRCLE, "NURBS_CIRCLE", ICON_CURVE_NCIRCLE, "NURBS Circle", ""},
|
||||
{CU_NURBS|CU_PRIM_PATH, "PATH", ICON_CURVE_PATH, "Path", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -1064,7 +1064,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
|
||||
int *index, a, nr, totvert=0;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -1091,7 +1091,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
|
||||
cent[0]= cent[1]= cent[2]= 0.0;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -1200,7 +1200,7 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
|
||||
int index=0, a, nr=0;
|
||||
|
||||
for(nu= editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -2795,7 +2795,7 @@ void make_vertex_parent(Scene *scene, Object *obedit, View3D *v3d)
|
||||
|
||||
nu= editnurb->first;
|
||||
while(nu) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -3705,7 +3705,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
|
||||
|
||||
nu= nu1;
|
||||
while(nu) {
|
||||
if( (nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
while (a--) {
|
||||
VecSubf(nu->bezt[a].vec[0], nu->bezt[a].vec[0], cent);
|
||||
@@ -5742,7 +5742,7 @@ static void apply_objects_internal(Scene *scene, View3D *v3d, int apply_scale, i
|
||||
|
||||
nu= cu->nurb.first;
|
||||
while(nu) {
|
||||
if( (nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
while(a--) {
|
||||
|
||||
@@ -193,7 +193,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
|
||||
int a;
|
||||
|
||||
for(nu=cu->editnurb->first; nu; nu=nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
|
||||
@@ -1392,7 +1392,7 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb
|
||||
int i;
|
||||
|
||||
for (nu= cu->editnurb->first; nu; nu=nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
for (i=0; i<nu->pntsu; i++) {
|
||||
BezTriple *bezt = &nu->bezt[i];
|
||||
|
||||
@@ -3888,7 +3888,7 @@ static void tekenhandlesN(Nurb *nu, short sel)
|
||||
|
||||
glBegin(GL_LINES);
|
||||
|
||||
if( (nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
if(sel) col= nurbcol+4;
|
||||
else col= nurbcol;
|
||||
|
||||
@@ -3945,7 +3945,7 @@ static void tekenvertsN(Nurb *nu, short sel)
|
||||
|
||||
bglBegin(GL_POINTS);
|
||||
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
@@ -3986,7 +3986,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
|
||||
nu= nurb;
|
||||
while(nu) {
|
||||
if(nu->hide==0) {
|
||||
switch(nu->type & 7) {
|
||||
switch(nu->type) {
|
||||
case CU_POLY:
|
||||
cpack(nurbcol[3]);
|
||||
bp= nu->bp;
|
||||
@@ -4094,7 +4094,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
|
||||
|
||||
/* first non-selected handles */
|
||||
for(nu=nurb; nu; nu=nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
tekenhandlesN(nu, 0);
|
||||
}
|
||||
}
|
||||
@@ -4102,7 +4102,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
|
||||
draw_editnurb(ob, nurb, 1);
|
||||
/* selected handles */
|
||||
for(nu=nurb; nu; nu=nu->next) {
|
||||
if((nu->type & 7)==1) tekenhandlesN(nu, 1);
|
||||
if(nu->type == CU_BEZIER) tekenhandlesN(nu, 1);
|
||||
tekenvertsN(nu, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ static void v3d_editvertex_buts(const bContext *C, uiBlock *block, View3D *v3d,
|
||||
|
||||
nu= cu->editnurb->first;
|
||||
while(nu) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
@@ -409,7 +409,7 @@ static void v3d_editvertex_buts(const bContext *C, uiBlock *block, View3D *v3d,
|
||||
|
||||
nu= cu->editnurb->first;
|
||||
while(nu) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
|
||||
@@ -302,7 +302,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
|
||||
int totmalloc= 0;
|
||||
|
||||
for(nu= cu->editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER)
|
||||
if(nu->type == CU_BEZIER)
|
||||
totmalloc += 3*nu->pntsu;
|
||||
else
|
||||
totmalloc += nu->pntsu*nu->pntsv;
|
||||
@@ -311,7 +311,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
|
||||
|
||||
nu= cu->editnurb->first;
|
||||
while(nu) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
while(a--) {
|
||||
|
||||
@@ -1373,7 +1373,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
|
||||
|
||||
/* count total of vertices, check identical as in 2nd loop for making transdata! */
|
||||
for(nu= cu->editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
|
||||
if(bezt->hide==0) {
|
||||
if (G.f & G_HIDDENHANDLES) {
|
||||
@@ -1409,7 +1409,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
|
||||
|
||||
td = t->data;
|
||||
for(nu= cu->editnurb->first; nu; nu= nu->next) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
TransData *head, *tail;
|
||||
head = tail = td;
|
||||
for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
|
||||
|
||||
@@ -252,7 +252,7 @@ int calc_manipulator_stats(const bContext *C)
|
||||
|
||||
nu= cu->editnurb->first;
|
||||
while(nu) {
|
||||
if((nu->type & 7)==CU_BEZIER) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
while(a--) {
|
||||
|
||||
@@ -744,7 +744,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
|
||||
for (nu = cu->editnurb->first; nu; nu = nu->next)
|
||||
{
|
||||
/* only bezier has a normal */
|
||||
if((nu->type & 7) == CU_BEZIER)
|
||||
if(nu->type == CU_BEZIER)
|
||||
{
|
||||
bezt= nu->bezt;
|
||||
a= nu->pntsu;
|
||||
|
||||
@@ -236,6 +236,7 @@ typedef struct Curve {
|
||||
|
||||
/* flag (nurb) */
|
||||
#define CU_SMOOTH 1
|
||||
#define CU_2D 8 /* moved from type since 2.4x */
|
||||
|
||||
/* type (nurb) */
|
||||
#define CU_POLY 0
|
||||
@@ -243,9 +244,7 @@ typedef struct Curve {
|
||||
#define CU_BSPLINE 2
|
||||
#define CU_CARDINAL 3
|
||||
#define CU_NURBS 4
|
||||
#define CU_TYPE 7
|
||||
|
||||
#define CU_2D 8
|
||||
#define CU_TYPE (CU_POLY|CU_BEZIER|CU_BSPLINE|CU_CARDINAL|CU_NURBS)
|
||||
|
||||
/* only for adding */
|
||||
#define CU_PRIMITIVE 0xF00
|
||||
|
||||
@@ -142,24 +142,39 @@ static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max)
|
||||
*max= cu->totcol-1;
|
||||
}
|
||||
|
||||
static void rna_Curve_2d_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Curve *cu= (Curve*)ptr->id.data;
|
||||
Nurb *nu;
|
||||
|
||||
if(value) {
|
||||
cu->flag &= ~CU_3D;
|
||||
for(nu= cu->nurb.first; nu; nu= nu->next) {
|
||||
nu->flag |= CU_2D;
|
||||
test2DNurb(nu);
|
||||
}
|
||||
}
|
||||
else {
|
||||
cu->flag |= CU_3D;
|
||||
for(nu= cu->nurb.first; nu; nu= nu->next) {
|
||||
nu->flag &= ~CU_2D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int rna_Nurb_length(PointerRNA *ptr)
|
||||
{
|
||||
Nurb *nu= (Nurb*)ptr->data;
|
||||
return nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu;
|
||||
}
|
||||
|
||||
/* grr! mixing CU_2D with type is dodgy */
|
||||
static int rna_Nurb_type_get(PointerRNA *ptr)
|
||||
{
|
||||
Nurb *nu= (Nurb*)ptr->data;
|
||||
return nu->type & 7;
|
||||
}
|
||||
|
||||
static void rna_Nurb_type_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Nurb *nu= (Nurb*)ptr->data;
|
||||
nu->type &= CU_2D;
|
||||
nu->type |= value;
|
||||
nu->type = value;
|
||||
// XXX - TODO change datatypes
|
||||
}
|
||||
|
||||
static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
@@ -677,6 +692,7 @@ static void rna_def_curve(BlenderRNA *brna)
|
||||
/* Flags */
|
||||
prop= RNA_def_property(srna, "curve_2d", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_3D);
|
||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_Curve_2d_set");
|
||||
RNA_def_property_ui_text(prop, "2D Curve", "Define curve in two dimensions only. Note that fill only works when this is enabled.");
|
||||
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
|
||||
|
||||
@@ -751,7 +767,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
|
||||
// XXX - switching type probably needs comprehensive recalc of data like in 2.4x
|
||||
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, curve_type_items);
|
||||
RNA_def_property_enum_funcs(prop, "rna_Nurb_type_get", "rna_Nurb_type_set", NULL);
|
||||
RNA_def_property_enum_funcs(prop, NULL, "rna_Nurb_type_set", NULL);
|
||||
RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element.");
|
||||
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user