diff options
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r-- | source/blender/editors/curve/curve_ops.c | 7 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 311 | ||||
-rw-r--r-- | source/blender/editors/curve/editfont.c | 14 |
3 files changed, 158 insertions, 174 deletions
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index a242e424aa0..6006c7e656b 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -202,11 +202,8 @@ void ED_keymap_curve(wmWindowManager *wm) RNA_int_set(WM_keymap_add_item(keymap, "FONT_OT_change_character", DOWNARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1); WM_keymap_add_item(keymap, "FONT_OT_text_copy", CKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "FONT_OT_text_copy", CKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "FONT_OT_text_cut", XKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "FONT_OT_text_cut", XKEY, KM_PRESS, KM_OSKEY, 0); - WM_keymap_add_item(keymap, "FONT_OT_text_paste", VKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "FONT_OT_text_paste", VKEY, KM_PRESS, KM_OSKEY, 0); + WM_keymap_add_item(keymap, "FONT_OT_text_paste", PKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "FONT_OT_line_break", RETKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "FONT_OT_text_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last! @@ -233,7 +230,7 @@ void ED_keymap_curve(wmWindowManager *wm) WM_keymap_add_item(keymap, "CURVE_OT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0); - RNA_enum_set(WM_keymap_add_item(keymap, "TFM_OT_transform", TKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", TFM_TILT); + RNA_enum_set(WM_keymap_add_item(keymap, "TFM_OT_transform", TKEY, KM_PRESS, 0, 0)->ptr, "mode", TFM_TILT); RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1); RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, 0, 0)->ptr, "type", 3); RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0)->ptr, "type", 2); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index e346ccafde3..28a9d3ac7c9 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -86,6 +86,9 @@ /* still need to eradicate a few :( */ #define callocstructN(x,y,name) (x*)MEM_callocN((y)* sizeof(x),name) +/* for curve objects in editmode that can have hidden handles */ +#define BEZSELECTED_HIDDENHANDLES(bezt) ((G.f & G_HIDDENHANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt)) + float nurbcircle[8][2]= { {0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0}, {0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0} @@ -191,7 +194,7 @@ int isNurbsel(Nurb *nu) BPoint *bp; int a; - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { @@ -210,17 +213,17 @@ int isNurbsel(Nurb *nu) return 0; } -int isNurbsel_count(Curve *cu, Nurb *nu) +int isNurbsel_count(Nurb *nu) { BezTriple *bezt; BPoint *bp; int a, sel=0; - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { - if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) sel++; + if (BEZSELECTED_HIDDENHANDLES(bezt)) sel++; bezt++; } } @@ -244,7 +247,7 @@ void printknots(Object *obedit) int a, num; for(nu= editnurb->first; nu; nu= nu->next) { - if(isNurbsel(nu) && nu->type == CU_NURBS) { + if(isNurbsel(nu) && (nu->type & 7)==CU_NURBS) { if(nu->knotsu) { num= KNOTSU(nu); for(a=0;a<num;a++) printf("knotu %d: %f\n", a, nu->knotsu[a]); @@ -266,8 +269,6 @@ void load_editNurb(Object *obedit) if(obedit==NULL) return; - set_actNurb(obedit, NULL); - if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { Curve *cu= obedit->data; Nurb *nu, *newnu; @@ -299,7 +300,7 @@ void load_editNurb(Object *obedit) newnu= duplicateNurb(nu); BLI_addtail(&(cu->nurb), newnu); - if(nu->type == CU_NURBS) { + if((nu->type & 7)==CU_NURBS) { clamp_nurb_order_u(nu); } } @@ -313,13 +314,11 @@ void load_editNurb(Object *obedit) void make_editNurb(Object *obedit) { ListBase *editnurb= curve_get_editcurve(obedit); - Nurb *nu, *newnu, *nu_act= NULL; + Nurb *nu, *newnu; KeyBlock *actkey; if(obedit==NULL) return; - set_actNurb(obedit, NULL); - if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { Curve *cu= obedit->data; @@ -335,12 +334,6 @@ void make_editNurb(Object *obedit) newnu= duplicateNurb(nu); test2DNurb(newnu); // after join, or any other creation of curve BLI_addtail(editnurb, newnu); - - if (nu_act == NULL && isNurbsel(nu)) { - nu_act= newnu; - set_actNurb(obedit, newnu); - } - nu= nu->next; } @@ -350,6 +343,8 @@ void make_editNurb(Object *obedit) key_to_curve(actkey, cu, editnurb); } } + + set_actNurb(obedit, NULL); } void free_editNurb(Object *obedit) @@ -414,10 +409,10 @@ static int separate_exec(bContext *C, wmOperator *op) load_editNurb(newob); free_editNurb(newob); - DAG_id_flush_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */ - DAG_id_flush_update(&newob->id, OB_RECALC_DATA); /* this is the separated one */ + DAG_object_flush_update(scene, oldob, OB_RECALC_DATA); /* this is the original one */ + DAG_object_flush_update(scene, newob, OB_RECALC_DATA); /* this is the separated one */ - WM_event_add_notifier(C, NC_GEOM|ND_DATA, oldob->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, oldob); WM_cursor_wait(0); @@ -489,7 +484,7 @@ static void setflagsNurb(ListBase *editnurb, short flag) int a; for(nu= editnurb->first; nu; nu= nu->next) { - if(nu->type == CU_BEZIER) { + if( (nu->type & 7)==CU_BEZIER) { a= nu->pntsu; bezt= nu->bezt; while(a--) { @@ -516,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 == CU_NURBS) { + if((nu->type & 7)==CU_NURBS) { bp= nu->bp; a= nu->pntsu*nu->pntsv; @@ -545,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 == CU_BEZIER) { + if( (nu->type & 7)==CU_BEZIER) { a= nu->pntsu; bezt= nu->bezt; while(a--) { @@ -575,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 == CU_NURBS) { + if((nu->type & 7)==CU_NURBS) { a= nu->pntsu*nu->pntsv; bp= nu->bp; while(a--) { @@ -839,7 +834,7 @@ static void adduplicateflagNurb(Object *obedit, short flag) nu= editnurb->last; while(nu) { - if(nu->type == CU_BEZIER) { + if( (nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; for(a=0; a<nu->pntsu; a++) { enda= -1; @@ -1010,8 +1005,8 @@ static int switch_direction_exec(bContext *C, wmOperator *op) if(isNurbsel(nu)) switchdirectionNurb(nu); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); return OPERATOR_FINISHED; } @@ -1057,8 +1052,8 @@ static int set_weight_exec(bContext *C, wmOperator *op) } } - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); return OPERATOR_FINISHED; } @@ -1108,8 +1103,8 @@ static int set_radius_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -1183,8 +1178,8 @@ static int smooth_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -1348,8 +1343,8 @@ static int smooth_radius_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -1386,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 == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { a= nu->pntsu; bezt= nu->bezt; if(next < 0) bezt= (nu->bezt + (a-1)); @@ -1452,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 == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { a= nu->pntsu; /* which point? */ @@ -1498,7 +1493,7 @@ static int de_select_first_exec(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); selectend_nurb(obedit, FIRST, 1, DESELECT); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -1522,7 +1517,7 @@ static int de_select_last_exec(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); selectend_nurb(obedit, LAST, 1, DESELECT); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -1551,7 +1546,7 @@ static short nurb_has_selected_cps(ListBase *editnurb) int a; for(nu= editnurb->first; nu; nu= nu->next) { - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { a= nu->pntsu; bezt= nu->bezt; while(a--) { @@ -1590,7 +1585,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op) select_adjacent_cp(editnurb, 1, 1, SELECT); /* cascade selection */ } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -1614,7 +1609,6 @@ void CURVE_OT_select_all_toggle(wmOperatorType *ot) static int hide_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BPoint *bp; @@ -1622,16 +1616,16 @@ 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 == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; sel= 0; while(a--) { - if(invert == 0 && BEZSELECTED_HIDDENHANDLES(cu, bezt)) { + if(invert == 0 && BEZSELECTED_HIDDENHANDLES(bezt)) { select_beztriple(bezt, DESELECT, 1, HIDDEN); bezt->hide= 1; } - else if(invert && !BEZSELECTED_HIDDENHANDLES(cu, bezt)) { + else if(invert && !BEZSELECTED_HIDDENHANDLES(bezt)) { select_beztriple(bezt, DESELECT, 1, HIDDEN); bezt->hide= 1; } @@ -1660,8 +1654,8 @@ static int hide_exec(bContext *C, wmOperator *op) } } - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -1696,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 == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { @@ -1720,8 +1714,8 @@ static int reveal_exec(bContext *C, wmOperator *op) } } - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -1745,7 +1739,6 @@ void CURVE_OT_reveal(wmOperatorType *ot) static int select_inverse_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BPoint *bp; @@ -1753,13 +1746,13 @@ static int select_inverse_exec(bContext *C, wmOperator *op) int a; for(nu= editnurb->first; nu; nu= nu->next) { - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { if(bezt->hide==0) { bezt->f2 ^= SELECT; /* always do the center point */ - if((cu->drawflag & CU_HIDE_HANDLES)==0) { + if ((G.f & G_HIDDENHANDLES)==0) { bezt->f1 ^= SELECT; bezt->f3 ^= SELECT; } @@ -1777,7 +1770,7 @@ static int select_inverse_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -1810,7 +1803,6 @@ void CURVE_OT_select_inverse(wmOperatorType *ot) static int subdivide_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BezTriple *prevbezt, *bezt, *beztnew, *beztn; @@ -1822,7 +1814,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) for(nu= editnurb->first; nu; nu= nu->next) { amount= 0; - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { /* Insert a point into a 2D Bezier curve. Endpoints are preserved. Otherwise, all selected and inserted points are @@ -1840,7 +1832,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) bezt= prevbezt+1; } while(a--) { - if( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) amount++; + if( BEZSELECTED_HIDDENHANDLES(prevbezt) && BEZSELECTED_HIDDENHANDLES(bezt) ) amount++; prevbezt= bezt; bezt++; } @@ -1864,7 +1856,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) memcpy(beztn, prevbezt, sizeof(BezTriple)); beztn++; - if( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(prevbezt) && BEZSELECTED_HIDDENHANDLES(bezt) ) { memcpy(beztn, bezt, sizeof(BezTriple)); /* midpoint subdividing */ @@ -1903,7 +1895,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) calchandlesNurb(nu); } - } /* End of 'if(nu->type == CU_BEZIER)' */ + } /* End of 'if((nu->type & 7)==CU_BEZIER)' */ else if (nu->pntsv==1) { /* All flat lines (ie. co-planar), except flat Nurbs. Flat NURB curves @@ -1972,7 +1964,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) } } } /* End of 'else if(nu->pntsv==1)' */ - else if(nu->type == CU_NURBS) { + else if((nu->type & 7)==CU_NURBS) { /* This is a very strange test ... */ /** Subdivide NURB surfaces - nzc 30-5-'00 - @@ -2171,11 +2163,11 @@ static int subdivide_exec(bContext *C, wmOperator *op) MEM_freeN(usel); MEM_freeN(vsel); - } /* End of 'if(nu->type == CU_NURBS)' */ + } /* End of 'if((nu->type & 7)==CU_NURBS)' */ } - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -2264,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 == CU_BEZIER) { + if((nu1->type & 7)==CU_BEZIER) { bezt1= nu1->bezt; a= nu1->pntsu; while(a--) { @@ -2321,7 +2313,7 @@ static int convertspline(short type, Nurb *nu) BPoint *bp; int a, c, nr; - if(nu->type == CU_POLY) { + if((nu->type & 7)==CU_POLY) { if(type==CU_BEZIER) { /* to Bezier with vecthandles */ nr= nu->pntsu; bezt = @@ -2341,11 +2333,13 @@ static int convertspline(short type, Nurb *nu) MEM_freeN(nu->bp); nu->bp= 0; nu->pntsu= nr; - nu->type = CU_BEZIER; + nu->type &= ~7; + nu->type |= CU_BEZIER; calchandlesNurb(nu); } else if(type==CU_NURBS) { - nu->type = CU_NURBS; + nu->type &= ~7; + nu->type |= CU_NURBS; nu->orderu= 4; nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ nu->flagu += 4; @@ -2358,15 +2352,15 @@ static int convertspline(short type, Nurb *nu) } } } - else if(nu->type == CU_BEZIER) { /* Bezier */ - if(type==CU_POLY || type==CU_NURBS) { + else if((nu->type & 7)==CU_BEZIER) { /* Bezier */ + if(type==0 || type==4) { /* to Poly or Nurb */ nr= 3*nu->pntsu; nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype"); a= nu->pntsu; bezt= nu->bezt; bp= nu->bp; while(a--) { - if(type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) { + if(type==0 && bezt->h1==HD_VECT && bezt->h2==HD_VECT) { /* vector handle becomes 1 poly vertice */ VECCOPY(bp->vec, bezt->vec[1]); bp->vec[3]= 1.0; @@ -2391,24 +2385,25 @@ static int convertspline(short type, Nurb *nu) bezt++; } MEM_freeN(nu->bezt); - nu->bezt= NULL; + nu->bezt= 0; nu->pntsu= nr; nu->pntsv= 1; nu->orderu= 4; nu->orderv= 1; - nu->type = type; + nu->type &= ~7; + nu->type+= type; if(nu->flagu & CU_CYCLIC) c= nu->orderu-1; else c= 0; - if(type== CU_NURBS) { + if(type== 4) { nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ nu->flagu += 4; makeknots(nu, 1); } } } - else if(nu->type == CU_NURBS) { - if(type==CU_POLY) { - nu->type = CU_POLY; + else if((nu->type & 7)==CU_NURBS) { + if(type==0) { /* to Poly */ + nu->type &= ~7; 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); @@ -2443,7 +2438,8 @@ static int convertspline(short type, Nurb *nu) MEM_freeN(nu->knotsu); nu->knotsu= NULL; nu->pntsu= nr; - nu->type = CU_BEZIER; + nu->type &= ~7; + nu->type |= CU_BEZIER; } } } @@ -2472,15 +2468,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) } } - if(changed) { - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - return OPERATOR_FINISHED; - } - else { - return OPERATOR_CANCELLED; - } + return (changed)? OPERATOR_FINISHED: OPERATOR_CANCELLED; } void CURVE_OT_spline_type_set(wmOperatorType *ot) @@ -2488,8 +2476,8 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot) static EnumPropertyItem type_items[]= { {CU_POLY, "POLY", 0, "Poly", ""}, {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, -// {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, -// {CU_BSPLINE, "B_SPLINE", 0, "B-Spline", ""}, + {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, + {CU_BSPLINE, "B_SPLINE", 0, "B-Spline", ""}, {CU_NURBS, "NURBS", 0, "NURBS", ""}, {0, NULL, 0, NULL, NULL}}; @@ -2499,7 +2487,6 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot) /* api callbacks */ ot->exec= set_spline_type_exec; - ot->invoke= WM_menu_invoke; ot->poll= ED_operator_editcurve; /* flags */ @@ -2513,13 +2500,14 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot) static int set_handle_type_exec(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); sethandlesNurb(editnurb, RNA_enum_get(op->ptr, "type")); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -2812,7 +2800,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu } } - if(nu1->type == CU_NURBS) { + if((nu1->type & 7)==CU_NURBS) { /* merge knots */ makeknots(nu1, 1); @@ -2873,8 +2861,8 @@ static int merge_nurb(bContext *C, wmOperator *op) set_actNurb(obedit, NULL); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -2882,8 +2870,8 @@ static int merge_nurb(bContext *C, wmOperator *op) static int make_segment_exec(bContext *C, wmOperator *op) { /* joins 2 curves */ + Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu, *nu1=0, *nu2=0; BezTriple *bezt; @@ -2899,8 +2887,8 @@ static int make_segment_exec(bContext *C, wmOperator *op) if( isNurbsel(nu) ) { if(nu->pntsu>1 && nu->pntsv>1) break; - if(isNurbsel_count(cu, nu)>1) break; - if(isNurbsel_count(cu, nu)==1) { + if(isNurbsel_count(nu)>1) break; + if(isNurbsel_count(nu)==1) { /* only 1 selected, not first or last, a little complex, but intuitive */ if(nu->pntsv==1) { if( (nu->bp->f1 & SELECT) || ((nu->bp+nu->pntsu-1)->f1 & SELECT)); @@ -2917,26 +2905,26 @@ 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 == CU_BEZIER) { + if( (nu->type & 7)==CU_BEZIER ) { bezt= nu->bezt; if(nu1==0) { - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) nu1= nu; + if( BEZSELECTED_HIDDENHANDLES(bezt) ) nu1= nu; else { bezt= bezt+(nu->pntsu-1); - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(bezt) ) { nu1= nu; switchdirectionNurb(nu); } } } else if(nu2==0) { - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(bezt) ) { nu2= nu; switchdirectionNurb(nu); } else { bezt= bezt+(nu->pntsu-1); - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(bezt) ) { nu2= nu; } } @@ -2974,7 +2962,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) if((nu1 && nu2) && (nu1!=nu2)) { if( nu1->type==nu2->type) { - if(nu1->type == CU_BEZIER) { + if((nu1->type & 7)==CU_BEZIER) { bezt = (BezTriple*)MEM_mallocN((nu1->pntsu+nu2->pntsu) * sizeof(BezTriple), "addsegmentN"); memcpy(bezt, nu2->bezt, nu2->pntsu*sizeof(BezTriple)); @@ -3000,7 +2988,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) BLI_remlink(editnurb, nu2); /* now join the knots */ - if(nu1->type == CU_NURBS) { + if((nu1->type & 7)==CU_NURBS) { if(nu1->knotsu==NULL) { makeknots(nu1, 1); } @@ -3027,8 +3015,8 @@ static int make_segment_exec(bContext *C, wmOperator *op) set_actNurb(obedit, NULL); /* for selected */ - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -3057,8 +3045,8 @@ void CURVE_OT_make_segment(wmOperatorType *ot) void mouse_nurb(bContext *C, short mval[2], int extend) { Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); + Curve *cu= obedit->data; ViewContext vc; Nurb *nu; BezTriple *bezt=0; @@ -3112,7 +3100,7 @@ void mouse_nurb(bContext *C, short mval[2], int extend) } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); if(nu!=get_actNurb(obedit)) set_actNurb(obedit, nu); @@ -3243,8 +3231,8 @@ static int spin_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -3267,6 +3255,7 @@ void CURVE_OT_spin(wmOperatorType *ot) static int addvert_Nurb(bContext *C, short mode, float location[3]) { + Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; @@ -3280,7 +3269,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 == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { /* which bezpoint? */ if(bezt== nu->bezt) { /* first */ BEZ_DESEL(bezt); @@ -3378,8 +3367,8 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) test2DNurb(nu); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -3434,14 +3423,14 @@ void CURVE_OT_vertex_add(wmOperatorType *ot) static int extrude_exec(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; /* first test: curve? */ for(nu= editnurb->first; nu; nu= nu->next) - if(nu->pntsv==1 && isNurbsel_count(cu, nu)==1) + if(nu->pntsv==1 && isNurbsel_count(nu)==1) break; if(obedit->type==OB_CURVE || nu) { @@ -3449,8 +3438,8 @@ static int extrude_exec(bContext *C, wmOperator *op) } else { if(extrudeflagNurb(editnurb, 1)) { /* '1'= flag */ - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); } } @@ -3492,7 +3481,6 @@ void CURVE_OT_extrude(wmOperatorType *ot) static int toggle_cyclic_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BezTriple *bezt; @@ -3501,7 +3489,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 == CU_POLY) { + if( (nu->type & 7)==CU_POLY ) { a= nu->pntsu; bp= nu->bp; while(a--) { @@ -3512,11 +3500,11 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) bp++; } } - else if(nu->type == CU_BEZIER) { + else if( (nu->type & 7)==CU_BEZIER ) { a= nu->pntsu; bezt= nu->bezt; while(a--) { - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(bezt) ) { nu->flagu ^= CU_CYCLIC; break; } @@ -3524,7 +3512,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) } calchandlesNurb(nu); } - else if(nu->pntsv==1 && nu->type == CU_NURBS) { + else if(nu->pntsv==1 && (nu->type & 7)==CU_NURBS) { if (nu->knotsu) { /* if check_valid_nurb_u fails the knotsu can be NULL */ a= nu->pntsu; bp= nu->bp; @@ -3561,8 +3549,8 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -3653,7 +3641,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -3694,8 +3682,8 @@ void CURVE_OT_select_linked(wmOperatorType *ot) static int select_row_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); + Curve *cu= obedit->data; static BPoint *last=0; static int direction=0; Nurb *nu; @@ -3745,7 +3733,7 @@ static int select_row_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -3772,7 +3760,7 @@ static int select_next_exec(bContext *C, wmOperator *op) ListBase *editnurb= curve_get_editcurve(obedit); select_adjacent_cp(editnurb, 1, 0, SELECT); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -3799,7 +3787,7 @@ static int select_previous_exec(bContext *C, wmOperator *op) ListBase *editnurb= curve_get_editcurve(obedit); select_adjacent_cp(editnurb, -1, 0, SELECT); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -3886,7 +3874,7 @@ static int select_more_exec(bContext *C, wmOperator *op) select_adjacent_cp(editnurb, -1, 0, SELECT); } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -3975,7 +3963,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 == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { a= nu->pntsu; bezt= nu->bezt; while(a--) { @@ -4047,7 +4035,7 @@ static int select_less_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -4121,7 +4109,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 == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { @@ -4143,7 +4131,7 @@ static int select_random_exec(bContext *C, wmOperator *op) MEM_freeN(itemstobeselected); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -4177,7 +4165,7 @@ static int select_every_nth_exec(bContext *C, wmOperator *op) select_adjacent_cp(editnurb, n, 1, SELECT); select_adjacent_cp(editnurb, -n, 1, SELECT); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -4243,8 +4231,8 @@ void CURVE_OT_duplicate(wmOperatorType *ot) static int delete_exec(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu, *next, *nu1; BezTriple *bezt, *bezt1, *bezt2; @@ -4255,8 +4243,8 @@ static int delete_exec(bContext *C, wmOperator *op) if(type==0) deleteflagNurb(C, op, 1); else freeNurblist(editnurb); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -4266,12 +4254,12 @@ static int delete_exec(bContext *C, wmOperator *op) nu= editnurb->first; while(nu) { next= nu->next; - if(nu->type == CU_BEZIER) { + if( (nu->type & 7)==CU_BEZIER ) { bezt= nu->bezt; a= nu->pntsu; if(a) { while(a) { - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ); + if( BEZSELECTED_HIDDENHANDLES(bezt) ); else break; a--; bezt++; @@ -4302,7 +4290,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 == CU_NURBS)) { + if ((nu!= NULL) && ((nu->type & 7)==CU_NURBS)) { clamp_nurb_order_u(nu); } */ @@ -4313,10 +4301,10 @@ static int delete_exec(bContext *C, wmOperator *op) while(nu) { next= nu->next; type= 0; - if(nu->type == CU_BEZIER) { + if( (nu->type & 7)==CU_BEZIER ) { bezt= nu->bezt; for(a=0;a<nu->pntsu;a++) { - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(bezt) ) { memmove(bezt, bezt+1, (nu->pntsu-a-1)*sizeof(BezTriple)); nu->pntsu--; a--; @@ -4356,7 +4344,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 == CU_NURBS) { + if ((nu->type & 7)==CU_NURBS) { clamp_nurb_order_u(nu); }*/ } @@ -4373,10 +4361,10 @@ static int delete_exec(bContext *C, wmOperator *op) nu1= 0; while(nu) { next= nu->next; - if(nu->type == CU_BEZIER) { + if( (nu->type & 7)==CU_BEZIER ) { bezt= nu->bezt; for(a=0; a<nu->pntsu-1; a++) { - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(bezt) ) { bezt1= bezt; bezt2= bezt+1; if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) ; @@ -4385,8 +4373,8 @@ static int delete_exec(bContext *C, wmOperator *op) bezt2= bezt+(nu->pntsu-1); if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) { nu->flagu &= ~CU_CYCLIC; - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); } } @@ -4411,8 +4399,8 @@ static int delete_exec(bContext *C, wmOperator *op) bp2= bp+(nu->pntsu-1); if( bp2->f1 & SELECT ) { nu->flagu &= ~CU_CYCLIC; - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); } } @@ -4509,8 +4497,8 @@ static int delete_exec(bContext *C, wmOperator *op) else if(type==2) freeNurblist(editnurb); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -4581,8 +4569,8 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } @@ -4727,7 +4715,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) cent[2]-= obedit->obmat[3][2]; if(rv3d) { - if (!(newname) || U.flag & USER_ADD_VIEWALIGNED) + if (!(newname) || U.flag & USER_ADD_VIEWALIGNED || !rv3d) Mat3CpyMat4(imat, rv3d->viewmat); else Mat3One(imat); @@ -4747,7 +4735,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= cutype; + nu->type= type; nu->resolu= 4; nu->resolv= 4; } @@ -4760,7 +4748,6 @@ 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"); @@ -4869,7 +4856,6 @@ 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; @@ -5096,7 +5082,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) } /* always do: */ - nu->flag |= CU_SMOOTH; + nu->flag= CU_SMOOTH; test2DNurb(nu); @@ -5108,7 +5094,6 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) static int clear_tilt_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BezTriple *bezt; @@ -5120,7 +5105,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *op) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(BEZSELECTED_HIDDENHANDLES(cu, bezt)) bezt->alfa= 0.0; + if(BEZSELECTED_HIDDENHANDLES(bezt)) bezt->alfa= 0.0; bezt++; } } @@ -5134,8 +5119,8 @@ static int clear_tilt_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index ae34f30a4f1..46be95063ec 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -273,14 +273,15 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re BKE_text_to_curve(scene, obedit, mode); if(recalc) - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); } /********************** insert lorem operator *********************/ static int insert_lorem_exec(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); char *p, *p2; int i; @@ -307,8 +308,8 @@ static int insert_lorem_exec(bContext *C, wmOperator *op) insert_into_textbuf(obedit, '\n'); insert_into_textbuf(obedit, '\n'); - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); return OPERATOR_FINISHED; } @@ -613,6 +614,7 @@ static EnumPropertyItem style_items[]= { static int set_style(bContext *C, int style, int clear) { + Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; EditFont *ef= cu->editfont; @@ -628,8 +630,8 @@ static int set_style(bContext *C, int style, int clear) ef->textbufinfo[i].flag |= style; } - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); return OPERATOR_FINISHED; } |