diff options
Diffstat (limited to 'source/blender/editors/curve/editcurve.c')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 84 |
1 files changed, 45 insertions, 39 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index bceb103503c..d4b96762ab8 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -27,6 +27,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/editors/curve/editcurve.c + * \ingroup edcurve + */ + + #include <math.h> #include <string.h> @@ -78,6 +83,7 @@ #include "curve_intern.h" #include "UI_interface.h" +#include "UI_resources.h" #include "RNA_access.h" #include "RNA_define.h" @@ -1063,7 +1069,7 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves) CVKeyIndex *keyIndex; char rna_path[64], orig_rna_path[64]; AnimData *ad= BKE_animdata_from_id(&cu->id); - ListBase curves= {0, 0}; + ListBase curves= {NULL, NULL}; FCurve *fcu, *next; while(nu) { @@ -2460,7 +2466,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu int a; short sel; - if(obedit==0) return; + if(obedit==NULL) return; cu= (Curve*)obedit->data; cu->lastsel= NULL; @@ -3309,7 +3315,7 @@ static short findnearestNurbvert(ViewContext *vc, short sel, int mval[2], Nurb * /* sel==1: selected gets a disadvantage */ /* in nurb and bezt or bp the nearest is written */ /* return 0 1 2: handlepunt */ - struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; int dist, hpoint, select, mval[2]; } data = {0}; + struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; int dist, hpoint, select, mval[2]; } data = {NULL}; data.dist = 100; data.hpoint = 0; @@ -3336,24 +3342,24 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt BPoint *bp1; int a; - *nu= 0; - *bezt= 0; - *bp= 0; + *nu= NULL; + *bezt= NULL; + *bp= NULL; for(nu1= editnurb->first; nu1; nu1= nu1->next) { if(nu1->type == CU_BEZIER) { bezt1= nu1->bezt; a= nu1->pntsu; while(a--) { if( (bezt1->f1 & SELECT) || (bezt1->f2 & SELECT) || (bezt1->f3 & SELECT) ) { - if(*nu!=0 && *nu!= nu1) { - *nu= 0; - *bp= 0; - *bezt= 0; + if(*nu != NULL && *nu != nu1) { + *nu= NULL; + *bp= NULL; + *bezt= NULL; return; } else if(*bezt || *bp) { - *bp= 0; - *bezt= 0; + *bp= NULL; + *bezt= NULL; } else { *bezt= bezt1; @@ -3368,15 +3374,15 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt a= nu1->pntsu*nu1->pntsv; while(a--) { if( bp1->f1 & 1 ) { - if(*nu!=0 && *nu!= nu1) { - *bp= 0; - *bezt= 0; - *nu= 0; + if(*nu != NULL && *nu != nu1) { + *bp= NULL; + *bezt= NULL; + *nu= NULL; return; } else if(*bezt || *bp) { - *bp= 0; - *bezt= 0; + *bp= NULL; + *bezt= NULL; } else { *bp= bp1; @@ -3415,7 +3421,7 @@ static int convertspline(short type, Nurb *nu) bezt++; } MEM_freeN(nu->bp); - nu->bp= 0; + nu->bp= NULL; nu->pntsu= nr; nu->type = CU_BEZIER; calchandlesNurb(nu); @@ -3515,7 +3521,7 @@ static int convertspline(short type, Nurb *nu) bezt++; } MEM_freeN(nu->bp); - nu->bp= 0; + nu->bp= NULL; MEM_freeN(nu->knotsu); nu->knotsu= NULL; nu->pntsu= nr; @@ -3720,12 +3726,12 @@ typedef struct NurbSort { float vec[3]; } NurbSort; -static ListBase nsortbase= {0, 0}; +static ListBase nsortbase= {NULL, NULL}; /* static NurbSort *nusmain; */ /* this var seems to go unused... at least in this file */ static void make_selection_list_nurb(ListBase *editnurb) { - ListBase nbase= {0, 0}; + ListBase nbase= {NULL, NULL}; NurbSort *nus, *nustest, *headdo, *taildo; Nurb *nu; BPoint *bp; @@ -3760,7 +3766,7 @@ static void make_selection_list_nurb(ListBase *editnurb) while(nbase.first) { headdist= taildist= 1.0e30; - headdo= taildo= 0; + headdo= taildo= NULL; nustest= nbase.first; while(nustest) { @@ -3971,7 +3977,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; ListBase *nubase= curve_get_editcurve(obedit); - Nurb *nu, *nu1=0, *nu2=0; + Nurb *nu, *nu1=NULL, *nu2=NULL; BPoint *bp; float *fp, offset; int a, ok= 0; @@ -4006,7 +4012,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic */ if(nu->type == CU_BEZIER) { - if(nu1==0) { + if(nu1==NULL) { if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) nu1= nu; else { if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) { @@ -4016,7 +4022,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) } } } - else if(nu2==0) { + else if(nu2==NULL) { if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) { nu2= nu; switchdirectionNurb(nu); @@ -4032,7 +4038,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) } else if(nu->pntsv==1) { bp= nu->bp; - if(nu1==0) { + if(nu1==NULL) { if( bp->f1 & SELECT) nu1= nu; else { bp= bp+(nu->pntsu-1); @@ -4043,7 +4049,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) } } } - else if(nu2==0) { + else if(nu2==NULL) { if( bp->f1 & SELECT ) { nu2= nu; switchdirectionNurb(nu); @@ -4169,8 +4175,8 @@ int mouse_nurb(bContext *C, short mval[2], int extend) ListBase *editnurb= curve_get_editcurve(obedit); ViewContext vc; Nurb *nu; - BezTriple *bezt=0; - BPoint *bp=0; + BezTriple *bezt=NULL; + BPoint *bp=NULL; int location[2]; short hand; @@ -4469,7 +4475,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) mul_m3_v3(imat,newbp->vec); newbp->vec[3]= 1.0; - newnu->knotsu= newnu->knotsv= 0; + newnu->knotsu= newnu->knotsv= NULL; nurbs_knot_calc_u(newnu); ok= 1; @@ -4535,7 +4541,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) bezt= newbezt; ok= 1; } - else bezt= 0; + else bezt= NULL; if(bezt) { if(!newnu) nu->pntsu++; @@ -4606,7 +4612,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) bp= newbp; ok= 1; } - else bp= 0; + else bp= NULL; if(bp) { if(mode=='e') { @@ -4844,7 +4850,7 @@ static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve for(nu= editnurb->first; nu; nu= nu->next) { if(nu->pntsu>1 || nu->pntsv>1) { if(nu->type==CU_NURBS) { - pup= uiPupMenuBegin(C, "Direction", ICON_NULL); + pup= uiPupMenuBegin(C, "Direction", ICON_NONE); layout= uiPupMenuLayout(pup); uiItemsEnumO(layout, op->type->idname, "direction"); uiPupMenuEnd(C, pup); @@ -5025,13 +5031,13 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op)) Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); - static BPoint *last=0; + static BPoint *last= NULL; static int direction=0; Nurb *nu; BPoint *bp; int u = 0, v = 0, a, b, ok=0; - if(editnurb->first==0) + if(editnurb->first == NULL) return OPERATOR_CANCELLED; if(cu->lastsel==NULL) return OPERATOR_CANCELLED; @@ -5951,14 +5957,14 @@ static int delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) uiLayout *layout; if(obedit->type==OB_SURF) { - pup= uiPupMenuBegin(C, "Delete", ICON_NULL); + pup= uiPupMenuBegin(C, "Delete", ICON_NONE); layout= uiPupMenuLayout(pup); uiItemEnumO(layout, op->type->idname, NULL, 0, "type", 0); uiItemEnumO(layout, op->type->idname, NULL, 0, "type", 2); uiPupMenuEnd(C, pup); } else { - pup= uiPupMenuBegin(C, "Delete", ICON_NULL); + pup= uiPupMenuBegin(C, "Delete", ICON_NONE); layout= uiPupMenuLayout(pup); uiItemsEnumO(layout, op->type->idname, "type"); uiPupMenuEnd(C, pup); @@ -6059,7 +6065,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) float imat[4][4], cmat[4][4]; int a; - tempbase.first= tempbase.last= 0; + tempbase.first= tempbase.last= NULL; /* trasnform all selected curves inverse in obact */ invert_m4_m4(imat, ob->obmat); |