Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/curve/editcurve_add.c
| Show First 20 Lines • Show All 467 Lines • ▼ Show 20 Lines | if (nu) { /* should always be set */ | ||||
| BKE_nurb_test2D(nu); | BKE_nurb_test2D(nu); | ||||
| } | } | ||||
| return nu; | return nu; | ||||
| } | } | ||||
| static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) | static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) | ||||
| { | { | ||||
| WorkSpace *workspace = CTX_wm_workspace(C); | |||||
| eObjectMode initial_workspace_mode = workspace->preferred_mode; | |||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| ListBase *editnurb; | ListBase *editnurb; | ||||
| Nurb *nu; | Nurb *nu; | ||||
| bool newob = false; | bool newob = false; | ||||
| bool enter_editmode; | bool enter_editmode; | ||||
| unsigned int layer; | unsigned int layer; | ||||
| float dia; | float dia; | ||||
| float loc[3], rot[3]; | float loc[3], rot[3]; | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) | ||||
| nu = ED_curve_add_nurbs_primitive(C, obedit, mat, type, newob); | nu = ED_curve_add_nurbs_primitive(C, obedit, mat, type, newob); | ||||
| editnurb = object_editcurve_get(obedit); | editnurb = object_editcurve_get(obedit); | ||||
| BLI_addtail(editnurb, nu); | BLI_addtail(editnurb, nu); | ||||
| /* userdef */ | /* userdef */ | ||||
| if (newob && !enter_editmode) { | if (newob && !enter_editmode) { | ||||
| ED_object_editmode_exit(C, EM_FREEDATA); | ED_object_editmode_exit(C, EM_FREEDATA); | ||||
| /* restore workspace mode */ | |||||
| workspace->preferred_mode = initial_workspace_mode; | |||||
| } | } | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); | WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int curve_prim_add(bContext *C, wmOperator *op, int type) | static int curve_prim_add(bContext *C, wmOperator *op, int type) | ||||
| ▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines | |||||