From d900f5be55d0812eb5c7dfd3ea47020c3edafd41 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Feb 2014 18:55:59 +1100 Subject: Code cleanup: use bools where possible --- source/blender/blenkernel/BKE_DerivedMesh.h | 4 +-- source/blender/blenkernel/BKE_action.h | 2 +- source/blender/blenkernel/BKE_curve.h | 2 +- source/blender/blenkernel/BKE_depsgraph.h | 4 +-- source/blender/blenkernel/BKE_fcurve.h | 8 ++--- source/blender/blenkernel/BKE_global.h | 2 +- source/blender/blenkernel/BKE_image.h | 8 ++--- source/blender/blenkernel/BKE_key.h | 2 +- source/blender/blenkernel/BKE_lattice.h | 2 +- source/blender/blenkernel/BKE_mask.h | 14 ++++---- source/blender/blenkernel/BKE_movieclip.h | 10 +++--- source/blender/blenkernel/BKE_nla.h | 4 +-- source/blender/blenkernel/BKE_node.h | 2 +- source/blender/blenkernel/BKE_object.h | 2 +- source/blender/blenkernel/BKE_paint.h | 2 +- source/blender/blenkernel/BKE_pbvh.h | 10 +++--- source/blender/blenkernel/BKE_scene.h | 8 ++--- source/blender/blenkernel/BKE_sequencer.h | 2 +- source/blender/blenkernel/BKE_text.h | 16 +++++----- source/blender/blenkernel/BKE_texture.h | 2 +- source/blender/blenkernel/BKE_tracking.h | 2 +- source/blender/blenkernel/BKE_unit.h | 2 +- source/blender/blenkernel/BKE_writeffmpeg.h | 2 +- source/blender/blenkernel/intern/DerivedMesh.c | 15 +++++---- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/colortools.c | 2 +- source/blender/blenkernel/intern/curve.c | 4 +-- source/blender/blenkernel/intern/deform.c | 2 +- source/blender/blenkernel/intern/depsgraph.c | 10 +++--- source/blender/blenkernel/intern/dynamicpaint.c | 2 +- source/blender/blenkernel/intern/fcurve.c | 12 +++---- source/blender/blenkernel/intern/font.c | 2 +- source/blender/blenkernel/intern/image.c | 12 +++---- source/blender/blenkernel/intern/key.c | 2 +- source/blender/blenkernel/intern/lattice.c | 6 ++-- source/blender/blenkernel/intern/mask.c | 8 ++--- source/blender/blenkernel/intern/mask_evaluate.c | 6 ++-- source/blender/blenkernel/intern/mask_rasterize.c | 12 +++---- source/blender/blenkernel/intern/movieclip.c | 18 +++++------ source/blender/blenkernel/intern/multires.c | 6 ++-- source/blender/blenkernel/intern/nla.c | 4 +-- source/blender/blenkernel/intern/node.c | 2 +- source/blender/blenkernel/intern/object.c | 8 ++--- source/blender/blenkernel/intern/object_dupli.c | 2 +- source/blender/blenkernel/intern/pbvh.c | 37 +++++++++++----------- source/blender/blenkernel/intern/pbvh_intern.h | 10 +++--- source/blender/blenkernel/intern/scene.c | 10 +++--- source/blender/blenkernel/intern/sequencer.c | 22 ++++++------- source/blender/blenkernel/intern/shrinkwrap.c | 11 +++---- source/blender/blenkernel/intern/text.c | 16 +++++----- source/blender/blenkernel/intern/texture.c | 2 +- .../blenkernel/intern/tracking_region_tracker.c | 3 +- source/blender/blenkernel/intern/unit.c | 2 +- source/blender/blenkernel/intern/writeffmpeg.c | 2 +- 54 files changed, 183 insertions(+), 181 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 6ffa126713d..353b1c5d597 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -147,7 +147,7 @@ typedef int (*DMSetMaterial)(int mat_nr, void *attribs); typedef int (*DMCompareDrawOptions)(void *userData, int cur_index, int next_index); typedef void (*DMSetDrawInterpOptions)(void *userData, int index, float t); typedef DMDrawOption (*DMSetDrawOptions)(void *userData, int index); -typedef DMDrawOption (*DMSetDrawOptionsTex)(struct MTFace *tface, int has_vcol, int matnr); +typedef DMDrawOption (*DMSetDrawOptionsTex)(struct MTFace *tface, const bool has_vcol, int matnr); typedef enum DMDrawFlag { DM_DRAW_USE_COLORS = 1, @@ -673,7 +673,7 @@ DerivedMesh *editbmesh_get_derived_cage_and_final(struct Scene *scene, struct Ob struct BMEditMesh *em, DerivedMesh **final_r, CustomDataMask dataMask); float (*editbmesh_get_vertex_cos(struct BMEditMesh *em, int *numVerts_r))[3]; -int editbmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm); +bool editbmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm); void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct BMEditMesh *em, CustomDataMask dataMask, int build_shapekey_layers); diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 9068be970b5..517c0f7d58b 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -103,7 +103,7 @@ short action_get_item_transforms(struct bAction *act, struct Object *ob, struct void calc_action_range(const struct bAction *act, float *start, float *end, short incl_modifiers); /* Does action have any motion data at all? */ -short action_has_motion(const struct bAction *act); +bool action_has_motion(const struct bAction *act); /* Action Groups API ----------------- */ diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index afa053012da..850c387cd45 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -82,7 +82,7 @@ void BKE_curve_texspace_get(struct Curve *cu, float r_loc[3], float r_rot[3], fl bool BKE_curve_minmax(struct Curve *cu, bool use_radius, float min[3], float max[3]); bool BKE_curve_center_median(struct Curve *cu, float cent[3]); bool BKE_curve_center_bounds(struct Curve *cu, float cent[3]); -void BKE_curve_translate(struct Curve *cu, float offset[3], int do_keys); +void BKE_curve_translate(struct Curve *cu, float offset[3], const bool do_keys); void BKE_curve_material_index_remove(struct Curve *cu, int index); void BKE_curve_material_index_clear(struct Curve *cu); diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index df7e9561c46..8a0f9f3fa67 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -106,8 +106,8 @@ void DAG_scene_free(struct Scene *sce); * not cause any updates but is used by external render engines to detect if for * example a datablock was removed. */ -void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay, const short do_time); -void DAG_on_visible_update(struct Main *bmain, const short do_time); +void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay, const bool do_time); +void DAG_on_visible_update(struct Main *bmain, const bool do_time); void DAG_id_tag_update(struct ID *id, short flag); void DAG_id_tag_update_ex(struct Main *bmain, struct ID *id, short flag); diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 06598a26b30..13eca506d9e 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -228,16 +228,16 @@ int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, /* get the time extents for F-Curve */ bool calc_fcurve_range(struct FCurve *fcu, float *min, float *max, - const short do_sel_only, const short do_min_length); + const bool do_sel_only, const bool do_min_length); /* get the bounding-box extents for F-Curve */ -short calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, - const short do_sel_only, const short include_handles); +bool calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, + const bool do_sel_only, const bool include_handles); /* .............. */ /* Are keyframes on F-Curve of any use (to final result, and to show in editors)? */ -short fcurve_are_keyframes_usable(struct FCurve *fcu); +bool fcurve_are_keyframes_usable(struct FCurve *fcu); /* Can keyframes be added to F-Curve? */ bool fcurve_is_keyframable(struct FCurve *fcu); diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 3742b45c6c0..61f70d7f7e7 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -73,7 +73,7 @@ typedef struct Global { short winpos, displaymode; /* used to be in Render */ /* to indicate render is busy, prevent renderwindow events etc */ - short is_rendering; + bool is_rendering; /* debug value, can be set from the UI and python, used for testing nonstandard features */ short debug_value; diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index a44a9e0c7a9..e36d4bab566 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -140,7 +140,7 @@ enum { #define IMA_CHAN_FLAG_ALPHA 4 /* checks whether there's an image buffer for given image and user */ -int BKE_image_has_ibuf(struct Image *ima, struct ImageUser *iuser); +bool BKE_image_has_ibuf(struct Image *ima, struct ImageUser *iuser); /* same as above, but can be used to retrieve images being rendered in * a thread safe way, always call both acquire and release */ @@ -181,7 +181,7 @@ void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf); /* called on frame change or before render */ void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); -int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr, short *r_is_in_range); +int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr, bool *r_is_in_range); void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path); void BKE_image_update_frame(const struct Main *bmain, int cfra); @@ -216,10 +216,10 @@ struct Image *BKE_image_copy(struct Main *bmain, struct Image *ima); void BKE_image_merge(struct Image *dest, struct Image *source); /* scale the image */ -int BKE_image_scale(struct Image *image, int width, int height); +bool BKE_image_scale(struct Image *image, int width, int height); /* check if texture has alpha (depth=32) */ -int BKE_image_has_alpha(struct Image *image); +bool BKE_image_has_alpha(struct Image *image); void BKE_image_get_size(struct Image *image, struct ImageUser *iuser, int *width, int *height); void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float size[2]); diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index 19264feaf48..6183df8666d 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -69,7 +69,7 @@ struct KeyBlock *BKE_keyblock_from_object(struct Object *ob); struct KeyBlock *BKE_keyblock_from_object_reference(struct Object *ob); struct KeyBlock *BKE_keyblock_add(struct Key *key, const char *name); -struct KeyBlock *BKE_keyblock_add_ctime(struct Key *key, const char *name, const short do_force); +struct KeyBlock *BKE_keyblock_add_ctime(struct Key *key, const char *name, const bool do_force); struct KeyBlock *BKE_keyblock_from_key(struct Key *key, int index); struct KeyBlock *BKE_keyblock_find_name(struct Key *key, const char name[]); void BKE_keyblock_copy_settings(struct KeyBlock *kb_dst, const struct KeyBlock *kb_src); diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index b57fa360441..ba45df73590 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -85,7 +85,7 @@ struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt); void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3]); void BKE_lattice_center_median(struct Lattice *lt, float cent[3]); void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]); -void BKE_lattice_translate(struct Lattice *lt, float offset[3], int do_keys); +void BKE_lattice_translate(struct Lattice *lt, float offset[3], bool do_keys); int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w); void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w); diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index de262f98d39..691afaf8f16 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -87,7 +87,7 @@ float BKE_mask_spline_project_co(struct MaskSpline *spline, struct MaskSplinePoi float start_u, const float co[2], const eMaskSign sign); /* point */ -int BKE_mask_point_has_handle(struct MaskSplinePoint *point); +bool BKE_mask_point_has_handle(struct MaskSplinePoint *point); void BKE_mask_point_handle(struct MaskSplinePoint *point, float handle[2]); void BKE_mask_point_set_handle(struct MaskSplinePoint *point, float loc[2], bool keep_direction, float orig_handle[2], float orig_vec[3][3]); @@ -100,8 +100,8 @@ float BKE_mask_point_weight(struct MaskSpline *spline, struct MaskSplinePoint *p struct MaskSplinePointUW *BKE_mask_point_sort_uw(struct MaskSplinePoint *point, struct MaskSplinePointUW *uw); void BKE_mask_point_add_uw(struct MaskSplinePoint *point, float u, float w); -void BKE_mask_point_select_set(struct MaskSplinePoint *point, const short do_select); -void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, const short do_select); +void BKE_mask_point_select_set(struct MaskSplinePoint *point, const bool do_select); +void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, const bool do_select); /* general */ struct Mask *BKE_mask_new(struct Main *bmain, const char *name); @@ -131,7 +131,7 @@ void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct Mask void BKE_mask_calc_tangent_polyline(struct MaskSpline *spline, struct MaskSplinePoint *point, float t[2]); void BKE_mask_calc_handle_point(struct MaskSpline *spline, struct MaskSplinePoint *point); void BKE_mask_calc_handle_point_auto(struct MaskSpline *spline, struct MaskSplinePoint *point, - const short do_recalc_length); + const bool do_recalc_length); void BKE_mask_get_handle_point_adjacent(struct MaskSpline *spline, struct MaskSplinePoint *point, struct MaskSplinePoint **r_point_prev, struct MaskSplinePoint **r_point_next); void BKE_mask_layer_calc_handles(struct MaskLayer *masklay); @@ -199,7 +199,7 @@ float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, void BKE_mask_spline_feather_collapse_inner_loops(struct MaskSpline *spline, float (*feather_points)[2], const unsigned int tot_feather_point); float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int width, int height, unsigned int *tot_diff_point))[2]; float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, unsigned int *tot_feather_point, - const unsigned int resol, const int do_feather_isect))[2]; + const unsigned int resol, const bool do_feather_isect))[2]; /* *** mask point functions which involve evaluation *** */ float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2]; @@ -220,8 +220,8 @@ MaskRasterHandle *BKE_maskrasterize_handle_new(void); void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle); void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, const int width, const int height, - const short do_aspect_correct, const short do_mask_aa, - const short do_feather); + const bool do_aspect_correct, const bool do_mask_aa, + const bool do_feather); float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]); void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h index 4828df2fbec..341105cfdf7 100644 --- a/source/blender/blenkernel/BKE_movieclip.h +++ b/source/blender/blenkernel/BKE_movieclip.h @@ -55,7 +55,7 @@ void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, void BKE_movieclip_get_size_fl(struct MovieClip *clip, struct MovieClipUser *user, float size[2]); int BKE_movieclip_get_duration(struct MovieClip *clip); void BKE_movieclip_get_aspect(struct MovieClip *clip, float *aspx, float *aspy); -int BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user); +bool BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user); void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr); void BKE_movieclip_update_scopes(struct MovieClip *clip, struct MovieClipUser *user, struct MovieClipScopes *scopes); @@ -63,10 +63,10 @@ void BKE_movieclip_update_scopes(struct MovieClip *clip, struct MovieClipUser *u void BKE_movieclip_get_cache_segments(struct MovieClip *clip, struct MovieClipUser *user, int *totseg_r, int **points_r); void BKE_movieclip_build_proxy_frame(struct MovieClip *clip, int clip_flag, struct MovieDistortion *distortion, - int cfra, int *build_sizes, int build_count, int undistorted); + int cfra, int *build_sizes, int build_count, bool undistorted); void BKE_movieclip_build_proxy_frame_for_ibuf(struct MovieClip *clip, struct ImBuf *ibuf, struct MovieDistortion *distortion, - int cfra, int *build_sizes, int build_count, int undistorted); + int cfra, int *build_sizes, int build_count, bool undistorted); float BKE_movieclip_remap_scene_to_clip_frame(struct MovieClip *clip, float framenr); float BKE_movieclip_remap_clip_to_scene_frame(struct MovieClip *clip, float framenr); @@ -74,8 +74,8 @@ float BKE_movieclip_remap_clip_to_scene_frame(struct MovieClip *clip, float fram void BKE_movieclip_filename_for_frame(struct MovieClip *clip, struct MovieClipUser *user, char *name); struct ImBuf *BKE_movieclip_anim_ibuf_for_frame(struct MovieClip *clip, struct MovieClipUser *user); -int BKE_movieclip_has_cached_frame(struct MovieClip *clip, struct MovieClipUser *user); -int BKE_movieclip_put_frame_if_possible(struct MovieClip *clip, struct MovieClipUser *user, struct ImBuf *ibuf); +bool BKE_movieclip_has_cached_frame(struct MovieClip *clip, struct MovieClipUser *user); +bool BKE_movieclip_put_frame_if_possible(struct MovieClip *clip, struct MovieClipUser *user, struct ImBuf *ibuf); /* cacheing flags */ #define MOVIECLIP_CACHE_SKIP (1 << 0) diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 5b41dc481c9..344797dd15a 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -59,7 +59,7 @@ struct NlaStrip *add_nla_soundstrip(struct Scene *scene, struct Speaker *spk); /* ----------------------------- */ /* API */ -short BKE_nlastrips_has_space(ListBase *strips, float start, float end); +bool BKE_nlastrips_has_space(ListBase *strips, float start, float end); void BKE_nlastrips_sort_strips(ListBase *strips); short BKE_nlastrips_add_strip(ListBase *strips, struct NlaStrip *strip); @@ -78,7 +78,7 @@ void BKE_nlatrack_set_active(ListBase *tracks, struct NlaTrack *nlt); void BKE_nlatrack_solo_toggle(struct AnimData *adt, struct NlaTrack *nlt); -short BKE_nlatrack_has_space(struct NlaTrack *nlt, float start, float end); +bool BKE_nlatrack_has_space(struct NlaTrack *nlt, float start, float end); void BKE_nlatrack_sort_strips(struct NlaTrack *nlt); short BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip); diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 664c1a6b051..3a111724d18 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -554,7 +554,7 @@ void BKE_node_preview_clear_tree(struct bNodeTree *ntree); void BKE_node_preview_sync_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree); void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree, bool remove_old); -void BKE_node_preview_set_pixel(struct bNodePreview *preview, const float col[4], int x, int y, int do_manage); +void BKE_node_preview_set_pixel(struct bNodePreview *preview, const float col[4], int x, int y, bool do_manage); /* ************** NODE TYPE ACCESS *************** */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 38055dd1ec5..f9a3f19df96 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -174,7 +174,7 @@ int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float * int BKE_object_insert_ptcache(struct Object *ob); // void object_delete_ptcache(struct Object *ob, int index); -struct KeyBlock *BKE_object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, int from_mix); +struct KeyBlock *BKE_object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, const bool from_mix); bool BKE_object_is_child_recursive(struct Object *ob_parent, struct Object *ob_child); bool BKE_object_is_animated(struct Scene *scene, struct Object *ob); diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 60cb4792da0..2f166dd2dac 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -140,7 +140,7 @@ typedef struct SculptSession { /* PBVH acceleration structure */ struct PBVH *pbvh; - int show_diffuse_color; + bool show_diffuse_color; /* Paiting on deformed mesh */ int modifiers_active; /* object is deformed with some modifiers */ diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 9f825cf439f..1a2d6469a29 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -53,7 +53,7 @@ typedef struct { /* Callbacks */ /* returns 1 if the search should continue from this node, 0 otherwise */ -typedef int (*BKE_pbvh_SearchCallback)(PBVHNode *node, void *data); +typedef bool (*BKE_pbvh_SearchCallback)(PBVHNode *node, void *data); typedef void (*BKE_pbvh_HitCallback)(PBVHNode *node, void *data); typedef void (*BKE_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin); @@ -174,9 +174,9 @@ void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max float BKE_pbvh_node_get_tmin(PBVHNode *node); /* test if AABB is at least partially inside the planes' volume */ -int BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data); +bool BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data); /* test if AABB is at least partially outside the planes' volume */ -int BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data); +bool BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data); struct GSet *BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node); struct GSet *BKE_pbvh_bmesh_node_other_verts(PBVHNode *node); @@ -203,7 +203,7 @@ void BKE_pbvh_node_layer_disp_free(PBVHNode *node); /* vertex deformer */ float (*BKE_pbvh_get_vertCos(struct PBVH *pbvh))[3]; void BKE_pbvh_apply_vertCos(struct PBVH *pbvh, float (*vertCos)[3]); -int BKE_pbvh_isDeformed(struct PBVH *pbvh); +bool BKE_pbvh_isDeformed(struct PBVH *pbvh); /* Vertex Iterator */ @@ -330,6 +330,6 @@ void BKE_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***nodes, int *totnode); //void BKE_pbvh_node_BB_reset(PBVHNode *node); //void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]); -void pbvh_show_diffuse_color_set(PBVH *bvh, int show_diffuse_color); +void pbvh_show_diffuse_color_set(PBVH *bvh, bool show_diffuse_color); #endif /* __BKE_PBVH_H__ */ diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index d19c281afb8..52042649dc4 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -119,7 +119,7 @@ void BKE_scene_update_tagged(struct EvaluationContext *eval_ctx, struct Main *bm void BKE_scene_update_for_newframe(struct EvaluationContext *eval_ctx, struct Main *bmain, struct Scene *sce, unsigned int lay); struct SceneRenderLayer *BKE_scene_add_render_layer(struct Scene *sce, const char *name); -int BKE_scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl); +bool BKE_scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl); /* render profile */ int get_render_subsurf_level(struct RenderData *r, int level); @@ -127,11 +127,11 @@ int get_render_child_particle_number(struct RenderData *r, int num); int get_render_shadow_samples(struct RenderData *r, int samples); float get_render_aosss_error(struct RenderData *r, float error); -int BKE_scene_use_new_shading_nodes(struct Scene *scene); +bool BKE_scene_use_new_shading_nodes(struct Scene *scene); void BKE_scene_disable_color_management(struct Scene *scene); -int BKE_scene_check_color_management_enabled(const struct Scene *scene); -int BKE_scene_check_rigidbody_active(const struct Scene *scene); +bool BKE_scene_check_color_management_enabled(const struct Scene *scene); +bool BKE_scene_check_rigidbody_active(const struct Scene *scene); int BKE_scene_num_threads(const struct Scene *scene); int BKE_render_num_threads(const struct RenderData *r); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 3ac04a32f38..0cbb9215868 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -220,7 +220,7 @@ void BKE_sequence_free(struct Scene *scene, struct Sequence *seq); const char *BKE_sequence_give_name(struct Sequence *seq); void BKE_sequence_calc(struct Scene *scene, struct Sequence *seq); void BKE_sequence_calc_disp(struct Scene *scene, struct Sequence *seq); -void BKE_sequence_reload_new_file(struct Scene *scene, struct Sequence *seq, int lock_range); +void BKE_sequence_reload_new_file(struct Scene *scene, struct Sequence *seq, const bool lock_range); int BKE_sequencer_evaluate_frame(struct Scene *scene, int cfra); struct StripElem *BKE_sequencer_give_stripelem(struct Sequence *seq, int cfra); diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index eb89216d360..7d7fad1c58d 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -62,7 +62,7 @@ char *txt_to_buf (struct Text *text); void txt_clean_text (struct Text *text); void txt_order_cursors (struct Text *text, const bool reverse); int txt_find_string (struct Text *text, const char *findstr, int wrap, int match_case); -int txt_has_sel (struct Text *text); +bool txt_has_sel (struct Text *text); int txt_get_span (struct TextLine *from, struct TextLine *to); int txt_utf8_offset_to_index(const char *str, int offset); int txt_utf8_index_to_offset(const char *str, int index); @@ -112,13 +112,13 @@ void txt_print_undo (struct Text *text); #endif /* utility functions, could be moved somewhere more generic but are python/text related */ -int text_check_bracket(const char ch); -int text_check_delim(const char ch); -int text_check_digit(const char ch); -int text_check_identifier(const char ch); -int text_check_identifier_nodigit(const char ch); -int text_check_whitespace(const char ch); -int text_find_identifier_start(const char *str, int i); +int text_check_bracket(const char ch); +bool text_check_delim(const char ch); +bool text_check_digit(const char ch); +bool text_check_identifier(const char ch); +bool text_check_identifier_nodigit(const char ch); +bool text_check_whitespace(const char ch); +int text_find_identifier_start(const char *str, int i); /* defined in bpy_interface.c */ extern int text_check_identifier_unicode(const unsigned int ch); diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index cf192234906..6a5b5626b50 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -64,7 +64,7 @@ void BKE_texture_free(struct Tex *t); void init_colorband(struct ColorBand *coba, bool rangetype); struct ColorBand *add_colorband(bool rangetype); -int do_colorband(const struct ColorBand *coba, float in, float out[4]); +bool do_colorband(const struct ColorBand *coba, float in, float out[4]); void colorband_table_RGBA(struct ColorBand *coba, float **array, int *size); struct CBData *colorband_element_add(struct ColorBand *coba, float position); int colorband_element_remove(struct ColorBand *coba, int index); diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index 081547f94f0..4d41640527f 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -209,7 +209,7 @@ void BKE_tracking_disable_channels(struct ImBuf *ibuf, bool disable_red, bool di /* **** 2D tracking **** */ struct MovieTrackingContext *BKE_tracking_context_new(struct MovieClip *clip, struct MovieClipUser *user, - short backwards, short sequence); + const bool backwards, const bool sequence); void BKE_tracking_context_free(struct MovieTrackingContext *context); void BKE_tracking_context_sync(struct MovieTrackingContext *context); void BKE_tracking_context_sync_user(const struct MovieTrackingContext *context, struct MovieClipUser *user); diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h index 8bccf3511d8..07aeceda474 100644 --- a/source/blender/blenkernel/BKE_unit.h +++ b/source/blender/blenkernel/BKE_unit.h @@ -34,7 +34,7 @@ extern "C" { /* in all cases the value is assumed to be scaled by the user preference */ /* humanly readable representation of a value in units (used for button drawing) */ -size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, bool pad); +size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, bool split, bool pad); /* replace units with values, used before python button evaluation */ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double scale_pref, int system, int type); diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h index 347c8b60532..0610c23a6b2 100644 --- a/source/blender/blenkernel/BKE_writeffmpeg.h +++ b/source/blender/blenkernel/BKE_writeffmpeg.h @@ -78,7 +78,7 @@ void BKE_ffmpeg_filepath_get(char *string, struct RenderData *rd); void BKE_ffmpeg_preset_set(struct RenderData *rd, int preset); void BKE_ffmpeg_image_type_verify(struct RenderData *rd, struct ImageFormatData *imf); void BKE_ffmpeg_codec_settings_verify(struct RenderData *rd); -int BKE_ffmpeg_alpha_channel_is_supported(struct RenderData *rd); +bool BKE_ffmpeg_alpha_channel_is_supported(struct RenderData *rd); struct IDProperty *BKE_ffmpeg_property_add(struct RenderData *Rd, const char *type, int opt_index, int parent_index); int BKE_ffmpeg_property_add_string(struct RenderData *rd, const char *type, const char *str); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 83e0d99bc6b..c59044d1fce 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1444,9 +1444,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos const bool do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol; #endif const bool do_final_wmcol = FALSE; - int do_init_wmcol = ((dataMask & CD_MASK_PREVIEW_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && !do_final_wmcol); + const bool do_init_wmcol = ((dataMask & CD_MASK_PREVIEW_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && !do_final_wmcol); /* XXX Same as above... For now, only weights preview in WPaint mode. */ - const int do_mod_wmcol = do_init_wmcol; + const bool do_mod_wmcol = do_init_wmcol; VirtualModifierData virtualModifierData; @@ -1938,7 +1938,7 @@ float (*editbmesh_get_vertex_cos(BMEditMesh *em, int *numVerts_r))[3] return cos; } -int editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *dm) +bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *dm) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); int required_mode = eModifierMode_Realtime | eModifierMode_Editmode; @@ -1965,9 +1965,9 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D int required_mode = eModifierMode_Realtime | eModifierMode_Editmode; int draw_flag = dm_drawflag_calc(scene->toolsettings); - // const int do_mod_mcol = true; // (ob->mode == OB_MODE_OBJECT); + // const bool do_mod_mcol = true; // (ob->mode == OB_MODE_OBJECT); #if 0 /* XXX Will re-enable this when we have global mod stack options. */ - const int do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol; + const bool do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol; #endif const bool do_final_wmcol = FALSE; const bool do_init_wmcol = ((((Mesh *)ob->data)->drawflag & ME_DRAWEIGHT) && !do_final_wmcol); @@ -2697,7 +2697,8 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm) { float *verts[4], *tex_coords[4]; const int nr_verts = mface[f].v4 != 0 ? 4 : 3; - int i, is_degenerate; + bool is_degenerate; + int i; verts[0] = mvert[mface[f].v1].co; verts[1] = mvert[mface[f].v2].co; verts[2] = mvert[mface[f].v3].co; tex_coords[0] = mtface[f].uv[0]; tex_coords[1] = mtface[f].uv[1]; tex_coords[2] = mtface[f].uv[2]; @@ -2725,7 +2726,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm) /* verify the winding is consistent */ if (is_degenerate == 0) { float prev_edge[2]; - int is_signed = 0; + bool is_signed = 0; sub_v2_v2v2(prev_edge, tex_coords[0], tex_coords[3]); i = 0; diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index aea915b9ec4..8967df14b24 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1007,7 +1007,7 @@ void BKE_pose_remove_group(Object *ob) /* ************** F-Curve Utilities for Actions ****************** */ /* Check if the given action has any keyframes */ -short action_has_motion(const bAction *act) +bool action_has_motion(const bAction *act) { FCurve *fcu; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index c2ce779f03f..76f610c0d79 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1020,7 +1020,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * int savedlines, saveline; float rgba[4], ycc[3], luma; int ycc_mode = -1; - const short is_float = (ibuf->rect_float != NULL); + const bool is_float = (ibuf->rect_float != NULL); void *cache_handle = NULL; struct ColormanageProcessor *cm_processor = NULL; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index cba4b7e1ea2..c5979686afb 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2524,7 +2524,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) struct BevelSort *sortdata, *sd, *sd1; int a, b, nr, poly, resolu = 0, len = 0; int do_tilt, do_radius, do_weight; - int is_editmode = 0; + bool is_editmode = false; ListBase *bev; /* this function needs an object, because of tflag and upflag */ @@ -4092,7 +4092,7 @@ bool BKE_curve_center_bounds(Curve *cu, float cent[3]) return false; } -void BKE_curve_translate(Curve *cu, float offset[3], int do_keys) +void BKE_curve_translate(Curve *cu, float offset[3], const bool do_keys) { ListBase *nurb_lb = BKE_curve_nurbs_get(cu); Nurb *nu; diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 8aeacda8100..6ff27e50bf8 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -557,7 +557,7 @@ void defgroup_unique_name(bDeformGroup *dg, Object *ob) BLI_uniquename_cb(defgroup_unique_check, &data, DATA_("Group"), '.', dg->name, sizeof(dg->name)); } -static int is_char_sep(const char c) +static bool is_char_sep(const char c) { return ELEM4(c, '.', ' ', '-', '_'); } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 0e3a15b114e..e60505a2245 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1988,7 +1988,7 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob) } /* recursively update objects in groups, each group is done at most once */ -static void dag_group_update_flags(Main *bmain, Scene *scene, Group *group, const short do_time) +static void dag_group_update_flags(Main *bmain, Scene *scene, Group *group, const bool do_time) { GroupObject *go; @@ -2007,7 +2007,7 @@ static void dag_group_update_flags(Main *bmain, Scene *scene, Group *group, cons /* flag all objects that need recalc, for changes in time for example */ /* do_time: make this optional because undo resets objects to their animated locations without this */ -void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const short do_time) +void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const bool do_time) { Base *base; Object *ob; @@ -2160,7 +2160,7 @@ static void dag_group_on_visible_update(Group *group) } } -void DAG_on_visible_update(Main *bmain, const short do_time) +void DAG_on_visible_update(Main *bmain, const bool do_time) { ListBase listbase; DagSceneLayer *dsl; @@ -2228,7 +2228,7 @@ void DAG_on_visible_update(Main *bmain, const short do_time) static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUSED(ob), ID **idpoin) { - struct { ID *id; int is_dependent; } *data = userData; + struct { ID *id; bool is_dependent; } *data = userData; if (*idpoin && GS((*idpoin)->name) == ID_TE) { if (data->id == (*idpoin)) @@ -2286,7 +2286,7 @@ static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id) /* set flags based on textures - can influence depgraph via modifiers */ if (idtype == ID_TE) { for (obt = bmain->object.first; obt; obt = obt->id.next) { - struct { ID *id; int is_dependent; } data; + struct { ID *id; bool is_dependent; } data; data.id = id; data.is_dependent = 0; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index ef4d199dbb2..98cac2f4721 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1461,7 +1461,7 @@ static void dynamicPaint_setInitialColor(Scene *scene, DynamicPaintSurface *surf PaintPoint *pPoint = (PaintPoint *)sData->type_data; DerivedMesh *dm = surface->canvas->dm; int i; - bool scene_color_manage = BKE_scene_check_color_management_enabled(scene); + const bool scene_color_manage = BKE_scene_check_color_management_enabled(scene); if (surface->type != MOD_DPAINT_SURFACE_T_PAINT) return; diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 04765a74b77..c93181bd903 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -433,7 +433,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, bool * /* helper for calc_fcurve_* functions -> find first and last BezTriple to be used */ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple **last, - const short do_sel_only) + const bool do_sel_only) { short found = FALSE; @@ -482,12 +482,12 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple /* Calculate the extents of F-Curve's data */ -short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, - const short do_sel_only, const short include_handles) +bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, + const bool do_sel_only, const bool include_handles) { float xminv = 999999999.0f, xmaxv = -999999999.0f; float yminv = 999999999.0f, ymaxv = -999999999.0f; - short foundvert = FALSE; + bool foundvert = false; unsigned int i; if (fcu->totvert) { @@ -578,7 +578,7 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo /* Calculate the extents of F-Curve's keyframes */ bool calc_fcurve_range(FCurve *fcu, float *start, float *end, - const short do_sel_only, const short do_min_length) + const bool do_sel_only, const bool do_min_length) { float min = 999999999.0f, max = -999999999.0f; short foundvert = FALSE; @@ -631,7 +631,7 @@ bool calc_fcurve_range(FCurve *fcu, float *start, float *end, * Usability of keyframes refers to whether they should be displayed, * and also whether they will have any influence on the final result. */ -short fcurve_are_keyframes_usable(FCurve *fcu) +bool fcurve_are_keyframes_usable(FCurve *fcu) { /* F-Curve must exist */ if (fcu == NULL) diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 2f543dcbe09..c60c1ea2b5f 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -211,7 +211,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *name) VFont *vfont = NULL; PackedFile *pf; PackedFile *temp_pf = NULL; - int is_builtin; + bool is_builtin; if (STREQ(name, FO_BUILTIN_NAME)) { BLI_strncpy(filename, name, sizeof(filename)); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 322f09f48d5..55699bc0aae 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -561,7 +561,7 @@ void BKE_image_merge(Image *dest, Image *source) } /* note, we could be clever and scale all imbuf's but since some are mipmaps its not so simple */ -int BKE_image_scale(Image *image, int width, int height) +bool BKE_image_scale(Image *image, int width, int height) { ImBuf *ibuf; void *lock; @@ -1264,7 +1264,7 @@ char BKE_imtype_from_arg(const char *imtype_arg) else return R_IMF_IMTYPE_INVALID; } -static int do_add_image_extension(char *string, const char imtype, const ImageFormatData *im_format) +static bool do_add_image_extension(char *string, const char imtype, const ImageFormatData *im_format) { const char *extension = NULL; const char *extension_test; @@ -3149,7 +3149,7 @@ void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock) } /* checks whether there's an image buffer for given image and user */ -int BKE_image_has_ibuf(Image *ima, ImageUser *iuser) +bool BKE_image_has_ibuf(Image *ima, ImageUser *iuser) { ImBuf *ibuf; @@ -3284,7 +3284,7 @@ void BKE_image_pool_release_ibuf(Image *ima, ImBuf *ibuf, ImagePool *pool) } } -int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr, short *r_is_in_range) +int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr, bool *r_is_in_range) { const int len = (iuser->fie_ima * iuser->frames) / 2; @@ -3346,7 +3346,7 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr, shor void BKE_image_user_frame_calc(ImageUser *iuser, int cfra, int fieldnr) { if (iuser) { - short is_in_range; + bool is_in_range; const int framenr = BKE_image_user_frame_get(iuser, cfra, fieldnr, &is_in_range); if (is_in_range) { @@ -3404,7 +3404,7 @@ void BKE_image_user_file_path(ImageUser *iuser, Image *ima, char *filepath) BLI_path_abs(filepath, ID_BLEND_PATH(G.main, &ima->id)); } -int BKE_image_has_alpha(struct Image *image) +bool BKE_image_has_alpha(struct Image *image) { ImBuf *ibuf; void *lock; diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index e01993d64d9..d2080b4922c 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1558,7 +1558,7 @@ KeyBlock *BKE_keyblock_add(Key *key, const char *name) * \param name Optional name for the new keyblock. * \param do_force always use ctime even for relative keys. */ -KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, const short do_force) +KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, const bool do_force) { KeyBlock *kb = BKE_keyblock_add(key, name); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 525f9107a12..8b509c77155 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -620,7 +620,7 @@ static int calc_curve_deform(Object *par, float co[3], Curve *cu = par->data; float fac, loc[4], dir[3], new_quat[4], radius; short index; - const int is_neg_axis = (axis > 2); + const bool is_neg_axis = (axis > 2); /* to be sure, mostly after file load */ if (par->curve_cache->path == NULL) { @@ -711,7 +711,7 @@ void curve_deform_verts(Object *cuOb, Object *target, DerivedMesh *dm, float (*v int a; CurveDeform cd; int use_vgroups; - const int is_neg_axis = (defaxis > 2); + const bool is_neg_axis = (defaxis > 2); if (cuOb->type != OB_CURVE) return; @@ -1147,7 +1147,7 @@ void BKE_lattice_center_bounds(Lattice *lt, float cent[3]) mid_v3_v3v3(cent, min, max); } -void BKE_lattice_translate(Lattice *lt, float offset[3], int do_keys) +void BKE_lattice_translate(Lattice *lt, float offset[3], bool do_keys) { int i, numVerts; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 131e383a8a2..33e758ed754 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -434,7 +434,7 @@ float BKE_mask_spline_project_co(MaskSpline *spline, MaskSplinePoint *point, /* point */ -int BKE_mask_point_has_handle(MaskSplinePoint *point) +bool BKE_mask_point_has_handle(MaskSplinePoint *point) { BezTriple *bezt = &point->bezt; @@ -671,7 +671,7 @@ void BKE_mask_point_add_uw(MaskSplinePoint *point, float u, float w) BKE_mask_point_sort_uw(point, &point->uw[point->tot_uw - 1]); } -void BKE_mask_point_select_set(MaskSplinePoint *point, const short do_select) +void BKE_mask_point_select_set(MaskSplinePoint *point, const bool do_select) { int i; @@ -692,7 +692,7 @@ void BKE_mask_point_select_set(MaskSplinePoint *point, const short do_select) } } -void BKE_mask_point_select_set_handle(MaskSplinePoint *point, const short do_select) +void BKE_mask_point_select_set_handle(MaskSplinePoint *point, const bool do_select) { if (do_select) { MASKPOINT_SEL_HANDLE(point); @@ -1298,7 +1298,7 @@ void BKE_mask_calc_handle_adjacent_interp(MaskSpline *spline, MaskSplinePoint *p * Useful for giving sane defaults. */ void BKE_mask_calc_handle_point_auto(MaskSpline *spline, MaskSplinePoint *point, - const short do_recalc_length) + const bool do_recalc_length) { MaskSplinePoint *point_prev, *point_next; const char h_back[2] = {point->bezt.h1, point->bezt.h2}; diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index f63d027d9f4..c6cc4a412b8 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -505,7 +505,7 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, float (*fe static float (*mask_spline_feather_differentiated_points_with_resolution__even(MaskSpline *spline, unsigned int *tot_feather_point, const unsigned int resol, - const int do_feather_isect + const bool do_feather_isect ))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -578,7 +578,7 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__even(M static float (*mask_spline_feather_differentiated_points_with_resolution__double(MaskSpline *spline, unsigned int *tot_feather_point, const unsigned int resol, - const int do_feather_isect + const bool do_feather_isect ))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -715,7 +715,7 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__double float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, unsigned int *tot_feather_point, const unsigned int resol, - const int do_feather_isect + const bool do_feather_isect ))[2] { switch (spline->offset_mode) { diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 3ecca00e31b..6c46b9c7c5b 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -192,7 +192,7 @@ typedef struct MaskRasterSplineInfo { unsigned int vertex_total_cap_head; unsigned int vertex_total_cap_tail; - unsigned int is_cyclic; + bool is_cyclic; } MaskRasterSplineInfo; /** @@ -256,7 +256,7 @@ void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle) static void maskrasterize_spline_differentiate_point_outset(float (*diff_feather_points)[2], float (*diff_points)[2], const unsigned int tot_diff_point, const float ofs, - const short do_test) + const bool do_test) { unsigned int k_prev = tot_diff_point - 2; unsigned int k_curr = tot_diff_point - 1; @@ -558,8 +558,8 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, const int width, const int height, - const short do_aspect_correct, const short do_mask_aa, - const short do_feather) + const bool do_aspect_correct, const bool do_mask_aa, + const bool do_feather) { const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f}; const float pixel_size = 1.0f / (float)min_ii(width, height); @@ -613,8 +613,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas BLI_scanfill_begin_arena(&sf_ctx, sf_arena); for (spline = masklay->splines.first; spline; spline = spline->next) { - const unsigned int is_cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0; - const unsigned int is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0; + const bool is_cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0; + const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0; float (*diff_points)[2]; unsigned int tot_diff_point; diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index dfa0d30f536..4ea98650551 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -176,7 +176,7 @@ static void get_sequence_fname(MovieClip *clip, int framenr, char *name) } /* supposed to work with sequences only */ -static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistorted, int framenr, char *name) +static void get_proxy_fname(MovieClip *clip, int proxy_render_size, bool undistorted, int framenr, char *name) { int size = rendersize_to_number(proxy_render_size); char dir[FILE_MAX], clipdir[FILE_MAX], clipfile[FILE_MAX]; @@ -482,7 +482,7 @@ static ImBuf *get_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag) return NULL; } -static int has_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag) +static bool has_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag) { if (clip->cache) { MovieClipImBufCacheKey key; @@ -1046,7 +1046,7 @@ ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float } -int BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user) +bool BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user) { ImBuf *ibuf = BKE_movieclip_get_ibuf(clip, user); @@ -1290,7 +1290,7 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip scopes->ok = TRUE; } -static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, int proxy_render_size, int undistorted, bool threaded) +static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, int proxy_render_size, bool undistorted, bool threaded) { char name[FILE_MAX]; int quality, rectx, recty; @@ -1335,7 +1335,7 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i * (meaning scaling shall be threaded) */ void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct MovieDistortion *distortion, - int cfra, int *build_sizes, int build_count, int undistorted) + int cfra, int *build_sizes, int build_count, bool undistorted) { ImBuf *ibuf; MovieClipUser user; @@ -1370,7 +1370,7 @@ void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct Movi * (different threads handles different frames, no threading within frame is needed) */ void BKE_movieclip_build_proxy_frame_for_ibuf(MovieClip *clip, ImBuf *ibuf, struct MovieDistortion *distortion, - int cfra, int *build_sizes, int build_count, int undistorted) + int cfra, int *build_sizes, int build_count, bool undistorted) { if (!build_count) return; @@ -1508,9 +1508,9 @@ ImBuf *BKE_movieclip_anim_ibuf_for_frame(MovieClip *clip, MovieClipUser *user) return ibuf; } -int BKE_movieclip_has_cached_frame(MovieClip *clip, MovieClipUser *user) +bool BKE_movieclip_has_cached_frame(MovieClip *clip, MovieClipUser *user) { - int has_frame = FALSE; + bool has_frame = false; BLI_lock_thread(LOCK_MOVIECLIP); has_frame = has_imbuf_cache(clip, user, clip->flag); @@ -1519,7 +1519,7 @@ int BKE_movieclip_has_cached_frame(MovieClip *clip, MovieClipUser *user) return has_frame; } -int BKE_movieclip_put_frame_if_possible(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf) +bool BKE_movieclip_put_frame_if_possible(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf) { bool result; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 2189fbd2f55..cba905ad487 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -899,7 +899,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl CCGKey highGridKey, lowGridKey; CCGSubSurf *ss; int i, numGrids, highGridSize; - int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK); + const bool has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK); /* create subsurf DM from original mesh at high level */ cddm = CDDM_from_mesh(me); @@ -1170,7 +1170,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm) CCGKey highGridKey, lowGridKey; CCGSubSurf *ss; int i, j, numGrids, highGridSize, lowGridSize; - int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK); + const bool has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK); /* create subsurf DM from original mesh at high level */ if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform); @@ -1233,7 +1233,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm) } else { DerivedMesh *cddm, *subdm; - int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK); + const bool has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK); if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform); else cddm = CDDM_from_mesh(me); diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 1fbc2432595..b2b20f82757 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -548,7 +548,7 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode) /* (these functions are used for NLA-Tracks and also for nested/meta-strips) */ /* Check if there is any space in the given list to add the given strip */ -short BKE_nlastrips_has_space(ListBase *strips, float start, float end) +bool BKE_nlastrips_has_space(ListBase *strips, float start, float end) { NlaStrip *strip; @@ -967,7 +967,7 @@ void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a) } /* Check if there is any space in the given track to add a strip of the given length */ -short BKE_nlatrack_has_space(NlaTrack *nlt, float start, float end) +bool BKE_nlatrack_has_space(NlaTrack *nlt, float start, float end) { /* sanity checks * - track must exist diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 02751e0cbb3..f058bbc5f78 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1478,7 +1478,7 @@ void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, boo /* hack warning! this function is only used for shader previews, and * since it gets called multiple times per pixel for Ztransp we only * add the color once. Preview gets cleared before it starts render though */ -void BKE_node_preview_set_pixel(bNodePreview *preview, const float col[4], int x, int y, int do_manage) +void BKE_node_preview_set_pixel(bNodePreview *preview, const float col[4], int x, int y, bool do_manage) { if (preview) { if (x >= 0 && y >= 0) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b8d4ef8167c..53eb24bb23f 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3224,7 +3224,7 @@ void object_delete_ptcache(Object *ob, int index) /* shape key utility function */ /************************* Mesh ************************/ -static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, int from_mix) +static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, const bool from_mix) { Mesh *me = ob->data; Key *key = me->key; @@ -3256,7 +3256,7 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, int return kb; } /************************* Lattice ************************/ -static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int from_mix) +static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, const bool from_mix) { Lattice *lt = ob->data; Key *key = lt->key; @@ -3294,7 +3294,7 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int return kb; } /************************* Curve ************************/ -static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int from_mix) +static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, const bool from_mix) { Curve *cu = ob->data; Key *key = cu->key; @@ -3334,7 +3334,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int return kb; } -KeyBlock *BKE_object_insert_shape_key(Scene *scene, Object *ob, const char *name, int from_mix) +KeyBlock *BKE_object_insert_shape_key(Scene *scene, Object *ob, const char *name, const bool from_mix) { switch (ob->type) { case OB_MESH: diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 0874d34b25d..dd9f1a268b2 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -838,7 +838,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem float (*obmat)[4]; int a, b, hair = 0; int totpart, totchild, totgroup = 0 /*, pa_num */; - int dupli_type_hack = !BKE_scene_use_new_shading_nodes(scene); + const bool dupli_type_hack = !BKE_scene_use_new_shading_nodes(scene); int no_draw_flag = PARS_UNEXIST; diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 76ac13963a9..cb7c7c636c8 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -880,12 +880,12 @@ static void BKE_pbvh_search_callback_occluded(PBVH *bvh, } } -static int update_search_cb(PBVHNode *node, void *data_v) +static bool update_search_cb(PBVHNode *node, void *data_v) { int flag = GET_INT_FROM_POINTER(data_v); if (node->flag & PBVH_Leaf) - return (node->flag & flag); + return (node->flag & flag) != 0; return 1; } @@ -1362,7 +1362,7 @@ typedef struct { int original; } RaycastData; -static int ray_aabb_intersect(PBVHNode *node, void *data_v) +static bool ray_aabb_intersect(PBVHNode *node, void *data_v) { RaycastData *rcd = data_v; float bb_min[3], bb_max[3]; @@ -1387,11 +1387,11 @@ void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data, BKE_pbvh_search_callback_occluded(bvh, ray_aabb_intersect, &rcd, cb, data); } -int ray_face_intersection(const float ray_start[3], - const float ray_normal[3], - const float *t0, const float *t1, - const float *t2, const float *t3, - float *fdist) +bool ray_face_intersection(const float ray_start[3], + const float ray_normal[3], + const float t0[3], const float t1[3], + const float t2[3], const float t3[3], + float *fdist) { float dist; @@ -1406,14 +1406,15 @@ int ray_face_intersection(const float ray_start[3], } } -static int pbvh_faces_node_raycast(PBVH *bvh, const PBVHNode *node, - float (*origco)[3], - const float ray_start[3], - const float ray_normal[3], float *dist) +static bool pbvh_faces_node_raycast(PBVH *bvh, const PBVHNode *node, + float (*origco)[3], + const float ray_start[3], + const float ray_normal[3], float *dist) { const MVert *vert = bvh->verts; const int *faces = node->prim_indices; - int i, hit = 0, totface = node->totprim; + int i, totface = node->totprim; + bool hit = false; for (i = 0; i < totface; ++i) { const MFace *f = bvh->faces + faces[i]; @@ -1501,7 +1502,7 @@ int BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use const float ray_start[3], const float ray_normal[3], float *dist) { - int hit = 0; + bool hit = false; if (node->flag & PBVH_FullyHidden) return 0; @@ -1641,7 +1642,7 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3], return ret; } -int BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data) +bool BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data) { float bb_min[3], bb_max[3]; @@ -1649,7 +1650,7 @@ int BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data) return test_planes_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE; } -int BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data) +bool BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data) { float bb_min[3], bb_max[3]; @@ -1788,7 +1789,7 @@ void BKE_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)[3]) } } -int BKE_pbvh_isDeformed(PBVH *pbvh) +bool BKE_pbvh_isDeformed(PBVH *pbvh) { return pbvh->deformed; } @@ -1911,7 +1912,7 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node, vi->vmask = CustomData_get_layer(bvh->vdata, CD_PAINT_MASK); } -void pbvh_show_diffuse_color_set(PBVH *bvh, int show_diffuse_color) +void pbvh_show_diffuse_color_set(PBVH *bvh, bool show_diffuse_color) { bvh->show_diffuse_color = show_diffuse_color; } diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h index bd72b0339c7..d4cd6bcf9d8 100644 --- a/source/blender/blenkernel/intern/pbvh_intern.h +++ b/source/blender/blenkernel/intern/pbvh_intern.h @@ -154,9 +154,9 @@ struct PBVH { #endif /* flag are verts/faces deformed */ - int deformed; + bool deformed; - int show_diffuse_color; + bool show_diffuse_color; /* Dynamic topology */ BMesh *bm; @@ -175,9 +175,9 @@ void BB_expand_with_bb(BB *bb, BB *bb2); void BBC_update_centroid(BBC *bbc); int BB_widest_axis(const BB *bb); void pbvh_grow_nodes(PBVH *bvh, int totnode); -int ray_face_intersection(const float ray_start[3], const float ray_normal[3], - const float *t0, const float *t1, const float *t2, - const float *t3, float *fdist); +bool ray_face_intersection(const float ray_start[3], const float ray_normal[3], + const float *t0, const float *t1, const float *t2, + const float *t3, float *fdist); void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes, int totnode, int flag); /* pbvh_bmesh.c */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 975e06467d4..936f76765c2 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -744,7 +744,7 @@ void BKE_scene_unlink(Main *bmain, Scene *sce, Scene *newsce) int BKE_scene_base_iter_next(EvaluationContext *eval_ctx, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob) { - int run_again = 1; + bool run_again = true; /* init */ if (val == 0) { @@ -1671,7 +1671,7 @@ SceneRenderLayer *BKE_scene_add_render_layer(Scene *sce, const char *name) return srl; } -int BKE_scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl) +bool BKE_scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl) { const int act = BLI_findindex(&scene->r.layers, srl); Scene *sce; @@ -1766,7 +1766,7 @@ Base *_setlooper_base_step(Scene **sce_iter, Base *base) return NULL; } -int BKE_scene_use_new_shading_nodes(Scene *scene) +bool BKE_scene_use_new_shading_nodes(Scene *scene) { RenderEngineType *type = RE_engines_find(scene->r.engine); return (type && type->flag & RE_USE_SHADING_NODES); @@ -1810,12 +1810,12 @@ void BKE_scene_disable_color_management(Scene *scene) } } -int BKE_scene_check_color_management_enabled(const Scene *scene) +bool BKE_scene_check_color_management_enabled(const Scene *scene) { return strcmp(scene->display_settings.display_device, "None") != 0; } -int BKE_scene_check_rigidbody_active(const Scene *scene) +bool BKE_scene_check_rigidbody_active(const Scene *scene) { return scene && scene->rigidbody_world && scene->rigidbody_world->group && !(scene->rigidbody_world->flag & RBW_FLAG_MUTED); } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b261ad5686b..58d4a2acf33 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -176,7 +176,7 @@ static void seq_free_strip(Strip *strip) } /* only give option to skip cache locally (static func) */ -static void BKE_sequence_free_ex(Scene *scene, Sequence *seq, const int do_cache) +static void BKE_sequence_free_ex(Scene *scene, Sequence *seq, const bool do_cache) { if (seq->strip) seq_free_strip(seq->strip); @@ -752,7 +752,7 @@ void BKE_sequence_calc(Scene *scene, Sequence *seq) } /* note: caller should run BKE_sequence_calc(scene, seq) after */ -void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range) +void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, const bool lock_range) { char str[FILE_MAX]; int prev_startdisp = 0, prev_enddisp = 0; @@ -1925,7 +1925,7 @@ int BKE_sequencer_input_have_to_preprocess(const SeqRenderData *UNUSED(context), } static ImBuf *input_preprocess(const SeqRenderData *context, Sequence *seq, float cfra, ImBuf *ibuf, - int is_proxy_image, int is_preprocessed) + const bool is_proxy_image, const bool is_preprocessed) { Scene *scene = context->scene; float mul; @@ -2457,11 +2457,11 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq * -jahka */ - const short is_rendering = G.is_rendering; - const short is_background = G.background; - const int do_seq_gl = is_rendering ? - 0 /* (context->scene->r.seq_flag & R_SEQ_GL_REND) */ : - (context->scene->r.seq_flag & R_SEQ_GL_PREV); + const bool is_rendering = G.is_rendering; + const bool is_background = G.background; + const bool do_seq_gl = is_rendering ? + 0 /* (context->scene->r.seq_flag & R_SEQ_GL_REND) */ : + (context->scene->r.seq_flag & R_SEQ_GL_PREV) != 0; int do_seq; // int have_seq = FALSE; /* UNUSED */ int have_comp = FALSE; @@ -2756,12 +2756,12 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, Sequence *s static ImBuf *seq_render_strip(const SeqRenderData *context, Sequence *seq, float cfra) { ImBuf *ibuf = NULL; - int use_preprocess = FALSE; - int is_proxy_image = FALSE; + bool use_preprocess = false; + bool is_proxy_image = false; float nr = give_stripelem_index(seq, cfra); /* all effects are handled similarly with the exception of speed effect */ int type = (seq->type & SEQ_TYPE_EFFECT && seq->type != SEQ_TYPE_SPEED) ? SEQ_TYPE_EFFECT : seq->type; - int is_preprocessed = !ELEM3(type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SCENE); + bool is_preprocessed = !ELEM3(type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SCENE); ibuf = BKE_sequencer_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF); diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 74771378e9c..dce82f9cbc4 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -51,11 +51,11 @@ #include "BKE_lattice.h" #include "BKE_deform.h" -#include "BKE_mesh.h" #include "BKE_subsurf.h" -#include "BKE_mesh.h" #include "BKE_editmesh.h" +#include "BLI_strict_flags.h" + /* for timing... */ #if 0 # include "PIL_time.h" @@ -281,7 +281,6 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for int i; /* Options about projection direction */ - const char use_normal = calc->smd->shrinkOpts; const float proj_limit_squared = calc->smd->projLimit * calc->smd->projLimit; float proj_axis[3] = {0.0f, 0.0f, 0.0f}; @@ -300,7 +299,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for /* If the user doesn't allows to project in any direction of projection axis * then theres nothing todo. */ - if ((use_normal & (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0) + if ((calc->smd->shrinkOpts & (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0) return; @@ -370,7 +369,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for hit.dist = 10000.0f; /* TODO: we should use FLT_MAX here, but sweepsphere code isn't prepared for that */ /* Project over positive direction of axis */ - if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR) { + if (calc->smd->shrinkOpts & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR) { if (auxData.tree) { BKE_shrinkwrap_project_normal(0, tmp_co, tmp_no, @@ -384,7 +383,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for } /* Project over negative direction of axis */ - if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR) { + if (calc->smd->shrinkOpts & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR) { float inv_no[3]; negate_v3_v3(inv_no, tmp_no); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 145f832063a..7fea20a14e2 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1230,7 +1230,7 @@ void txt_order_cursors(Text *text, const bool reverse) } } -int txt_has_sel(Text *text) +bool txt_has_sel(Text *text) { return ((text->curl != text->sell) || (text->curc != text->selc)); } @@ -3010,7 +3010,7 @@ int text_check_bracket(const char ch) } /* TODO, have a function for operators - http://docs.python.org/py3k/reference/lexical_analysis.html#operators */ -int text_check_delim(const char ch) +bool text_check_delim(const char ch) { int a; char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,@"; @@ -3022,14 +3022,14 @@ int text_check_delim(const char ch) return 0; } -int text_check_digit(const char ch) +bool text_check_digit(const char ch) { if (ch < '0') return 0; if (ch <= '9') return 1; return 0; } -int text_check_identifier(const char ch) +bool text_check_identifier(const char ch) { if (ch < '0') return 0; if (ch <= '9') return 1; @@ -3040,7 +3040,7 @@ int text_check_identifier(const char ch) return 0; } -int text_check_identifier_nodigit(const char ch) +bool text_check_identifier_nodigit(const char ch) { if (ch <= '9') return 0; if (ch < 'A') return 0; @@ -3051,18 +3051,18 @@ int text_check_identifier_nodigit(const char ch) } #ifndef WITH_PYTHON -int text_check_identifier_unicode(const unsigned int ch) +bool text_check_identifier_unicode(const unsigned int ch) { return (ch < 255 && text_check_identifier((char)ch)); } -int text_check_identifier_nodigit_unicode(const unsigned int ch) +bool text_check_identifier_nodigit_unicode(const unsigned int ch) { return (ch < 255 && text_check_identifier_nodigit((char)ch)); } #endif /* WITH_PYTHON */ -int text_check_whitespace(const char ch) +bool text_check_whitespace(const char ch) { if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') return 1; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 786a490fa10..d192ca71c12 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -253,7 +253,7 @@ ColorBand *add_colorband(bool rangetype) /* ------------------------------------------------------------------------- */ -int do_colorband(const ColorBand *coba, float in, float out[4]) +bool do_colorband(const ColorBand *coba, float in, float out[4]) { const CBData *cbd1, *cbd2, *cbd0, *cbd3; float fac, mfac, t[4]; diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c index 491a35602bd..6a274921d44 100644 --- a/source/blender/blenkernel/intern/tracking_region_tracker.c +++ b/source/blender/blenkernel/intern/tracking_region_tracker.c @@ -94,7 +94,8 @@ static void track_context_free(void *customdata) * for thread-safe tracking, allowing clip modifications during * tracking. */ -MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *user, short backwards, short sequence) +MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *user, + const bool backwards, const bool sequence) { MovieTrackingContext *context = MEM_callocN(sizeof(MovieTrackingContext), "trackingContext"); MovieTracking *tracking = &clip->tracking; diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index a26b579f5e5..ed32750e402 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -423,7 +423,7 @@ static size_t unit_as_string(char *str, int len_max, double value, int prec, bUn /* Used for drawing number buttons, try keep fast. * Return the length of the generated string. */ -size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, bool pad) +size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, bool split, bool pad) { bUnitCollection *usys = unit_get_system(system, type); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 541d10637d5..ddd6780b0e9 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1596,7 +1596,7 @@ void BKE_ffmpeg_codec_settings_verify(RenderData *rd) ffmpeg_set_expert_options(rd); } -int BKE_ffmpeg_alpha_channel_is_supported(RenderData *rd) +bool BKE_ffmpeg_alpha_channel_is_supported(RenderData *rd) { int codec = rd->ffcodecdata.codec; -- cgit v1.2.3