From 44505b38df557a5711703613685a1dec9fc2c3d9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jun 2018 09:31:30 +0200 Subject: Cleanup: strip trailing space in editors --- source/blender/editors/curve/curve_ops.c | 18 +-- source/blender/editors/curve/editcurve.c | 216 ++++++++++++------------- source/blender/editors/curve/editcurve_paint.c | 2 +- source/blender/editors/curve/editfont.c | 132 +++++++-------- 4 files changed, 184 insertions(+), 184 deletions(-) (limited to 'source/blender/editors/curve') diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 85b561f3a9f..5d27e13ed17 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -73,10 +73,10 @@ void ED_operatortypes_curve(void) WM_operatortype_append(FONT_OT_change_character); WM_operatortype_append(FONT_OT_change_spacing); - + WM_operatortype_append(FONT_OT_open); WM_operatortype_append(FONT_OT_unlink); - + WM_operatortype_append(FONT_OT_textbox_add); WM_operatortype_append(FONT_OT_textbox_remove); @@ -98,20 +98,20 @@ void ED_operatortypes_curve(void) WM_operatortype_append(CURVE_OT_shade_smooth); WM_operatortype_append(CURVE_OT_shade_flat); WM_operatortype_append(CURVE_OT_tilt_clear); - + WM_operatortype_append(CURVE_OT_primitive_bezier_curve_add); WM_operatortype_append(CURVE_OT_primitive_bezier_circle_add); WM_operatortype_append(CURVE_OT_primitive_nurbs_curve_add); WM_operatortype_append(CURVE_OT_primitive_nurbs_circle_add); WM_operatortype_append(CURVE_OT_primitive_nurbs_path_add); - + WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_curve_add); WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_circle_add); WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_surface_add); WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_cylinder_add); WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_sphere_add); WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_torus_add); - + WM_operatortype_append(CURVE_OT_smooth); WM_operatortype_append(CURVE_OT_smooth_weight); WM_operatortype_append(CURVE_OT_smooth_radius); @@ -168,10 +168,10 @@ void ED_keymap_curve(wmKeyConfig *keyconf) { wmKeyMap *keymap; wmKeyMapItem *kmi; - + keymap = WM_keymap_find(keyconf, "Font", 0, 0); keymap->poll = ED_operator_editfont; - + /* only set in editmode font, by space_view3d listener */ RNA_enum_set(WM_keymap_add_item(keymap, "FONT_OT_style_toggle", BKEY, KM_PRESS, KM_CTRL, 0)->ptr, "style", CU_CHINFO_BOLD); RNA_enum_set(WM_keymap_add_item(keymap, "FONT_OT_style_toggle", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "style", CU_CHINFO_ITALIC); @@ -233,7 +233,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf) keymap->poll = ED_operator_editsurfcurve; WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0); - + WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0); @@ -289,7 +289,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CURVE_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0); - + WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_curve_specials", WKEY, KM_PRESS, 0, 0); /* menus */ diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index ebf2b63bb49..139034a22d5 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1342,12 +1342,12 @@ void CURVE_OT_separate(wmOperatorType *ot) ot->name = "Separate"; ot->idname = "CURVE_OT_separate"; ot->description = "Separate selected points from connected unselected points into a new object"; - + /* api callbacks */ ot->invoke = WM_operator_confirm; ot->exec = separate_exec; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -1852,7 +1852,7 @@ bool ed_editnurb_extrude_flag(EditNurb *editnurb, const short flag) while (a--) { select_bpoint(bp, SELECT, flag, HIDDEN); select_bpoint(newbp, DESELECT, flag, HIDDEN); - bp++; + bp++; newbp++; } @@ -2332,7 +2332,7 @@ void CURVE_OT_switch_direction(wmOperatorType *ot) ot->name = "Switch Direction"; ot->description = "Switch direction of selected splines"; ot->idname = "CURVE_OT_switch_direction"; - + /* api callbacks */ ot->exec = switch_direction_exec; ot->poll = ED_operator_editsurfcurve; @@ -2352,7 +2352,7 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op) BPoint *bp; float weight = RNA_float_get(op->ptr, "weight"); int a; - + for (nu = editnurb->first; nu; nu = nu->next) { if (nu->bezt) { for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) { @@ -2380,7 +2380,7 @@ void CURVE_OT_spline_weight_set(wmOperatorType *ot) ot->name = "Set Goal Weight"; ot->description = "Set softbody goal weight for selected points"; ot->idname = "CURVE_OT_spline_weight_set"; - + /* api callbacks */ ot->exec = set_goal_weight_exec; ot->invoke = WM_operator_props_popup; @@ -2404,7 +2404,7 @@ static int set_radius_exec(bContext *C, wmOperator *op) BPoint *bp; float radius = RNA_float_get(op->ptr, "radius"); int a; - + for (nu = editnurb->first; nu; nu = nu->next) { if (nu->bezt) { for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) { @@ -2432,7 +2432,7 @@ void CURVE_OT_radius_set(wmOperatorType *ot) ot->name = "Set Curve Radius"; ot->description = "Set per-point radius which is used for bevel tapering"; ot->idname = "CURVE_OT_radius_set"; - + /* api callbacks */ ot->exec = set_radius_exec; ot->invoke = WM_operator_props_popup; @@ -2584,7 +2584,7 @@ void CURVE_OT_smooth(wmOperatorType *ot) ot->name = "Smooth"; ot->description = "Flatten angles of selected points"; ot->idname = "CURVE_OT_smooth"; - + /* api callbacks */ ot->exec = smooth_exec; ot->poll = ED_operator_editsurfcurve; @@ -2788,7 +2788,7 @@ static int curve_smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); ListBase *editnurb = object_editcurve_get(obedit); - + curve_smooth_value(editnurb, offsetof(BezTriple, radius), offsetof(BPoint, radius)); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); @@ -2803,11 +2803,11 @@ void CURVE_OT_smooth_radius(wmOperatorType *ot) ot->name = "Smooth Curve Radius"; ot->description = "Interpolate radii of selected points"; ot->idname = "CURVE_OT_smooth_radius"; - + /* api clastbacks */ ot->exec = curve_smooth_radius_exec; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -2905,14 +2905,14 @@ void CURVE_OT_hide(wmOperatorType *ot) ot->name = "Hide Selected"; ot->idname = "CURVE_OT_hide"; ot->description = "Hide (un)selected control points"; - + /* api callbacks */ ot->exec = hide_exec; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* props */ RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected"); } @@ -2967,11 +2967,11 @@ void CURVE_OT_reveal(wmOperatorType *ot) ot->name = "Reveal Hidden"; ot->idname = "CURVE_OT_reveal"; ot->description = "Reveal hidden control points"; - + /* api callbacks */ ot->exec = reveal_exec; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3227,7 +3227,7 @@ static void subdividenurb(Object *obedit, int number_cuts) for (b = 0; b < nu->pntsu; b++) { *bpn = *bp; keyIndex_updateBP(editnurb, bp, bpn, 1); - bpn++; + bpn++; bp++; if (b < nu->pntsu - 1) { prevbp = bp - 1; @@ -3255,7 +3255,7 @@ static void subdividenurb(Object *obedit, int number_cuts) interp_v4_v4v4(tmp->vec, prevbp->vec, bp->vec, factor); tmp += countu; } - bp++; + bp++; prevbp++; bpn++; } @@ -3331,7 +3331,7 @@ static void subdividenurb(Object *obedit, int number_cuts) for (b = 0; b < nu->pntsu; b++) { *bpn = *bp; keyIndex_updateBP(editnurb, bp, bpn, 1); - bpn++; + bpn++; bp++; if ( (b < nu->pntsu - 1) && usel[b] == nu->pntsv && usel[b + 1] == nu->pntsv) { /* @@ -3358,7 +3358,7 @@ static void subdividenurb(Object *obedit, int number_cuts) } } } - MEM_freeN(usel); + MEM_freeN(usel); MEM_freeN(vsel); } /* End of 'if (nu->type == CU_NURBS)' */ @@ -3389,11 +3389,11 @@ void CURVE_OT_subdivide(wmOperatorType *ot) ot->name = "Subdivide"; ot->description = "Subdivide selected segments"; ot->idname = "CURVE_OT_subdivide"; - + /* api callbacks */ ot->exec = subdivide_exec; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3551,7 +3551,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Not yet implemented"); return OPERATOR_CANCELLED; } - + for (nu = editnurb->first; nu; nu = nu->next) { if (ED_curve_nurb_select_check(obedit->data, nu)) { const int pntsu_prev = nu->pntsu; @@ -3601,12 +3601,12 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot) ot->name = "Set Spline Type"; ot->description = "Set type of active spline"; ot->idname = "CURVE_OT_spline_type_set"; - + /* api callbacks */ ot->exec = set_spline_type_exec; ot->invoke = WM_menu_invoke; ot->poll = ED_operator_editcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3646,12 +3646,12 @@ void CURVE_OT_handle_type_set(wmOperatorType *ot) ot->name = "Set Handle Type"; ot->description = "Set type of handles for selected control points"; ot->idname = "CURVE_OT_handle_type_set"; - + /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = set_handle_type_exec; ot->poll = ED_operator_editcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3701,9 +3701,9 @@ static void switchdirection_knots(float *base, int tot) { float *fp1, *fp2, *tempf; int a; - + if (base == NULL || tot == 0) return; - + /* reverse knots */ a = tot; fp1 = base; @@ -3712,7 +3712,7 @@ static void switchdirection_knots(float *base, int tot) while (fp1 != fp2 && a > 0) { SWAP(float, *fp1, *fp2); a--; - fp1++; + fp1++; fp2--; } @@ -3744,15 +3744,15 @@ static void rotate_direction_nurb(Nurb *nu) { BPoint *bp1, *bp2, *temp; int u, v; - + SWAP(int, nu->pntsu, nu->pntsv); SWAP(short, nu->orderu, nu->orderv); SWAP(short, nu->resolu, nu->resolv); SWAP(short, nu->flagu, nu->flagv); - + SWAP(float *, nu->knotsu, nu->knotsv); switchdirection_knots(nu->knotsv, KNOTSV(nu)); - + temp = MEM_dupallocN(nu->bp); bp1 = nu->bp; for (v = 0; v < nu->pntsv; v++) { @@ -3769,7 +3769,7 @@ static bool is_u_selected(Nurb *nu, int u) { BPoint *bp; int v; - + /* what about resolu == 2? */ bp = &nu->bp[u]; for (v = 0; v < nu->pntsv - 1; v++, bp += nu->pntsu) { @@ -3777,7 +3777,7 @@ static bool is_u_selected(Nurb *nu, int u) return true; } } - + return false; } @@ -3798,14 +3798,14 @@ static void make_selection_list_nurb(Curve *cu, ListBase *editnurb) BPoint *bp; float dist, headdist, taildist; int a; - + for (nu = editnurb->first; nu; nu = nu->next) { if (ED_curve_nurb_select_check(cu, nu)) { - + nus = (NurbSort *)MEM_callocN(sizeof(NurbSort), "sort"); BLI_addhead(&nbase, nus); nus->nu = nu; - + bp = nu->bp; a = nu->pntsu; while (a--) { @@ -3813,8 +3813,8 @@ static void make_selection_list_nurb(Curve *cu, ListBase *editnurb) bp++; } mul_v3_fl(nus->vec, 1.0f / (float)nu->pntsu); - - + + } } @@ -3822,10 +3822,10 @@ static void make_selection_list_nurb(Curve *cu, ListBase *editnurb) nus = nbase.first; BLI_remlink(&nbase, nus); BLI_addtail(&nsortbase, nus); - + /* now add, either at head or tail, the closest one */ while (nbase.first) { - + headdist = taildist = 1.0e30; headdo = taildo = NULL; @@ -3845,7 +3845,7 @@ static void make_selection_list_nurb(Curve *cu, ListBase *editnurb) } nustest = nustest->next; } - + if (headdist < taildist) { BLI_remlink(&nbase, headdo); BLI_addhead(&nsortbase, headdo); @@ -3862,12 +3862,12 @@ static void merge_2_nurb(wmOperator *op, Curve *cu, ListBase *editnurb, Nurb *nu BPoint *bp, *bp1, *bp2, *temp; float len1, len2; int origu, u, v; - + /* first nurbs will be changed to make u = resolu-1 selected */ /* 2nd nurbs will be changed to make u = 0 selected */ /* first nurbs: u = resolu-1 selected */ - + if (is_u_selected(nu1, nu1->pntsu - 1)) { /* pass */ } @@ -3898,7 +3898,7 @@ static void merge_2_nurb(wmOperator *op, Curve *cu, ListBase *editnurb, Nurb *nu } } } - + /* 2nd nurbs: u = 0 selected */ if (is_u_selected(nu2, 0)) { /* pass */ @@ -3928,19 +3928,19 @@ static void merge_2_nurb(wmOperator *op, Curve *cu, ListBase *editnurb, Nurb *nu } } } - + if (nu1->pntsv != nu2->pntsv) { BKE_report(op->reports, RPT_ERROR, "Resolution does not match"); return; } - + /* ok, now nu1 has the rightmost column and nu2 the leftmost column selected */ /* maybe we need a 'v' flip of nu2? */ - + bp1 = &nu1->bp[nu1->pntsu - 1]; bp2 = nu2->bp; len1 = 0.0; - + for (v = 0; v < nu1->pntsv; v++, bp1 += nu1->pntsu, bp2 += nu2->pntsu) { len1 += len_v3v3(bp1->vec, bp2->vec); } @@ -3948,7 +3948,7 @@ static void merge_2_nurb(wmOperator *op, Curve *cu, ListBase *editnurb, Nurb *nu bp1 = &nu1->bp[nu1->pntsu - 1]; bp2 = &nu2->bp[nu2->pntsu * (nu2->pntsv - 1)]; len2 = 0.0; - + for (v = 0; v < nu1->pntsv; v++, bp1 += nu1->pntsu, bp2 -= nu2->pntsu) { len2 += len_v3v3(bp1->vec, bp2->vec); } @@ -3960,12 +3960,12 @@ static void merge_2_nurb(wmOperator *op, Curve *cu, ListBase *editnurb, Nurb *nu if (nu1->orderv < 3 && nu1->orderv < nu1->pntsv) nu1->orderv++; temp = nu1->bp; nu1->bp = MEM_mallocN(nu1->pntsu * nu1->pntsv * sizeof(BPoint), "mergeBP"); - + bp = nu1->bp; bp1 = temp; - + for (v = 0; v < nu1->pntsv; v++) { - + /* switch direction? */ if (len1 < len2) bp2 = &nu2->bp[v * nu2->pntsu]; else bp2 = &nu2->bp[(nu1->pntsv - v - 1) * nu2->pntsu]; @@ -3986,11 +3986,11 @@ static void merge_2_nurb(wmOperator *op, Curve *cu, ListBase *editnurb, Nurb *nu if (nu1->type == CU_NURBS) { /* merge knots */ BKE_nurb_knot_calc_u(nu1); - + /* make knots, for merged curved for example */ BKE_nurb_knot_calc_v(nu1); } - + MEM_freeN(temp); BLI_remlink(editnurb, nu2); BKE_nurb_free(nu2); @@ -4003,15 +4003,15 @@ static int merge_nurb(bContext *C, wmOperator *op) ListBase *editnurb = object_editcurve_get(obedit); NurbSort *nus1, *nus2; bool ok = true; - + make_selection_list_nurb(cu, editnurb); - + if (nsortbase.first == nsortbase.last) { BLI_freelistN(&nsortbase); BKE_report(op->reports, RPT_ERROR, "Too few selections to merge"); return OPERATOR_CANCELLED; } - + nus1 = nsortbase.first; nus2 = nus1->next; @@ -4041,7 +4041,7 @@ static int merge_nurb(bContext *C, wmOperator *op) else { ok = 0; } - + if (ok == 0) { BKE_report(op->reports, RPT_ERROR, "Resolution does not match"); BLI_freelistN(&nsortbase); @@ -4052,14 +4052,14 @@ static int merge_nurb(bContext *C, wmOperator *op) merge_2_nurb(op, cu, editnurb, nus1->nu, nus2->nu); nus2 = nus2->next; } - + BLI_freelistN(&nsortbase); - + BKE_curve_nurb_active_set(obedit->data, NULL); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, 0); - + return OPERATOR_FINISHED; } @@ -4077,7 +4077,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) /* first decide if this is a surface merge! */ if (obedit->type == OB_SURF) nu = nubase->first; else nu = NULL; - + while (nu) { const int nu_select_num = ED_curve_nurb_select_count(cu, nu); if (nu_select_num) { @@ -4106,7 +4106,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) if (nu) return merge_nurb(C, op); - + /* find both nurbs and points, nu1 will be put behind nu2 */ for (nu = nubase->first; nu; nu = nu->next) { if (nu->pntsu == 1) @@ -4276,7 +4276,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot) ot->name = "Make Segment"; ot->idname = "CURVE_OT_make_segment"; ot->description = "Join two curves by their selected ends"; - + /* api callbacks */ ot->exec = make_segment_exec; ot->poll = ED_operator_editsurfcurve; @@ -4299,10 +4299,10 @@ bool ED_curve_editnurb_select_pick(bContext *C, const int mval[2], bool extend, const void *vert = BKE_curve_vert_active_get(cu); int location[2]; short hand; - + view3d_operator_needs_opengl(C); ED_view3d_viewcontext_init(C, &vc); - + location[0] = mval[0]; location[1] = mval[1]; @@ -4400,7 +4400,7 @@ bool ED_curve_editnurb_select_pick(bContext *C, const int mval[2], bool extend, return true; } - + return false; } @@ -4425,7 +4425,7 @@ bool ed_editnurb_spin(float viewmat[4][4], Object *obedit, const float axis[3], /* imat and center and size */ copy_m3_m4(bmat, obedit->obmat); invert_m3_m3(imat, bmat); - + axis_angle_to_mat3(cmat, axis, M_PI / 4.0); mul_m3_m3m3(tmat, cmat, bmat); mul_m3_m3m3(rotmat, imat, tmat); @@ -4488,18 +4488,18 @@ static int spin_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); RegionView3D *rv3d = ED_view3d_context_rv3d(C); float cent[3], axis[3], viewmat[4][4]; - + RNA_float_get_array(op->ptr, "center", cent); RNA_float_get_array(op->ptr, "axis", axis); - + invert_m4_m4(obedit->imat, obedit->obmat); mul_m4_v3(obedit->imat, cent); - + if (rv3d) copy_m4_m4(viewmat, rv3d->viewmat); else unit_m4(viewmat); - + if (!ed_editnurb_spin(viewmat, obedit, axis, cent)) { BKE_report(op->reports, RPT_ERROR, "Cannot spin"); return OPERATOR_CANCELLED; @@ -4520,13 +4520,13 @@ static int spin_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = ED_view3d_context_rv3d(C); float axis[3] = {0.0f, 0.0f, 1.0f}; - + if (rv3d) copy_v3_v3(axis, rv3d->viewinv[2]); - + RNA_float_set_array(op->ptr, "center", ED_view3d_cursor3d_get(scene, v3d)); RNA_float_set_array(op->ptr, "axis", axis); - + return spin_exec(C, op); } @@ -4536,7 +4536,7 @@ void CURVE_OT_spin(wmOperatorType *ot) ot->name = "Spin"; ot->idname = "CURVE_OT_spin"; ot->description = "Extrude selected boundary row around pivot point and current view axis"; - + /* api callbacks */ ot->exec = spin_exec; ot->invoke = spin_invoke; @@ -4544,7 +4544,7 @@ void CURVE_OT_spin(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -OBJECT_ADD_SIZE_MAXF, OBJECT_ADD_SIZE_MAXF, "Center", "Center in global view space", -1000.0f, 1000.0f); RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -1.0f, 1.0f); @@ -5069,7 +5069,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot) ot->name = "Add Vertex"; ot->idname = "CURVE_OT_vertex_add"; ot->description = "Add a new control point (linked to only selected end-curve one, if any)"; - + /* api callbacks */ ot->exec = add_vertex_exec; ot->invoke = add_vertex_invoke; @@ -5092,7 +5092,7 @@ static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op)) EditNurb *editnurb = cu->editnurb; bool changed = false; bool as_curve = false; - + /* first test: curve? */ if (obedit->type != OB_CURVE) { Nurb *nu; @@ -5131,7 +5131,7 @@ void CURVE_OT_extrude(wmOperatorType *ot) ot->name = "Extrude"; ot->description = "Extrude selected control point(s)"; ot->idname = "CURVE_OT_extrude"; - + /* api callbacks */ ot->exec = curve_extrude_exec; ot->poll = ED_operator_editsurfcurve; @@ -5198,7 +5198,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) a = nu->pntsu * nu->pntsv; bp = nu->bp; while (a--) { - + if (bp->f1 & SELECT) { if (direction == 0 && nu->pntsu > 1) { nu->flagu ^= CU_NURB_CYCLIC; @@ -5212,7 +5212,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) } bp++; } - + } } } @@ -5260,7 +5260,7 @@ void CURVE_OT_cyclic_toggle(wmOperatorType *ot) ot->name = "Toggle Cyclic"; ot->description = "Make active spline closed/opened loop"; ot->idname = "CURVE_OT_cyclic_toggle"; - + /* api callbacks */ ot->exec = toggle_cyclic_exec; ot->invoke = toggle_cyclic_invoke; @@ -5300,11 +5300,11 @@ void CURVE_OT_duplicate(wmOperatorType *ot) ot->name = "Duplicate Curve"; ot->description = "Duplicate selected control points"; ot->idname = "CURVE_OT_duplicate"; - + /* api callbacks */ ot->exec = duplicate_exec; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -5775,12 +5775,12 @@ void CURVE_OT_delete(wmOperatorType *ot) ot->name = "Delete"; ot->description = "Delete selected control points or segments"; ot->idname = "CURVE_OT_delete"; - + /* api callbacks */ ot->exec = curve_delete_exec; ot->invoke = WM_menu_invoke; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -5989,17 +5989,17 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) ListBase *editnurb = object_editcurve_get(obedit); Nurb *nu; int clear = (STREQ(op->idname, "CURVE_OT_shade_flat")); - + if (obedit->type != OB_CURVE) return OPERATOR_CANCELLED; - + for (nu = editnurb->first; nu; nu = nu->next) { if (ED_curve_nurb_select_check(obedit->data, nu)) { if (!clear) nu->flag |= CU_SMOOTH; else nu->flag &= ~CU_SMOOTH; } } - + WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, 0); @@ -6012,11 +6012,11 @@ void CURVE_OT_shade_smooth(wmOperatorType *ot) ot->name = "Shade Smooth"; ot->idname = "CURVE_OT_shade_smooth"; ot->description = "Set shading to smooth"; - + /* api callbacks */ ot->exec = shade_smooth_exec; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -6027,11 +6027,11 @@ void CURVE_OT_shade_flat(wmOperatorType *ot) ot->name = "Shade Flat"; ot->idname = "CURVE_OT_shade_flat"; ot->description = "Set shading to flat"; - + /* api callbacks */ ot->exec = shade_smooth_exec; ot->poll = ED_operator_editsurfcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -6068,21 +6068,21 @@ int join_curve_exec(bContext *C, wmOperator *op) } BLI_listbase_clear(&tempbase); - + /* trasnform all selected curves inverse in obact */ invert_m4_m4(imat, ob->obmat); - + CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) { if (base->object->type == ob->type) { if (base->object != ob) { - + cu = base->object->data; - + if (cu->nurb.first) { /* watch it: switch order here really goes wrong */ mul_m4_m4m4(cmat, imat, base->object->obmat); - + nu = cu->nurb.first; while (nu) { newnu = BKE_nurb_duplicate(nu); @@ -6093,7 +6093,7 @@ int join_curve_exec(bContext *C, wmOperator *op) newnu->mat_nr = 0; } BLI_addtail(&tempbase, newnu); - + if ((bezt = newnu->bezt)) { a = newnu->pntsu; while (a--) { @@ -6114,16 +6114,16 @@ int join_curve_exec(bContext *C, wmOperator *op) nu = nu->next; } } - + ED_base_object_free_and_unlink(bmain, scene, base); } } } CTX_DATA_END; - + cu = ob->data; BLI_movelisttolist(&cu->nurb, &tempbase); - + if (ob->type == OB_CURVE) { /* Account for mixed 2D/3D curves when joining */ BKE_curve_curve_dimension_update(cu); @@ -6182,11 +6182,11 @@ void CURVE_OT_tilt_clear(wmOperatorType *ot) ot->name = "Clear Tilt"; ot->idname = "CURVE_OT_tilt_clear"; ot->description = "Clear the tilt of selected control points"; - + /* api callbacks */ ot->exec = clear_tilt_exec; ot->poll = ED_operator_editcurve; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 36d9f8a4c55..964296df205 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -987,7 +987,7 @@ static int curve_draw_exec(bContext *C, wmOperator *op) nu->resolv = 1; nu->orderu = 4; nu->orderv = 1; - + BPoint *bp = nu->bp; BLI_mempool_iternew(cdd->stroke_elem_pool, &iter); diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index d651f673a7f..e4db0f1b3fc 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -81,7 +81,7 @@ static int kill_selection(Object *obedit, int ins); static char findaccent(char char1, unsigned int code) { char new = 0; - + if (char1 == 'a') { if (code == '`') new = 224; else if (code == 39) new = 225; @@ -213,7 +213,7 @@ static char findaccent(char char1, unsigned int code) else if (char1 == '+') { if (code == '-') new = 177; } - + if (new) return new; else return char1; } @@ -222,7 +222,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c) { Curve *cu = obedit->data; EditFont *ef = cu->editfont; - + if (ef->len < MAXTEXT - 1) { int x; @@ -232,7 +232,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c) ef->textbufinfo[ef->pos] = cu->curinfo; ef->textbufinfo[ef->pos].kern = 0; ef->textbufinfo[ef->pos].mat_nr = obedit->actcol; - + ef->pos++; ef->len++; ef->textbuf[ef->len] = '\0'; @@ -375,7 +375,7 @@ static int paste_from_file_exec(bContext *C, wmOperator *op) { char *path; int retval; - + path = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); retval = paste_from_file(C, op->reports, path); MEM_freeN(path); @@ -388,7 +388,7 @@ static int paste_from_file_invoke(bContext *C, wmOperator *op, const wmEvent *UN if (RNA_struct_property_is_set(op->ptr, "filepath")) return paste_from_file_exec(C, op); - WM_event_add_fileselect(C, op); + WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; } @@ -399,12 +399,12 @@ void FONT_OT_text_paste_from_file(wmOperatorType *ot) ot->name = "Paste File"; ot->description = "Paste contents from file"; ot->idname = "FONT_OT_text_paste_from_file"; - + /* api callbacks */ ot->exec = paste_from_file_exec; ot->invoke = paste_from_file_invoke; ot->poll = ED_operator_editfont; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -428,7 +428,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, const char *s; int a; float rot[3] = {0.f, 0.f, 0.f}; - + obedit = BKE_object_add(bmain, scene, OB_FONT, NULL); base = scene->basact; @@ -501,12 +501,12 @@ void ED_text_to_object(bContext *C, Text *text, const bool split_lines) linenum++; continue; } - + /* do the translation */ offset[0] = 0; offset[1] = -linenum; offset[2] = 0; - + if (rv3d) mul_mat3_m4_v3(rv3d->viewinv, offset); @@ -602,11 +602,11 @@ void FONT_OT_style_set(wmOperatorType *ot) ot->name = "Set Style"; ot->description = "Set font style"; ot->idname = "FONT_OT_style_set"; - + /* api callbacks */ ot->exec = set_style_exec; ot->poll = ED_operator_editfont; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -625,7 +625,7 @@ static int toggle_style_exec(bContext *C, wmOperator *op) if (!BKE_vfont_select_get(obedit, &selstart, &selend)) return OPERATOR_CANCELLED; - + style = RNA_enum_get(op->ptr, "style"); cu->curinfo.flag ^= style; @@ -640,11 +640,11 @@ void FONT_OT_style_toggle(wmOperatorType *ot) ot->name = "Toggle Style"; ot->description = "Toggle font style"; ot->idname = "FONT_OT_style_toggle"; - + /* api callbacks */ ot->exec = toggle_style_exec; ot->poll = ED_operator_editfont; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -698,7 +698,7 @@ void FONT_OT_select_all(wmOperatorType *ot) static void copy_selection(Object *obedit) { int selstart, selend; - + if (BKE_vfont_select_get(obedit, &selstart, &selend)) { Curve *cu = obedit->data; EditFont *ef = cu->editfont; @@ -735,7 +735,7 @@ void FONT_OT_text_copy(wmOperatorType *ot) ot->name = "Copy Text"; ot->description = "Copy selected text to clipboard"; ot->idname = "FONT_OT_text_copy"; - + /* api callbacks */ ot->exec = copy_text_exec; ot->poll = ED_operator_editfont; @@ -765,7 +765,7 @@ void FONT_OT_text_cut(wmOperatorType *ot) ot->name = "Cut Text"; ot->description = "Cut selected text to clipboard"; ot->idname = "FONT_OT_text_cut"; - + /* api callbacks */ ot->exec = cut_text_exec; ot->poll = ED_operator_editfont; @@ -866,7 +866,7 @@ void FONT_OT_text_paste(wmOperatorType *ot) ot->name = "Paste Text"; ot->description = "Paste text from clipboard"; ot->idname = "FONT_OT_text_paste"; - + /* api callbacks */ ot->exec = paste_text_exec; ot->poll = ED_operator_editfont; @@ -910,7 +910,7 @@ static int move_cursor(bContext *C, int type, const bool select) } cursmove = FO_CURS; break; - + case LINE_END: while (ef->pos < ef->len) { if (ef->textbuf[ef->pos] == 0) break; @@ -953,7 +953,7 @@ static int move_cursor(bContext *C, int type, const bool select) case PREV_LINE: cursmove = FO_CURSUP; break; - + case NEXT_LINE: cursmove = FO_CURSDOWN; break; @@ -966,7 +966,7 @@ static int move_cursor(bContext *C, int type, const bool select) cursmove = FO_PAGEDOWN; break; } - + if (cursmove == -1) return OPERATOR_CANCELLED; @@ -1011,7 +1011,7 @@ void FONT_OT_move(wmOperatorType *ot) ot->name = "Move Cursor"; ot->description = "Move cursor to position type"; ot->idname = "FONT_OT_move"; - + /* api callbacks */ ot->exec = move_exec; ot->poll = ED_operator_editfont; @@ -1038,7 +1038,7 @@ void FONT_OT_move_select(wmOperatorType *ot) ot->name = "Move Select"; ot->description = "Move the cursor while selecting"; ot->idname = "FONT_OT_move_select"; - + /* api callbacks */ ot->exec = move_select_exec; ot->poll = ED_operator_editfont; @@ -1079,7 +1079,7 @@ void FONT_OT_change_spacing(wmOperatorType *ot) ot->name = "Change Spacing"; ot->description = "Change font spacing"; ot->idname = "FONT_OT_change_spacing"; - + /* api callbacks */ ot->exec = change_spacing_exec; ot->poll = ED_operator_editfont; @@ -1123,7 +1123,7 @@ void FONT_OT_change_character(wmOperatorType *ot) ot->name = "Change Character"; ot->description = "Change font character code"; ot->idname = "FONT_OT_change_character"; - + /* api callbacks */ ot->exec = change_character_exec; ot->poll = ED_operator_editfont; @@ -1158,7 +1158,7 @@ void FONT_OT_line_break(wmOperatorType *ot) ot->name = "Line Break"; ot->description = "Insert line break at cursor position"; ot->idname = "FONT_OT_line_break"; - + /* api callbacks */ ot->exec = line_break_exec; ot->poll = ED_operator_editfont; @@ -1284,7 +1284,7 @@ void FONT_OT_delete(wmOperatorType *ot) ot->name = "Delete"; ot->description = "Delete text by cursor position"; ot->idname = "FONT_OT_delete"; - + /* api callbacks */ ot->exec = delete_exec; ot->poll = ED_operator_editfont; @@ -1307,7 +1307,7 @@ static int insert_text_exec(bContext *C, wmOperator *op) if (!RNA_struct_property_is_set(op->ptr, "text")) return OPERATOR_CANCELLED; - + inserted_utf8 = RNA_string_get_alloc(op->ptr, "text", NULL, 0); len = BLI_strlen_utf8(inserted_utf8); @@ -1345,7 +1345,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event) accentcode = 1; return OPERATOR_FINISHED; } - + /* tab should exit editmode, but we allow it to be typed using modifier keys */ if (event_type == TABKEY) { if ((alt || ctrl || shift) == 0) @@ -1353,7 +1353,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event) else ascii = 9; } - + if (event_type == BACKSPACEKEY) { if (alt && ef->len != 0 && ef->pos > 0) accentcode = 1; @@ -1389,7 +1389,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event) else { BLI_assert(0); } - + kill_selection(obedit, 1); text_update_edited(C, obedit, FO_EDIT); } @@ -1413,7 +1413,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* reset property? */ if (event_val == 0) accentcode = 0; - + return OPERATOR_FINISHED; } @@ -1423,12 +1423,12 @@ void FONT_OT_text_insert(wmOperatorType *ot) ot->name = "Insert Text"; ot->description = "Insert text at cursor position"; ot->idname = "FONT_OT_text_insert"; - + /* api callbacks */ ot->exec = insert_text_exec; ot->invoke = insert_text_invoke; ot->poll = ED_operator_editfont; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1444,14 +1444,14 @@ static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op)) Object *obedit = CTX_data_active_object(C); Curve *cu = obedit->data; int i; - + if (cu->totbox < 256) { for (i = cu->totbox; i > cu->actbox; i--) cu->tb[i] = cu->tb[i - 1]; cu->tb[cu->actbox] = cu->tb[cu->actbox - 1]; cu->actbox++; cu->totbox++; } - + WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1462,15 +1462,15 @@ void FONT_OT_textbox_add(wmOperatorType *ot) ot->name = "Add Textbox"; ot->description = "Add a new text box"; ot->idname = "FONT_OT_textbox_add"; - + /* api callbacks */ ot->exec = textbox_add_exec; ot->poll = ED_operator_object_active_editable_font; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - + + } @@ -1485,17 +1485,17 @@ static int textbox_remove_exec(bContext *C, wmOperator *op) Curve *cu = obedit->data; int i; int index = RNA_int_get(op->ptr, "index"); - - + + if (cu->totbox > 1) { for (i = index; i < cu->totbox; i++) cu->tb[i] = cu->tb[i + 1]; cu->totbox--; if (cu->actbox >= index) cu->actbox--; } - + WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - + return OPERATOR_FINISHED; } @@ -1505,14 +1505,14 @@ void FONT_OT_textbox_remove(wmOperatorType *ot) ot->name = "Remove Textbox"; ot->description = "Remove the textbox"; ot->idname = "FONT_OT_textbox_remove"; - + /* api callbacks */ ot->exec = textbox_remove_exec; ot->poll = ED_operator_object_active_editable_font; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "The current text box", 0, INT_MAX); } @@ -1525,14 +1525,14 @@ void ED_curve_editfont_make(Object *obedit) Curve *cu = obedit->data; EditFont *ef = cu->editfont; int len_wchar; - + if (ef == NULL) { ef = cu->editfont = MEM_callocN(sizeof(EditFont), "editfont"); - + ef->textbuf = MEM_callocN((MAXTEXT + 4) * sizeof(wchar_t), "texteditbuf"); ef->textbufinfo = MEM_callocN((MAXTEXT + 4) * sizeof(CharInfo), "texteditbufinfo"); } - + /* Convert the original text to wchar_t */ len_wchar = BLI_strncpy_wchar_from_utf8(ef->textbuf, cu->str, MAXTEXT + 4); BLI_assert(len_wchar == cu->len_wchar); @@ -1571,7 +1571,7 @@ void ED_curve_editfont_load(Object *obedit) /* Copy the wchar to UTF-8 */ BLI_strncpy_wchar_as_utf8(cu->str, ef->textbuf, cu->len + 1); - + if (cu->strinfo) MEM_freeN(cu->strinfo); cu->strinfo = MEM_callocN((cu->len_wchar + 4) * sizeof(CharInfo), "texteditinfo"); @@ -1603,7 +1603,7 @@ static int set_case(bContext *C, int ccase) wchar_t *str; int len; int selstart, selend; - + if (BKE_vfont_select_get(obedit, &selstart, &selend)) { len = (selend - selstart) + 1; str = &ef->textbuf[selstart]; @@ -1643,7 +1643,7 @@ void FONT_OT_case_set(wmOperatorType *ot) ot->name = "Set Case"; ot->description = "Set font case"; ot->idname = "FONT_OT_case_set"; - + /* api callbacks */ ot->exec = set_case_exec; ot->poll = ED_operator_editfont; @@ -1664,7 +1664,7 @@ static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op)) EditFont *ef = cu->editfont; wchar_t *str; int len, ccase = CASE_UPPER; - + len = wcslen(ef->textbuf); str = ef->textbuf; while (len) { @@ -1676,7 +1676,7 @@ static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op)) len--; str++; } - + return set_case(C, ccase); } @@ -1686,7 +1686,7 @@ void FONT_OT_case_toggle(wmOperatorType *ot) ot->name = "Toggle Case"; ot->description = "Toggle font case"; ot->idname = "FONT_OT_case_toggle"; - + /* api callbacks */ ot->exec = toggle_case_exec; ot->poll = ED_operator_editfont; @@ -1700,7 +1700,7 @@ void FONT_OT_case_toggle(wmOperatorType *ot) static void font_ui_template_init(bContext *C, wmOperator *op) { PropertyPointerRNA *pprop; - + op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA"); UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop); } @@ -1729,7 +1729,7 @@ static int font_open_exec(bContext *C, wmOperator *op) if (!op->customdata) font_ui_template_init(C, op); - + /* hook into UI */ pprop = op->customdata; @@ -1737,7 +1737,7 @@ static int font_open_exec(bContext *C, wmOperator *op) /* when creating new ID blocks, use is already 1, but RNA * pointer use also increases user, so this compensates it */ id_us_min(&font->id); - + RNA_id_pointer_create(&font->id, &idptr); RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr); RNA_property_update(C, &pprop->ptr, pprop->prop); @@ -1772,7 +1772,7 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) return font_open_exec(C, op); RNA_string_set(op->ptr, "filepath", path); - WM_event_add_fileselect(C, op); + WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; } @@ -1783,15 +1783,15 @@ void FONT_OT_open(wmOperatorType *ot) ot->name = "Open Font"; ot->idname = "FONT_OT_open"; ot->description = "Load a new font from a file"; - + /* api callbacks */ ot->exec = font_open_exec; ot->invoke = open_invoke; ot->cancel = font_open_cancel; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ WM_operator_properties_filesel( ot, FILE_TYPE_FOLDER | FILE_TYPE_FTFONT, FILE_SPECIAL, FILE_OPENFILE, @@ -1808,7 +1808,7 @@ static int font_unlink_exec(bContext *C, wmOperator *op) PropertyPointerRNA pprop; UI_context_active_but_prop_get_templateID(C, &pprop.ptr, &pprop.prop); - + if (pprop.prop == NULL) { BKE_report(op->reports, RPT_ERROR, "Incorrect context for running font unlink"); return OPERATOR_CANCELLED; @@ -1829,7 +1829,7 @@ void FONT_OT_unlink(wmOperatorType *ot) ot->name = "Unlink"; ot->idname = "FONT_OT_unlink"; ot->description = "Unlink active font data-block"; - + /* api callbacks */ ot->exec = font_unlink_exec; } -- cgit v1.2.3