From d900f5be55d0812eb5c7dfd3ea47020c3edafd41 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Feb 2014 18:55:59 +1100 Subject: Code cleanup: use bools where possible --- source/blender/editors/armature/armature_add.c | 2 +- source/blender/editors/armature/armature_select.c | 2 +- source/blender/editors/armature/editarmature_sketch.c | 16 ++++++++-------- source/blender/editors/armature/pose_select.c | 4 ++-- source/blender/editors/armature/pose_transform.c | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index ed8ae2d4cbb..456dd802086 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -527,7 +527,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) bArmature *arm; EditBone *newbone, *ebone, *flipbone, *first = NULL; int a, totbone = 0, do_extrude; - int forked = RNA_boolean_get(op->ptr, "forked"); + bool forked = RNA_boolean_get(op->ptr, "forked"); obedit = CTX_data_edit_object(C); arm = obedit->data; diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index ed2d1388196..d51b27aefb8 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -973,7 +973,7 @@ static int armature_select_hierarchy_exec(bContext *C, wmOperator *op) bArmature *arm; EditBone *curbone, *pabone, *chbone; int direction = RNA_enum_get(op->ptr, "direction"); - int add_to_sel = RNA_boolean_get(op->ptr, "extend"); + const bool add_to_sel = RNA_boolean_get(op->ptr, "extend"); ob = obedit; arm = (bArmature *)ob->data; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 36999c15665..a1ec0b595b0 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1147,7 +1147,7 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, return point_added; } -static void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, short snap) +static void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, const bool snap) { ToolSettings *ts = CTX_data_tool_settings(C); int point_added = 0; @@ -1165,7 +1165,7 @@ static void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK } } -static void sk_getStrokePoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, short snap) +static void sk_getStrokePoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, const bool snap) { int point_added = 0; @@ -2180,7 +2180,7 @@ static void sk_start_draw_gesture(SK_Sketch *sketch) sketch->gesture = sk_createStroke(); } -static int sk_draw_stroke(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, short snap) +static int sk_draw_stroke(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, bool snap) { if (sk_stroke_filtermval(dd)) { sk_addStrokePoint(C, sketch, stk, dd, snap); @@ -2383,7 +2383,7 @@ static void sketch_draw_stroke_cancel(bContext *C, wmOperator *op) static int sketch_draw_stroke(bContext *C, wmOperator *op, const wmEvent *event) { - short snap = RNA_boolean_get(op->ptr, "snap"); + const bool snap = RNA_boolean_get(op->ptr, "snap"); SK_DrawData *dd; SK_Sketch *sketch = contextSketch(C, 1); @@ -2408,7 +2408,7 @@ static void sketch_draw_gesture_cancel(bContext *C, wmOperator *op) static int sketch_draw_gesture(bContext *C, wmOperator *op, const wmEvent *event) { - short snap = RNA_boolean_get(op->ptr, "snap"); + const bool snap = RNA_boolean_get(op->ptr, "snap"); SK_DrawData *dd; SK_Sketch *sketch = contextSketch(C, 1); /* create just to be sure */ sk_cancelStroke(sketch); @@ -2426,7 +2426,7 @@ static int sketch_draw_gesture(bContext *C, wmOperator *op, const wmEvent *event static int sketch_draw_modal(bContext *C, wmOperator *op, const wmEvent *event, short gesture, SK_Stroke *stk) { - short snap = RNA_boolean_get(op->ptr, "snap"); + bool snap = RNA_boolean_get(op->ptr, "snap"); SK_DrawData *dd = op->customdata; SK_Sketch *sketch = contextSketch(C, 1); /* create just to be sure */ int retval = OPERATOR_RUNNING_MODAL; @@ -2434,7 +2434,7 @@ static int sketch_draw_modal(bContext *C, wmOperator *op, const wmEvent *event, switch (event->type) { case LEFTCTRLKEY: case RIGHTCTRLKEY: - snap = event->ctrl; + snap = event->ctrl != 0; RNA_boolean_set(op->ptr, "snap", snap); break; case MOUSEMOVE: @@ -2496,7 +2496,7 @@ static int sketch_draw_gesture_modal(bContext *C, wmOperator *op, const wmEvent static int sketch_draw_preview(bContext *C, wmOperator *op, const wmEvent *event) { - short snap = RNA_boolean_get(op->ptr, "snap"); + const bool snap = RNA_boolean_get(op->ptr, "snap"); SK_Sketch *sketch = contextSketch(C, 0); if (sketch) { diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 34023d365ca..4038200d0a0 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -526,8 +526,8 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) bArmature *arm = ob->data; Bone *curbone, *pabone, *chbone; int direction = RNA_enum_get(op->ptr, "direction"); - int add_to_sel = RNA_boolean_get(op->ptr, "extend"); - int found = 0; + const bool add_to_sel = RNA_boolean_get(op->ptr, "extend"); + bool found = false; CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) { diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 6beb442108f..5fba6554b8c 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -298,7 +298,7 @@ static void set_pose_keys(Object *ob) * * > returns: whether the bone that we pasted to if we succeeded */ -static bPoseChannel *pose_bone_do_paste(Object *ob, bPoseChannel *chan, short selOnly, short flip) +static bPoseChannel *pose_bone_do_paste(Object *ob, bPoseChannel *chan, const bool selOnly, const bool flip) { bPoseChannel *pchan; char name[MAXBONENAME]; @@ -459,8 +459,8 @@ static int pose_paste_exec(bContext *C, wmOperator *op) Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); Scene *scene = CTX_data_scene(C); bPoseChannel *chan; - int flip = RNA_boolean_get(op->ptr, "flipped"); - int selOnly = RNA_boolean_get(op->ptr, "selected_mask"); + const bool flip = RNA_boolean_get(op->ptr, "flipped"); + bool selOnly = RNA_boolean_get(op->ptr, "selected_mask"); /* get KeyingSet to use */ KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID); -- cgit v1.2.3