diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 358f884f74e..99e16dedac4 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -66,9 +66,9 @@ void BKE_curve_type_test(struct Object *ob); void BKE_curve_curve_dimension_update(struct Curve *cu); void BKE_curve_texspace_calc(struct Curve *cu); -int BKE_curve_minmax(struct Curve *cu, float min[3], float max[3]); -int BKE_curve_center_median(struct Curve *cu, float cent[3]); -int BKE_curve_center_bounds(struct Curve *cu, float cent[3]); +bool BKE_curve_minmax(struct Curve *cu, 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_delete_material_index(struct Curve *cu, int index); @@ -118,11 +118,11 @@ void BKE_nurb_knot_calc_u(struct Nurb *nu); void BKE_nurb_knot_calc_v(struct Nurb *nu); /* nurb checks if they can be drawn, also clamp order func */ -int BKE_nurb_check_valid_u(struct Nurb *nu); -int BKE_nurb_check_valid_v(struct Nurb *nu); +bool BKE_nurb_check_valid_u(struct Nurb *nu); +bool BKE_nurb_check_valid_v(struct Nurb *nu); -int BKE_nurb_order_clamp_u(struct Nurb *nu); -int BKE_nurb_order_clamp_v(struct Nurb *nu); +bool BKE_nurb_order_clamp_u(struct Nurb *nu); +bool BKE_nurb_order_clamp_v(struct Nurb *nu); void BKE_nurb_direction_switch(struct Nurb *nu); @@ -135,4 +135,4 @@ void BKE_nurb_handles_calc(struct Nurb *nu); void BKE_nurb_handles_autocalc(struct Nurb *nu, int flag); void BKE_nurb_handles_test(struct Nurb *nu); -#endif +#endif /* __BKE_CURVE_H__ */ diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index cd52dd75f26..028ff0f93d6 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -71,7 +71,7 @@ typedef struct EditFont { } EditFont; -int BKE_vfont_is_builtin(struct VFont *vfont); +bool BKE_vfont_is_builtin(struct VFont *vfont); void BKE_vfont_builtin_register(void *mem, int size); void BKE_vfont_free_data(struct VFont *vfont); diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h index 2a01ef3afdb..74dc8de753e 100644 --- a/source/blender/blenkernel/BKE_idcode.h +++ b/source/blender/blenkernel/BKE_idcode.h @@ -64,7 +64,7 @@ int BKE_idcode_from_name(const char *name); * \param code The code to check. * \return Boolean, 0 when non linkable. */ -int BKE_idcode_is_linkable(int code); +bool BKE_idcode_is_linkable(int code); /** * Return if the ID code is a valid ID code. @@ -72,7 +72,7 @@ int BKE_idcode_is_linkable(int code); * \param code The code to check. * \return Boolean, 0 when invalid. */ -int BKE_idcode_is_valid(int code); +bool BKE_idcode_is_valid(int code); /** * Return an ID code and steps the index forward 1. diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index dd7e06259bd..26ac2cc8bb4 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -68,7 +68,7 @@ int BKE_add_image_extension_from_type(char *string, const char imtype); char BKE_ftype_to_imtype(const int ftype); int BKE_imtype_to_ftype(const char imtype); -int BKE_imtype_is_movie(const char imtype); +bool BKE_imtype_is_movie(const char imtype); int BKE_imtype_supports_zbuf(const char imtype); int BKE_imtype_supports_compress(const char imtype); int BKE_imtype_supports_quality(const char imtype); diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 662bfab10a1..9bbff515983 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -48,8 +48,8 @@ void BKE_mball_make_local(struct MetaBall *mb); void BKE_mball_cubeTable_free(void); void BKE_mball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase); -int BKE_mball_is_basis_for(struct Object *ob1, struct Object *ob2); -int BKE_mball_is_basis(struct Object *ob); +bool BKE_mball_is_basis_for(struct Object *ob1, struct Object *ob2); +bool BKE_mball_is_basis(struct Object *ob); struct Object *BKE_mball_basis_find(struct Scene *scene, struct Object *ob); void BKE_mball_texspace_calc(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index d1611b9d2d1..5caa484caa0 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -68,7 +68,7 @@ void BKE_object_update_base_layer(struct Scene *scene, struct Object *ob); void BKE_object_free(struct Object *ob); void BKE_object_free_display(struct Object *ob); -int BKE_object_support_modifier_type_check(struct Object *ob, int modifier_type); +bool BKE_object_support_modifier_type_check(struct Object *ob, int modifier_type); void BKE_object_link_modifiers(struct Object *ob, struct Object *from); void BKE_object_free_modifiers(struct Object *ob); @@ -77,8 +77,8 @@ void BKE_object_make_proxy(struct Object *ob, struct Object *target, struct Obje void BKE_object_copy_proxy_drivers(struct Object *ob, struct Object *target); void BKE_object_unlink(struct Object *ob); -int BKE_object_exists_check(struct Object *obtest); -int BKE_object_is_in_editmode(struct Object *ob); +bool BKE_object_exists_check(struct Object *obtest); +bool BKE_object_is_in_editmode(struct Object *ob); struct Object *BKE_object_add_only_object(struct Main *bmain, int type, const char *name); struct Object *BKE_object_add(struct Scene *scene, int type); @@ -87,8 +87,8 @@ void *BKE_object_obdata_add_from_type(int type); struct Object *BKE_object_copy_ex(struct Main *bmain, struct Object *ob, int copy_caches); struct Object *BKE_object_copy(struct Object *ob); void BKE_object_make_local(struct Object *ob); -int BKE_object_is_libdata(struct Object *ob); -int BKE_object_obdata_is_libdata(struct Object *ob); +bool BKE_object_is_libdata(struct Object *ob); +bool BKE_object_obdata_is_libdata(struct Object *ob); void BKE_object_scale_to_mat3(struct Object *ob, float mat[3][3]); void BKE_object_rot_to_mat3(struct Object *ob, float mat[3][3], short use_drot); @@ -128,7 +128,7 @@ void BKE_scene_foreach_display_point(struct Scene *scene, const short flag, void (*func_cb)(const float[3], void *), void *user_data); -int BKE_object_parent_loop_check(const struct Object *parent, const struct Object *ob); +bool BKE_object_parent_loop_check(const struct Object *parent, const struct Object *ob); void *BKE_object_tfm_backup(struct Object *ob); void BKE_object_tfm_restore(struct Object *ob, void *obtfm_pt); @@ -161,9 +161,11 @@ int BKE_object_insert_ptcache(struct Object *ob); struct KeyBlock *BKE_object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, int 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); + +/* return ModifierMode flag */ int BKE_object_is_modified(struct Scene *scene, struct Object *ob); int BKE_object_is_deform_modified(struct Scene *scene, struct Object *ob); -int BKE_object_is_animated(struct Scene *scene, struct Object *ob); void BKE_object_relink(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index b19a2092206..8fab44121de 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -74,7 +74,7 @@ void rewindPackedFile(struct PackedFile *pf); int readPackedFile(struct PackedFile *pf, void *data, int size); /* ID should be not NULL, return 1 if there's a packed file */ -int BKE_pack_check(struct ID *id); +bool BKE_pack_check(struct ID *id); /* ID should be not NULL, throws error when ID is Library */ void BKE_unpack_id(struct Main *bmain, struct ID *id, struct ReportList *reports, int how); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 7dd0d2e7ae3..a46d947b9d9 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -289,10 +289,10 @@ int BKE_sequence_tx_get_final_right(struct Sequence *seq, int metaclip); void BKE_sequence_tx_set_final_left(struct Sequence *seq, int val); void BKE_sequence_tx_set_final_right(struct Sequence *seq, int val); void BKE_sequence_tx_handle_xlimits(struct Sequence *seq, int leftflag, int rightflag); -int BKE_sequence_tx_test(struct Sequence *seq); -int BKE_sequence_single_check(struct Sequence *seq); +bool BKE_sequence_tx_test(struct Sequence *seq); +bool BKE_sequence_single_check(struct Sequence *seq); void BKE_sequence_single_fix(struct Sequence *seq); -int BKE_sequence_test_overlap(struct ListBase *seqbasep, struct Sequence *test); +bool BKE_sequence_test_overlap(struct ListBase *seqbasep, struct Sequence *test); void BKE_sequence_translate(struct Scene *scene, struct Sequence *seq, int delta); void BKE_sequence_sound_init(struct Scene *scene, struct Sequence *seq); struct Sequence *BKE_sequencer_foreground_frame_get(struct Scene *scene, int frame); @@ -301,14 +301,14 @@ struct Sequence *BKE_sequence_metastrip(ListBase *seqbase /* = ed->seqbase */, s void BKE_sequencer_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs); void BKE_sequencer_dupe_animdata(struct Scene *scene, const char *name_src, const char *name_dst); -int BKE_sequence_base_shuffle(struct ListBase *seqbasep, struct Sequence *test, struct Scene *evil_scene); -int BKE_sequence_base_shuffle_time(ListBase *seqbasep, struct Scene *evil_scene); -int BKE_sequence_base_isolated_sel_check(struct ListBase *seqbase); +bool BKE_sequence_base_shuffle(struct ListBase *seqbasep, struct Sequence *test, struct Scene *evil_scene); +bool BKE_sequence_base_shuffle_time(ListBase *seqbasep, struct Scene *evil_scene); +bool BKE_sequence_base_isolated_sel_check(struct ListBase *seqbase); void BKE_sequencer_free_imbuf(struct Scene *scene, struct ListBase *seqbasep, int for_render); struct Sequence *BKE_sequence_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence *seq, int dupe_flag); int BKE_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str); -int BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur); +bool BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur); void BKE_sequence_invalidate_cache(struct Scene *scene, struct Sequence *seq); void BKE_sequence_invalidate_dependent(struct Scene *scene, struct Sequence *seq); void BKE_sequence_invalidate_cache_for_modifier(struct Scene *scene, struct Sequence *seq); @@ -320,7 +320,7 @@ void BKE_sequencer_update_sound(struct Scene *scene, struct bSound *sound); void BKE_sequence_base_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq); void BKE_sequence_base_dupli_recursive(struct Scene *scene, struct Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag); -int BKE_sequence_is_valid_check(struct Sequence *seq); +bool BKE_sequence_is_valid_check(struct Sequence *seq); void BKE_sequencer_clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce); void BKE_sequencer_clear_movieclip_in_clipboard(struct MovieClip *clip); @@ -419,4 +419,4 @@ int BKE_sequence_supports_modifiers(struct Sequence *seq); struct ImBuf *BKE_sequencer_render_mask_input(SeqRenderData context, int mask_input_type, struct Sequence *mask_sequence, struct Mask *mask_id, int cfra, int make_float); void BKE_sequencer_color_balance_apply(struct StripColorBalance *cb, struct ImBuf *ibuf, float mul, short make_float, struct ImBuf *mask_input); -#endif /* __BKE_SEQUENCER_H__ */ +#endif /* __BKE_SEQUENCER_H__ */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 0cb42fb46de..5d2c85e5825 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3319,76 +3319,76 @@ void BKE_curve_keyVertexTilts_apply(Curve *UNUSED(cu), ListBase *lb, float *key) } } -int BKE_nurb_check_valid_u(struct Nurb *nu) +bool BKE_nurb_check_valid_u(struct Nurb *nu) { if (nu == NULL) - return 0; + return false; if (nu->pntsu <= 1) - return 0; + return false; if (nu->type != CU_NURBS) - return 1; /* not a nurb, lets assume its valid */ + return true; /* not a nurb, lets assume its valid */ - if (nu->pntsu < nu->orderu) return 0; + if (nu->pntsu < nu->orderu) return false; if (((nu->flag & CU_NURB_CYCLIC) == 0) && (nu->flagu & CU_NURB_BEZIER)) { /* Bezier U Endpoints */ if (nu->orderu == 4) { if (nu->pntsu < 5) - return 0; /* bezier with 4 orderu needs 5 points */ + return false; /* bezier with 4 orderu needs 5 points */ } else { if (nu->orderu != 3) - return 0; /* order must be 3 or 4 */ + return false; /* order must be 3 or 4 */ } } - return 1; + return true; } -int BKE_nurb_check_valid_v(struct Nurb *nu) +bool BKE_nurb_check_valid_v(struct Nurb *nu) { if (nu == NULL) - return 0; + return false; if (nu->pntsv <= 1) - return 0; + return false; if (nu->type != CU_NURBS) - return 1; /* not a nurb, lets assume its valid */ + return true; /* not a nurb, lets assume its valid */ if (nu->pntsv < nu->orderv) - return 0; + return false; if (((nu->flag & CU_NURB_CYCLIC) == 0) && (nu->flagv & CU_NURB_BEZIER)) { /* Bezier V Endpoints */ if (nu->orderv == 4) { if (nu->pntsv < 5) - return 0; /* bezier with 4 orderu needs 5 points */ + return false; /* bezier with 4 orderu needs 5 points */ } else { if (nu->orderv != 3) - return 0; /* order must be 3 or 4 */ + return false; /* order must be 3 or 4 */ } } - return 1; + return true; } -int BKE_nurb_order_clamp_u(struct Nurb *nu) +bool BKE_nurb_order_clamp_u(struct Nurb *nu) { - int change = 0; + bool change = false; if (nu->pntsu < nu->orderu) { nu->orderu = nu->pntsu; - change = 1; + change = true; } if (((nu->flagu & CU_NURB_CYCLIC) == 0) && (nu->flagu & CU_NURB_BEZIER)) { CLAMP(nu->orderu, 3, 4); - change = 1; + change = true; } return change; } -int BKE_nurb_order_clamp_v(struct Nurb *nu) +bool BKE_nurb_order_clamp_v(struct Nurb *nu) { - int change = 0; + bool change = false; if (nu->pntsv < nu->orderv) { nu->orderv = nu->pntsv; - change = 1; + change = true; } if (((nu->flagv & CU_NURB_CYCLIC) == 0) && (nu->flagv & CU_NURB_BEZIER)) { CLAMP(nu->orderv, 3, 4); - change = 1; + change = true; } return change; } @@ -3405,7 +3405,7 @@ ListBase *BKE_curve_nurbs_get(Curve *cu) /* basic vertex data functions */ -int BKE_curve_minmax(Curve *cu, float min[3], float max[3]) +bool BKE_curve_minmax(Curve *cu, float min[3], float max[3]) { ListBase *nurb_lb = BKE_curve_nurbs_get(cu); Nurb *nu; @@ -3416,7 +3416,7 @@ int BKE_curve_minmax(Curve *cu, float min[3], float max[3]) return (nurb_lb->first != NULL); } -int BKE_curve_center_median(Curve *cu, float cent[3]) +bool BKE_curve_center_median(Curve *cu, float cent[3]) { ListBase *nurb_lb = BKE_curve_nurbs_get(cu); Nurb *nu; @@ -3454,16 +3454,16 @@ int BKE_curve_center_median(Curve *cu, float cent[3]) return (total != 0); } -int BKE_curve_center_bounds(Curve *cu, float cent[3]) +bool BKE_curve_center_bounds(Curve *cu, float cent[3]) { float min[3], max[3]; INIT_MINMAX(min, max); if (BKE_curve_minmax(cu, min, max)) { mid_v3_v3v3(cent, min, max); - return 1; + return true; } - return 0; + return false; } void BKE_curve_translate(Curve *cu, float offset[3], int do_keys) diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 3578033f566..3682de8567d 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -101,7 +101,7 @@ void BKE_vfont_free(struct VFont *vf) static void *builtin_font_data = NULL; static int builtin_font_size = 0; -int BKE_vfont_is_builtin(struct VFont *vfont) +bool BKE_vfont_is_builtin(struct VFont *vfont) { return (strcmp(vfont->name, FO_BUILTIN_NAME) == 0); } diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index c3008d17bd1..7aec97e1582 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -30,12 +30,13 @@ * \ingroup bke */ - #include #include #include "DNA_ID.h" +#include "BLI_utildefines.h" + #include "BKE_idcode.h" typedef struct { @@ -105,15 +106,15 @@ static IDType *idtype_from_code(int code) return NULL; } -int BKE_idcode_is_valid(int code) +bool BKE_idcode_is_valid(int code) { - return idtype_from_code(code) ? 1 : 0; + return idtype_from_code(code) ? true : false; } -int BKE_idcode_is_linkable(int code) +bool BKE_idcode_is_linkable(int code) { IDType *idt = idtype_from_code(code); - return idt ? (idt->flags & IDTYPE_FLAGS_ISLINKABLE) : 0; + return idt ? ((idt->flags & IDTYPE_FLAGS_ISLINKABLE) != 0) : false; } const char *BKE_idcode_to_name(int code) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 689d1959b16..cad9e8cfbc6 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1042,7 +1042,7 @@ char BKE_ftype_to_imtype(const int ftype) } -int BKE_imtype_is_movie(const char imtype) +bool BKE_imtype_is_movie(const char imtype) { switch (imtype) { case R_IMF_IMTYPE_AVIRAW: @@ -1053,9 +1053,9 @@ int BKE_imtype_is_movie(const char imtype) case R_IMF_IMTYPE_THEORA: case R_IMF_IMTYPE_XVID: case R_IMF_IMTYPE_FRAMESERVER: - return 1; + return true; } - return 0; + return false; } int BKE_imtype_supports_zbuf(const char imtype) diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index 468a88775c6..415f0a87431 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -24,13 +24,14 @@ * \ingroup bke */ - #include #include -#include "BKE_image.h" #include "BLI_math_color.h" #include "BLI_math_base.h" + +#include "BKE_image.h" + #include "BLF_api.h" void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, const float color[4]) diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 5c97b29885f..925040940f8 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -439,18 +439,15 @@ float *BKE_mball_make_orco(Object *ob, ListBase *dispbase) * It test last character of Object ID name. If last character * is digit it return 0, else it return 1. */ -int BKE_mball_is_basis(Object *ob) +bool BKE_mball_is_basis(Object *ob) { - int len; - /* just a quick test */ - len = strlen(ob->id.name); - if (isdigit(ob->id.name[len - 1]) ) return 0; - return 1; + const int len = strlen(ob->id.name); + return (!isdigit(ob->id.name[len - 1])); } /* return nonzero if ob1 is a basis mball for ob */ -int BKE_mball_is_basis_for(Object *ob1, Object *ob2) +bool BKE_mball_is_basis_for(Object *ob1, Object *ob2) { int basis1nr, basis2nr; char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME]; @@ -458,8 +455,12 @@ int BKE_mball_is_basis_for(Object *ob1, Object *ob2) BLI_split_name_num(basis1name, &basis1nr, ob1->id.name + 2, '.'); BLI_split_name_num(basis2name, &basis2nr, ob2->id.name + 2, '.'); - if (!strcmp(basis1name, basis2name)) return BKE_mball_is_basis(ob1); - else return 0; + if (!strcmp(basis1name, basis2name)) { + return BKE_mball_is_basis(ob1); + } + else { + return false; + } } /* \brief copy some properties from object to other metaball object with same base name diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 0ace60b1fd4..0205fe91a60 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -185,7 +185,7 @@ void BKE_object_free_modifiers(Object *ob) BKE_object_free_softbody(ob); } -int BKE_object_support_modifier_type_check(Object *ob, int modifier_type) +bool BKE_object_support_modifier_type_check(Object *ob, int modifier_type) { ModifierTypeInfo *mti; @@ -194,10 +194,10 @@ int BKE_object_support_modifier_type_check(Object *ob, int modifier_type) if (!((mti->flags & eModifierTypeFlag_AcceptsCVs) || (ob->type == OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh)))) { - return FALSE; + return false; } - return TRUE; + return true; } void BKE_object_link_modifiers(struct Object *ob_dst, struct Object *ob_src) @@ -773,61 +773,61 @@ void BKE_object_unlink(Object *ob) } /* actual check for internal data, not context or flags */ -int BKE_object_is_in_editmode(Object *ob) +bool BKE_object_is_in_editmode(Object *ob) { if (ob->data == NULL) - return 0; + return false; if (ob->type == OB_MESH) { Mesh *me = ob->data; if (me->edit_btmesh) - return 1; + return true; } else if (ob->type == OB_ARMATURE) { bArmature *arm = ob->data; if (arm->edbo) - return 1; + return true; } else if (ob->type == OB_FONT) { Curve *cu = ob->data; if (cu->editfont) - return 1; + return true; } else if (ob->type == OB_MBALL) { MetaBall *mb = ob->data; if (mb->editelems) - return 1; + return true; } else if (ob->type == OB_LATTICE) { Lattice *lt = ob->data; if (lt->editlatt) - return 1; + return true; } else if (ob->type == OB_SURF || ob->type == OB_CURVE) { Curve *cu = ob->data; if (cu->editnurb) - return 1; + return true; } - return 0; + return false; } -int BKE_object_exists_check(Object *obtest) +bool BKE_object_exists_check(Object *obtest) { Object *ob; - if (obtest == NULL) return 0; + if (obtest == NULL) return false; ob = G.main->object.first; while (ob) { - if (ob == obtest) return 1; + if (ob == obtest) return true; ob = ob->id.next; } - return 0; + return false; } /* *************************************************** */ @@ -1394,24 +1394,24 @@ void BKE_object_make_local(Object *ob) /* * Returns true if the Object is a from an external blend file (libdata) */ -int BKE_object_is_libdata(Object *ob) +bool BKE_object_is_libdata(Object *ob) { - if (!ob) return 0; - if (ob->proxy) return 0; - if (ob->id.lib) return 1; - return 0; + if (!ob) return false; + if (ob->proxy) return false; + if (ob->id.lib) return true; + return false; } /* Returns true if the Object data is a from an external blend file (libdata) */ -int BKE_object_obdata_is_libdata(Object *ob) +bool BKE_object_obdata_is_libdata(Object *ob) { - if (!ob) return 0; - if (ob->proxy && (ob->data == NULL || ((ID *)ob->data)->lib == NULL)) return 0; - if (ob->id.lib) return 1; - if (ob->data == NULL) return 0; - if (((ID *)ob->data)->lib) return 1; + if (!ob) return false; + if (ob->proxy && (ob->data == NULL || ((ID *)ob->data)->lib == NULL)) return false; + if (ob->id.lib) return true; + if (ob->data == NULL) return false; + if (((ID *)ob->data)->lib) return true; - return 0; + return false; } /* *************** PROXY **************** */ @@ -2623,11 +2623,11 @@ void BKE_object_tfm_restore(Object *ob, void *obtfm_pt) copy_m4_m4(ob->imat, obtfm->imat); } -int BKE_object_parent_loop_check(const Object *par, const Object *ob) +bool BKE_object_parent_loop_check(const Object *par, const Object *ob) { /* test if 'ob' is a parent somewhere in par's parents */ - if (par == NULL) return 0; - if (ob == par) return 1; + if (par == NULL) return false; + if (ob == par) return true; return BKE_object_parent_loop_check(par->parent, ob); } @@ -3192,7 +3192,7 @@ int BKE_object_is_deform_modified(Scene *scene, Object *ob) } /* See if an object is using an animated modifier */ -int BKE_object_is_animated(Scene *scene, Object *ob) +bool BKE_object_is_animated(Scene *scene, Object *ob) { ModifierData *md; @@ -3201,9 +3201,9 @@ int BKE_object_is_animated(Scene *scene, Object *ob) (modifier_isEnabled(scene, md, eModifierMode_Realtime) || modifier_isEnabled(scene, md, eModifierMode_Render))) { - return 1; + return true; } - return 0; + return false; } static void copy_object__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin) diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index ec13e58d4e0..5a02d929b76 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -617,7 +617,7 @@ void unpackAll(Main *bmain, ReportList *reports, int how) } /* ID should be not NULL, return 1 if there's a packed file */ -int BKE_pack_check(ID *id) +bool BKE_pack_check(ID *id) { if (GS(id->name) == ID_IM) { Image *ima = (Image *)id; @@ -635,7 +635,7 @@ int BKE_pack_check(ID *id) Library *li = (Library *)id; return li->packedfile != NULL; } - return 0; + return false; } /* ID should be not NULL */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index a4949e3b338..74d43b61429 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3062,30 +3062,30 @@ static void free_anim_seq(Sequence *seq) } /* check whether sequence cur depends on seq */ -int BKE_sequence_check_depend(Sequence *seq, Sequence *cur) +bool BKE_sequence_check_depend(Sequence *seq, Sequence *cur) { if (cur->seq1 == seq || cur->seq2 == seq || cur->seq3 == seq) - return TRUE; + return true; /* sequences are not intersecting in time, assume no dependency exists between them */ if (cur->enddisp < seq->startdisp || cur->startdisp > seq->enddisp) - return FALSE; + return false; /* checking sequence is below reference one, not dependent on it */ if (cur->machine < seq->machine) - return FALSE; + return false; /* sequence is not blending with lower machines, no dependency here occurs * check for non-effects only since effect could use lower machines as input */ if ((cur->type & SEQ_TYPE_EFFECT) == 0 && - ((cur->blend_mode == SEQ_BLEND_REPLACE) || - (cur->blend_mode == SEQ_TYPE_CROSS && cur->blend_opacity == 100.0f))) + ((cur->blend_mode == SEQ_BLEND_REPLACE) || + (cur->blend_mode == SEQ_TYPE_CROSS && cur->blend_opacity == 100.0f))) { - return FALSE; + return false; } - return TRUE; + return true; } static void sequence_do_invalidate_dependent(Sequence *seq, ListBase *seqbase) @@ -3291,7 +3291,7 @@ void BKE_sequence_tx_set_final_right(Sequence *seq, int val) /* used so we can do a quick check for single image seq * since they work a bit differently to normal image seq's (during transform) */ -int BKE_sequence_single_check(Sequence *seq) +bool BKE_sequence_single_check(Sequence *seq) { return ((seq->len == 1) && (seq->type == SEQ_TYPE_IMAGE || @@ -3300,21 +3300,21 @@ int BKE_sequence_single_check(Sequence *seq) } /* check if the selected seq's reference unselected seq's */ -int BKE_sequence_base_isolated_sel_check(ListBase *seqbase) +bool BKE_sequence_base_isolated_sel_check(ListBase *seqbase) { Sequence *seq; /* is there more than 1 select */ - int ok = FALSE; + bool ok = false; for (seq = seqbase->first; seq; seq = seq->next) { if (seq->flag & SELECT) { - ok = TRUE; + ok = true; break; } } - if (ok == FALSE) - return FALSE; + if (ok == false) + return false; /* test relationships */ for (seq = seqbase->first; seq; seq = seq->next) { @@ -3322,24 +3322,24 @@ int BKE_sequence_base_isolated_sel_check(ListBase *seqbase) continue; if (seq->flag & SELECT) { - if ( (seq->seq1 && (seq->seq1->flag & SELECT) == 0) || - (seq->seq2 && (seq->seq2->flag & SELECT) == 0) || - (seq->seq3 && (seq->seq3->flag & SELECT) == 0) ) + if ((seq->seq1 && (seq->seq1->flag & SELECT) == 0) || + (seq->seq2 && (seq->seq2->flag & SELECT) == 0) || + (seq->seq3 && (seq->seq3->flag & SELECT) == 0) ) { - return FALSE; + return false; } } else { - if ( (seq->seq1 && (seq->seq1->flag & SELECT)) || - (seq->seq2 && (seq->seq2->flag & SELECT)) || - (seq->seq3 && (seq->seq3->flag & SELECT)) ) + if ((seq->seq1 && (seq->seq1->flag & SELECT)) || + (seq->seq2 && (seq->seq2->flag & SELECT)) || + (seq->seq3 && (seq->seq3->flag & SELECT)) ) { - return FALSE; + return false; } } } - return TRUE; + return true; } /* use to impose limits when dragging/extending - so impossible situations don't happen @@ -3405,29 +3405,29 @@ void BKE_sequence_single_fix(Sequence *seq) } } -int BKE_sequence_tx_test(Sequence *seq) +bool BKE_sequence_tx_test(Sequence *seq) { return (seq->type < SEQ_TYPE_EFFECT) || (BKE_sequence_effect_get_num_inputs(seq->type) == 0); } -static int seq_overlap(Sequence *seq1, Sequence *seq2) +static bool seq_overlap(Sequence *seq1, Sequence *seq2) { return (seq1 != seq2 && seq1->machine == seq2->machine && ((seq1->enddisp <= seq2->startdisp) || (seq1->startdisp >= seq2->enddisp)) == 0); } -int BKE_sequence_test_overlap(ListBase *seqbasep, Sequence *test) +bool BKE_sequence_test_overlap(ListBase *seqbasep, Sequence *test) { Sequence *seq; seq = seqbasep->first; while (seq) { if (seq_overlap(test, seq)) - return 1; + return true; seq = seq->next; } - return 0; + return false; } @@ -3487,7 +3487,7 @@ Sequence *BKE_sequencer_foreground_frame_get(Scene *scene, int frame) } /* return 0 if there werent enough space */ -int BKE_sequence_base_shuffle(ListBase *seqbasep, Sequence *test, Scene *evil_scene) +bool BKE_sequence_base_shuffle(ListBase *seqbasep, Sequence *test, Scene *evil_scene) { int orig_machine = test->machine; test->machine++; @@ -3518,10 +3518,10 @@ int BKE_sequence_base_shuffle(ListBase *seqbasep, Sequence *test, Scene *evil_sc BKE_sequence_translate(evil_scene, test, new_frame - test->start); BKE_sequence_calc(evil_scene, test); - return 0; + return false; } else { - return 1; + return true; } } @@ -3572,7 +3572,7 @@ static int shuffle_seq_time_offset(Scene *scene, ListBase *seqbasep, char dir) return tot_ofs; } -int BKE_sequence_base_shuffle_time(ListBase *seqbasep, Scene *evil_scene) +bool BKE_sequence_base_shuffle_time(ListBase *seqbasep, Scene *evil_scene) { /* note: seq->tmp is used to tag strips to move */ @@ -3591,7 +3591,7 @@ int BKE_sequence_base_shuffle_time(ListBase *seqbasep, Scene *evil_scene) } } - return offset ? 0 : 1; + return offset ? false : true; } void BKE_sequencer_update_sound_bounds_all(Scene *scene) @@ -4324,7 +4324,7 @@ void BKE_sequence_base_dupli_recursive(Scene *scene, Scene *scene_to, ListBase * /* called on draw, needs to be fast, * we could cache and use a flag if we want to make checks for file paths resolving for eg. */ -int BKE_sequence_is_valid_check(Sequence *seq) +bool BKE_sequence_is_valid_check(Sequence *seq) { switch (seq->type) { case SEQ_TYPE_MASK: @@ -4337,6 +4337,6 @@ int BKE_sequence_is_valid_check(Sequence *seq) return (seq->sound != NULL); } - return TRUE; + return true; } diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 2ccc28dc07b..97564ca5363 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -130,7 +130,7 @@ void BLI_ghashIterator_step(GHashIterator *ghi); * \param ghi The iterator. * \return True if done, False otherwise. */ -int BLI_ghashIterator_notDone(GHashIterator *ghi); +bool BLI_ghashIterator_notDone(GHashIterator *ghi); #define GHASH_ITER(gh_iter_, ghash_) \ for (BLI_ghashIterator_init(&gh_iter_, ghash_); \ diff --git a/source/blender/blenlib/BLI_gsqueue.h b/source/blender/blenlib/BLI_gsqueue.h index b4cb1edd45a..b9d8a8f9d14 100644 --- a/source/blender/blenlib/BLI_gsqueue.h +++ b/source/blender/blenlib/BLI_gsqueue.h @@ -47,7 +47,7 @@ GSQueue *BLI_gsqueue_new(int elem_size); /** * Query if the queue is empty */ -int BLI_gsqueue_is_empty(GSQueue *gq); +bool BLI_gsqueue_is_empty(GSQueue *gq); /** * Query number elements in the queue diff --git a/source/blender/blenlib/BLI_heap.h b/source/blender/blenlib/BLI_heap.h index c0941e00c9b..bc7b6000322 100644 --- a/source/blender/blenlib/BLI_heap.h +++ b/source/blender/blenlib/BLI_heap.h @@ -54,7 +54,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr); void BLI_heap_remove(Heap *heap, HeapNode *node); /* Return 0 if the heap is empty, 1 otherwise. */ -int BLI_heap_is_empty(Heap *heap); +bool BLI_heap_is_empty(Heap *heap); /* Return the size of the heap. */ unsigned int BLI_heap_size(Heap *heap); diff --git a/source/blender/blenlib/BLI_lasso.h b/source/blender/blenlib/BLI_lasso.h index a7e90a51e86..0addd463a70 100644 --- a/source/blender/blenlib/BLI_lasso.h +++ b/source/blender/blenlib/BLI_lasso.h @@ -35,7 +35,7 @@ struct rcti; void BLI_lasso_boundbox(struct rcti *rect, const int mcords[][2], const short moves); -int BLI_lasso_is_point_inside(const int mcords[][2], const short moves, const int sx, const int sy, const int error_value); -int BLI_lasso_is_edge_inside(const int mcords[][2], const short moves, int x0, int y0, int x1, int y1, const int error_value); +bool BLI_lasso_is_point_inside(const int mcords[][2], const short moves, const int sx, const int sy, const int error_value); +bool BLI_lasso_is_edge_inside(const int mcords[][2], const short moves, int x0, int y0, int x1, int y1, const int error_value); #endif diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index 3c9363039b2..9ce75de5ea8 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -43,8 +43,8 @@ struct rcti; extern "C" { #endif -int BLI_rcti_is_empty(const struct rcti *rect); -int BLI_rctf_is_empty(const struct rctf *rect); +bool BLI_rcti_is_empty(const struct rcti *rect); +bool BLI_rctf_is_empty(const struct rctf *rect); void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax); void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax); void BLI_rcti_init_minmax(struct rcti *rect); @@ -60,18 +60,18 @@ void BLI_rcti_scale(rcti *rect, const float scale); void BLI_rctf_scale(rctf *rect, const float scale); void BLI_rctf_interp(struct rctf *rect, const struct rctf *rect_a, const struct rctf *rect_b, const float fac); //void BLI_rcti_interp(struct rctf *rect, struct rctf *rect_a, struct rctf *rect_b, float fac); -int BLI_rctf_clamp_pt_v(const struct rctf *rect, float xy[2]); -int BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2]); -int BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit); -int BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b); -int BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest); -int BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest); -int BLI_rcti_isect_pt(const struct rcti *rect, const int x, const int y); -int BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2]); -int BLI_rctf_isect_pt(const struct rctf *rect, const float x, const float y); -int BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2]); -int BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2]); -int BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2]); +bool BLI_rctf_clamp_pt_v(const struct rctf *rect, float xy[2]); +bool BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2]); +bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit); +bool BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b); +bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest); +bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest); +bool BLI_rcti_isect_pt(const struct rcti *rect, const int x, const int y); +bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2]); +bool BLI_rctf_isect_pt(const struct rctf *rect, const float x, const float y); +bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2]); +bool BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2]); +bool BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2]); void BLI_rctf_union(struct rctf *rctf1, const struct rctf *rctf2); void BLI_rcti_union(struct rcti *rcti1, const struct rcti *rcti2); void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src); diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index c3b3a3e348c..ebc40ebc5e3 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -271,7 +271,7 @@ void BLI_ghashIterator_step(GHashIterator *ghi) } } } -int BLI_ghashIterator_notDone(GHashIterator *ghi) +bool BLI_ghashIterator_notDone(GHashIterator *ghi) { return ghi->curEntry != NULL; } diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index aa54969b6f8..53489c76962 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -33,9 +33,10 @@ #include #include "MEM_guardedalloc.h" + +#include "BLI_utildefines.h" #include "BLI_memarena.h" #include "BLI_heap.h" -#include "BLI_utildefines.h" /***/ @@ -183,7 +184,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr) return node; } -int BLI_heap_is_empty(Heap *heap) +bool BLI_heap_is_empty(Heap *heap) { return (heap->size == 0); } diff --git a/source/blender/blenlib/intern/gsqueue.c b/source/blender/blenlib/intern/gsqueue.c index d569534f2f3..272f840296e 100644 --- a/source/blender/blenlib/intern/gsqueue.c +++ b/source/blender/blenlib/intern/gsqueue.c @@ -32,6 +32,8 @@ #include #include "MEM_guardedalloc.h" + +#include "BLI_utildefines.h" #include "BLI_gsqueue.h" typedef struct _GSQueueElem GSQueueElem; @@ -54,7 +56,7 @@ GSQueue *BLI_gsqueue_new(int elem_size) return gq; } -int BLI_gsqueue_is_empty(GSQueue *gq) +bool BLI_gsqueue_is_empty(GSQueue *gq) { return (gq->head == NULL); } diff --git a/source/blender/blenlib/intern/lasso.c b/source/blender/blenlib/intern/lasso.c index 5cd8bb813a1..024c1010765 100644 --- a/source/blender/blenlib/intern/lasso.c +++ b/source/blender/blenlib/intern/lasso.c @@ -53,9 +53,9 @@ void BLI_lasso_boundbox(rcti *rect, const int mcords[][2], const short moves) } -int BLI_lasso_is_point_inside(const int mcords[][2], const short moves, - const int sx, const int sy, - const int error_value) +bool BLI_lasso_is_point_inside(const int mcords[][2], const short moves, + const int sx, const int sy, + const int error_value) { /* we do the angle rule, define that all added angles should be about zero or (2 * PI) */ float angletot = 0.0, dot, ang, cross, fp1[2], fp2[2]; @@ -63,7 +63,7 @@ int BLI_lasso_is_point_inside(const int mcords[][2], const short moves, const int *p1, *p2; if (sx == error_value) { - return 0; + return false; } p1 = mcords[moves - 1]; @@ -95,35 +95,35 @@ int BLI_lasso_is_point_inside(const int mcords[][2], const short moves, p2 = mcords[a + 1]; } - if (fabsf(angletot) > 4.0f) return 1; - return 0; + if (fabsf(angletot) > 4.0f) return true; + return false; } /* edge version for lasso select. we assume boundbox check was done */ -int BLI_lasso_is_edge_inside(const int mcords[][2], const short moves, - int x0, int y0, int x1, int y1, - const int error_value) +bool BLI_lasso_is_edge_inside(const int mcords[][2], const short moves, + int x0, int y0, int x1, int y1, + const int error_value) { int v1[2], v2[2]; int a; if (x0 == error_value || x1 == error_value) { - return 0; + return false; } v1[0] = x0, v1[1] = y0; v2[0] = x1, v2[1] = y1; /* check points in lasso */ - if (BLI_lasso_is_point_inside(mcords, moves, v1[0], v1[1], error_value)) return 1; - if (BLI_lasso_is_point_inside(mcords, moves, v2[0], v2[1], error_value)) return 1; + if (BLI_lasso_is_point_inside(mcords, moves, v1[0], v1[1], error_value)) return true; + if (BLI_lasso_is_point_inside(mcords, moves, v2[0], v2[1], error_value)) return true; /* no points in lasso, so we have to intersect with lasso edge */ - if (isect_line_line_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) return 1; + if (isect_line_line_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) return true; for (a = 0; a < moves - 1; a++) { - if (isect_line_line_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) return 1; + if (isect_line_line_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) return true; } - return 0; + return false; } diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 4bd7715ea7a..127855161c0 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -48,23 +48,23 @@ * * \return True if \a rect is empty. */ -int BLI_rcti_is_empty(const rcti *rect) +bool BLI_rcti_is_empty(const rcti *rect) { return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin)); } -int BLI_rctf_is_empty(const rctf *rect) +bool BLI_rctf_is_empty(const rctf *rect) { return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin)); } -int BLI_rcti_isect_pt(const rcti *rect, const int x, const int y) +bool BLI_rcti_isect_pt(const rcti *rect, const int x, const int y) { - if (x < rect->xmin) return 0; - if (x > rect->xmax) return 0; - if (y < rect->ymin) return 0; - if (y > rect->ymax) return 0; - return 1; + if (x < rect->xmin) return false; + if (x > rect->xmax) return false; + if (y < rect->ymin) return false; + if (y > rect->ymax) return false; + return true; } /** @@ -74,31 +74,31 @@ int BLI_rcti_isect_pt(const rcti *rect, const int x, const int y) * * \return True if \a rect is empty. */ -int BLI_rcti_isect_pt_v(const rcti *rect, const int xy[2]) +bool BLI_rcti_isect_pt_v(const rcti *rect, const int xy[2]) { - if (xy[0] < rect->xmin) return 0; - if (xy[0] > rect->xmax) return 0; - if (xy[1] < rect->ymin) return 0; - if (xy[1] > rect->ymax) return 0; - return 1; + if (xy[0] < rect->xmin) return false; + if (xy[0] > rect->xmax) return false; + if (xy[1] < rect->ymin) return false; + if (xy[1] > rect->ymax) return false; + return true; } -int BLI_rctf_isect_pt(const rctf *rect, const float x, const float y) +bool BLI_rctf_isect_pt(const rctf *rect, const float x, const float y) { - if (x < rect->xmin) return 0; - if (x > rect->xmax) return 0; - if (y < rect->ymin) return 0; - if (y > rect->ymax) return 0; - return 1; + if (x < rect->xmin) return false; + if (x > rect->xmax) return false; + if (y < rect->ymin) return false; + if (y > rect->ymax) return false; + return true; } -int BLI_rctf_isect_pt_v(const rctf *rect, const float xy[2]) +bool BLI_rctf_isect_pt_v(const rctf *rect, const float xy[2]) { - if (xy[0] < rect->xmin) return 0; - if (xy[0] > rect->xmax) return 0; - if (xy[1] < rect->ymin) return 0; - if (xy[1] > rect->ymax) return 0; - return 1; + if (xy[0] < rect->xmin) return false; + if (xy[0] > rect->xmax) return false; + if (xy[1] < rect->ymin) return false; + if (xy[1] > rect->ymax) return false; + return true; } /* based closely on 'isect_line_line_v2_int', but in modified so corner cases are treated as intersections */ @@ -127,17 +127,17 @@ static int isect_segments_fl(const float v1[2], const float v2[2], const float v } } -int BLI_rcti_isect_segment(const rcti *rect, const int s1[2], const int s2[2]) +bool BLI_rcti_isect_segment(const rcti *rect, const int s1[2], const int s2[2]) { /* first do outside-bounds check for both points of the segment */ - if (s1[0] < rect->xmin && s2[0] < rect->xmin) return 0; - if (s1[0] > rect->xmax && s2[0] > rect->xmax) return 0; - if (s1[1] < rect->ymin && s2[1] < rect->ymin) return 0; - if (s1[1] > rect->ymax && s2[1] > rect->ymax) return 0; + if (s1[0] < rect->xmin && s2[0] < rect->xmin) return false; + if (s1[0] > rect->xmax && s2[0] > rect->xmax) return false; + if (s1[1] < rect->ymin && s2[1] < rect->ymin) return false; + if (s1[1] > rect->ymax && s2[1] > rect->ymax) return false; /* if either points intersect then we definetly intersect */ if (BLI_rcti_isect_pt_v(rect, s1) || BLI_rcti_isect_pt_v(rect, s2)) { - return 1; + return true; } else { /* both points are outside but may insersect the rect */ @@ -147,32 +147,32 @@ int BLI_rcti_isect_segment(const rcti *rect, const int s1[2], const int s2[2]) tvec1[0] = rect->xmin; tvec1[1] = rect->ymin; tvec2[0] = rect->xmin; tvec2[1] = rect->ymax; if (isect_segments_i(s1, s2, tvec1, tvec2)) { - return 1; + return true; } /* diagonal: [\] */ tvec1[0] = rect->xmin; tvec1[1] = rect->ymax; tvec2[0] = rect->xmax; tvec2[1] = rect->ymin; if (isect_segments_i(s1, s2, tvec1, tvec2)) { - return 1; + return true; } /* no intersection */ - return 0; + return false; } } -int BLI_rctf_isect_segment(const rctf *rect, const float s1[2], const float s2[2]) +bool BLI_rctf_isect_segment(const rctf *rect, const float s1[2], const float s2[2]) { /* first do outside-bounds check for both points of the segment */ - if (s1[0] < rect->xmin && s2[0] < rect->xmin) return 0; - if (s1[0] > rect->xmax && s2[0] > rect->xmax) return 0; - if (s1[1] < rect->ymin && s2[1] < rect->ymin) return 0; - if (s1[1] > rect->ymax && s2[1] > rect->ymax) return 0; + if (s1[0] < rect->xmin && s2[0] < rect->xmin) return false; + if (s1[0] > rect->xmax && s2[0] > rect->xmax) return false; + if (s1[1] < rect->ymin && s2[1] < rect->ymin) return false; + if (s1[1] > rect->ymax && s2[1] > rect->ymax) return false; /* if either points intersect then we definetly intersect */ if (BLI_rctf_isect_pt_v(rect, s1) || BLI_rctf_isect_pt_v(rect, s2)) { - return 1; + return true; } else { /* both points are outside but may insersect the rect */ @@ -182,18 +182,18 @@ int BLI_rctf_isect_segment(const rctf *rect, const float s1[2], const float s2[2 tvec1[0] = rect->xmin; tvec1[1] = rect->ymin; tvec2[0] = rect->xmin; tvec2[1] = rect->ymax; if (isect_segments_fl(s1, s2, tvec1, tvec2)) { - return 1; + return true; } /* diagonal: [\] */ tvec1[0] = rect->xmin; tvec1[1] = rect->ymax; tvec2[0] = rect->xmax; tvec2[1] = rect->ymin; if (isect_segments_fl(s1, s2, tvec1, tvec2)) { - return 1; + return true; } /* no intersection */ - return 0; + return false; } } @@ -353,49 +353,49 @@ void BLI_rctf_interp(rctf *rect, const rctf *rect_a, const rctf *rect_b, const f /* BLI_rcti_interp() not needed yet */ -int BLI_rctf_clamp_pt_v(const struct rctf *rect, float xy[2]) +bool BLI_rctf_clamp_pt_v(const struct rctf *rect, float xy[2]) { - int change = 0; - if (xy[0] < rect->xmin) { xy[0] = rect->xmin; change = 1; } - if (xy[0] > rect->xmax) { xy[0] = rect->xmax; change = 1; } - if (xy[1] < rect->ymin) { xy[1] = rect->ymin; change = 1; } - if (xy[1] > rect->ymax) { xy[1] = rect->ymax; change = 1; } + bool change = false; + if (xy[0] < rect->xmin) { xy[0] = rect->xmin; change = true; } + if (xy[0] > rect->xmax) { xy[0] = rect->xmax; change = true; } + if (xy[1] < rect->ymin) { xy[1] = rect->ymin; change = true; } + if (xy[1] > rect->ymax) { xy[1] = rect->ymax; change = true; } return change; } -int BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2]) +bool BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2]) { - int change = 0; - if (xy[0] < rect->xmin) { xy[0] = rect->xmin; change = 1; } - if (xy[0] > rect->xmax) { xy[0] = rect->xmax; change = 1; } - if (xy[1] < rect->ymin) { xy[1] = rect->ymin; change = 1; } - if (xy[1] > rect->ymax) { xy[1] = rect->ymax; change = 1; } + bool change = false; + if (xy[0] < rect->xmin) { xy[0] = rect->xmin; change = true; } + if (xy[0] > rect->xmax) { xy[0] = rect->xmax; change = true; } + if (xy[1] < rect->ymin) { xy[1] = rect->ymin; change = true; } + if (xy[1] > rect->ymax) { xy[1] = rect->ymax; change = true; } return change; } -int BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit) +bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit) { if (fabsf(rect_a->xmin - rect_b->xmin) < limit) if (fabsf(rect_a->xmax - rect_b->xmax) < limit) if (fabsf(rect_a->ymin - rect_b->ymin) < limit) if (fabsf(rect_a->ymax - rect_b->ymax) < limit) - return 1; + return true; - return 0; + return false; } -int BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b) +bool BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b) { if (rect_a->xmin == rect_b->xmin) if (rect_a->xmax == rect_b->xmax) if (rect_a->ymin == rect_b->ymin) if (rect_a->ymax == rect_b->ymax) - return 1; + return true; - return 0; + return false; } -int BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest) +bool BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest) { float xmin, xmax; float ymin, ymax; @@ -412,7 +412,7 @@ int BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest) dest->ymin = ymin; dest->ymax = ymax; } - return 1; + return true; } else { if (dest) { @@ -421,11 +421,11 @@ int BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest) dest->ymin = 0; dest->ymax = 0; } - return 0; + return false; } } -int BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest) +bool BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest) { int xmin, xmax; int ymin, ymax; @@ -442,7 +442,7 @@ int BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest) dest->ymin = ymin; dest->ymax = ymax; } - return 1; + return true; } else { if (dest) { @@ -451,7 +451,7 @@ int BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest) dest->ymin = 0; dest->ymax = 0; } - return 0; + return false; } } diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index ae07c2cf0bc..7f96cd990ec 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -26,12 +26,12 @@ #include "MEM_guardedalloc.h" -#include "BLI_heap.h" #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_array.h" #include "BLI_smallhash.h" #include "BLI_rand.h" +#include "BLI_heap.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index ba755a866de..8c5694dd4bf 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -29,10 +29,10 @@ #include "DNA_meshdata_types.h" #include "BLI_array.h" -#include "BLI_heap.h" #include "BLI_math.h" #include "BLI_math_geom.h" #include "BLI_smallhash.h" +#include "BLI_heap.h" #include "BKE_customdata.h" #include "BKE_mesh.h" diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index fead8a9d990..0c1346dd034 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -38,6 +38,8 @@ #include "DNA_space_types.h" #include "DNA_object_types.h" +#include "BLI_math.h" + #include "BKE_context.h" #include "BKE_brush.h" #include "BKE_main.h" @@ -47,8 +49,6 @@ #include "ED_screen.h" -#include "BLI_math.h" - #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" #include "IMB_colormanagement.h" diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index cfeacff7f4a..c493ecb7b44 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1700,7 +1700,7 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int { ImBuf *colormanaged_ibuf = ibuf; int do_colormanagement; - int is_movie = BKE_imtype_is_movie(image_format_data->imtype); + bool is_movie = BKE_imtype_is_movie(image_format_data->imtype); int requires_linear_float = BKE_imtype_requires_linear_float(image_format_data->imtype); int do_alpha_under = image_format_data->planes != R_IMF_PLANES_RGBA;