diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-21 04:36:07 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-21 04:36:07 +0400 |
commit | 0aebd5f14475ef84b0095de4a8f034170b9aee75 (patch) | |
tree | fb10b43f22d18cc8e101ea988d2af430f147e500 /source/blender/editors/curve | |
parent | 5fd16476d990a59098f924d401dc9de9ef40a58a (diff) |
2.5: Make shade smooth/flat operators consistent,
and add object mode operators.
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r-- | source/blender/editors/curve/curve_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/curve/curve_ops.c | 3 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 29 |
3 files changed, 24 insertions, 11 deletions
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 34e81b60a16..ad3e9427861 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -75,7 +75,8 @@ void CURVE_OT_spline_type_set(struct wmOperatorType *ot); void CURVE_OT_radius_set(struct wmOperatorType *ot); void CURVE_OT_spline_weight_set(struct wmOperatorType *ot); void CURVE_OT_handle_type_set(struct wmOperatorType *ot); -void CURVE_OT_smooth_set(struct wmOperatorType *ot); +void CURVE_OT_shade_smooth(struct wmOperatorType *ot); +void CURVE_OT_shade_flat(struct wmOperatorType *ot); void CURVE_OT_tilt_clear(struct wmOperatorType *ot); void CURVE_OT_smooth(struct wmOperatorType *ot); diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 45dc76d5488..6006c7e656b 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -130,7 +130,8 @@ void ED_operatortypes_curve(void) WM_operatortype_append(CURVE_OT_radius_set); WM_operatortype_append(CURVE_OT_spline_weight_set); WM_operatortype_append(CURVE_OT_handle_type_set); - WM_operatortype_append(CURVE_OT_smooth_set); + 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_smooth); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 51a9cf5c75a..2bf5d357e5c 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4550,14 +4550,14 @@ void CURVE_OT_delete(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Which elements to delete."); } -/********************** set smooth operator *********************/ +/********************** shade smooth/flat operator *********************/ -static int set_smooth_exec(bContext *C, wmOperator *op) +static int shade_smooth_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; - int clear= RNA_boolean_get(op->ptr, "clear"); + int clear= (strcmp(op->idname, "CURVE_OT_shade_flat") == 0); if(obedit->type != OB_CURVE) return OPERATOR_CANCELLED; @@ -4575,21 +4575,32 @@ static int set_smooth_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void CURVE_OT_smooth_set(wmOperatorType *ot) +void CURVE_OT_shade_smooth(wmOperatorType *ot) { /* identifiers */ - ot->name= "Set Smooth"; - ot->idname= "CURVE_OT_smooth_set"; + ot->name= "Shade Smooth"; + ot->idname= "CURVE_OT_shade_smooth"; /* api callbacks */ - ot->exec= set_smooth_exec; + ot->exec= shade_smooth_exec; ot->poll= ED_operator_editsurfcurve; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} - /* properties */ - RNA_def_boolean(ot->srna, "clear", 0, "Clear", "Clear smooth shading to solid for selection instead of enabling it."); +void CURVE_OT_shade_flat(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Shade Flat"; + ot->idname= "CURVE_OT_shade_flat"; + + /* api callbacks */ + ot->exec= shade_smooth_exec; + ot->poll= ED_operator_editsurfcurve; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } /************** join operator, to be used externally? ****************/ |