diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-11 05:25:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-11 05:33:29 +0400 |
commit | a15b3c4d111613993eca23d5f99600c2052469e7 (patch) | |
tree | 18d4bcd4291013ecf12a24def023d6f7a73ebd65 /source/blender/editors | |
parent | 52af5fa31fbc0a1855a28d957d4387e5d6a15170 (diff) |
Code cleanup: use bool
Diffstat (limited to 'source/blender/editors')
54 files changed, 117 insertions, 106 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 341e27a12bf..5d97b7be9f7 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -387,7 +387,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled */ -void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on) +void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short mode) { bAnimListElem *ale, *match = NULL; int prevLevel = 0, matchLevel = 0; @@ -437,8 +437,8 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn * - only flush up if the current state is now disabled (negative 'off' state is default) * (otherwise, it's too much work to force the parents to be active too) */ - if ( ((setting == ACHANNEL_SETTING_VISIBLE) && on) || - ((setting != ACHANNEL_SETTING_VISIBLE) && on == 0) ) + if ( ((setting == ACHANNEL_SETTING_VISIBLE) && (mode != ACHANNEL_SETFLAG_CLEAR)) || + ((setting != ACHANNEL_SETTING_VISIBLE) && (mode == ACHANNEL_SETFLAG_CLEAR))) { /* go backwards in the list, until the highest-ranking element (by indention has been covered) */ for (ale = match->prev; ale; ale = ale->prev) { @@ -461,7 +461,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn */ if (level < prevLevel) { /* flush the new status... */ - ANIM_channel_setting_set(ac, ale, setting, on); + ANIM_channel_setting_set(ac, ale, setting, mode); /* store this level as the 'old' level now */ prevLevel = level; @@ -502,7 +502,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn * flush the new status... */ if (level > matchLevel) - ANIM_channel_setting_set(ac, ale, setting, on); + ANIM_channel_setting_set(ac, ale, setting, mode); /* however, if the level is 'less than or equal to' the channel that was changed, * (i.e. the current channel is as important if not more important than the changed channel) * then we should stop, since we've found the last one of the children we should flush diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index b1789d25b88..af06351d23c 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -223,7 +223,7 @@ static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt) * - restore = whether to map points back to non-mapped time * - only_keys = whether to only adjust the location of the center point of beztriples */ -void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, short restore, short only_keys) +void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, bool only_keys) { KeyframeEditData ked = {{NULL}}; KeyframeEditFunc map_cb; diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 48611633592..7ce33e01747 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -705,9 +705,9 @@ void free_fmodifiers_copybuf(void) * assuming that the buffer has been cleared already with free_fmodifiers_copybuf() * - active: only copy the active modifier */ -short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active) +bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active) { - short ok = 1; + bool ok = true; /* sanity checks */ if (ELEM(NULL, modifiers, modifiers->first)) @@ -734,10 +734,10 @@ short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active) /* 'Paste' the F-Modifier(s) from the buffer to the specified list * - replace: free all the existing modifiers to leave only the pasted ones */ -short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace) +bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace) { FModifier *fcm; - short ok = 0; + bool ok = false; /* sanity checks */ if (modifiers == NULL) diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index e5929d0ad8e..4a160353670 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -428,6 +428,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) */ #define KEYFRAME_OK_CHECKS(check) \ { \ + CHECK_TYPE(ok, short); \ if (check(1)) \ ok |= KEYFRAME_OK_KEY; \ \ diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index b354facb9b3..e004b37a307 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -124,7 +124,7 @@ void ED_armature_exit_posemode(bContext *C, Base *base) /* if a selected or active bone is protected, throw error (oonly if warn == 1) and return 1 */ /* only_selected == 1: the active bone is allowed to be protected */ #if 0 /* UNUSED 2.5 */ -static short pose_has_protected_selected(Object *ob, short warn) +static bool pose_has_protected_selected(Object *ob, short warn) { /* check protection */ if (ob->proxy) { diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index f77a3da06fb..fb510473b11 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -878,7 +878,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) pchan = BKE_pose_channel_find_name(pose, agrp->name); if (pchan) { - short ok = 0; + bool ok = 0; /* check if this bone should get any animation applied */ if (pld->selcount == 0) { diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 9c0909b67f2..50152b02993 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2971,7 +2971,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, BezTriple *bezt; BPoint *bp; int a; - short lastsel = false; + bool lastsel = false; if (next == 0) return; @@ -3141,7 +3141,7 @@ void CURVE_OT_de_select_last(wmOperatorType *ot) /******************* de select all operator ***************/ -static short nurb_has_selected_cps(ListBase *editnurb) +static bool nurb_has_selected_cps(ListBase *editnurb) { Nurb *nu; BezTriple *bezt; @@ -4358,7 +4358,7 @@ static int merge_nurb(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); ListBase *editnurb = object_editcurve_get(obedit); NurbSort *nus1, *nus2; - int ok = 1; + bool ok = true; make_selection_list_nurb(editnurb); @@ -4427,7 +4427,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) ListBase *nubase = object_editcurve_get(obedit); Nurb *nu, *nu1 = NULL, *nu2 = NULL; BPoint *bp; - int ok = 0; + bool ok = false; /* int a; */ /* UNUSED */ /* first decide if this is a surface merge! */ @@ -4913,7 +4913,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) BezTriple *bezt, *newbezt = NULL; BPoint *bp, *newbp = NULL; float imat[4][4], temp[3]; - int ok = 0; + bool ok = false; BezTriple *bezt_recalc[3] = {NULL}; invert_m4_m4(imat, obedit->obmat); diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 5c067e80619..de067d68573 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -716,7 +716,7 @@ static EnumPropertyItem style_items[] = { {0, NULL, 0, NULL, NULL} }; -static int set_style(bContext *C, const int style, const int clear) +static int set_style(bContext *C, const int style, const bool clear) { Object *obedit = CTX_data_edit_object(C); Curve *cu = obedit->data; @@ -742,7 +742,7 @@ static int set_style(bContext *C, const int style, const int clear) static int set_style_exec(bContext *C, wmOperator *op) { const int style = RNA_enum_get(op->ptr, "style"); - const int clear = RNA_boolean_get(op->ptr, "clear"); + const bool clear = RNA_boolean_get(op->ptr, "clear"); return set_style(C, style, clear); } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index dc3fe66cbea..88d5937d220 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -454,7 +454,7 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled */ -void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on); +void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short mode); /* Deselect all animation channels */ @@ -511,12 +511,12 @@ void free_fmodifiers_copybuf(void); * assuming that the buffer has been cleared already with free_fmodifiers_copybuf() * - active: only copy the active modifier */ -short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active); +bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active); /* 'Paste' the F-Modifier(s) from the buffer to the specified list * - replace: free all the existing modifiers to leave only the pasted ones */ -short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace); +bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace); /* ************************************************* */ /* ASSORTED TOOLS */ @@ -537,7 +537,7 @@ void getcolor_fcurve_rainbow(int cur, int tot, float out[3]); struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale); /* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */ -void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys); +void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, bool restore, bool only_keys); /* ..... */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 8a4233a97b0..7e6e00bbdff 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1264,7 +1264,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) */ int ui_is_but_push_ex(uiBut *but, double *value) { - int is_push = false; + int is_push = 0; if (but->bit) { const bool state = ELEM3(but->type, TOGN, ICONTOGN, OPTIONN) ? false : true; @@ -1862,7 +1862,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) != 0; + const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; int unit_type = uiButGetUnitType(but); int precision; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 85c82efc347..8cebc6ad822 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1483,7 +1483,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) { rctf rect; - int ok = 0, width, height; + bool ok = false; + int width, height; GLint scissor[4]; MovieClipScopes *scopes = (MovieClipScopes *)but->poin; diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 00629ab9537..b7e026ca8e3 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -1854,7 +1854,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op) { Mask *mask = CTX_data_edit_mask(C); MaskLayer *masklay; - const int unselected = RNA_boolean_get(op->ptr, "unselected"); + const bool unselected = RNA_boolean_get(op->ptr, "unselected"); bool changed = false; for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 56eb8cf626b..a05102310e6 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -699,7 +699,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE MaskSpline *spline; MaskSplinePoint *point = NULL; float co[2]; - int do_select = !RNA_boolean_get(op->ptr, "deselect"); + bool do_select = !RNA_boolean_get(op->ptr, "deselect"); const float threshold = 19; bool changed = false; diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 467b08c266c..61bfbfb4ac9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -168,7 +168,7 @@ void EDBM_select_mirrored(BMEditMesh *em, bool extend, void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag) { - int ok; + bool ok; BMEditMesh *em = BKE_editmesh_from_object(obedit); ok = BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, @@ -2092,7 +2092,7 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE BMVert *eve; BMEdge *e, *eed; BMFace *efa; - int sel = !RNA_boolean_get(op->ptr, "deselect"); + const bool sel = !RNA_boolean_get(op->ptr, "deselect"); int limit; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 68f80087e31..e57f6375a2a 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1285,7 +1285,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) Mesh *me = obedit->data; BMEditMesh *em = BKE_editmesh_from_object(obedit); ModifierData *md; - int mirrx = false, mirry = false, mirrz = false; + bool mirrx = false, mirry = false, mirrz = false; int i, repeat; float clip_dist = 0.0f; bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; @@ -1370,7 +1370,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) BMEditMesh *em = BKE_editmesh_from_object(obedit); Mesh *me = obedit->data; bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; - int usex = true, usey = true, usez = true, preserve_volume = true; + bool usex = true, usey = true, usez = true, preserve_volume = true; int i, repeat; float lambda_factor; float lambda_border; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index c1d1c10124e..d252ae20270 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -596,7 +596,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) DerivedMesh *dm = NULL; Key *key = me->key; KeyBlock *kb; - int ok = 0, nonequal_verts = 0; + bool ok = false, nonequal_verts = false; CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { @@ -606,7 +606,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) selme = (Mesh *)base->object->data; if (selme->totvert == me->totvert) - ok++; + ok = true; else nonequal_verts = 1; } diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index a833c530711..dc3ac2ee0ae 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -502,7 +502,7 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); MetaBall *mb = (MetaBall *)obedit->data; MetaElem *ml; - const int invert = RNA_boolean_get(op->ptr, "unselected") ? SELECT : 0; + const bool invert = RNA_boolean_get(op->ptr, "unselected") ? SELECT : 0; ml = mb->editelems->first; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index e3041d97019..da989ba4f21 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1259,8 +1259,8 @@ static void copy_object_set_idnew(bContext *C, int dupflag) /********************* Make Duplicates Real ************************/ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, - const short use_base_parent, - const short use_hierarchy) + const bool use_base_parent, + const bool use_hierarchy) { Main *bmain = CTX_data_main(C); ListBase *lb; @@ -1410,8 +1410,8 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - const short use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent"); - const short use_hierarchy = RNA_boolean_get(op->ptr, "use_hierarchy"); + const bool use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent"); + const bool use_hierarchy = RNA_boolean_get(op->ptr, "use_hierarchy"); BKE_main_id_clear_newpoins(bmain); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 7ae54a1a803..5b0bfef6330 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -178,7 +178,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); bool changed = false; - const int unselected = RNA_boolean_get(op->ptr, "unselected"); + const bool unselected = RNA_boolean_get(op->ptr, "unselected"); CTX_DATA_BEGIN(C, Base *, base, visible_bases) { @@ -273,7 +273,7 @@ void OBJECT_OT_hide_render_clear(wmOperatorType *ot) static int object_hide_render_set_exec(bContext *C, wmOperator *op) { - const int unselected = RNA_boolean_get(op->ptr, "unselected"); + const bool unselected = RNA_boolean_get(op->ptr, "unselected"); CTX_DATA_BEGIN(C, Base *, base, visible_bases) { @@ -432,7 +432,7 @@ void ED_object_editmode_enter(bContext *C, int flag) Object *ob; ScrArea *sa = CTX_wm_area(C); View3D *v3d = NULL; - int ok = 0; + bool ok = false; if (scene->id.lib) return; diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index 72d7ffaf2ea..bfaf7f13e61 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -249,7 +249,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) int single_group_index = RNA_enum_get(op->ptr, "group"); Group *single_group = group_object_active_find_index(ob, single_group_index); Group *group; - int ok = 0; + bool ok = false; if (ob == NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index e67381a1d43..670e2f2d4ac 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -542,7 +542,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); Object *obsel = NULL; - const int use_bone = RNA_boolean_get(op->ptr, "use_bone"); + const bool use_bone = RNA_boolean_get(op->ptr, "use_bone"); const int mode = use_bone ? OBJECT_ADDHOOK_SELOB_BONE : OBJECT_ADDHOOK_SELOB; CTX_DATA_BEGIN (C, Object *, ob, selected_objects) diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index b0d3d363c45..3493f6bf778 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -375,7 +375,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob) } } -static int apply_objects_internal(bContext *C, ReportList *reports, int apply_loc, int apply_rot, int apply_scale) +static int apply_objects_internal(bContext *C, ReportList *reports, bool apply_loc, bool apply_rot, bool apply_scale) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -647,9 +647,9 @@ void OBJECT_OT_visual_transform_apply(wmOperatorType *ot) static int object_transform_apply_exec(bContext *C, wmOperator *op) { - const int loc = RNA_boolean_get(op->ptr, "location"); - const int rot = RNA_boolean_get(op->ptr, "rotation"); - const int sca = RNA_boolean_get(op->ptr, "scale"); + const bool loc = RNA_boolean_get(op->ptr, "location"); + const bool rot = RNA_boolean_get(op->ptr, "rotation"); + const bool sca = RNA_boolean_get(op->ptr, "scale"); if (loc || rot || sca) { return apply_objects_internal(C, op->reports, loc, rot, sca); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 242ba1f1d67..e095485f68b 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -512,8 +512,8 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op) ImBuf *ibuf, *ibuf_save = NULL; void *lock; char name[FILE_MAX]; - int ok = 0; - const short view_context = (oglrender->v3d != NULL); + bool ok = false; + const bool view_context = (oglrender->v3d != NULL); Object *camera = NULL; bool is_movie; diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index fdb9b5c04ed..6eb4c5901cd 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -524,7 +524,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre /* new UI convention: draw is in pixel space already. */ /* uses ROUNDBOX button in block to get the rect */ -static int ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, rcti *newrect) +static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, rcti *newrect) { Render *re; RenderResult rres; @@ -532,7 +532,7 @@ static int ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, r int offx = 0; int newx = BLI_rcti_size_x(rect); int newy = BLI_rcti_size_y(rect); - int ok = 0; + bool ok = false; if (!split || first) sprintf(name, "Preview %p", (void *)sa); else sprintf(name, "SecondPreview %p", (void *)sa); diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 81eb11d7138..f82a98a2394 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -366,7 +366,7 @@ static void texture_changed(Main *bmain, Tex *tex) Scene *scene; Object *ob; bNode *node; - int texture_draw = false; + bool texture_draw = false; /* icons */ BKE_icon_changed(BKE_icon_getid(&tex->id)); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 4cf59a575b9..2f4caeeef1b 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -808,7 +808,7 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings) wmWindow *win; ScrArea *sa; ImagePaintSettings *imapaint = &settings->imapaint; - int enabled = false; + bool enabled = false; for (win = wm->windows.first; win; win = win->next) for (sa = win->screen->areabase.first; sa; sa = sa->next) diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 4c86862fae8..e06ee4c21f9 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -405,7 +405,7 @@ void PAINT_OT_vert_select_ungrouped(wmOperatorType *ot) static int face_select_hide_exec(bContext *C, wmOperator *op) { - const int unselected = RNA_boolean_get(op->ptr, "unselected"); + const bool unselected = RNA_boolean_get(op->ptr, "unselected"); Object *ob = CTX_data_active_object(C); paintface_hide(ob, unselected); ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 4608a25cc00..eea7851415c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4218,9 +4218,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, /* Returns true if any of the smoothing modes are active (currently * one of smooth brush, autosmooth, mask smooth, or shift-key * smooth) */ -static int sculpt_any_smooth_mode(const Brush *brush, - StrokeCache *cache, - int stroke_mode) +static bool sculpt_any_smooth_mode(const Brush *brush, + StrokeCache *cache, + int stroke_mode) { return ((stroke_mode == BRUSH_STROKE_SMOOTH) || (cache && cache->alt_smooth) || @@ -4393,8 +4393,8 @@ static int sculpt_brush_stroke_init(bContext *C, wmOperator *op) SculptSession *ss = CTX_data_active_object(C)->sculpt; Brush *brush = BKE_paint_brush(&sd->paint); int mode = RNA_enum_get(op->ptr, "mode"); - int is_smooth = 0; - int need_mask = false; + bool is_smooth; + bool need_mask = false; if (brush->sculpt_tool == SCULPT_TOOL_MASK) { need_mask = true; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 673e4d90d99..724d093a48f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -402,8 +402,8 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb) DerivedMesh *dm; SculptSession *ss = ob->sculpt; SculptUndoNode *unode; - int update = false, rebuild = false; - int need_mask = false; + bool update = false, rebuild = false; + bool need_mask = false; for (unode = lb->first; unode; unode = unode->next) { if (strcmp(unode->idname, ob->id.name) == 0) { diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 1c2933b823d..f66e5a74b41 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -3501,9 +3501,10 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot) /********************** clean tracks operator *********************/ -static int is_track_clean(MovieTrackingTrack *track, int frames, int del) +static bool is_track_clean(MovieTrackingTrack *track, int frames, int del) { - int ok = 1, a, prev = -1, count = 0; + bool ok = true; + int a, prev = -1, count = 0; MovieTrackingMarker *markers = track->markers, *new_markers = NULL; int start_disabled = 0; int markersnr = track->markersnr; diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 213d9d79132..290f4c2e5f2 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -554,7 +554,7 @@ static int console_delete_exec(bContext *C, wmOperator *op) int stride; const short type = RNA_enum_get(op->ptr, "type"); - int done = false; + bool done = false; if (ci->len == 0) { return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 9c11fc712c8..8becb287cf1 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -127,7 +127,7 @@ static void clamp_to_filelist(int numfiles, FileSelection *sel) } } -static FileSelection file_selection_get(bContext *C, const rcti *rect, short fill) +static FileSelection file_selection_get(bContext *C, const rcti *rect, bool fill) { ARegion *ar = CTX_wm_region(C); SpaceFile *sfile = CTX_wm_space_file(C); @@ -155,7 +155,7 @@ static FileSelection file_selection_get(bContext *C, const rcti *rect, short fil return sel; } -static FileSelect file_select_do(bContext *C, int selected_idx, short do_diropen) +static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen) { FileSelect retval = FILE_SELECT_NOTHING; SpaceFile *sfile = CTX_wm_space_file(C); @@ -205,7 +205,7 @@ static FileSelect file_select_do(bContext *C, int selected_idx, short do_diropen } -static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, short fill, short do_diropen) +static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, bool fill, bool do_diropen) { SpaceFile *sfile = CTX_wm_space_file(C); FileSelect retval = FILE_SELECT_NOTHING; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index c2053c15f95..702f6af4071 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2320,7 +2320,7 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op) { bAnimContext ac; bAnimListElem *ale; - short ok = 0; + bool ok = false; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index c7876bb44c4..203b983838f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -839,7 +839,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man const bool is_render_out = (id && GS(id->name) == ID_SCE); uiLayout *col, *row, *split, *sub; - int show_preview = false; + bool show_preview = false; col = uiLayoutColumn(layout, false); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c9dda074667..562fb2cf827 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -157,7 +157,7 @@ static int space_image_file_exists_poll(bContext *C) SpaceImage *sima = CTX_wm_space_image(C); ImBuf *ibuf; void *lock; - int ret = false; + bool ret = false; char name[FILE_MAX]; ibuf = ED_space_image_acquire_buffer(sima, &lock); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 8ed34451b8e..acf5d6a2f55 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -922,7 +922,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c return block; } -static int is_sensor_linked(uiBlock *block, bSensor *sens) +static bool is_sensor_linked(uiBlock *block, bSensor *sens) { bController *cont; int i; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 80b1918ff8e..da619ed79bd 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -110,7 +110,7 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - int ok = 0; + bool ok = false; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -131,7 +131,7 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op) AnimData *adt = ale->data; /* try entering tweakmode if valid */ - ok += BKE_nla_tweakmode_enter(adt); + ok |= BKE_nla_tweakmode_enter(adt); } /* free temp data */ @@ -527,7 +527,7 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op) bAnimListElem *ale; int filter; - int done = false; + bool done = false; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -595,7 +595,7 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op) BKE_nlastrip_validate_name(adt, strip); /* make note of this */ - done++; + done = true; } } @@ -2087,7 +2087,8 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op) bAnimContext ac; ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - int filter, ok = 0; + int filter; + bool ok = false; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -2111,7 +2112,7 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op) continue; // TODO: when 'active' vs 'all' boolean is added, change last param! - ok += ANIM_fmodifiers_copy_to_buf(&strip->modifiers, 0); + ok |= ANIM_fmodifiers_copy_to_buf(&strip->modifiers, 0); } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 7c5ffa54f92..9e89a192543 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2323,9 +2323,9 @@ static int node_shader_script_update_poll(bContext *C) } /* recursively check for script nodes in groups using this text and update */ -static int node_shader_script_update_text_recursive(RenderEngine *engine, RenderEngineType *type, bNodeTree *ntree, Text *text) +static bool node_shader_script_update_text_recursive(RenderEngine *engine, RenderEngineType *type, bNodeTree *ntree, Text *text) { - int found = false; + bool found = false; bNode *node; ntree->done = true; @@ -2356,7 +2356,7 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op) bNode *node = NULL; RenderEngine *engine; RenderEngineType *type; - int found = false; + bool found = false; /* setup render engine */ type = RE_engines_find(scene->r.engine); diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 05348acfae7..14a68bd1674 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -684,7 +684,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, ListBase anim_basepaths = {NULL, NULL}; float min[2], max[2], center[2]; int totselect; - int expose_all = false; + bool expose_all = false; bNode *input_node, *output_node; /* XXX rough guess, not nice but we don't have access to UI constants here ... */ @@ -831,7 +831,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, if (node_group_make_use_node(node, gnode)) { for (sock = node->inputs.first; sock; sock = sock->next) { bNodeSocket *iosock, *input_sock; - int skip = false; + bool skip = false; for (link = ngroup->links.first; link; link = link->next) { if (link->tosock == sock) { skip = true; @@ -852,7 +852,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, for (sock = node->outputs.first; sock; sock = sock->next) { bNodeSocket *iosock, *output_sock; - int skip = false; + bool skip = false; for (link = ngroup->links.first; link; link = link->next) if (link->fromsock == sock) skip = true; diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 7d9bf4b67f2..e1d66b9f916 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -206,7 +206,7 @@ static void snode_autoconnect(SpaceNode *snode, const bool allow_multiple, const for (nli = nodelist->first; nli; nli = nli->next) { bNode *node_fr, *node_to; bNodeSocket *sock_fr, *sock_to; - int has_selected_inputs = 0; + bool has_selected_inputs = false; if (nli->next == NULL) break; @@ -770,7 +770,7 @@ static int cut_links_exec(bContext *C, wmOperator *op) RNA_END; if (i > 1) { - int found = false; + bool found = false; bNodeLink *link, *next; ED_preview_kill_jobs(C); diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index 90b9c2071de..8946b38653f 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -425,7 +425,7 @@ bool ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], floa Image *ima; ImBuf *ibuf; float fx, fy, bufx, bufy; - int ret = false; + bool ret = false; if (STREQ(snode->tree_idname, ntreeType_Composite->idname) || (snode->flag & SNODE_BACKDRAW) == 0) { /* use viewer image for color sampling only if we're in compositor tree diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index c266563cd6f..18692880ddf 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -893,7 +893,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) /* add color */ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - short is_type_set = RNA_struct_property_is_set(op->ptr, "type"); + bool is_type_set = RNA_struct_property_is_set(op->ptr, "type"); int type = -1; int prop_flag = SEQPROP_ENDFRAME; diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 9f7f40899b2..fe900b6bcae 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -918,7 +918,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq GLuint last_texid; void *display_buffer; void *cache_handle = NULL; - const int is_imbuf = ED_space_sequencer_check_show_imbuf(sseq); + const bool is_imbuf = ED_space_sequencer_check_show_imbuf(sseq); int format, type; bool glsl_used = false; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c5f01f88706..8c664a1f423 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -3168,7 +3168,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq = BKE_sequencer_active_get(scene); - const int is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); + const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); if (seq->type == SEQ_TYPE_IMAGE) { char directory[FILE_MAX]; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 9edf8433fca..496be65cf0e 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -952,7 +952,7 @@ static bool select_grouped_type_basic(Editing *ed, Sequence *actseq) { Sequence *seq; bool changed = false; - short is_sound = SEQ_IS_SOUND(actseq); + const bool is_sound = SEQ_IS_SOUND(actseq); SEQP_BEGIN (ed, seq) { diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index b45838e0bac..4d2eea87904 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2845,7 +2845,7 @@ static int text_insert_exec(bContext *C, wmOperator *op) SpaceText *st = CTX_wm_space_text(C); Text *text = CTX_data_edit_text(C); char *str; - int done = false; + bool done = false; size_t i = 0; unsigned int code; diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 8eb9c9be40b..c7f8abd7fb4 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -222,7 +222,7 @@ static void ruler_item_active_set(RulerInfo *ruler_info, RulerItem *ruler_item) static void ruler_item_as_string(RulerItem *ruler_item, UnitSettings *unit, char *numstr, size_t numstr_size, int prec) { - const int do_split = unit->flag & USER_UNIT_OPT_SPLIT; + const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; if (ruler_item->flag & RULERITEM_USE_ANGLE) { const float ruler_angle = angle_v3v3v3(ruler_item->co[0], diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 9467eae930f..90a88567996 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1388,7 +1388,7 @@ static bool mouse_select(bContext *C, const int mval[2], Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL; bool is_obedit; float dist = ED_view3d_select_dist_px() * 1.3333f; - int retval = false; + bool retval = false; short hits; const float mval_fl[2] = {(float)mval[0], (float)mval[1]}; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 3486e930466..26ebd1ddf63 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -413,7 +413,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3]) MovieClip *clip = BKE_object_movieclip_get(scene, ob, false); MovieTracking *tracking; MovieTrackingObject *object; - int ok = 0; + bool ok = false; float min[3], max[3], mat[4][4], pos[3], cammat[4][4] = MAT4_UNITY; if (!clip) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5a8a84112d5..8b0667a8992 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2584,7 +2584,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) bConstraintTypeInfo *cti = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); bConstraintOb cob; bConstraint *con; - int do_limit = false; + bool do_limit = false; /* Evaluate valid constraints */ for (con = td->con; con; con = con->next) { @@ -4107,7 +4107,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN] dist = len_v3(vec); if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) { - int i, do_split = t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1 : 0; + const bool do_split = (t->scene->unit.flag & USER_UNIT_OPT_SPLIT) != 0; + int i; for (i = 0; i < 3; i++) { bUnit_AsString(&tvec[NUM_STR_REP_LEN * i], NUM_STR_REP_LEN, dvec[i] * t->scene->unit.scale_length, @@ -4121,13 +4122,18 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN] } } - if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) + if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) { + const bool do_split = (t->scene->unit.flag & USER_UNIT_OPT_SPLIT) != 0; bUnit_AsString(distvec, sizeof(distvec), dist * t->scene->unit.scale_length, 4, t->scene->unit.system, - B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, false); - else if (dist > 1e10f || dist < -1e10f) /* prevent string buffer overflow */ + B_UNIT_LENGTH, do_split, false); + } + else if (dist > 1e10f || dist < -1e10f) { + /* prevent string buffer overflow */ BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4e", dist); - else + } + else { BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4f", dist); + } if (t->flag & T_AUTOIK) { short chainlen = t->settings->autoik_chainlen; @@ -4571,7 +4577,8 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { TransData *td; float ratio; - int i, initial_feather = false; + int i; + bool initial_feather = false; char str[MAX_INFO_LEN]; ratio = t->values[0]; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 455fa45d01b..6f0208175b1 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -6596,7 +6596,7 @@ static void MaskHandleToTransData(MaskSplinePoint *point, eMaskWhichHandle which /*const*/ float parent_inverse_matrix[3][3]) { BezTriple *bezt = &point->bezt; - short is_sel_any = MASKPOINT_ISSEL_ANY(point); + const bool is_sel_any = MASKPOINT_ISSEL_ANY(point); tdm->point = point; copy_m3_m3(tdm->vec, bezt->vec); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 2fa0b6b320f..08a291860f0 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -505,7 +505,7 @@ int calc_manipulator_stats(const bContext *C) else if (ob && (ob->mode & OB_MODE_POSE)) { bPoseChannel *pchan; int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed - int ok = false; + bool ok = false; if ((ob->lay & v3d->lay) == 0) return 0; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 1338a34749a..87b064acac7 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -858,7 +858,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], bArmature *arm = ob->data; bPoseChannel *pchan; float imat[3][3], mat[3][3]; - int ok = false; + bool ok = false; if (activeOnly && (pchan = BKE_pose_channel_active(ob))) { add_v3_v3(normal, pchan->pose_mat[2]); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index f5dcac7e062..0706ac3278b 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1684,7 +1684,7 @@ typedef struct UVvert { static int uv_remove_doubles_exec(bContext *C, wmOperator *op) { const float threshold = RNA_float_get(op->ptr, "threshold"); - const int use_unselected = RNA_boolean_get(op->ptr, "use_unselected"); + const bool use_unselected = RNA_boolean_get(op->ptr, "use_unselected"); SpaceImage *sima; Scene *scene; |