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 --- .../blender/editors/animation/anim_channels_edit.c | 4 +-- source/blender/editors/animation/drivers.c | 6 ++-- source/blender/editors/animation/keyframes_draw.c | 2 +- .../blender/editors/animation/keyframes_general.c | 2 +- source/blender/editors/animation/keyframing.c | 11 ++++--- source/blender/editors/animation/keyingsets.c | 2 +- source/blender/editors/armature/armature_add.c | 2 +- source/blender/editors/armature/armature_select.c | 2 +- .../blender/editors/armature/editarmature_sketch.c | 16 ++++----- source/blender/editors/armature/pose_select.c | 4 +-- source/blender/editors/armature/pose_transform.c | 6 ++-- source/blender/editors/curve/editcurve.c | 3 +- source/blender/editors/curve/editfont.c | 2 +- source/blender/editors/gpencil/gpencil_edit.c | 4 +-- source/blender/editors/include/ED_curve.h | 2 +- source/blender/editors/include/ED_keyframes_draw.h | 2 +- source/blender/editors/include/ED_keyframes_edit.h | 2 +- source/blender/editors/include/ED_keyframing.h | 2 +- source/blender/editors/include/ED_mask.h | 4 +-- source/blender/editors/include/ED_node.h | 6 ++-- source/blender/editors/include/ED_sequencer.h | 8 ++--- source/blender/editors/interface/interface.c | 2 +- source/blender/editors/interface/interface_ops.c | 6 ++-- .../editors/interface/interface_templates.c | 4 +-- source/blender/editors/interface/view2d_ops.c | 4 +-- source/blender/editors/mask/mask_add.c | 10 +++--- source/blender/editors/mask/mask_draw.c | 22 ++++++------- source/blender/editors/mask/mask_editaction.c | 2 +- source/blender/editors/mask/mask_intern.h | 2 +- source/blender/editors/mask/mask_ops.c | 7 ++-- source/blender/editors/mask/mask_select.c | 4 +-- source/blender/editors/mesh/editmesh_tools.c | 4 +-- source/blender/editors/object/object_add.c | 4 +-- source/blender/editors/object/object_bake.c | 2 +- source/blender/editors/object/object_constraint.c | 4 +-- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/object/object_modifier.c | 4 +-- source/blender/editors/object/object_shapekey.c | 4 +-- source/blender/editors/object/object_transform.c | 2 +- source/blender/editors/physics/particle_object.c | 4 +-- source/blender/editors/render/render_opengl.c | 10 +++--- source/blender/editors/render/render_preview.c | 2 +- source/blender/editors/screen/screen_edit.c | 2 +- source/blender/editors/screen/screen_intern.h | 2 +- source/blender/editors/screen/screen_ops.c | 6 ++-- source/blender/editors/sculpt_paint/paint_hide.c | 8 ++--- .../blender/editors/sculpt_paint/paint_image_2d.c | 6 ++-- .../editors/sculpt_paint/paint_image_proj.c | 28 ++++++++-------- source/blender/editors/sculpt_paint/paint_ops.c | 8 ++--- source/blender/editors/sculpt_paint/paint_vertex.c | 15 +++++---- source/blender/editors/sculpt_paint/sculpt.c | 4 +-- source/blender/editors/sculpt_paint/sculpt_uv.c | 4 +-- source/blender/editors/space_clip/tracking_ops.c | 10 +++--- source/blender/editors/space_console/console_ops.c | 8 ++--- source/blender/editors/space_file/file_intern.h | 2 +- source/blender/editors/space_file/file_ops.c | 2 +- source/blender/editors/space_file/filelist.c | 6 ++-- source/blender/editors/space_file/filelist.h | 4 +-- source/blender/editors/space_image/image_ops.c | 8 ++--- source/blender/editors/space_nla/nla_draw.c | 2 +- source/blender/editors/space_nla/nla_edit.c | 6 ++-- source/blender/editors/space_nla/nla_intern.h | 2 +- source/blender/editors/space_nla/nla_ops.c | 4 +-- source/blender/editors/space_node/drawnode.c | 7 ++-- source/blender/editors/space_node/node_edit.c | 8 ++--- source/blender/editors/space_node/node_group.c | 2 +- source/blender/editors/space_node/node_intern.h | 8 ++--- .../editors/space_node/node_relationships.c | 12 +++---- source/blender/editors/space_node/node_select.c | 16 ++++----- .../blender/editors/space_outliner/outliner_edit.c | 6 ++-- .../editors/space_sequencer/sequencer_add.c | 27 +++++++-------- .../editors/space_sequencer/sequencer_edit.c | 14 ++++---- .../editors/space_sequencer/sequencer_select.c | 6 ++-- source/blender/editors/space_text/text_ops.c | 4 +-- source/blender/editors/space_view3d/drawmesh.c | 10 +++--- source/blender/editors/space_view3d/drawobject.c | 2 +- source/blender/editors/space_view3d/view3d_view.c | 10 +++--- .../editors/transform/transform_conversions.c | 2 +- source/blender/editors/transform/transform_ops.c | 6 ++-- source/blender/editors/uvedit/uvedit_ops.c | 8 ++--- .../blender/editors/uvedit/uvedit_smart_stitch.c | 16 ++++----- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 38 +++++++++++----------- 82 files changed, 274 insertions(+), 262 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index f157487955b..6b8c01965f7 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -859,7 +859,7 @@ static void rearrange_animchannel_flatten_islands(ListBase *islands, ListBase *s /* ............................. */ /* performing rearranging of channels using islands */ -static short rearrange_animchannel_islands(ListBase *list, AnimChanRearrangeFp rearrange_func, short mode, short type) +static bool rearrange_animchannel_islands(ListBase *list, AnimChanRearrangeFp rearrange_func, short mode, short type) { ListBase islands = {NULL, NULL}; Link *channel, *chanNext = NULL; @@ -1027,7 +1027,7 @@ static void join_groups_action_temp(bAction *act) static void rearrange_action_channels(bAnimContext *ac, bAction *act, short mode) { bActionGroup tgrp; - short do_channels; + bool do_channels; /* get rearranging function */ AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode); diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index bbfa981c0c7..668c8cdceec 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -502,7 +502,8 @@ static int add_driver_button_exec(bContext *C, wmOperator *op) PointerRNA ptr = {{NULL}}; PropertyRNA *prop = NULL; short success = 0; - int index, all = RNA_boolean_get(op->ptr, "all"); + int index; + const bool all = RNA_boolean_get(op->ptr, "all"); /* try to create driver using property retrieved from UI */ uiContextActiveProperty(C, &ptr, &prop, &index); @@ -556,7 +557,8 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op) PointerRNA ptr = {{NULL}}; PropertyRNA *prop = NULL; short success = 0; - int index, all = RNA_boolean_get(op->ptr, "all"); + int index; + const bool all = RNA_boolean_get(op->ptr, "all"); /* try to find driver using property retrieved from UI */ uiContextActiveProperty(C, &ptr, &prop, &index); diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 859485a55a6..1dea1329f9f 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -513,7 +513,7 @@ static void set_touched_actkeyblock(ActKeyBlock *ab) /* --------- */ /* Checks if ActKeyBlock should exist... */ -short actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys) +bool actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys) { ActKeyColumn *ak; short startCurves, endCurves, totCurves; diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 481012bf411..0ead68c4d4a 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -73,7 +73,7 @@ * Not recommended to be used many times successively. For that * there is delete_fcurve_keys(). */ -void delete_fcurve_key(FCurve *fcu, int index, short do_recalc) +void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc) { /* sanity check */ if (fcu == NULL) diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 23f4ebeee66..a69403b085f 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1649,7 +1649,8 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) char *path; float cfra = (float)CFRA; short success = 0; - int a, index, length, all = RNA_boolean_get(op->ptr, "all"); + int a, index, length; + const bool all = RNA_boolean_get(op->ptr, "all"); short flag = 0; /* flags for inserting keyframes */ @@ -1740,7 +1741,8 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) char *path; float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap short success = 0; - int a, index, length, all = RNA_boolean_get(op->ptr, "all"); + int a, index, length; + const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ uiContextActiveProperty(C, &ptr, &prop, &index); @@ -1809,7 +1811,8 @@ static int clear_key_button_exec(bContext *C, wmOperator *op) PropertyRNA *prop = NULL; char *path; short success = 0; - int a, index, length, all = RNA_boolean_get(op->ptr, "all"); + int a, index, length; + const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ uiContextActiveProperty(C, &ptr, &prop, &index); @@ -1898,7 +1901,7 @@ int autokeyframe_cfra_can_key(Scene *scene, ID *id) /* --------------- API/Per-Datablock Handling ------------------- */ /* Checks if some F-Curve has a keyframe for a given frame */ -short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter) +bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter) { /* quick sanity check */ if (ELEM(NULL, fcu, fcu->bezt)) diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 8d8290f83b7..b0b1ae3b0c9 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -296,7 +296,7 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) char *path = NULL; short success = 0; int index = 0, pflag = 0; - int all = RNA_boolean_get(op->ptr, "all"); + const bool all = RNA_boolean_get(op->ptr, "all"); /* verify the Keying Set to use: * - use the active one for now (more control over this can be added later) 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); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index b2a5844ccea..8d9e4737481 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3019,7 +3019,8 @@ static int hide_exec(bContext *C, wmOperator *op) Nurb *nu; BPoint *bp; BezTriple *bezt; - int a, sel, invert = RNA_boolean_get(op->ptr, "unselected"); + int a, sel; + const bool invert = RNA_boolean_get(op->ptr, "unselected"); for (nu = editnurb->first; nu; nu = nu->next) { if (nu->type == CU_BEZIER) { diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 9f97a0aedff..7207c07b71a 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -631,7 +631,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, const WM_event_add_notifier(C, NC_OBJECT | NA_ADDED, obedit); } -void ED_text_to_object(bContext *C, Text *text, int split_lines) +void ED_text_to_object(bContext *C, Text *text, const bool split_lines) { RegionView3D *rv3d = CTX_wm_region_view3d(C); TextLine *line; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 8d66a94f423..a5376741ffd 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1655,12 +1655,12 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op) static bool gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) { const char *prop_id = RNA_property_identifier(prop); - int link_strokes = RNA_boolean_get(ptr, "use_link_strokes"); + const bool link_strokes = RNA_boolean_get(ptr, "use_link_strokes"); int timing_mode = RNA_enum_get(ptr, "timing_mode"); bool realtime = RNA_boolean_get(ptr, "use_realtime"); float gap_duration = RNA_float_get(ptr, "gap_duration"); float gap_randomness = RNA_float_get(ptr, "gap_randomness"); - int valid_timing = RNA_boolean_get(ptr, "use_timing_data"); + const bool valid_timing = RNA_boolean_get(ptr, "use_timing_data"); /* Always show those props */ if (strcmp(prop_id, "type") == 0 || diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 296d7095938..d3b3425a27d 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -78,7 +78,7 @@ void make_editText(struct Object *obedit); void load_editText(struct Object *obedit); void free_editText(struct Object *obedit); -void ED_text_to_object(struct bContext *C, struct Text *text, int split_lines); +void ED_text_to_object(struct bContext *C, struct Text *text, const bool split_lines); bool ED_curve_select_nth(struct Curve *cu, int nth); diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index ffee46e30c6..58a262e150a 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -154,6 +154,6 @@ short compare_ak_cfraPtr(void *node, void *data); short compare_ab_cfraPtr(void *node, void *data); /* Checks if ActKeyBlock can be used (i.e. drawn/used to detect "holds") */ -short actkeyblock_is_valid(ActKeyBlock *ab, struct DLRBT_Tree *keys); +bool actkeyblock_is_valid(ActKeyBlock *ab, struct DLRBT_Tree *keys); #endif /* __ED_KEYFRAMES_DRAW_H__ */ diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 5718a70208e..c99c70377ab 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -236,7 +236,7 @@ void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt); /* ************************************************ */ /* Destructive Editing API (keyframes_general.c) */ -void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc); +void delete_fcurve_key(struct FCurve *fcu, int index, bool do_recalc); bool delete_fcurve_keys(struct FCurve *fcu); void clear_fcurve_keys(struct FCurve *fcu); void duplicate_fcurve_keys(struct FCurve *fcu); diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index b9ad597558b..ad5f61a12f6 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -297,7 +297,7 @@ int autokeyframe_cfra_can_key(struct Scene *scene, struct ID *id); /* Lesser Keyframe Checking API call: * - Used for the buttons to check for keyframes... */ -short fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter); +bool fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter); /* Main Keyframe Checking API call: * Checks whether a keyframe exists for the given ID-block one the given frame. diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 3f8d571b239..d8fe14282e3 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -60,7 +60,7 @@ void ED_mask_draw_region(struct Mask *mask, struct ARegion *ar, const char draw_flag, const char draw_type, const char overlay_mode, const int width_i, const int height_i, const float aspx, const float aspy, - const short do_scale_applied, const short do_draw_cb, + const bool do_scale_applied, const bool do_draw_cb, float stabmat[4][4], const struct bContext *C); @@ -76,7 +76,7 @@ short ED_masklayer_frames_looper(struct MaskLayer *masklay, struct Scene *scene, short (*masklay_shape_cb)(struct MaskLayerShape *, struct Scene *)); void ED_masklayer_make_cfra_list(struct MaskLayer *masklay, ListBase *elems, short onlysel); -short ED_masklayer_frame_select_check(struct MaskLayer *masklay); +bool ED_masklayer_frame_select_check(struct MaskLayer *masklay); void ED_masklayer_frame_select_set(struct MaskLayer *masklay, short mode); void ED_masklayer_frames_select_border(struct MaskLayer *masklay, float min, float max, short select_mode); void ED_mask_select_frames(struct MaskLayer *masklay, short select_mode); diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index 5fe2dd6c96b..f00af1dfede 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -91,9 +91,9 @@ void ED_node_link_insert(struct ScrArea *sa); /* node_edit.c */ void ED_node_set_tree_type(struct SpaceNode *snode, struct bNodeTreeType *typeinfo); -int ED_node_is_compositor(struct SpaceNode *snode); -int ED_node_is_shader(struct SpaceNode *snode); -int ED_node_is_texture(struct SpaceNode *snode); +bool ED_node_is_compositor(struct SpaceNode *snode); +bool ED_node_is_shader(struct SpaceNode *snode); +bool ED_node_is_texture(struct SpaceNode *snode); void ED_node_shader_default(const struct bContext *C, struct ID *id); void ED_node_composit_default(const struct bContext *C, struct Scene *scene); diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h index 21477a72014..4e9d67df61e 100644 --- a/source/blender/editors/include/ED_sequencer.h +++ b/source/blender/editors/include/ED_sequencer.h @@ -34,11 +34,11 @@ struct SpaceSeq; void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, bool deselect_all); void ED_sequencer_deselect_all(struct Scene *scene); -int ED_space_sequencer_maskedit_mask_poll(struct bContext *C); -int ED_space_sequencer_check_show_maskedit(struct SpaceSeq *sseq, struct Scene *scene); -int ED_space_sequencer_maskedit_poll(struct bContext *C); +int ED_space_sequencer_maskedit_mask_poll(struct bContext *C); +bool ED_space_sequencer_check_show_maskedit(struct SpaceSeq *sseq, struct Scene *scene); +int ED_space_sequencer_maskedit_poll(struct bContext *C); -int ED_space_sequencer_check_show_imbuf(struct SpaceSeq *sseq); +bool ED_space_sequencer_check_show_imbuf(struct SpaceSeq *sseq); void ED_operatormacros_sequencer(void); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e98a04fea37..6317cb83a3a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1749,7 +1749,7 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, bool pad, int float_precision) { UnitSettings *unit = but->block->unit; - int do_split = unit->flag & USER_UNIT_OPT_SPLIT; + int do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; int unit_type = uiButGetUnitType(but); int precision; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 593f6e1dbe0..9286b589983 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -185,7 +185,8 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) { PointerRNA ptr; PropertyRNA *prop; - int index, all = RNA_boolean_get(op->ptr, "all"); + int index; + const bool all = RNA_boolean_get(op->ptr, "all"); /* try to reset the nominated setting to its default value */ uiContextActiveProperty(C, &ptr, &prop, &index); @@ -333,7 +334,8 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op) PointerRNA ptr, lptr, idptr; PropertyRNA *prop, *lprop; int success = 0; - int index, all = RNA_boolean_get(op->ptr, "all"); + int index; + const bool all = RNA_boolean_get(op->ptr, "all"); /* try to reset the nominated setting to its default value */ uiContextActiveProperty(C, &ptr, &prop, &index); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 2fb0b6b7e06..c2076f90a71 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -303,8 +303,8 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) break; case UI_ID_ALONE: if (id) { - const int do_scene_obj = (GS(id->name) == ID_OB) && - (template->ptr.type == &RNA_SceneObjects); + const bool do_scene_obj = (GS(id->name) == ID_OB) && + (template->ptr.type == &RNA_SceneObjects); /* make copy */ if (do_scene_obj) { diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index dfd6a9fb48f..a332e5bbcd7 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -743,8 +743,8 @@ static void VIEW2D_OT_zoom_in(wmOperatorType *ot) static int view_zoomout_exec(bContext *C, wmOperator *op) { ScrArea *sa = CTX_wm_area(C); - short do_zoom_x = true; - short do_zoom_y = true; + bool do_zoom_x = true; + bool do_zoom_y = true; /* check that there's an active region, as View2D data resides there */ if (!view_zoom_poll(C)) diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index d2704923de1..7fa41c361bb 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -408,9 +408,9 @@ static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, int point_index; float tangent_point[2]; float tangent_co[2]; - int do_cyclic_correct = FALSE; - int do_recalc_src = FALSE; /* when extruding from endpoints only */ - int do_prev; /* use prev point rather then next?? */ + bool do_cyclic_correct = false; + bool do_recalc_src = false; /* when extruding from endpoints only */ + bool do_prev; /* use prev point rather then next?? */ if (!masklay) { return FALSE; @@ -584,8 +584,8 @@ static int add_vertex_exec(bContext *C, wmOperator *op) MaskSpline *spline = masklay->act_spline; MaskSplinePoint *point = masklay->act_point; - int is_sta = (point == spline->points); - int is_end = (point == &spline->points[spline->tot_point - 1]); + const bool is_sta = (point == spline->points); + const bool is_end = (point == &spline->points[spline->tot_point - 1]); /* then check are we overlapping the mouse */ if ((is_sta || is_end) && equals_v2v2(co, point->bezt.vec[1])) { diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 4cf4cd1ddba..24fcbd19fc1 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -56,7 +56,7 @@ #include "mask_intern.h" /* own include */ -static void mask_spline_color_get(MaskLayer *masklay, MaskSpline *spline, const int is_sel, +static void mask_spline_color_get(MaskLayer *masklay, MaskSpline *spline, const bool is_sel, unsigned char r_rgb[4]) { if (is_sel) { @@ -76,7 +76,7 @@ static void mask_spline_color_get(MaskLayer *masklay, MaskSpline *spline, const r_rgb[3] = 255; } -static void mask_spline_feather_color_get(MaskLayer *UNUSED(masklay), MaskSpline *UNUSED(spline), const int is_sel, +static void mask_spline_feather_color_get(MaskLayer *UNUSED(masklay), MaskSpline *UNUSED(spline), const bool is_sel, unsigned char r_rgb[4]) { if (is_sel) { @@ -136,7 +136,7 @@ static void mask_point_undistort_pos(SpaceClip *sc, float r_co[2], const float c static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline *spline, const char UNUSED(draw_flag), const char draw_type) { - const int is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0; + const bool is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0; unsigned char rgb_spline[4]; MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); SpaceClip *sc = CTX_wm_space_clip(C); @@ -212,7 +212,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline float handle[2]; float vert[2]; - int has_handle = BKE_mask_point_has_handle(point); + const bool has_handle = BKE_mask_point_has_handle(point); copy_v2_v2(vert, bezt->vec[1]); BKE_mask_point_handle(point_deform, handle); @@ -295,7 +295,7 @@ static void mask_color_active_tint(unsigned char r_rgb[4], const unsigned char r } static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (*orig_points)[2], int tot_point, - const short is_feather, const short is_smooth, const short is_active, + const bool is_feather, const bool is_smooth, const bool is_active, const unsigned char rgb_spline[4], const char draw_type) { const int draw_method = (spline->flag & MASK_SPLINE_CYCLIC) ? GL_LINE_LOOP : GL_LINE_STRIP; @@ -407,7 +407,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline *spline, const char draw_flag, const char draw_type, - const short is_active, + const bool is_active, int width, int height) { const unsigned int resol = max_ii(BKE_mask_spline_feather_resolution(spline, width, height), @@ -415,9 +415,9 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline unsigned char rgb_tmp[4]; - const short is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0; - const short is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH); - const short is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0; + const bool is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0; + const bool is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH) != 0; + const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0; unsigned int tot_diff_point; float (*diff_points)[2]; @@ -489,7 +489,7 @@ static void draw_masklays(const bContext *C, Mask *mask, const char draw_flag, c for (masklay = mask->masklayers.first, i = 0; masklay; masklay = masklay->next, i++) { MaskSpline *spline; - const short is_active = (i == mask->masklay_act); + const bool is_active = (i == mask->masklay_act); if (masklay->restrictflag & MASK_RESTRICT_VIEW) { continue; @@ -623,7 +623,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, const char draw_flag, const char draw_type, const char overlay_mode, const int width_i, const int height_i, /* convert directly into aspect corrected vars */ const float aspx, const float aspy, - const short do_scale_applied, const short do_draw_cb, + const bool do_scale_applied, const bool do_draw_cb, float stabmat[4][4], /* optional - only used by clip */ const bContext *C /* optional - only used when do_post_draw is set or called from clip editor */ ) diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 20d49e89771..d4ac0338456 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -110,7 +110,7 @@ void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short only /* Selection Tools */ /* check if one of the frames in this layer is selected */ -short ED_masklayer_frame_select_check(MaskLayer *masklay) +bool ED_masklayer_frame_select_check(MaskLayer *masklay) { MaskLayerShape *masklay_shape; diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index a666daaafde..62872e72cb4 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -73,7 +73,7 @@ bool ED_mask_feather_find_nearest( struct MaskSplinePoint *ED_mask_point_find_nearest( const struct bContext *C, struct Mask *mask, const float normal_co[2], const float threshold, - struct MaskLayer **masklay_r, struct MaskSpline **spline_r, int *is_handle_r, + struct MaskLayer **masklay_r, struct MaskSpline **spline_r, bool *is_handle_r, float *score); void MASK_OT_layer_move(struct wmOperatorType *ot); diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 13ae17c6efd..2f7ffd92f90 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -60,7 +60,7 @@ /******************** utility functions *********************/ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const float normal_co[2], const float threshold, - MaskLayer **masklay_r, MaskSpline **spline_r, int *is_handle_r, + MaskLayer **masklay_r, MaskSpline **spline_r, bool *is_handle_r, float *score) { ScrArea *sa = CTX_wm_area(C); @@ -471,8 +471,9 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent * MaskSpline *spline, *cv_spline, *feather_spline; MaskSplinePoint *point, *cv_point, *feather_point; MaskSplinePointUW *uw = NULL; - int is_handle = FALSE, width, height, action = SLIDE_ACTION_NONE; - int slide_feather = RNA_boolean_get(op->ptr, "slide_feather"); + int width, height, action = SLIDE_ACTION_NONE; + bool is_handle = false; + const bool slide_feather = RNA_boolean_get(op->ptr, "slide_feather"); float co[2], cv_score, feather_score; const float threshold = 19; diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 497aea27b26..16fd8414f22 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -256,7 +256,7 @@ static int select_exec(bContext *C, wmOperator *op) bool deselect = RNA_boolean_get(op->ptr, "deselect"); bool toggle = RNA_boolean_get(op->ptr, "toggle"); - int is_handle = 0; + bool is_handle = 0; const float threshold = 19; RNA_float_get_array(op->ptr, "location", co); @@ -703,7 +703,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE float co[2]; int do_select = !RNA_boolean_get(op->ptr, "deselect"); - int is_handle = 0; + bool is_handle = false; const float threshold = 19; bool changed = false; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 616553169c8..dbb15525dfe 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4950,7 +4950,7 @@ static int edbm_mark_freestyle_edge_exec(bContext *C, wmOperator *op) BMEdge *eed; BMIter iter; FreestyleEdge *fed; - int clear = RNA_boolean_get(op->ptr, "clear"); + const bool clear = RNA_boolean_get(op->ptr, "clear"); if (em == NULL) return OPERATOR_FINISHED; @@ -5012,7 +5012,7 @@ static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op) BMFace *efa; BMIter iter; FreestyleFace *ffa; - int clear = RNA_boolean_get(op->ptr, "clear"); + const bool clear = RNA_boolean_get(op->ptr, "clear"); if (em == NULL) return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 924e88babf1..025a7358d97 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2092,7 +2092,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - int linked = RNA_boolean_get(op->ptr, "linked"); + const bool linked = RNA_boolean_get(op->ptr, "linked"); int dupflag = (linked) ? 0 : U.dupflag; BKE_main_id_clear_newpoins(bmain); @@ -2161,7 +2161,7 @@ static int add_named_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Base *basen, *base; Object *ob; - int linked = RNA_boolean_get(op->ptr, "linked"); + const bool linked = RNA_boolean_get(op->ptr, "linked"); int dupflag = (linked) ? 0 : U.dupflag; char name[MAX_ID_NAME - 2]; diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index b8a96bba874..0a4bbf10bf0 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -770,7 +770,7 @@ static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), const return OPERATOR_PASS_THROUGH; } -static int is_multires_bake(Scene *scene) +static bool is_multires_bake(Scene *scene) { if (ELEM4(scene->r.bake_mode, RE_BAKE_NORMALS, RE_BAKE_DISPLACEMENT, RE_BAKE_DERIVATIVE, RE_BAKE_AO)) return scene->r.bake_flag & R_BAKE_MULTIRES; diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 244bd5c1d71..3d055e7485f 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1613,7 +1613,7 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o } /* used by add constraint operators to add the constraint required */ -static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget) +static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, const bool setTarget) { Main *bmain = CTX_data_main(C); bPoseChannel *pchan; @@ -1907,7 +1907,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED static int pose_ik_add_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); - int with_targets = RNA_boolean_get(op->ptr, "with_targets"); + const bool with_targets = RNA_boolean_get(op->ptr, "with_targets"); /* add the constraint - all necessary checks should have been done by the invoke() callback already... */ return constraint_add_exec(C, op, ob, get_active_constraints(ob), CONSTRAINT_TYPE_KINEMATIC, with_targets); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index bccbb5a23b3..c76b866bf2d 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1610,7 +1610,7 @@ static int object_mode_set_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); ObjectMode mode = RNA_enum_get(op->ptr, "mode"); ObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT; - int toggle = RNA_boolean_get(op->ptr, "toggle"); + const bool toggle = RNA_boolean_get(op->ptr, "toggle"); if (!ob || !object_mode_compat_test(ob, mode)) return OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 50d708bb49e..cd99fd34aac 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1289,7 +1289,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op) Object *ob = ED_object_active_context(C); Mesh *me = (ob) ? ob->data : op->customdata; char path[FILE_MAX]; - int relative = RNA_boolean_get(op->ptr, "relative_path"); + const bool relative = RNA_boolean_get(op->ptr, "relative_path"); if (!me) return OPERATOR_CANCELLED; @@ -2097,7 +2097,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op) OceanCache *och; struct Ocean *ocean; int f, cfra, i = 0; - int free = RNA_boolean_get(op->ptr, "free"); + const bool free = RNA_boolean_get(op->ptr, "free"); wmJob *wm_job; OceanBakeJob *oj; diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 57cd464b7ad..3df4f721f7a 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -75,7 +75,7 @@ /*********************** add shape key ***********************/ -static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int from_mix) +static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, const bool from_mix) { KeyBlock *kb; if ((kb = BKE_object_insert_shape_key(scene, ob, NULL, from_mix))) { @@ -312,7 +312,7 @@ static int shape_key_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *ob = ED_object_context(C); - int from_mix = RNA_boolean_get(op->ptr, "from_mix"); + const bool from_mix = RNA_boolean_get(op->ptr, "from_mix"); ED_object_shape_key_add(C, scene, ob, from_mix); diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index d40d239319c..dbb4837b009 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -794,7 +794,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) Object *ob = ctx_ob->ptr.data; if ((ob->flag & OB_DONE) == 0) { - int do_inverse_offset = FALSE; + bool do_inverse_offset = false; ob->flag |= OB_DONE; if (centermode == ORIGIN_TO_CURSOR) { diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index bebc46d1242..8090cf4fefd 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -588,7 +588,7 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op) Object *ob= ED_object_context(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= NULL; - int all = RNA_boolean_get(op->ptr, "all"); + const bool all = RNA_boolean_get(op->ptr, "all"); if (!ob) return OPERATOR_CANCELLED; @@ -739,7 +739,7 @@ static int connect_hair_exec(bContext *C, wmOperator *op) Object *ob= ED_object_context(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= NULL; - int all = RNA_boolean_get(op->ptr, "all"); + const bool all = RNA_boolean_get(op->ptr, "all"); int any_connected = FALSE; if (!ob) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 3ef3ff8f366..a254cd01c30 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -196,7 +196,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) rctf viewplane; float clipsta, clipend; - int is_ortho = ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); + bool is_ortho = ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); if (is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend); else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); } @@ -521,7 +521,7 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op) int ok = 0; const short view_context = (oglrender->v3d != NULL); Object *camera = NULL; - int is_movie; + bool is_movie; /* go to next frame */ if (CFRA < oglrender->nfra) @@ -665,7 +665,7 @@ finally: /* Step the frame and bail early if needed */ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent *event) { OGLRender *oglrender = op->customdata; - int anim = RNA_boolean_get(op->ptr, "animation"); + const bool anim = RNA_boolean_get(op->ptr, "animation"); bool ret; switch (event->type) { @@ -706,7 +706,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent static int screen_opengl_render_invoke(bContext *C, wmOperator *op, const wmEvent *event) { OGLRender *oglrender; - int anim = RNA_boolean_get(op->ptr, "animation"); + const bool anim = RNA_boolean_get(op->ptr, "animation"); if (!screen_opengl_render_init(C, op)) return OPERATOR_CANCELLED; @@ -731,7 +731,7 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, const wmEven /* executes blocking render */ static int screen_opengl_render_exec(bContext *C, wmOperator *op) { - const short is_animation = RNA_boolean_get(op->ptr, "animation"); + const bool is_animation = RNA_boolean_get(op->ptr, "animation"); if (!screen_opengl_render_init(C, op)) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index f0507abaf95..482c855f067 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -1035,7 +1035,7 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short { IconPreview *ip = (IconPreview *)customdata; IconPreviewSize *cur_size = ip->sizes.first; - int use_new_shading = BKE_scene_use_new_shading_nodes(ip->scene); + const bool use_new_shading = BKE_scene_use_new_shading_nodes(ip->scene); while (cur_size) { ShaderPreview *sp = MEM_callocN(sizeof(ShaderPreview), "Icon ShaderPreview"); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 30337e81890..fa7fd62231b 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -259,7 +259,7 @@ void removenotused_scredges(bScreen *sc) } } -int scredge_is_horizontal(ScrEdge *se) +bool scredge_is_horizontal(ScrEdge *se) { return (se->v1->vec.y == se->v2->vec.y); } diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 66677aed68f..8a76c52d985 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -52,7 +52,7 @@ void removenotused_scrverts(bScreen *sc); void removedouble_scrverts(bScreen *sc); void removedouble_scredges(bScreen *sc); void removenotused_scredges(bScreen *sc); -int scredge_is_horizontal(ScrEdge *se); +bool scredge_is_horizontal(ScrEdge *se); ScrEdge *screen_find_active_scredge(bScreen *sc, const int winsize_x, const int winsize_y, const int mx, const int my); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e6273749157..ae1b7cc937f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2073,8 +2073,8 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) DLRBT_Tree keys; ActKeyColumn *ak; float cfra; - short next = RNA_boolean_get(op->ptr, "next"); - short done = FALSE; + const bool next = RNA_boolean_get(op->ptr, "next"); + bool done = false; /* sanity checks */ if (scene == NULL) @@ -2164,7 +2164,7 @@ static int marker_jump_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); TimeMarker *marker; int closest = CFRA; - short next = RNA_boolean_get(op->ptr, "next"); + const bool next = RNA_boolean_get(op->ptr, "next"); bool found = false; /* find matching marker in the right direction */ diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 0eb019afbf7..6542bb2ca9b 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -72,10 +72,10 @@ #include /* return true if the element should be hidden/shown */ -static int is_effected(PartialVisArea area, - float planes[4][4], - const float co[3], - const float mask) +static bool is_effected(PartialVisArea area, + float planes[4][4], + const float co[3], + const float mask) { if (area == PARTIALVIS_ALL) return 1; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index be2f8727ec4..19f2673d96a 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -653,7 +653,7 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai } /* keep these functions in sync */ -static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const short is_torus, float r_rgb[4]) +static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const bool is_torus, float r_rgb[4]) { if (is_torus) { x %= ibuf->x; @@ -671,7 +671,7 @@ static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const short is_toru straight_uchar_to_premul_float(r_rgb, rrgb); } } -static void paint_2d_ibuf_rgb_set(ImBuf *ibuf, int x, int y, const short is_torus, const float rgb[4]) +static void paint_2d_ibuf_rgb_set(ImBuf *ibuf, int x, int y, const bool is_torus, const float rgb[4]) { if (is_torus) { x %= ibuf->x; @@ -715,7 +715,7 @@ static int paint_2d_ibuf_add_if(ImBuf *ibuf, unsigned int x, unsigned int y, flo return 1; } -static void paint_2d_lift_soften(ImBuf *ibuf, ImBuf *ibufb, int *pos, const short is_torus) +static void paint_2d_lift_soften(ImBuf *ibuf, ImBuf *ibufb, int *pos, const bool is_torus) { int x, y, count, xi, yi, xo, yo; int out_off[2], in_off[2], dim[2]; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 2e8a8a32ce9..d2714639a56 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -234,14 +234,14 @@ typedef struct ProjPaintState { int winx, winy; /* from the carea or from the projection render */ /* options for projection painting */ - int do_layer_clone; - int do_layer_stencil; - int do_layer_stencil_inv; - - short do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/ - short do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */ - short do_mask_normal; /* mask out pixels based on their normals */ - short do_new_shading_nodes; /* cache BKE_scene_use_new_shading_nodes value */ + bool do_layer_clone; + bool do_layer_stencil; + bool do_layer_stencil_inv; + + bool do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/ + bool do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */ + bool do_mask_normal; /* mask out pixels based on their normals */ + bool do_new_shading_nodes; /* cache BKE_scene_use_new_shading_nodes value */ float normal_angle; /* what angle to mask at*/ float normal_angle_inner; float normal_angle_range; /* difference between normal_angle and normal_angle_inner, for easy access */ @@ -1846,7 +1846,7 @@ static int float_z_sort(const void *p1, const void *p2) } static void project_bucket_clip_face( - const int is_ortho, + const bool is_ortho, rctf *bucket_bounds, float *v1coSS, float *v2coSS, float *v3coSS, float *uv1co, float *uv2co, float *uv3co, @@ -2210,10 +2210,10 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i float uv_clip[8][2]; int uv_clip_tot; - const short is_ortho = ps->is_ortho; - const short is_clone_other = ((ps->brush->imagepaint_tool == PAINT_TOOL_CLONE) && ps->dm_mtface_clone); - const short do_backfacecull = ps->do_backfacecull; - const short do_clip = ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0; + const bool is_ortho = ps->is_ortho; + const bool is_clone_other = ((ps->brush->imagepaint_tool == PAINT_TOOL_CLONE) && ps->dm_mtface_clone); + const bool do_backfacecull = ps->do_backfacecull; + const bool do_clip = ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0; vCo[0] = ps->dm_mvert[mf->v1].co; vCo[1] = ps->dm_mvert[mf->v2].co; @@ -4244,7 +4244,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->do_new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); /* only cache the value */ if (ps->tool == PAINT_TOOL_CLONE) - ps->do_layer_clone = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE); + ps->do_layer_clone = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE) ? 1 : 0; ps->do_layer_stencil = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_STENCIL) ? 1 : 0; ps->do_layer_stencil_inv = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_STENCIL_INV) ? 1 : 0; diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 809e9911e09..ce57b12d0ba 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -313,8 +313,8 @@ static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool, static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, const size_t tool_offset, const int ob_mode, - const char *tool_name, int create_missing, - int toggle) + const char *tool_name, const bool create_missing, + const bool toggle) { Brush *brush, *brush_orig = BKE_paint_brush(paint); @@ -350,8 +350,8 @@ static int brush_select_exec(bContext *C, wmOperator *op) ToolSettings *toolsettings = CTX_data_tool_settings(C); Paint *paint = NULL; int tool, paint_mode = RNA_enum_get(op->ptr, "paint_mode"); - int create_missing = RNA_boolean_get(op->ptr, "create_missing"); - int toggle = RNA_boolean_get(op->ptr, "toggle"); + const bool create_missing = RNA_boolean_get(op->ptr, "create_missing"); + const bool toggle = RNA_boolean_get(op->ptr, "toggle"); const char *tool_name = "Brush"; size_t tool_offset; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index d6d13decf4d..a1ce39a4833 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -280,12 +280,13 @@ static void do_shared_vertex_tesscol(Mesh *me, bool *mfacetag) MEM_freeN(scolmain); } -static void do_shared_vertexcol(Mesh *me, bool *mlooptag, bool *mfacetag, int do_tessface) +static void do_shared_vertexcol(Mesh *me, bool *mlooptag, bool *mfacetag, const bool do_tessface) { const int use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL); MPoly *mp; int (*scol)[4]; - int i, j, has_shared = 0; + int i, j; + bool has_shared = false; /* if no mloopcol: do not do */ /* if mtexpoly: only the involved faces, otherwise all */ @@ -1464,7 +1465,7 @@ static void multipaint_selection(MDeformVert *dvert, const int defbase_tot, floa static float redistribute_change(MDeformVert *ndv, const int defbase_tot, char *change_status, const char change_me, int changeto, float totchange, float total_valid, - char do_auto_normalize) + bool do_auto_normalize) { bool changed; float change; @@ -1523,7 +1524,7 @@ static float get_mp_change(MDeformVert *odv, const int defbase_tot, const bool * static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, const int defbase_tot, const bool *defbase_sel, const bool *lock_flags, const bool *vgroup_validmap, - char do_auto_normalize, char do_multipaint) + bool do_auto_normalize, bool do_multipaint) { float totchange = 0.0f; float totchange_allowed = 0.0f; @@ -1697,9 +1698,9 @@ typedef struct WeightPaintInfo { const bool *vgroup_validmap; /* same as WeightPaintData.vgroup_validmap, * only added here for convenience */ - char do_flip; - char do_multipaint; - char do_auto_normalize; + bool do_flip; + bool do_multipaint; + bool do_auto_normalize; float brush_alpha_value; /* result of BKE_brush_alpha_get() */ } WeightPaintInfo; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 331701cb486..c8645b1f3de 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -995,7 +995,7 @@ typedef struct { } SculptSearchSphereData; /* Test AABB against sphere */ -static int sculpt_search_sphere_cb(PBVHNode *node, void *data_v) +static bool sculpt_search_sphere_cb(PBVHNode *node, void *data_v) { SculptSearchSphereData *data = data_v; float *center = data->ss->cache->location, nearest[3]; @@ -3552,7 +3552,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, MultiresModifierData *mmd = sculpt_multires_active(scene, ob); ss->modifiers_active = sculpt_modifiers_active(scene, sd, ob); - ss->show_diffuse_color = sd->flags & SCULPT_SHOW_DIFFUSE; + ss->show_diffuse_color = (sd->flags & SCULPT_SHOW_DIFFUSE) != 0; if (need_mask) { if (mmd == NULL) { diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 6d5025f1a22..20f78690188 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -500,7 +500,7 @@ static void uv_sculpt_stroke_exit(bContext *C, wmOperator *op) op->customdata = NULL; } -static int uv_element_offset_from_face_get(UvElementMap *map, BMFace *efa, BMLoop *l, int island_index, int doIslands) +static int uv_element_offset_from_face_get(UvElementMap *map, BMFace *efa, BMLoop *l, int island_index, const bool doIslands) { UvElement *element = BM_uv_element_get(map, efa, l); if (!element || (doIslands && element->island != island_index)) { @@ -555,7 +555,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm GHash *edgeHash; GHashIterator *ghi; - int do_island_optimization = !(ts->uv_sculpt_settings & UV_SCULPT_ALL_ISLANDS); + bool do_island_optimization = !(ts->uv_sculpt_settings & UV_SCULPT_ALL_ISLANDS); int island_index = 0; /* Holds, for each UvElement in elementMap, a pointer to its unique uv.*/ int *uniqueUv; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 45f00462147..1ff8bac67d2 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -307,7 +307,7 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op)) MovieTrackingTrack *track = tracksbase->first, *next; MovieTrackingPlaneTrack *plane_track, *plane_track_next; int framenr = ED_space_clip_get_clip_frame_number(sc); - int has_selection = 0; + bool has_selection = false; bool changed = false; while (track) { @@ -1335,8 +1335,8 @@ static int track_markers_exec(bContext *C, wmOperator *op) struct MovieTrackingContext *context; MovieClipUser *user, fake_user = {0}; int framenr, sfra, efra; - int backwards = RNA_boolean_get(op->ptr, "backwards"); - int sequence = RNA_boolean_get(op->ptr, "sequence"); + const bool backwards = RNA_boolean_get(op->ptr, "backwards"); + const bool sequence = RNA_boolean_get(op->ptr, "sequence"); int frames_limit; if (RNA_struct_property_is_set(op->ptr, "clip")) { @@ -1846,7 +1846,7 @@ static int clear_track_path_exec(bContext *C, wmOperator *op) MovieTrackingTrack *track; ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking); int action = RNA_enum_get(op->ptr, "action"); - int clear_active = RNA_boolean_get(op->ptr, "clear_active"); + const bool clear_active = RNA_boolean_get(op->ptr, "clear_active"); int framenr = ED_space_clip_get_clip_frame_number(sc); if (clear_active) { @@ -2186,7 +2186,7 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb MovieTrackingTrack *track, char axis) { Object *camera = get_camera_with_movieclip(scene, clip); - int is_camera = tracking_object->flag & TRACKING_OBJECT_CAMERA; + const bool is_camera = (tracking_object->flag & TRACKING_OBJECT_CAMERA) != 0; bool flip = false; float mat[4][4], vec[3], obmat[4][4], dvec[3]; diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 3b1af1acdf8..36144a074e3 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -668,8 +668,8 @@ static int console_clear_exec(bContext *C, wmOperator *op) SpaceConsole *sc = CTX_wm_space_console(C); ARegion *ar = CTX_wm_region(C); - short scrollback = RNA_boolean_get(op->ptr, "scrollback"); - short history = RNA_boolean_get(op->ptr, "history"); + const bool scrollback = RNA_boolean_get(op->ptr, "scrollback"); + const bool history = RNA_boolean_get(op->ptr, "history"); /*ConsoleLine *ci = */ console_history_verify(C); @@ -715,7 +715,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevents crashes when no command line */ - short reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */ + const bool reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */ int prev_len = ci->len; /* keep a copy of the line above so when history is cycled @@ -783,7 +783,7 @@ static int console_history_append_exec(bContext *C, wmOperator *op) ConsoleLine *ci = console_history_verify(C); char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, don't free */ int cursor = RNA_int_get(op->ptr, "current_character"); - short rem_dupes = RNA_boolean_get(op->ptr, "remove_duplicates"); + const bool rem_dupes = RNA_boolean_get(op->ptr, "remove_duplicates"); int prev_len = ci->len; if (rem_dupes) { diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 841cb0d5f77..7147353b3f1 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -53,7 +53,7 @@ void file_calc_previews(const bContext *C, ARegion *ar); void file_draw_list(const bContext *C, ARegion *ar); void file_draw_check_cb(bContext *C, void *arg1, void *arg2); -int file_draw_check_exists(SpaceFile *sfile); +bool file_draw_check_exists(SpaceFile *sfile); /* file_ops.h */ struct wmOperatorType; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 523383a8955..94f6174de65 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -765,7 +765,7 @@ void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) } } -int file_draw_check_exists(SpaceFile *sfile) +bool file_draw_check_exists(SpaceFile *sfile) { if (sfile->op) { /* fails on reload */ if (RNA_struct_find_property(sfile->op->ptr, "check_existing")) { diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 79b6a13b459..249ab3ef2c1 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -990,7 +990,7 @@ void filelist_select(struct FileList *filelist, FileSelection *sel, FileSelType } } -int filelist_is_selected(struct FileList *filelist, int index, FileCheckType check) +bool filelist_is_selected(struct FileList *filelist, int index, FileCheckType check) { struct direntry *file = filelist_file(filelist, index); if (!file) { @@ -1003,7 +1003,7 @@ int filelist_is_selected(struct FileList *filelist, int index, FileCheckType che return S_ISREG(file->type) && (file->selflag & SELECTED_FILE); case CHECK_ALL: default: - return (file->selflag & SELECTED_FILE); + return (file->selflag & SELECTED_FILE) != 0; } } @@ -1028,7 +1028,7 @@ void filelist_sort(struct FileList *filelist, short sort) } -int filelist_islibrary(struct FileList *filelist, char *dir, char *group) +bool filelist_islibrary(struct FileList *filelist, char *dir, char *group) { return BLO_is_a_library(filelist->dir, dir, group); } diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index eb99b0d21ab..c37bb882168 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -72,7 +72,7 @@ void filelist_setdir(struct FileList *filelist, const char *dir); struct direntry * filelist_file(struct FileList *filelist, int index); void filelist_select(struct FileList *filelist, FileSelection *sel, FileSelType select, unsigned int flag, FileCheckType check); void filelist_select_file(struct FileList *filelist, int index, FileSelType select, unsigned int flag, FileCheckType check); -int filelist_is_selected(struct FileList *filelist, int index, FileCheckType check); +bool filelist_is_selected(struct FileList *filelist, int index, FileCheckType check); void filelist_hidedot(struct FileList *filelist, short hide); void filelist_setfilter(struct FileList *filelist, unsigned int filter); void filelist_setfilter_types(struct FileList *filelist, const char *filter_glob); @@ -87,7 +87,7 @@ int filelist_empty(struct FileList *filelist); void filelist_parent(struct FileList *filelist); struct BlendHandle *filelist_lib(struct FileList *filelist); -int filelist_islibrary(struct FileList *filelist, char *dir, char *group); +bool filelist_islibrary(struct FileList *filelist, char *dir, char *group); void filelist_from_main(struct FileList *filelist); void filelist_from_library(struct FileList *filelist); void filelist_freelib(struct FileList *filelist); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 120e6f52d95..e075ea09a59 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -657,7 +657,7 @@ static int image_view_all_exec(bContext *C, wmOperator *op) ARegion *ar; float aspx, aspy, zoomx, zoomy, w, h; int width, height; - int fit_view = RNA_boolean_get(op->ptr, "fit_view"); + const bool fit_view = RNA_boolean_get(op->ptr, "fit_view"); /* retrieve state */ sima = CTX_wm_space_image(C); @@ -2118,7 +2118,7 @@ void IMAGE_OT_invert(wmOperatorType *ot) static bool image_pack_test(bContext *C, wmOperator *op) { Image *ima = CTX_data_edit_image(C); - int as_png = RNA_boolean_get(op->ptr, "as_png"); + const bool as_png = RNA_boolean_get(op->ptr, "as_png"); if (!ima) return 0; @@ -2138,7 +2138,7 @@ static int image_pack_exec(bContext *C, wmOperator *op) struct Main *bmain = CTX_data_main(C); Image *ima = CTX_data_edit_image(C); ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL); - int as_png = RNA_boolean_get(op->ptr, "as_png"); + const bool as_png = RNA_boolean_get(op->ptr, "as_png"); if (!image_pack_test(C, op)) return OPERATOR_CANCELLED; @@ -2166,7 +2166,7 @@ static int image_pack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( ImBuf *ibuf; uiPopupMenu *pup; uiLayout *layout; - int as_png = RNA_boolean_get(op->ptr, "as_png"); + const bool as_png = RNA_boolean_get(op->ptr, "as_png"); if (!image_pack_test(C, op)) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index c9a86547984..9f83bc80314 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -641,7 +641,7 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View short indent = 0, offset = 0, sel = 0, group = 0; int special = -1; char name[128]; - short do_draw = FALSE; + bool do_draw = false; /* determine what needs to be drawn */ switch (ale->type) { diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 7347b446bce..37efd52f246 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1587,7 +1587,7 @@ static int nlaedit_sync_actlen_exec(bContext *C, wmOperator *op) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - short active_only = RNA_boolean_get(op->ptr, "active"); + const bool active_only = RNA_boolean_get(op->ptr, "active"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -2004,7 +2004,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op) FModifier *fcm; int type = RNA_enum_get(op->ptr, "type"); - short onlyActive = RNA_boolean_get(op->ptr, "only_active"); + const bool active_only = RNA_boolean_get(op->ptr, "only_active"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -2021,7 +2021,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op) for (strip = nlt->strips.first; strip; strip = strip->next) { /* can F-Modifier be added to the current strip? */ - if (onlyActive) { + if (active_only) { /* if not active, cannot add since we're only adding to active strip */ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0) continue; diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 2ad2418fc77..dedd6404a2c 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -141,7 +141,7 @@ void NLA_OT_selected_objects_add(wmOperatorType *ot); int nlaop_poll_tweakmode_off(bContext *C); int nlaop_poll_tweakmode_on(bContext *C); -short nlaedit_is_tweakmode_on(bAnimContext *ac); +bool nlaedit_is_tweakmode_on(bAnimContext *ac); /* --- */ diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index aa3224507bc..149690e10f7 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -101,10 +101,10 @@ int nlaop_poll_tweakmode_on(bContext *C) } /* is tweakmode enabled - for use in NLA operator code */ -short nlaedit_is_tweakmode_on(bAnimContext *ac) +bool nlaedit_is_tweakmode_on(bAnimContext *ac) { if (ac && ac->scene) - return (ac->scene->flag & SCE_NLA_EDIT_ON); + return (ac->scene->flag & SCE_NLA_EDIT_ON) != 0; return 0; } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 5f133aea2bb..b3d29c7bbdd 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3202,7 +3202,7 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa #define LINK_ARROW 12 /* position of arrow on the link, LINK_RESOL/2 */ #define ARROW_SIZE 7 void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, - int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3) + int th_col1, bool do_shaded, int th_col2, bool do_triple, int th_col3) { float coord_array[LINK_RESOL + 1][2]; @@ -3388,8 +3388,9 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, /* note; this is used for fake links in groups too */ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) { - int do_shaded = FALSE, th_col1 = TH_HEADER, th_col2 = TH_HEADER; - int do_triple = FALSE, th_col3 = TH_WIRE; + bool do_shaded = false; + bool do_triple = false; + int th_col1 = TH_HEADER, th_col2 = TH_HEADER, th_col3 = TH_WIRE; if (link->fromsock == NULL && link->tosock == NULL) return; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 360b394d406..7a12ed9ef08 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -364,17 +364,17 @@ void ED_node_set_tree_type(SpaceNode *snode, bNodeTreeType *typeinfo) snode->tree_idname[0] = '\0'; } -int ED_node_is_compositor(struct SpaceNode *snode) +bool ED_node_is_compositor(struct SpaceNode *snode) { return STREQ(snode->tree_idname, ntreeType_Composite->idname); } -int ED_node_is_shader(struct SpaceNode *snode) +bool ED_node_is_shader(struct SpaceNode *snode) { return STREQ(snode->tree_idname, ntreeType_Shader->idname); } -int ED_node_is_texture(struct SpaceNode *snode) +bool ED_node_is_texture(struct SpaceNode *snode) { return STREQ(snode->tree_idname, ntreeType_Texture->idname); } @@ -1130,7 +1130,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) bNodeTree *ntree = snode->edittree; bNode *node, *newnode, *lastnode; bNodeLink *link, *newlink, *lastlink; - int keep_inputs = RNA_boolean_get(op->ptr, "keep_inputs"); + const bool keep_inputs = RNA_boolean_get(op->ptr, "keep_inputs"); ED_preview_kill_jobs(C); diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 1ecedf32499..20e6900a268 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -145,7 +145,7 @@ static int node_group_edit_exec(bContext *C, wmOperator *op) SpaceNode *snode = CTX_wm_space_node(C); const char *node_idname = group_node_idname(C); bNode *gnode; - int exit = RNA_boolean_get(op->ptr, "exit"); + const bool exit = RNA_boolean_get(op->ptr, "exit"); ED_preview_kill_jobs(C); diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index f598a13bea9..fa20aeb8624 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -104,9 +104,9 @@ void node_keymap(struct wmKeyConfig *keyconf); /* node_select.c */ void node_deselect_all(struct SpaceNode *snode); void node_socket_select(struct bNode *node, struct bNodeSocket *sock); -void node_socket_deselect(struct bNode *node, struct bNodeSocket *sock, int deselect_node); -void node_deselect_all_input_sockets(struct SpaceNode *snode, int deselect_nodes); -void node_deselect_all_output_sockets(struct SpaceNode *snode, int deselect_nodes); +void node_socket_deselect(struct bNode *node, struct bNodeSocket *sock, const bool deselect_node); +void node_deselect_all_input_sockets(struct SpaceNode *snode, const bool deselect_nodes); +void node_deselect_all_output_sockets(struct SpaceNode *snode, const bool deselect_nodes); int node_select_same_type(struct SpaceNode *snode); int node_select_same_type_np(struct SpaceNode *snode, int dir); void node_select_single(struct bContext *C, struct bNode *node); @@ -136,7 +136,7 @@ void NODE_OT_backimage_sample(struct wmOperatorType *ot); /* drawnode.c */ void node_draw_link(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link); -void node_draw_link_bezier(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3); +void node_draw_link_bezier(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link, int th_col1, bool do_shaded, int th_col2, bool do_triple, int th_col3); int node_link_bezier_points(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link, float coord_array[][2], int resol); // void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 ); void draw_nodespace_back_pix(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, bNodeInstanceKey parent_key); diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index b50066560fb..4f9af022639 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -78,7 +78,7 @@ static int sort_nodes_locx(void *a, void *b) return 0; } -static int socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, int allow_used) +static int socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, const bool allow_used) { if (nodeSocketIsHidden(sock)) return 0; @@ -89,7 +89,7 @@ static int socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, int return 1; } -static bNodeSocket *best_socket_output(bNodeTree *ntree, bNode *node, bNodeSocket *sock_target, int allow_multiple) +static bNodeSocket *best_socket_output(bNodeTree *ntree, bNode *node, bNodeSocket *sock_target, const bool allow_multiple) { bNodeSocket *sock; @@ -184,7 +184,7 @@ static int snode_autoconnect_input(SpaceNode *snode, bNode *node_fr, bNodeSocket return 1; } -static void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace) +static void snode_autoconnect(SpaceNode *snode, const bool allow_multiple, const bool replace) { bNodeTree *ntree = snode->edittree; ListBase *nodelist = MEM_callocN(sizeof(ListBase), "items_list"); @@ -545,7 +545,7 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* return 1 when socket clicked */ -static bNodeLinkDrag *node_link_init(SpaceNode *snode, float cursor[2], int detach) +static bNodeLinkDrag *node_link_init(SpaceNode *snode, float cursor[2], const bool detach) { bNode *node; bNodeSocket *sock; @@ -641,7 +641,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, const wmEvent *event) bNodeLinkDrag *nldrag; float cursor[2]; - int detach = RNA_boolean_get(op->ptr, "detach"); + const bool detach = RNA_boolean_get(op->ptr, "detach"); UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]); @@ -700,7 +700,7 @@ void NODE_OT_link(wmOperatorType *ot) static int node_make_link_exec(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); - int replace = RNA_boolean_get(op->ptr, "replace"); + const bool replace = RNA_boolean_get(op->ptr, "replace"); ED_preview_kill_jobs(C); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index de0665e13b1..89f07950fe9 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -101,12 +101,12 @@ void node_socket_select(bNode *node, bNodeSocket *sock) node->flag |= SELECT; } -void node_socket_deselect(bNode *node, bNodeSocket *sock, int deselect_node) +void node_socket_deselect(bNode *node, bNodeSocket *sock, const bool deselect_node) { sock->flag &= ~SELECT; if (node && deselect_node) { - int sel = 0; + bool sel = 0; /* if no selected sockets remain, also deselect the node */ for (sock = node->inputs.first; sock; sock = sock->next) { @@ -144,7 +144,7 @@ void node_deselect_all(SpaceNode *snode) nodeSetSelected(node, FALSE); } -void node_deselect_all_input_sockets(SpaceNode *snode, int deselect_nodes) +void node_deselect_all_input_sockets(SpaceNode *snode, const bool deselect_nodes) { bNode *node; bNodeSocket *sock; @@ -175,7 +175,7 @@ void node_deselect_all_input_sockets(SpaceNode *snode, int deselect_nodes) } } -void node_deselect_all_output_sockets(SpaceNode *snode, int deselect_nodes) +void node_deselect_all_output_sockets(SpaceNode *snode, const bool deselect_nodes) { bNode *node; bNodeSocket *sock; @@ -186,7 +186,7 @@ void node_deselect_all_output_sockets(SpaceNode *snode, int deselect_nodes) */ for (node = snode->edittree->nodes.first; node; node = node->next) { - int sel = 0; + bool sel = false; for (sock = node->outputs.first; sock; sock = sock->next) sock->flag &= ~SELECT; @@ -473,7 +473,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op) static int node_border_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - int tweak = RNA_boolean_get(op->ptr, "tweak"); + const bool tweak = RNA_boolean_get(op->ptr, "tweak"); if (tweak) { /* prevent initiating the border select if the mouse is over a node */ @@ -835,8 +835,8 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op) bNode **node_array; bNode *active = nodeGetActive(snode->edittree); int totnodes; - int revert = RNA_boolean_get(op->ptr, "prev"); - int same_type = 1; + const bool revert = RNA_boolean_get(op->ptr, "prev"); + const bool same_type = 1; ntreeGetDependencyList(snode->edittree, &node_array, &totnodes); diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 61e6b09e7be..f80937bf63f 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -149,7 +149,7 @@ TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float fmval[2] /* Toggle Open/Closed ------------------------------------------- */ -static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, const float mval[2]) +static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, const bool all, const float mval[2]) { if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) { @@ -183,7 +183,7 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, const wmEvent *e SpaceOops *soops = CTX_wm_space_outliner(C); TreeElement *te; float fmval[2]; - int all = RNA_boolean_get(op->ptr, "all"); + const bool all = RNA_boolean_get(op->ptr, "all"); UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1); @@ -852,7 +852,7 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op) { SpaceOops *soops = CTX_wm_space_outliner(C); ARegion *ar = CTX_wm_region(C); - int add = RNA_boolean_get(op->ptr, "open"); + const bool add = RNA_boolean_get(op->ptr, "open"); int level; level = outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 93dfc347b1f..fcd8acd391d 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -179,7 +179,8 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, i static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) { - int relative = RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"); + PropertyRNA *prop; + const bool relative = (prop = RNA_struct_find_property(op->ptr, "relative_path")) && RNA_property_boolean_get(op->ptr, prop); int is_file = -1; memset(seq_load, 0, sizeof(SeqLoadInfo)); @@ -189,12 +190,12 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) seq_load->channel = RNA_int_get(op->ptr, "channel"); seq_load->len = 1; // images only, if endframe isn't set! - if (RNA_struct_find_property(op->ptr, "filepath")) { - RNA_string_get(op->ptr, "filepath", seq_load->path); /* full path, file is set by the caller */ + if ((prop = RNA_struct_find_property(op->ptr, "filepath"))) { + RNA_property_string_get(op->ptr, prop, seq_load->path); /* full path, file is set by the caller */ is_file = 1; } - else if (RNA_struct_find_property(op->ptr, "directory")) { - RNA_string_get(op->ptr, "directory", seq_load->path); /* full path, file is set by the caller */ + else if ((prop = RNA_struct_find_property(op->ptr, "directory"))) { + RNA_property_string_get(op->ptr, prop, seq_load->path); /* full path, file is set by the caller */ is_file = 0; } @@ -202,17 +203,17 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) BLI_path_rel(seq_load->path, G.main->name); - if (RNA_struct_find_property(op->ptr, "frame_end")) { - seq_load->end_frame = RNA_int_get(op->ptr, "frame_end"); + if ((prop = RNA_struct_find_property(op->ptr, "frame_end"))) { + seq_load->end_frame = RNA_property_int_get(op->ptr, prop); } - if (RNA_struct_find_property(op->ptr, "replace_sel") && RNA_boolean_get(op->ptr, "replace_sel")) + if ((prop = RNA_struct_find_property(op->ptr, "replace_sel")) && RNA_property_boolean_get(op->ptr, prop)) seq_load->flag |= SEQ_LOAD_REPLACE_SEL; - if (RNA_struct_find_property(op->ptr, "cache") && RNA_boolean_get(op->ptr, "cache")) + if ((prop = RNA_struct_find_property(op->ptr, "cache")) && RNA_property_boolean_get(op->ptr, prop)) seq_load->flag |= SEQ_LOAD_SOUND_CACHE; - if (RNA_struct_find_property(op->ptr, "sound") && RNA_boolean_get(op->ptr, "sound")) + if ((prop = RNA_struct_find_property(op->ptr, "sound")) && RNA_property_boolean_get(op->ptr, prop)) seq_load->flag |= SEQ_LOAD_MOVIE_SOUND; /* always use this for ops */ @@ -222,17 +223,17 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) if (is_file == 1) { BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name)); } - else if (RNA_struct_find_property(op->ptr, "files")) { + else if ((prop = RNA_struct_find_property(op->ptr, "files"))) { /* used for image strip */ /* best guess, first images name */ - RNA_BEGIN (op->ptr, itemptr, "files") + RNA_PROP_BEGIN (op->ptr, itemptr, prop) { char *name = RNA_string_get_alloc(&itemptr, "name", NULL, 0); BLI_strncpy(seq_load->name, name, sizeof(seq_load->name)); MEM_freeN(name); break; } - RNA_END; + RNA_PROP_END; } } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 3253d344ff6..c360987bd1f 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -475,7 +475,7 @@ int ED_space_sequencer_maskedit_mask_poll(bContext *C) return ED_space_sequencer_maskedit_poll(C); } -int ED_space_sequencer_check_show_maskedit(SpaceSeq *sseq, Scene *scene) +bool ED_space_sequencer_check_show_maskedit(SpaceSeq *sseq, Scene *scene) { if (sseq && sseq->mainb == SEQ_DRAW_IMG_IMBUF) { return (BKE_sequencer_mask_get(scene) != NULL); @@ -497,7 +497,7 @@ int ED_space_sequencer_maskedit_poll(bContext *C) } /* are we displaying the seq output (not channels or histogram)*/ -int ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq) +bool ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq) { return (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW) && ELEM(sseq->mainb, SEQ_DRAW_SEQUENCE, SEQ_DRAW_IMG_IMBUF)); @@ -1394,7 +1394,7 @@ static int sequencer_reload_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, FALSE); Sequence *seq; - int adjust_length = RNA_boolean_get(op->ptr, "adjust_length"); + const bool adjust_length = RNA_boolean_get(op->ptr, "adjust_length"); for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { @@ -2414,7 +2414,7 @@ void SEQUENCER_OT_view_selected(wmOperatorType *ot) static int find_next_prev_edit(Scene *scene, int cfra, const short side, - const short do_skip_mute, const short do_center) + const bool do_skip_mute, const bool do_center) { Editing *ed = BKE_sequencer_editing_get(scene, FALSE); Sequence *seq, *best_seq = NULL, *frame_seq = NULL; @@ -2488,7 +2488,7 @@ static int find_next_prev_edit(Scene *scene, int cfra, static bool strip_jump_internal(Scene *scene, const short side, - const short do_skip_mute, const short do_center) + const bool do_skip_mute, const bool do_center) { bool changed = false; int cfra = CFRA; @@ -2515,8 +2515,8 @@ static int sequencer_strip_jump_poll(bContext *C) static int sequencer_strip_jump_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - short next = RNA_boolean_get(op->ptr, "next"); - short center = RNA_boolean_get(op->ptr, "center"); + const bool next = RNA_boolean_get(op->ptr, "next"); + const bool center = RNA_boolean_get(op->ptr, "center"); /* currently do_skip_mute is always TRUE */ if (!strip_jump_internal(scene, next ? SEQ_SIDE_RIGHT : SEQ_SIDE_LEFT, TRUE, center)) { diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index d1cc2091265..c8178259dc2 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -927,7 +927,7 @@ static EnumPropertyItem sequencer_prop_select_grouped_types[] = { #define SEQ_IS_SOUND(_seq) ((_seq->type & SEQ_TYPE_SOUND_RAM) && !(_seq->type & SEQ_TYPE_EFFECT)) -#define SEQ_IS_EFFECT(_seq) (_seq->type & SEQ_TYPE_EFFECT) +#define SEQ_IS_EFFECT(_seq) ((_seq->type & SEQ_TYPE_EFFECT) != 0) #define SEQ_USE_DATA(_seq) (ELEM3(_seq->type, SEQ_TYPE_SCENE, SEQ_TYPE_MOVIECLIP, SEQ_TYPE_MASK) || SEQ_HAS_PATH(_seq)) @@ -970,7 +970,7 @@ static bool select_grouped_type_effect(Editing *ed, Sequence *actseq) { Sequence *seq; bool changed = false; - short is_effect = SEQ_IS_EFFECT(actseq); + const bool is_effect = SEQ_IS_EFFECT(actseq); SEQP_BEGIN (ed, seq) { @@ -1093,7 +1093,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq) { Sequence *seq = NULL; bool changed = false; - short is_audio = ((actseq->type == SEQ_TYPE_META) || SEQ_IS_SOUND(actseq)); + const bool is_audio = ((actseq->type == SEQ_TYPE_META) || SEQ_IS_SOUND(actseq)); int startdisp = actseq->startdisp; int enddisp = actseq->enddisp; int machine = actseq->machine; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index b17fff3aca9..43776f28c62 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -231,7 +231,7 @@ static int text_open_exec(bContext *C, wmOperator *op) PropertyPointerRNA *pprop; PointerRNA idptr; char str[FILE_MAX]; - short internal = RNA_boolean_get(op->ptr, "internal"); + const bool internal = RNA_boolean_get(op->ptr, "internal"); RNA_string_get(op->ptr, "filepath", str); @@ -3190,7 +3190,7 @@ void TEXT_OT_resolve_conflict(wmOperatorType *ot) static int text_to_3d_object_exec(bContext *C, wmOperator *op) { Text *text = CTX_data_edit_text(C); - int split_lines = RNA_boolean_get(op->ptr, "split_lines"); + const bool split_lines = RNA_boolean_get(op->ptr, "split_lines"); ED_text_to_object(C, text, split_lines); diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 52897aa023e..681d5ca22fb 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -82,8 +82,8 @@ typedef struct drawMeshFaceSelect_userData { typedef struct drawEMTFMapped_userData { BMEditMesh *em; - short has_mcol; - short has_mtface; + bool has_mcol; + bool has_mtface; MFace *mf; MTFace *tf; } drawEMTFMapped_userData; @@ -393,7 +393,7 @@ static void draw_textured_end(void) glPopMatrix(); } -static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr) +static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, const bool has_mcol, int matnr) { Material *ma = give_current_material(Gtexdraw.ob, matnr + 1); bool invalidtexture = false; @@ -434,7 +434,7 @@ static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int } } -static DMDrawOption draw_mcol__set_draw_legacy(MTFace *UNUSED(tface), int has_mcol, int UNUSED(matnr)) +static DMDrawOption draw_mcol__set_draw_legacy(MTFace *UNUSED(tface), const bool has_mcol, int UNUSED(matnr)) { if (has_mcol) return DM_DRAW_OPTION_NORMAL; @@ -442,7 +442,7 @@ static DMDrawOption draw_mcol__set_draw_legacy(MTFace *UNUSED(tface), int has_mc return DM_DRAW_OPTION_NO_MCOL; } -static DMDrawOption draw_tface__set_draw(MTFace *tface, int UNUSED(has_mcol), int matnr) +static DMDrawOption draw_tface__set_draw(MTFace *tface, const bool UNUSED(has_mcol), int matnr) { Material *ma = give_current_material(Gtexdraw.ob, matnr + 1); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1214a1bfe02..b62193e09a4 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3373,7 +3373,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D Object *ob = BKE_object_lod_meshob_get(base->object, scene); Mesh *me = ob->data; Material *ma = give_current_material(ob, 1); - const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO) && !BKE_scene_use_new_shading_nodes(scene)); + const bool hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO) && !BKE_scene_use_new_shading_nodes(scene)); eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; int /* totvert,*/ totedge, totface; DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 595e6dd98f2..faf83cdd772 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -748,10 +748,10 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) RegionView3D *rv3d = ar->regiondata; rctf viewplane; float clipsta, clipend, x1, y1, x2, y2; - int orth; + bool is_ortho; - orth = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); - rv3d->is_persp = !orth; + is_ortho = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); + rv3d->is_persp = !is_ortho; #if 0 printf("%s: %d %d %f %f %f %f %f %f\n", __func__, winx, winy, @@ -774,12 +774,12 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) rect->ymax /= (float)ar->winy; rect->ymax = y1 + rect->ymax * (y2 - y1); - if (orth) wmOrtho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend); + if (is_ortho) wmOrtho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend); else wmFrustum(rect->xmin, rect->xmax, rect->ymin, rect->ymax, clipsta, clipend); } else { - if (orth) wmOrtho(x1, x2, y1, y2, clipsta, clipend); + if (is_ortho) wmOrtho(x1, x2, y1, y2, clipsta, clipend); else wmFrustum(x1, x2, y1, y2, clipsta, clipend); } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2103073d5e9..e22dc84d432 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5110,7 +5110,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, } } else if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED)) { - short do_loc = FALSE, do_rot = FALSE, do_scale = FALSE; + bool do_loc = false, do_rot = false, do_scale = false; /* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */ if (tmode == TFM_TRANSLATION) { diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 26e32904976..f20fda27d37 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -250,9 +250,9 @@ static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot) static int create_orientation_exec(bContext *C, wmOperator *op) { char name[MAX_NAME]; - int use = RNA_boolean_get(op->ptr, "use"); - int overwrite = RNA_boolean_get(op->ptr, "overwrite"); - int use_view = RNA_boolean_get(op->ptr, "use_view"); + const bool use = RNA_boolean_get(op->ptr, "use"); + const bool overwrite = RNA_boolean_get(op->ptr, "overwrite"); + const bool use_view = RNA_boolean_get(op->ptr, "use_view"); RNA_string_get(op->ptr, "name", name); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 0d1778ea69f..8e980bdd4d2 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3460,7 +3460,7 @@ static int uv_pin_exec(bContext *C, wmOperator *op) BMIter iter, liter; MTexPoly *tface; MLoopUV *luv; - int clear = RNA_boolean_get(op->ptr, "clear"); + const bool clear = RNA_boolean_get(op->ptr, "clear"); const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); const int cd_poly_tex_offset = CustomData_get_offset(&em->bm->pdata, CD_MTEXPOLY); @@ -3589,7 +3589,7 @@ static int uv_hide_exec(bContext *C, wmOperator *op) BMIter iter, liter; MLoopUV *luv; MTexPoly *tf; - int swap = RNA_boolean_get(op->ptr, "unselected"); + const bool swap = RNA_boolean_get(op->ptr, "unselected"); Image *ima = sima ? sima->image : NULL; const int use_face_center = (ts->uv_selectmode == UV_SELECT_FACE); @@ -3950,8 +3950,8 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op) BMEditMesh *em; BMEdge *editedge; float limit[2] = {STD_UV_CONNECT_LIMIT, STD_UV_CONNECT_LIMIT}; - char mark_seams = RNA_boolean_get(op->ptr, "mark_seams"); - char mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp"); + const bool mark_seams = RNA_boolean_get(op->ptr, "mark_seams"); + const bool mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp"); BMesh *bm; BMIter iter; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index c931c843a23..f60972abdcb 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -114,7 +114,7 @@ typedef struct IslandStitchData { /* flag an island to be considered for determining static island */ char stitchableCandidate; /* if edge rotation is used, flag so that vertex rotation is not used */ - char use_edge_rotation; + bool use_edge_rotation; } IslandStitchData; /* just for averaging UVs */ @@ -142,17 +142,17 @@ typedef struct UvEdge { typedef struct StitchState { float aspect; /* use limit flag */ - char use_limit; + bool use_limit; /* limit to operator, same as original operator */ float limit_dist; /* snap uv islands together during stitching */ - char snap_islands; + bool snap_islands; /* stich at midpoints or at islands */ - char midpoints; + bool midpoints; /* editmesh, cached for use in modal handler */ BMEditMesh *em; /* clear seams of stitched edges after stitch */ - char clear_seams; + bool clear_seams; /* element map for getting info about uv connectivity */ UvElementMap *element_map; /* edge container */ @@ -271,10 +271,10 @@ static void stitch_update_header(StitchState *state, bContext *C) if (sa) { BLI_snprintf(msg, HEADER_LENGTH, str, state->mode == STITCH_VERT ? "Vertex" : "Edge", - state->snap_islands ? "On" : "Off", - state->midpoints ? "On" : "Off", + WM_bool_as_string(state->snap_islands), + WM_bool_as_string(state->midpoints), state->limit_dist, - state->use_limit ? "On" : "Off"); + WM_bool_as_string(state->use_limit)); ED_area_headerprint(sa, msg); } diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 8a05b33d105..c0a5e505f38 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -86,10 +86,10 @@ #include "uvedit_intern.h" #include "uvedit_parametrizer.h" -static void modifier_unwrap_state(Object *obedit, Scene *scene, short *use_subsurf) +static void modifier_unwrap_state(Object *obedit, Scene *scene, bool *r_use_subsurf) { ModifierData *md; - short subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF; + bool subsurf = (scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF) != 0; md = obedit->modifiers.first; @@ -101,7 +101,7 @@ static void modifier_unwrap_state(Object *obedit, Scene *scene, short *use_subsu subsurf = FALSE; } - *use_subsurf = subsurf; + *r_use_subsurf = subsurf; } static bool ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit) @@ -256,8 +256,8 @@ static void construct_param_handle_face_add(ParamHandle *handle, Scene *scene, } static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMEditMesh *em, - short implicit, short fill, short sel, - short correct_aspect) + const bool implicit, const bool fill, const bool sel, + const bool correct_aspect) { BMesh *bm = em->bm; ParamHandle *handle; @@ -516,7 +516,7 @@ static bool minimize_stretch_init(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); MinStretch *ms; - int fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); + const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); bool implicit = true; if (!uvedit_have_selection(scene, em, implicit)) { @@ -802,9 +802,9 @@ static ParamHandle *liveHandle = NULL; void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit) { BMEditMesh *em = BKE_editmesh_from_object(obedit); - short abf = scene->toolsettings->unwrapper == 0; - short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES; - short use_subsurf; + const bool abf = (scene->toolsettings->unwrapper == 0); + const bool fillholes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0; + bool use_subsurf; modifier_unwrap_state(obedit, scene, &use_subsurf); @@ -1068,9 +1068,9 @@ static void uv_map_clip_correct(Scene *scene, Object *ob, BMEditMesh *em, wmOper BMIter iter, liter; MLoopUV *luv; float dx, dy, min[2], max[2]; - int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); - int clip_to_bounds = RNA_boolean_get(op->ptr, "clip_to_bounds"); - int scale_to_bounds = RNA_boolean_get(op->ptr, "scale_to_bounds"); + const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); + const bool clip_to_bounds = RNA_boolean_get(op->ptr, "clip_to_bounds"); + const bool scale_to_bounds = RNA_boolean_get(op->ptr, "scale_to_bounds"); const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); @@ -1135,9 +1135,9 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel) BMEditMesh *em = BKE_editmesh_from_object(obedit); ParamHandle *handle; - const short fill_holes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES; - const short correct_aspect = !(scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT); - short use_subsurf; + const bool fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0; + const bool correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) != 0; + bool use_subsurf; modifier_unwrap_state(obedit, scene, &use_subsurf); @@ -1164,10 +1164,10 @@ static int unwrap_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); int method = RNA_enum_get(op->ptr, "method"); - int fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); - int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); - int use_subsurf = RNA_boolean_get(op->ptr, "use_subsurf_data"); - short use_subsurf_final; + const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); + const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); + const bool use_subsurf = RNA_boolean_get(op->ptr, "use_subsurf_data"); + bool use_subsurf_final; float obsize[3]; bool implicit = false; -- cgit v1.2.3