From 8655be437dc46af6b64e3d1e96dba5173cce9450 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Mar 2013 23:14:18 +0000 Subject: code cleanup: use bool where values are true/false, for view3d and related functions. --- source/blender/blenkernel/BKE_anim.h | 4 +- source/blender/blenkernel/BKE_camera.h | 2 +- source/blender/blenkernel/BKE_deform.h | 13 +- source/blender/blenkernel/BKE_displist.h | 4 +- source/blender/blenkernel/BKE_object.h | 10 +- source/blender/blenkernel/BKE_sequencer.h | 2 +- source/blender/blenkernel/intern/anim.c | 6 +- source/blender/blenkernel/intern/camera.c | 2 +- source/blender/blenkernel/intern/deform.c | 10 +- source/blender/blenkernel/intern/displist.c | 12 +- source/blender/blenkernel/intern/object.c | 12 +- source/blender/blenlib/BLI_math_geom.h | 4 +- source/blender/blenlib/intern/math_geom.c | 4 +- source/blender/editors/gpencil/drawgpencil.c | 2 +- source/blender/editors/include/ED_gpencil.h | 2 +- source/blender/editors/include/ED_transform.h | 2 +- source/blender/editors/include/ED_view3d.h | 36 ++-- source/blender/editors/space_view3d/drawarmature.c | 45 ++-- source/blender/editors/space_view3d/drawmesh.c | 30 +-- source/blender/editors/space_view3d/drawobject.c | 232 +++++++++++---------- source/blender/editors/space_view3d/drawvolume.c | 2 +- source/blender/editors/space_view3d/space_view3d.c | 10 +- .../blender/editors/space_view3d/view3d_buttons.c | 12 +- source/blender/editors/space_view3d/view3d_draw.c | 99 ++++----- source/blender/editors/space_view3d/view3d_edit.c | 113 +++++----- source/blender/editors/space_view3d/view3d_fly.c | 84 ++++---- .../blender/editors/space_view3d/view3d_header.c | 4 +- .../blender/editors/space_view3d/view3d_intern.h | 16 +- .../blender/editors/space_view3d/view3d_project.c | 34 +-- source/blender/editors/space_view3d/view3d_snap.c | 8 +- source/blender/editors/space_view3d/view3d_view.c | 56 ++--- .../editors/transform/transform_orientations.c | 2 +- source/blender/gpu/GPU_draw.h | 4 +- source/blender/gpu/intern/gpu_draw.c | 8 +- source/blender/render/extern/include/RE_engine.h | 2 +- .../blender/render/intern/source/external_engine.c | 2 +- 36 files changed, 446 insertions(+), 444 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 11537964e32..539c5780cd5 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -65,8 +65,8 @@ int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], fl /* ---------------------------------------------------- */ /* Dupli-Geometry */ -struct ListBase *object_duplilist_ex(struct Scene *sce, struct Object *ob, int update, int for_render); -struct ListBase *object_duplilist(struct Scene *sce, struct Object *ob, int for_render); +struct ListBase *object_duplilist_ex(struct Scene *sce, struct Object *ob, bool update, bool for_render); +struct ListBase *object_duplilist(struct Scene *sce, struct Object *ob, bool for_render); void free_object_duplilist(struct ListBase *lb); int count_duplilist(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index 057cd79b9e4..a07558cc8af 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -112,7 +112,7 @@ void BKE_camera_params_compute_matrix(CameraParams *params); /* Camera View Frame */ -void BKE_camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3], +void BKE_camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const bool do_clip, const float scale[3], float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]); void BKE_camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]); diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index b209e8bf667..b18bb5a87b6 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -43,9 +43,9 @@ struct MDeformVert; void defgroup_copy_list(struct ListBase *lb1, struct ListBase *lb2); struct bDeformGroup *defgroup_duplicate(struct bDeformGroup *ingroup); struct bDeformGroup *defgroup_find_name(struct Object *ob, const char *name); -int *defgroup_flip_map(struct Object *ob, int *flip_map_len, int use_default); -int *defgroup_flip_map_single(struct Object *ob, int *flip_map_len, int use_default, int defgroup); -int defgroup_flip_index(struct Object *ob, int index, int use_default); +int *defgroup_flip_map(struct Object *ob, int *flip_map_len, const bool use_default); +int *defgroup_flip_map_single(struct Object *ob, int *flip_map_len, const bool use_default, int defgroup); +int defgroup_flip_index(struct Object *ob, int index, const bool use_default); int defgroup_name_index(struct Object *ob, const char *name); void defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob); @@ -66,9 +66,9 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int void defvert_copy(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src); void defvert_copy_index(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const int defgroup); -void defvert_sync(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, int use_verify); +void defvert_sync(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const bool use_verify); void defvert_sync_mapped(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, - const int *flip_map, const int flip_map_len, const int use_verify); + const int *flip_map, const int flip_map_len, const bool use_verify); void defvert_remap(struct MDeformVert *dvert, int *map, const int map_len); void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len); void defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len); @@ -84,5 +84,4 @@ void BKE_deform_split_prefix(const char string[MAX_VGROUP_NAME], char base[MAX_V void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_NAME], int strip_number); -#endif - +#endif /* __BKE_DEFORM_H__ */ diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index 6b986cdceda..10c31189d02 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -85,7 +85,7 @@ DispList *BKE_displist_find(struct ListBase *lb, int type); void BKE_displist_normals_add(struct ListBase *lb); void BKE_displist_count(struct ListBase *lb, int *totvert, int *totface, int *tottri); void BKE_displist_free(struct ListBase *lb); -int BKE_displist_has_faces(struct ListBase *lb); +bool BKE_displist_has_faces(struct ListBase *lb); void BKE_displist_make_surf(struct Scene *scene, struct Object *ob, struct ListBase *dispbase, struct DerivedMesh **derivedFinal, int forRender, int forOrco); void BKE_displist_make_curveTypes(struct Scene *scene, struct Object *ob, int forOrco); @@ -94,7 +94,7 @@ void BKE_displist_make_curveTypes_forOrco(struct Scene *scene, struct Object *ob void BKE_displist_make_mball(struct Scene *scene, struct Object *ob); void BKE_displist_make_mball_forRender(struct Scene *scene, struct Object *ob, struct ListBase *dispbase); -int BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4); +bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4); void BKE_displist_fill(struct ListBase *dispbase, struct ListBase *to, int flipnormal); float BKE_displist_calc_taper(struct Scene *scene, struct Object *taperobj, int cur, int tot); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 5caa484caa0..da5fa3e8195 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -91,11 +91,11 @@ 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); -void BKE_object_mat3_to_rot(struct Object *ob, float mat[3][3], short use_compat); +void BKE_object_rot_to_mat3(struct Object *ob, float mat[3][3], bool use_drot); +void BKE_object_mat3_to_rot(struct Object *ob, float mat[3][3], bool use_compat); void BKE_object_to_mat3(struct Object *ob, float mat[3][3]); void BKE_object_to_mat4(struct Object *ob, float mat[4][4]); -void BKE_object_apply_mat4(struct Object *ob, float mat[4][4], const short use_compat, const short use_parent); +void BKE_object_apply_mat4(struct Object *ob, float mat[4][4], const bool use_compat, const bool use_parent); int BKE_object_pose_context_check(struct Object *ob); struct Object *BKE_object_pose_armature_get(struct Object *ob); @@ -117,8 +117,8 @@ struct BoundBox *BKE_object_boundbox_get(struct Object *ob); void BKE_object_dimensions_get(struct Object *ob, float vec[3]); void BKE_object_dimensions_set(struct Object *ob, const float *value); void BKE_object_boundbox_flag(struct Object *ob, int flag, int set); -void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const short use_hidden); -int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], const short use_hidden); +void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden); +int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden); /* sometimes min-max isn't enough, we need to loop over each point */ void BKE_object_foreach_display_point(struct Object *ob, float obmat[4][4], diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index a46d947b9d9..9586df6d119 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -368,7 +368,7 @@ struct Sequence *BKE_sequencer_add_sound_strip(struct bContext *C, ListBase *seq struct Sequence *BKE_sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); /* view3d draw callback, run when not in background view */ -typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, int, int, int, char[256]); +typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, bool, bool, int, char[256]); extern SequencerDrawView sequencer_view3d_cb; /* copy/paste */ diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index ddb4cc4391a..ad791852253 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1712,7 +1712,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas /* Returns a list of DupliObject * note; group dupli's already set transform matrix. see note in group_duplilist() */ -ListBase *object_duplilist_ex(Scene *sce, Object *ob, int update, int for_render) +ListBase *object_duplilist_ex(Scene *sce, Object *ob, bool update, bool for_render) { ListBase *duplilist = MEM_mallocN(sizeof(ListBase), "duplilist"); int persistent_id[MAX_DUPLI_RECUR] = {0}; @@ -1728,9 +1728,9 @@ ListBase *object_duplilist_ex(Scene *sce, Object *ob, int update, int for_render /* note: previously updating was always done, this is why it defaults to be on * but there are likely places it can be called without updating */ -ListBase *object_duplilist(Scene *sce, Object *ob, int for_render) +ListBase *object_duplilist(Scene *sce, Object *ob, bool for_render) { - return object_duplilist_ex(sce, ob, TRUE, for_render); + return object_duplilist_ex(sce, ob, true, for_render); } diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 34c2d144f4c..ae1fa3025b9 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -371,7 +371,7 @@ void BKE_camera_params_compute_matrix(CameraParams *params) /***************************** Camera View Frame *****************************/ -void BKE_camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3], +void BKE_camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const bool do_clip, const float scale[3], float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]) { float facx, facy; diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 2ba71ecd9b5..7543892f2e3 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -126,7 +126,7 @@ void defvert_copy_index(MDeformVert *dvert_dst, const MDeformVert *dvert_src, co /* only sync over matching weights, don't add or remove groups * warning, loop within loop. */ -void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, int use_verify) +void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, const bool use_verify) { if (dvert_src->totweight && dvert_dst->totweight) { int i; @@ -145,7 +145,7 @@ void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, int use_ /* be sure all flip_map values are valid */ void defvert_sync_mapped(MDeformVert *dvert_dst, const MDeformVert *dvert_src, - const int *flip_map, const int flip_map_len, const int use_verify) + const int *flip_map, const int flip_map_len, const bool use_verify) { if (dvert_src->totweight && dvert_dst->totweight) { int i; @@ -346,7 +346,7 @@ int defgroup_name_index(Object *ob, const char *name) } /* note, must be freed */ -int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default) +int *defgroup_flip_map(Object *ob, int *flip_map_len, const bool use_default) { int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase); @@ -384,7 +384,7 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default) } /* note, must be freed */ -int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, int defgroup) +int *defgroup_flip_map_single(Object *ob, int *flip_map_len, const bool use_default, int defgroup) { int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase); @@ -416,7 +416,7 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, in } } -int defgroup_flip_index(Object *ob, int index, int use_default) +int defgroup_flip_index(Object *ob, int index, const bool use_default) { bDeformGroup *dg = BLI_findlink(&ob->defbase, index); int flip_index = -1; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 6f85d4de60e..e4d7814c4e1 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -122,17 +122,17 @@ DispList *BKE_displist_find(ListBase *lb, int type) return NULL; } -int BKE_displist_has_faces(ListBase *lb) +bool BKE_displist_has_faces(ListBase *lb) { DispList *dl; for (dl = lb->first; dl; dl = dl->next) { if (ELEM3(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) { - return TRUE; + return true; } } - return FALSE; + return false; } void BKE_displist_copy(ListBase *lbn, ListBase *lb) @@ -271,10 +271,10 @@ void BKE_displist_count(ListBase *lb, int *totvert, int *totface, int *tottri) } } -int BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4) +bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4) { if ((dl->flag & DL_CYCL_V) == 0 && a == (dl->parts) - 1) { - return 0; + return false; } if (dl->flag & DL_CYCL_U) { @@ -297,7 +297,7 @@ int BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, in (*p4) -= dl->nr * dl->parts; } - return 1; + return true; } /* ****************** make displists ********************* */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 55ec5db419d..8d3e92975fe 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1581,7 +1581,7 @@ void BKE_object_scale_to_mat3(Object *ob, float mat[3][3]) size_to_mat3(mat, vec); } -void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], short use_drot) +void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot) { float rmat[3][3], dmat[3][3]; @@ -1618,7 +1618,7 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], short use_drot) copy_m3_m3(mat, rmat); } -void BKE_object_mat3_to_rot(Object *ob, float mat[3][3], short use_compat) +void BKE_object_mat3_to_rot(Object *ob, float mat[3][3], bool use_compat) { switch (ob->rotmode) { case ROT_MODE_QUAT: @@ -1721,7 +1721,7 @@ void BKE_object_tfm_protected_restore(Object *ob, } /* see BKE_pchan_apply_mat4() for the equivalent 'pchan' function */ -void BKE_object_apply_mat4(Object *ob, float mat[4][4], const short use_compat, const short use_parent) +void BKE_object_apply_mat4(Object *ob, float mat[4][4], const bool use_compat, const bool use_parent) { float rot[3][3]; @@ -2362,7 +2362,7 @@ void BKE_object_dimensions_set(Object *ob, const float *value) } } -void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const short use_hidden) +void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool use_hidden) { BoundBox bb; float vec[3]; @@ -2466,7 +2466,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const short u } } -int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const short use_hidden) +int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden) { int ok = FALSE; if ((ob->transflag & OB_DUPLI) == 0) { @@ -2478,7 +2478,7 @@ int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_ma lb = object_duplilist(scene, ob, FALSE); for (dob = lb->first; dob; dob = dob->next) { - if ((use_hidden == FALSE) && (dob->no_draw != 0)) { + if ((use_hidden == false) && (dob->no_draw != 0)) { /* pass */ } else { diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 94fa88801f0..7028c7c7530 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -118,7 +118,7 @@ int isect_ray_plane_v3(const float p1[3], const float d[3], float *r_lambda, const int clip); int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], - const float plane_co[3], const float plane_no[3], const short no_flip); + const float plane_co[3], const float plane_no[3], const bool no_flip); void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3], const float plane_a_co[3], const float plane_a_no[3], @@ -170,7 +170,7 @@ int isect_axial_line_tri_v3(const int axis, const float co1[3], const float co2[ int clip_line_plane(float p1[3], float p2[3], const float plane[4]); -void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int, void *), void *userData); +void plot_line_v2v2i(const int p1[2], const int p2[2], bool (*callback)(int, int, void *), void *userData); /****************************** Interpolation ********************************/ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 173c6d06861..579f397f833 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -1087,7 +1087,7 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], */ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], - const float plane_co[3], const float plane_no[3], const short no_flip) + const float plane_co[3], const float plane_no[3], const bool no_flip) { float l_vec[3]; /* l1 -> l2 normalized vector */ float p_no[3]; /* 'plane_no' normalized */ @@ -1997,7 +1997,7 @@ int clip_line_plane(float p1[3], float p2[3], const float plane[4]) } } -void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int, void *), void *userData) +void plot_line_v2v2i(const int p1[2], const int p2[2], bool (*callback)(int, int, void *), void *userData) { int x1 = p1[0]; int y1 = p1[1]; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 09a7890a539..59850aff72f 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -757,7 +757,7 @@ void draw_gpencil_view2d(const bContext *C, short onlyv2d) /* draw grease-pencil sketches to specified 3d-view assuming that matrices are already set correctly * Note: this gets called twice - first time with only3d=1 to draw 3d-strokes, * second time with only3d=0 for screen-aligned strokes */ -void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, short only3d) +void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, bool only3d) { bGPdata *gpd; int dflag = 0; diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 29d4097521d..cb4a81be8b8 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -79,7 +79,7 @@ void ED_operatortypes_gpencil(void); void draw_gpencil_2dimage(const struct bContext *C); void draw_gpencil_view2d(const struct bContext *C, short onlyv2d); -void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d); +void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, bool only3d); void gpencil_panel_standard_header(const struct bContext *C, struct Panel *pa); void gpencil_panel_standard(const struct bContext *C, struct Panel *pa); diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 6101d03b946..505f0cb8d7b 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -125,7 +125,7 @@ void BIF_createTransformOrientation(struct bContext *C, struct ReportList *repor void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts); void BIF_selectTransformOrientationValue(struct bContext *C, int orientation); -void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], int activeOnly); +void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], const bool activeOnly); struct EnumPropertyItem *BIF_enumTransformOrientation(struct bContext *C); const char *BIF_menustringTransformOrientation(const struct bContext *C, const char *title); /* the returned value was allocated and needs to be freed after use */ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 4a24d937a2b..81f49b4e1f8 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -79,7 +79,7 @@ typedef struct ViewDepths { float *depths; double depth_range[2]; - char damaged; + bool damaged; } ViewDepths; float *give_cursor(struct Scene *scene, struct View3D *v3d); @@ -201,8 +201,10 @@ void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coo void ED_view3d_win_to_3d(const struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]); void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac); void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]); -void ED_view3d_win_to_segment(const struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]); -int ED_view3d_win_to_segment_clip(const struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]); +void ED_view3d_win_to_segment(const struct ARegion *ar, struct View3D *v3d, const float mval[2], + float ray_start[3], float ray_end[3]); +bool ED_view3d_win_to_segment_clip(const struct ARegion *ar, struct View3D *v3d, const float mval[2], + float ray_start[3], float ray_end[3]); void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void ED_view3d_unproject(struct bglMats *mats, float out[3], const float x, const float y, const float z); @@ -223,7 +225,7 @@ void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, const struct rcti *rect); void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]); -int ED_view3d_clipping_test(struct RegionView3D *rv3d, const float co[3], const bool is_local); +bool ED_view3d_clipping_test(struct RegionView3D *rv3d, const float co[3], const bool is_local); void ED_view3d_clipping_set(struct RegionView3D *rv3d); void ED_view3d_clipping_enable(void); void ED_view3d_clipping_disable(void); @@ -244,13 +246,13 @@ unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2 unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y); /* draws and does a 4x4 sample */ -int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride); +bool ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride); /* only draw so ED_view3d_autodist_simple can be called many times after */ -int ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode); -int ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth); -int ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth); -int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth); +void ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode); +bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth); +bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth); +bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth); /* select */ #define MAXPICKBUF 10000 @@ -268,7 +270,7 @@ bool edge_inside_circle(const float cent[2], float radius, const float screen_co /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); -int ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar); +bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar); int ED_operator_rv3d_user_region_poll(struct bContext *C); void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); @@ -276,19 +278,19 @@ void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d); int ED_view3d_scene_layer_set(int lay, const int *values, int *active); -int ED_view3d_context_activate(struct bContext *C); +bool ED_view3d_context_activate(struct bContext *C); void ED_view3d_draw_offscreen_init(struct Scene *scene, struct View3D *v3d); void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, - int winx, int winy, float viewmat[4][4], float winmat[4][4], int do_bgpic); + int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic); struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, - int draw_background, int alpha_mode, char err_out[256]); + bool draw_background, int alpha_mode, char err_out[256]); struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, - int use_solid_tex, int draw_background, int alpha_mode, char err_out[256]); + bool use_solid_tex, bool draw_background, int alpha_mode, char err_out[256]); void ED_view3d_offscreen_sky_color_get(struct Scene *scene, float sky_color[3]); struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); -void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip); +void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip); void ED_view3d_update_viewmat(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4]); bool ED_view3d_lock(struct RegionView3D *rv3d); @@ -297,11 +299,11 @@ uint64_t ED_view3d_screen_datamask(struct bScreen *screen); uint64_t ED_view3d_object_datamask(struct Scene *scene); /* camera lock functions */ -int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d); +bool ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d); /* copy the camera to the view before starting a view transformation */ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); /* copy the view to the camera, return TRUE if */ -int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); +bool ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); void ED_view3D_lock_clear(struct View3D *v3d); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index f37437b159d..8a7918d87bd 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -144,7 +144,7 @@ static void cp_shade_color3ub(unsigned char cp[3], const int offset) } /* This function sets the gl-color for coloring a certain bone (based on bcolor) */ -static short set_pchan_glColor(short colCode, int boneflag, short constflag) +static bool set_pchan_glColor(short colCode, int boneflag, short constflag) { switch (colCode) { case PCHAN_COLOR_NORMAL: @@ -184,7 +184,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag) } } - return 1; + return true; } break; @@ -196,7 +196,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag) else UI_ThemeColor(TH_BONE_SOLID); - return 1; + return true; } break; @@ -208,7 +208,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag) else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80); else if (constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80); - return 1; + return true; } else return 0; @@ -238,7 +238,7 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag) else UI_ThemeColor(TH_BONE_SOLID); } - return 1; + return true; } break; case PCHAN_COLOR_SPHEREBONE_END: @@ -288,12 +288,12 @@ static short set_pchan_glColor(short colCode, int boneflag, short constflag) UI_ThemeColorShade(TH_BACK, -30); } - return 1; + return true; } break; } - return 0; + return false; } static void set_ebone_glColor(const unsigned int boneflag) @@ -1660,7 +1660,7 @@ static void bone_matrix_translate_y(float mat[4][4], float y) /* assumes object is Armature with pose */ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, const short dt, const unsigned char ob_wire_col[4], - const short do_const_color, const short is_outline) + const bool do_const_color, const bool is_outline) { RegionView3D *rv3d = ar->regiondata; Object *ob = base->object; @@ -1670,7 +1670,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, GLfloat tmp; float smat[4][4], imat[4][4], bmat[4][4]; int index = -1; - short do_dashed = 3, draw_wire = FALSE; + short do_dashed = 3; + bool draw_wire = false; int flag; /* being set below */ @@ -1767,7 +1768,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (use_custom) { /* if drawwire, don't try to draw in solid */ if (pchan->bone->flag & BONE_DRAWWIRE) { - draw_wire = 1; + draw_wire = true; } else { draw_custom_bone(scene, v3d, rv3d, pchan->custom, @@ -1801,7 +1802,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* very very confusing... but in object mode, solid draw, we cannot do glLoadName yet, * stick bones and/or wire custom-shapes are drawn in next loop */ - if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == 0)) { + if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == false)) { /* object tag, for bordersel optim */ glLoadName(index & 0xFFFF); index = -1; @@ -1810,7 +1811,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* draw custom bone shapes as wireframes */ if (!(arm->flag & ARM_NO_CUSTOM) && - ((draw_wire) || (dt <= OB_WIRE)) ) + (draw_wire || (dt <= OB_WIRE)) ) { if (arm->flag & ARM_POSEMODE) index = base->selcol; @@ -2384,7 +2385,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); BKE_pose_where_is(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2466,7 +2467,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base * BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); BKE_pose_where_is(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2539,7 +2540,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); BKE_pose_where_is(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false); } } @@ -2554,7 +2555,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); BKE_pose_where_is(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, TRUE, FALSE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false); } } } @@ -2579,16 +2580,16 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) /* called from drawobject.c, return 1 if nothing was drawn * (ob_wire_col == NULL) when drawing ghost */ -int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4], - const short is_outline) +bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, + const short dt, const short dflag, const unsigned char ob_wire_col[4], + const bool is_outline) { Object *ob = base->object; bArmature *arm = ob->data; - int retval = 0; + bool retval = false; if (v3d->flag2 & V3D_RENDER_OVERRIDE) - return 1; + return true; if (dt > OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) { /* we use color for solid lighting */ @@ -2652,7 +2653,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, UI_ThemeColor(TH_WIRE); /* restore, for extra draw stuff */ } else { - retval = 1; + retval = true; } } /* restore */ diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 9000ccbf324..b13f395b80b 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -240,13 +240,13 @@ static struct TextureDrawState { unsigned char obcol[4]; } Gtexdraw = {NULL, 0, 0, 0, false, {0, 0, 0, 0}}; -static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw) +static bool set_draw_settings_cached(int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw) { static Material *c_ma; static int c_textured; static MTFace c_texface; static int c_backculled; - static int c_badtex; + static bool c_badtex; static int c_lit; static int c_has_texface; @@ -256,12 +256,12 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m int textured = 0; int lit = 0; int has_texface = texface != NULL; - int need_set_tpage = FALSE; + bool need_set_tpage = false; if (clearcache) { c_textured = c_lit = c_backculled = -1; memset(&c_texface, 0, sizeof(MTFace)); - c_badtex = 0; + c_badtex = false; c_has_texface = -1; } else { @@ -307,7 +307,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m } else { GPU_set_tpage(NULL, 0, 0); - c_badtex = 0; + c_badtex = false; } c_textured = textured; c_has_texface = has_texface; @@ -345,7 +345,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) { unsigned char obcol[4]; - int is_tex, solidtex; + bool is_tex, solidtex; Mesh *me = ob->data; /* XXX scene->obedit warning */ @@ -353,24 +353,24 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O /* texture draw is abused for mask selection mode, do this so wire draw * with face selection in weight paint is not lit. */ if ((v3d->drawtype <= OB_WIRE) && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))) { - solidtex = FALSE; + solidtex = false; Gtexdraw.is_lit = 0; } else if (v3d->drawtype == OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype != OB_TEXTURE)) { /* draw with default lights in solid draw mode and edit mode */ - solidtex = TRUE; + solidtex = true; Gtexdraw.is_lit = -1; } else { /* draw with lights in the scene otherwise */ - solidtex = FALSE; + solidtex = false; Gtexdraw.is_lit = GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp); } rgba_float_to_uchar(obcol, ob->col); - if (solidtex || v3d->drawtype == OB_TEXTURE) is_tex = 1; - else is_tex = 0; + if (solidtex || v3d->drawtype == OB_TEXTURE) is_tex = true; + else is_tex = false; Gtexdraw.ob = ob; Gtexdraw.is_tex = is_tex; @@ -412,7 +412,7 @@ static void draw_textured_end(void) static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr) { Material *ma = give_current_material(Gtexdraw.ob, matnr + 1); - int invalidtexture = 0; + bool invalidtexture = false; if (ma && (ma->game.flag & GEMAT_INVISIBLE)) return DM_DRAW_OPTION_SKIP; @@ -867,7 +867,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs) if (ED_object_get_active_image(data->ob, mat_nr, &ima, &iuser, &node)) { /* get openl texture */ int mipmap = 1; - int bindcode = (ima) ? GPU_verify_image(ima, iuser, 0, 0, mipmap, FALSE) : 0; + int bindcode = (ima) ? GPU_verify_image(ima, iuser, 0, 0, mipmap, false) : 0; float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f}; if (bindcode) { @@ -1020,7 +1020,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, { DMSetDrawOptions facemask = NULL; Mesh *me = ob->data; - const short do_light = (v3d->drawtype >= OB_SOLID); + const bool do_light = (v3d->drawtype >= OB_SOLID); /* hide faces in face select mode */ if (me->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL)) @@ -1070,7 +1070,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, if (draw_flags & DRAW_FACE_SELECT) { draw_mesh_face_select(rv3d, me, dm); } - else if ((do_light == FALSE) || (ob->dtx & OB_DRAWWIRE)) { + else if ((do_light == false) || (ob->dtx & OB_DRAWWIRE)) { const int use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT); /* weight paint in solid mode, special case. focus on making the weights clear diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 84124e08443..d447a4876b2 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -191,61 +191,61 @@ static bool check_object_draw_texture(Scene *scene, View3D *v3d, int drawtype) return false; } -static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt) +static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt) { if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0) - return 0; + return false; if (G.f & G_BACKBUFSEL) - return 0; + return false; if ((vd->flag & V3D_ZBUF_SELECT) == 0) - return 1; + return true; /* if its drawing textures with zbuf sel, then don't draw dots */ if (dt == OB_TEXTURE && vd->drawtype == OB_TEXTURE) - return 0; + return false; if ((vd->drawtype >= OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX)) - return 0; + return false; - return 1; + return true; } /* ************************ */ /* check for glsl drawing */ -int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt) +bool draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt) { if (!GPU_glsl_support()) - return 0; + return false; if (G.f & G_PICKSEL) - return 0; + return false; if (!check_object_draw_texture(scene, v3d, dt)) - return 0; + return false; if (ob == OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT)) - return 0; + return false; if (v3d->flag2 & V3D_SHOW_SOLID_MATCAP) - return 1; + return true; if (BKE_scene_use_new_shading_nodes(scene)) - return 0; + return false; return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID); } -static int check_alpha_pass(Base *base) +static bool check_alpha_pass(Base *base) { if (base->flag & OB_FROMDUPLI) - return 0; + return false; if (G.f & G_PICKSEL) - return 0; + return false; if (base->object->mode & OB_MODE_ALL_PAINT) - return 0; + return false; return (base->object->dtx & OB_DRAWTRANSP); } @@ -754,7 +754,7 @@ void view3d_cached_text_draw_add(const float co[3], memcpy(++vos, str, alloc_len); } -void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[4][4]) +void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write, float mat[4][4]) { RegionView3D *rv3d = ar->regiondata; ListBase *strings = &CachedText[CachedTextLevel - 1]; @@ -1094,13 +1094,13 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, unsigned char col[4]; /* cone can't be drawn for duplicated lamps, because duplilist would be freed to */ /* the moment of view3d_draw_transp() call */ - const short is_view = (rv3d->persp == RV3D_CAMOB && v3d->camera == base->object); - const short drawcone = ((dt > OB_WIRE) && - !(G.f & G_PICKSEL) && - (la->type == LA_SPOT) && - (la->mode & LA_SHOW_CONE) && - !(base->flag & OB_FROMDUPLI) && - !is_view); + const bool is_view = (rv3d->persp == RV3D_CAMOB && v3d->camera == base->object); + const bool drawcone = ((dt > OB_WIRE) && + !(G.f & G_PICKSEL) && + (la->type == LA_SPOT) && + (la->mode & LA_SHOW_CONE) && + !(base->flag & OB_FROMDUPLI) && + !is_view); if (drawcone && !v3d->transp) { /* in this case we need to draw delayed */ @@ -1366,7 +1366,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, setlinestyle(0); - if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == FALSE)) { + if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == false)) { drawshadbuflimits(la, ob->obmat); } @@ -1429,7 +1429,7 @@ static void draw_focus_cross(float dist, float size) #ifdef VIEW3D_CAMERA_BORDER_HACK unsigned char view3d_camera_border_hack_col[3]; -short view3d_camera_border_hack_test = FALSE; +bool view3d_camera_border_hack_test = false; #endif /* ****************** draw clip data *************** */ @@ -1460,7 +1460,7 @@ static void draw_bundle_sphere(void) static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip, MovieTrackingObject *tracking_object, const short dflag, const unsigned char ob_wire_col[4], - int *global_track_index, int draw_selected) + int *global_track_index, bool draw_selected) { MovieTracking *tracking = &clip->tracking; MovieTrackingTrack *track; @@ -1615,7 +1615,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip, const short dflag, const unsigned char ob_wire_col[4], - int draw_selected) + const bool draw_selected) { MovieTracking *tracking = &clip->tracking; MovieTrackingObject *tracking_object; @@ -1664,13 +1664,13 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base float vec[4][3], asp[2], shift[2], scale[3]; int i; float drawsize; - const short is_view = (rv3d->persp == RV3D_CAMOB && ob == v3d->camera); + const bool is_view = (rv3d->persp == RV3D_CAMOB && ob == v3d->camera); MovieClip *clip = BKE_object_movieclip_get(scene, base->object, 0); /* draw data for movie clip set as active for scene */ if (clip) { - draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, FALSE); - draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, TRUE); + draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, false); + draw_viewport_reconstruction(scene, base, v3d, clip, dflag, ob_wire_col, true); } #ifdef VIEW3D_CAMERA_BORDER_HACK @@ -1685,7 +1685,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base glGetFloatv(GL_CURRENT_COLOR, col); rgb_float_to_uchar(view3d_camera_border_hack_col, col); } - view3d_camera_border_hack_test = TRUE; + view3d_camera_border_hack_test = true; return; } #endif @@ -1853,13 +1853,13 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel) bglEnd(); } -static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int use_wcol) +static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int actdef_wcol) { int index = ((w * lt->pntsv + v) * lt->pntsu) + u; - if (use_wcol) { + if (actdef_wcol) { float col[3]; - MDeformWeight *mdw = defvert_find_index(lt->dvert + index, use_wcol - 1); + MDeformWeight *mdw = defvert_find_index(lt->dvert + index, actdef_wcol - 1); weight_to_rgb(col, mdw ? mdw->weight : 0.0f); glColor3fv(col); @@ -1880,7 +1880,8 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) Lattice *lt = ob->data; DispList *dl; int u, v, w; - int use_wcol = FALSE, is_edit = (lt->editlatt != NULL); + int actdef_wcol = 0; + const bool is_edit = (lt->editlatt != NULL); /* now we default make displist, this will modifiers work for non animated case */ if (ob->disp.first == NULL) @@ -1893,7 +1894,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) cpack(0x004000); if (ob->defbase.first && lt->dvert) { - use_wcol = ob->actdef; + actdef_wcol = ob->actdef; glShadeModel(GL_SMOOTH); } } @@ -1907,16 +1908,16 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) int uxt = (u == 0 || u == lt->pntsu - 1); if (w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) { - drawlattice__point(lt, dl, u, v, w - 1, use_wcol); - drawlattice__point(lt, dl, u, v, w, use_wcol); + drawlattice__point(lt, dl, u, v, w - 1, actdef_wcol); + drawlattice__point(lt, dl, u, v, w, actdef_wcol); } if (v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) { - drawlattice__point(lt, dl, u, v - 1, w, use_wcol); - drawlattice__point(lt, dl, u, v, w, use_wcol); + drawlattice__point(lt, dl, u, v - 1, w, actdef_wcol); + drawlattice__point(lt, dl, u, v, w, actdef_wcol); } if (u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) { - drawlattice__point(lt, dl, u - 1, v, w, use_wcol); - drawlattice__point(lt, dl, u, v, w, use_wcol); + drawlattice__point(lt, dl, u - 1, v, w, actdef_wcol); + drawlattice__point(lt, dl, u, v, w, actdef_wcol); } } } @@ -1924,7 +1925,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) glEnd(); /* restoration for weight colors */ - if (use_wcol) + if (actdef_wcol) glShadeModel(GL_FLAT); if (is_edit) { @@ -2363,7 +2364,7 @@ static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba /* double lookup */ data.orig_index_mf_to_mpoly = DM_get_tessface_data_layer(dm, CD_ORIGINDEX); data.orig_index_mp_to_orig = DM_get_poly_data_layer(dm, CD_ORIGINDEX); - if ((data.orig_index_mf_to_mpoly && data.orig_index_mp_to_orig) == FALSE) { + if ((data.orig_index_mf_to_mpoly && data.orig_index_mp_to_orig) == false) { data.orig_index_mf_to_mpoly = data.orig_index_mp_to_orig = NULL; } @@ -2626,7 +2627,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS if (unit->system) { bUnit_AsString(numstr, sizeof(numstr), len_v3v3(v1, v2) * unit->scale_length, 3, - unit->system, B_UNIT_LENGTH, do_split, FALSE); + unit->system, B_UNIT_LENGTH, do_split, false); } else { sprintf(numstr, conv_float, len_v3v3(v1, v2)); @@ -2649,7 +2650,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS if (unit->system) { \ bUnit_AsString(numstr, sizeof(numstr), \ (double)(area * unit->scale_length * unit->scale_length), \ - 3, unit->system, B_UNIT_AREA, do_split, FALSE); \ + 3, unit->system, B_UNIT_AREA, do_split, false); \ view3d_cached_text_draw_add(vmid, numstr, 0, \ /* Metric system uses unicode "squared" sign! */ \ txt_flag ^ V3D_CACHE_TEXT_ASCII, col); \ @@ -2710,7 +2711,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS if (is_face_sel || do_moving) { BMIter liter; BMLoop *loop; - int is_first = TRUE; + bool is_first = true; BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) { if (is_face_sel || (do_moving && BM_elem_flag_test(loop->v, BM_ELEM_SELECT))) { @@ -2726,7 +2727,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS mul_mat3_m4_v3(ob->obmat, v1); mul_mat3_m4_v3(ob->obmat, v2); } - is_first = FALSE; + is_first = false; } if (do_global) { @@ -2833,7 +2834,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, { Mesh *me = ob->data; - BMFace *efa_act = BM_active_face_get(em->bm, FALSE, FALSE); /* annoying but active faces is stored differently */ + BMFace *efa_act = BM_active_face_get(em->bm, false, false); /* annoying but active faces is stored differently */ BMEdge *eed_act = NULL; BMVert *eve_act = NULL; @@ -3011,8 +3012,8 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm) { - if ((v3d->transp == FALSE) && /* not when we draw the transparent pass */ - (ob->mode & OB_MODE_ALL_PAINT) == FALSE) /* not when painting (its distracting) - campbell */ + if ((v3d->transp == false) && /* not when we draw the transparent pass */ + (ob->mode & OB_MODE_ALL_PAINT) == false) /* not when painting (its distracting) - campbell */ { glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f); glDepthMask(0); @@ -3269,14 +3270,15 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } /* returns 1 if nothing was drawn, for detecting to draw an object center */ -static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, - const char dt, const unsigned char ob_wire_col[4], const short dflag) +static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, + const char dt, const unsigned char ob_wire_col[4], const short dflag) { Object *ob = base->object; Object *obedit = scene->obedit; Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; - int do_alpha_after = FALSE, drawlinked = 0, retval = 0, glsl, check_alpha, i; + int i; + bool do_alpha_after = false, drawlinked = false, retval = false; /* If we are drawing shadows and any of the materials don't cast a shadow, * then don't draw the object */ @@ -3284,7 +3286,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D for (i = 0; i < ob->totcol; ++i) { Material *ma = give_current_material(ob, i); if (ma && !(ma->mode & MA_SHADBUF)) { - return 1; + return true; } } } @@ -3292,7 +3294,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D if (obedit && ob != obedit && ob->data == obedit->data) { if (BKE_key_from_object(ob) || BKE_key_from_object(obedit)) {} else if (ob->modifiers.first || obedit->modifiers.first) {} - else drawlinked = 1; + else drawlinked = true; } /* backface culling */ @@ -3311,7 +3313,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D scene->customdata_mask); if (dt > OB_WIRE) { - glsl = draw_glsl_material(scene, ob, v3d, dt); + const bool glsl = draw_glsl_material(scene, ob, v3d, dt); GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL); } @@ -3326,8 +3328,8 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D else { /* ob->bb was set by derived mesh system, do NULL check just to be sure */ if (me->totpoly <= 4 || (!ob->bb || ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb))) { - glsl = draw_glsl_material(scene, ob, v3d, dt); - check_alpha = check_alpha_pass(base); + const bool glsl = draw_glsl_material(scene, ob, v3d, dt); + const bool check_alpha = check_alpha_pass(base); if (dt == OB_SOLID || glsl) { GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, @@ -3338,7 +3340,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D GPU_end_object_materials(); - if (me->totvert == 0) retval = 1; + if (me->totvert == 0) retval = true; } } @@ -3368,11 +3370,11 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D /* ************** DRAW DISPLIST ****************** */ -static int draw_index_wire = 1; -static int index3_nors_incr = 1; +static bool draw_index_wire = true; +static bool index3_nors_incr = true; /* returns 1 when nothing was drawn */ -static int drawDispListwire(ListBase *dlbase) +static bool drawDispListwire(ListBase *dlbase) { DispList *dl; int parts, nr; @@ -3462,11 +3464,11 @@ static int drawDispListwire(ListBase *dlbase) glDisableClientState(GL_VERTEX_ARRAY); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - return 0; + return false; } static void drawDispListsolid(ListBase *lb, Object *ob, const short dflag, - const unsigned char ob_wire_col[4], int use_glsl) + const unsigned char ob_wire_col[4], const bool use_glsl) { DispList *dl; GPUVertexAttribs gattribs; @@ -3591,14 +3593,14 @@ static void drawCurveDMWired(Object *ob) dm->drawEdges(dm, 1, 0); } -/* return 1 when nothing was drawn */ -static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt) +/* return true when nothing was drawn */ +static bool drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt) { Object *ob = base->object; DerivedMesh *dm = ob->derivedFinal; if (!dm) { - return 1; + return true; } if (dt > OB_WIRE && dm->getNumTessFaces(dm)) { @@ -3620,15 +3622,15 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B drawCurveDMWired(ob); } - return 0; + return false; } /** * Only called by #drawDispList * \return 1 when nothing was drawn */ -static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const char dt, const short dflag, const unsigned char ob_wire_col[4]) +static bool drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; ListBase *lb = NULL; @@ -3637,8 +3639,8 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d const short render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE); const short solid = (dt > OB_WIRE); - if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == 0) { - return FALSE; + if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == false) { + return false; } switch (ob->type) { @@ -3651,45 +3653,45 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d if (solid) { dl = lb->first; if (dl == NULL) { - return TRUE; + return true; } if (dl->nors == NULL) BKE_displist_normals_add(lb); - index3_nors_incr = 0; + index3_nors_incr = false; - if (BKE_displist_has_faces(lb) == 0) { + if (BKE_displist_has_faces(lb) == false) { if (!render_only) { - draw_index_wire = 0; + draw_index_wire = false; drawDispListwire(lb); - draw_index_wire = 1; + draw_index_wire = true; } } else { if (draw_glsl_material(scene, ob, v3d, dt)) { GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL); - drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, true); GPU_end_object_materials(); } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, false); GPU_end_object_materials(); } if (cu->editnurb && cu->bevobj == NULL && cu->taperobj == NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) { cpack(0); - draw_index_wire = 0; + draw_index_wire = false; drawDispListwire(lb); - draw_index_wire = 1; + draw_index_wire = true; } } - index3_nors_incr = 1; + index3_nors_incr = true; } else { if (!render_only || (render_only && BKE_displist_has_faces(lb))) { int retval; - draw_index_wire = 0; + draw_index_wire = false; retval = drawDispListwire(lb); - draw_index_wire = 1; + draw_index_wire = true; return retval; } } @@ -3701,19 +3703,19 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d if (solid) { dl = lb->first; if (dl == NULL) { - return TRUE; + return true; } if (dl->nors == NULL) BKE_displist_normals_add(lb); if (draw_glsl_material(scene, ob, v3d, dt)) { GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL); - drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, true); GPU_end_object_materials(); } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, false); GPU_end_object_materials(); } } @@ -3727,19 +3729,19 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d lb = &ob->disp; if (lb->first == NULL) BKE_displist_make_mball(scene, ob); if (lb->first == NULL) { - return TRUE; + return true; } if (solid) { if (draw_glsl_material(scene, ob, v3d, dt)) { GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL); - drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, true); GPU_end_object_materials(); } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, false); GPU_end_object_materials(); } } @@ -3753,10 +3755,10 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d return FALSE; } -static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const char dt, const short dflag, const unsigned char ob_wire_col[4]) +static bool drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { - int retval; + bool retval; /* backface culling */ if (v3d->flag2 & V3D_BACKFACE_CULLING) { @@ -5443,11 +5445,11 @@ static void drawspiral(const float cent[3], float rad, float tmat[4][4], int sta float vec[3], vx[3], vy[3]; const float tot_inv = (1.0f / (float)CIRCLE_RESOL); int a; - char inverse = FALSE; + bool inverse = false; float x, y, fac; if (start < 0) { - inverse = TRUE; + inverse = true; start = -start; } @@ -5571,9 +5573,9 @@ static void drawcone(const float vec[3], float radius, float height, float tmat[ glEnd(); } -/* return TRUE if nothing was drawn */ -static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const char dt, const short dflag, const unsigned char ob_wire_col[4]) +/* return true if nothing was drawn */ +static bool drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; MetaBall *mb; @@ -5601,11 +5603,11 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, } if (ml == NULL) { - return TRUE; + return true; } if (v3d->flag2 & V3D_RENDER_OVERRIDE) { - return FALSE; + return false; } invert_m4_m4(imat, rv3d->viewmatob); @@ -5649,7 +5651,7 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, ml = ml->next; } - return FALSE; + return false; } static void draw_forcefield(Object *ob, RegionView3D *rv3d, @@ -6001,24 +6003,24 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { Curve *cu = ob->data; DerivedMesh *dm = ob->derivedFinal; - int hasfaces = 0; + bool has_faces = false; if (dm) { - hasfaces = dm->getNumTessFaces(dm); + has_faces = dm->getNumTessFaces(dm); } else { - hasfaces = BKE_displist_has_faces(&ob->disp); + has_faces = BKE_displist_has_faces(&ob->disp); } - if (hasfaces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { - draw_index_wire = 0; + if (has_faces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { + draw_index_wire = false; if (dm) { draw_mesh_object_outline(v3d, ob, dm); } else { drawDispListwire(&ob->disp); } - draw_index_wire = 1; + draw_index_wire = true; } } else if (ob->type == OB_MBALL) { @@ -6029,7 +6031,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } else if (ob->type == OB_ARMATURE) { if (!(ob->mode & OB_MODE_POSE && base == scene->basact)) - draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, ob_wire_col, TRUE); + draw_armature(scene, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true); } glLineWidth(1.0); @@ -6054,7 +6056,7 @@ static void draw_wire_extra(Scene *scene, RegionView3D *rv3d, Object *ob, unsign Curve *cu = ob->data; if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { if (ob->type == OB_CURVE) - draw_index_wire = 0; + draw_index_wire = false; if (ob->derivedFinal) { drawCurveDMWired(ob); @@ -6064,7 +6066,7 @@ static void draw_wire_extra(Scene *scene, RegionView3D *rv3d, Object *ob, unsign } if (ob->type == OB_CURVE) - draw_index_wire = 1; + draw_index_wire = true; } } else if (ob->type == OB_MBALL) { @@ -6568,7 +6570,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short else { if (dt > OB_WIRE) GPU_enable_material(0, NULL); /* we use default material */ - empty_object = draw_armature(scene, v3d, ar, base, dt, dflag, ob_wire_col, FALSE); + empty_object = draw_armature(scene, v3d, ar, base, dt, dflag, ob_wire_col, false); if (dt > OB_WIRE) GPU_disable_material(); } diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 70d3857601f..3933d8e4753 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -105,7 +105,7 @@ static int intersect_edges(float *points, float a, float b, float c, float d, fl return numpoints; } -static int convex(const float p0[3], const float up[3], const float a[3], const float b[3]) +static bool convex(const float p0[3], const float up[3], const float a[3], const float b[3]) { /* Vec3 va = a-p0, vb = b-p0; */ float va[3], vb[3], tmp[3]; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 340744839d2..ef16090c39d 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -159,7 +159,7 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C) /* ideally would return an rv3d but in some cases the region is needed too * so return that, the caller can then access the ar->regiondata */ -int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar) +bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar) { ScrArea *sa = CTX_wm_area(C); @@ -175,7 +175,7 @@ int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar) if (rv3d && rv3d->viewlock == 0) { *r_v3d = v3d; *r_ar = ar; - return 1; + return true; } else { ARegion *ar_unlock_user = NULL; @@ -198,19 +198,19 @@ int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar) if (ar_unlock_user) { *r_v3d = v3d; *r_ar = ar_unlock_user; - return 1; + return true; } if (ar_unlock) { *r_v3d = v3d; *r_ar = ar_unlock; - return 1; + return true; } } } } - return 0; + return false; } /* Most of the time this isn't needed since you could assume the view matrix was diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index bb286194992..533bb30d8d1 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -158,7 +158,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float TransformProperties *tfp; float median[NBR_TRANSFORM_PROPERTIES], ve_median[NBR_TRANSFORM_PROPERTIES]; int tot, totedgedata, totcurvedata, totlattdata, totskinradius, totcurvebweight; - int meshdata = FALSE; + bool has_meshdata = false; char defstr[320]; PointerRNA data_ptr; @@ -253,7 +253,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } } - meshdata = totedgedata || totskinradius; + has_meshdata = (totedgedata || totskinradius); } else if (ob->type == OB_CURVE || ob->type == OB_SURF) { Curve *cu = ob->data; @@ -360,7 +360,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float if (v3d->flag & V3D_GLOBAL_STATS) mul_m4_v3(ob->obmat, &median[LOC_X]); - if (meshdata) { + if (has_meshdata) { if (totedgedata) { median[M_CREASE] /= (float)totedgedata; median[M_WEIGHT] /= (float)totedgedata; @@ -428,7 +428,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiBlockEndAlign(block); /* Meshes... */ - if (meshdata) { + if (has_meshdata) { if (totedgedata) { /* customdata layer added on demand */ uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, @@ -808,8 +808,8 @@ static void editvert_mirror_update(Object *ob, BMVert *eve, int def_nr, int inde if (def_nr == -1) { /* all vgroups, add groups where neded */ int flip_map_len; - int *flip_map = defgroup_flip_map(ob, &flip_map_len, TRUE); - defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, TRUE); + int *flip_map = defgroup_flip_map(ob, &flip_map_len, true); + defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, true); MEM_freeN(flip_map); } else { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 30a6932c60e..fa2d8d695d1 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -219,20 +219,20 @@ void ED_view3d_clipping_enable(void) } } -static int view3d_clipping_test(const float co[3], float clip[6][4]) +static bool view3d_clipping_test(const float co[3], float clip[6][4]) { if (0.0f < clip[0][3] + dot_v3v3(co, clip[0])) if (0.0f < clip[1][3] + dot_v3v3(co, clip[1])) if (0.0f < clip[2][3] + dot_v3v3(co, clip[2])) if (0.0f < clip[3][3] + dot_v3v3(co, clip[3])) - return 0; + return false; - return 1; + return true; } /* for 'local' ED_view3d_clipping_local must run first * then all comparisons can be done in localspace */ -int ED_view3d_clipping_test(RegionView3D *rv3d, const float co[3], const bool is_local) +bool ED_view3d_clipping_test(RegionView3D *rv3d, const float co[3], const bool is_local) { return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip); } @@ -1002,7 +1002,7 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R { rctf viewborder; - view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE); + view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, true, true); r_size[0] = BLI_rctf_size_x(&viewborder); r_size[1] = BLI_rctf_size_y(&viewborder); } @@ -1099,7 +1099,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) if (v3d->camera->type == OB_CAMERA) ca = v3d->camera->data; - ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false); /* the offsets */ x1 = viewborder.xmin; y1 = viewborder.ymin; @@ -1150,10 +1150,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) glRectf(x1i, y1i, x2i, y2i); #ifdef VIEW3D_CAMERA_BORDER_HACK - if (view3d_camera_border_hack_test == TRUE) { + if (view3d_camera_border_hack_test == true) { glColor3ubv(view3d_camera_border_hack_col); glRectf(x1i + 1, y1i + 1, x2i - 1, y2i - 1); - view3d_camera_border_hack_test = FALSE; + view3d_camera_border_hack_test = false; } #endif @@ -1590,7 +1590,7 @@ exit: /* ************************************************************* */ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, - const short do_foreground, const short do_camera_frame) + const bool do_foreground, const bool do_camera_frame) { RegionView3D *rv3d = ar->regiondata; BGpic *bgpic; @@ -1688,7 +1688,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, if (do_camera_frame) { rctf vb; - ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, false); x1 = vb.xmin; y1 = vb.ymin; x2 = vb.xmax; @@ -1848,7 +1848,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, } static void view3d_draw_bgpic_test(Scene *scene, ARegion *ar, View3D *v3d, - const short do_foreground, const short do_camera_frame) + const bool do_foreground, const bool do_camera_frame) { RegionView3D *rv3d = ar->regiondata; @@ -1995,7 +1995,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas if (base->object->restrictflag & OB_RESTRICT_VIEW) return; tbase.flag = OB_FROMDUPLI | base->flag; - lb = object_duplilist(scene, base->object, FALSE); + lb = object_duplilist(scene, base->object, false); // BLI_sortlist(lb, dupli_ob_sort); /* might be nice to have if we have a dupli list with mixed objects. */ dob = dupli_step(lb->first); @@ -2025,7 +2025,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas /* generate displist, test for new object */ if (dob_prev && dob_prev->ob != dob->ob) { - if (use_displist == TRUE) + if (use_displist == true) glDeleteLists(displist, 1); use_displist = -1; @@ -2047,7 +2047,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas !(bb_tmp = BKE_object_boundbox_get(dob->ob))) { // printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name + 2); - use_displist = FALSE; + use_displist = false; } else { // printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name + 2); @@ -2063,7 +2063,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas draw_object(scene, ar, v3d, &tbase, DRAW_CONSTCOLOR); glEndList(); - use_displist = TRUE; + use_displist = true; BKE_object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0); } } @@ -2130,7 +2130,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) MEM_freeN(d->depths); d->depths = NULL; - d->damaged = FALSE; + d->damaged = false; } else if (d->w != w || d->h != h || @@ -2149,13 +2149,13 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths Subset"); - d->damaged = TRUE; + d->damaged = true; } if (d->damaged) { view3d_opengl_read_pixels(ar, d->x, d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths); glGetDoublev(GL_DEPTH_RANGE, d->depth_range); - d->damaged = FALSE; + d->damaged = false; } } @@ -2177,14 +2177,14 @@ void ED_view3d_depth_update(ARegion *ar) if (d->depths) MEM_freeN(d->depths); d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths"); - d->damaged = 1; + d->damaged = true; } if (d->damaged) { view3d_opengl_read_pixels(ar, 0, 0, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths); glGetDoublev(GL_DEPTH_RANGE, d->depth_range); - d->damaged = 0; + d->damaged = false; } } } @@ -2233,7 +2233,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) glEnable(GL_DEPTH_TEST); if (v3d->flag2 & V3D_SHOW_GPENCIL) { - draw_gpencil_view3d(scene, v3d, ar, TRUE); + draw_gpencil_view3d(scene, v3d, ar, true); } v3d->zbuf = zbuf; @@ -2415,7 +2415,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) if (ob->transflag & OB_DUPLI) { DupliObject *dob; - ListBase *lb = object_duplilist(scene, ob, FALSE); + ListBase *lb = object_duplilist(scene, ob, false); for (dob = lb->first; dob; dob = dob->next) if (dob->ob->type == OB_LAMP) @@ -2454,7 +2454,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) invert_m4_m4(rv3d.persinv, rv3d.viewinv); /* no need to call ED_view3d_draw_offscreen_init since shadow buffers were already updated */ - ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, FALSE); + ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, false); GPU_lamp_shadow_buffer_unbind(shadow->lamp); v3d->drawtype = drawtype; @@ -2602,7 +2602,7 @@ void ED_view3d_draw_offscreen_init(Scene *scene, View3D *v3d) * stuff like shadow buffers */ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy, - float viewmat[4][4], float winmat[4][4], int do_bgpic) + float viewmat[4][4], float winmat[4][4], bool do_bgpic) { RegionView3D *rv3d = ar->regiondata; Base *base; @@ -2653,7 +2653,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* important to do before clipping */ if (do_bgpic) { - view3d_draw_bgpic_test(scene, ar, v3d, FALSE, FALSE); + view3d_draw_bgpic_test(scene, ar, v3d, false, false); } if (rv3d->rflag & RV3D_CLIPPING) @@ -2687,7 +2687,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* must be before xray draw which clears the depth buffer */ if (v3d->flag2 & V3D_SHOW_GPENCIL) { if (v3d->zbuf) glDisable(GL_DEPTH_TEST); - draw_gpencil_view3d(scene, v3d, ar, TRUE); + draw_gpencil_view3d(scene, v3d, ar, true); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); } @@ -2701,7 +2701,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* important to do after clipping */ if (do_bgpic) { - view3d_draw_bgpic_test(scene, ar, v3d, TRUE, FALSE); + view3d_draw_bgpic_test(scene, ar, v3d, true, false); } /* cleanup */ @@ -2716,7 +2716,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, if (v3d->flag2 & V3D_SHOW_GPENCIL) { /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ - draw_gpencil_view3d(scene, v3d, ar, FALSE); + draw_gpencil_view3d(scene, v3d, ar, false); } /* freeing the images again here could be done after the operator runs, leaving for now */ @@ -2758,7 +2758,7 @@ static void offscreen_imbuf_add_sky(ImBuf *ibuf, Scene *scene) /* utility func for ED_view3d_draw_offscreen */ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag, - int draw_background, int alpha_mode, char err_out[256]) + bool draw_background, int alpha_mode, char err_out[256]) { RegionView3D *rv3d = ar->regiondata; ImBuf *ibuf; @@ -2816,7 +2816,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in /* creates own 3d views, used by the sequencer */ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height, unsigned int flag, int drawtype, - int use_solid_tex, int draw_background, int alpha_mode, char err_out[256]) + bool use_solid_tex, bool draw_background, int alpha_mode, char err_out[256]) { View3D v3d = {NULL}; ARegion ar = {NULL}; @@ -2922,7 +2922,7 @@ static void draw_viewport_fps(Scene *scene, rcti *rect) static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit); -static int view3d_main_area_do_render_draw(const bContext *C) +static bool view3d_main_area_do_render_draw(const bContext *C) { Scene *scene = CTX_data_scene(C); RenderEngineType *type = RE_engines_find(scene->r.engine); @@ -2930,7 +2930,7 @@ static int view3d_main_area_do_render_draw(const bContext *C) return (type && type->view_update && type->view_draw); } -static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw_border) +static bool view3d_main_area_draw_engine(const bContext *C, ARegion *ar, const bool draw_border) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -2945,9 +2945,9 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw type = RE_engines_find(scene->r.engine); if (!(type->view_update && type->view_draw)) - return 0; + return false; - engine = RE_engine_create_ex(type, TRUE); + engine = RE_engine_create_ex(type, true); engine->tile_x = scene->r.tilex; engine->tile_y = scene->r.tiley; @@ -2969,7 +2969,7 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw rcti cliprct; if (rv3d->persp == RV3D_CAMOB) { - ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false); cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder); cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder); @@ -2997,15 +2997,16 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw glGetIntegerv(GL_SCISSOR_BOX, scissor); glScissor(cliprct.xmin, cliprct.ymin, BLI_rcti_size_x(&cliprct), BLI_rcti_size_y(&cliprct)); } - else - return 0; + else { + return false; + } } glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (v3d->flag & V3D_DISPBGPICS) - view3d_draw_bgpic(scene, ar, v3d, FALSE, TRUE); + view3d_draw_bgpic(scene, ar, v3d, false, true); else fdrawcheckerboard(0, 0, ar->winx, ar->winy); @@ -3014,14 +3015,14 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw type->view_draw(rv3d->render_engine, C); if (v3d->flag & V3D_DISPBGPICS) - view3d_draw_bgpic(scene, ar, v3d, TRUE, TRUE); + view3d_draw_bgpic(scene, ar, v3d, true, true); if (draw_border) { /* restore scissor as it was before */ glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); } - return 1; + return true; } static void view3d_main_area_draw_engine_info(RegionView3D *rv3d, ARegion *ar) @@ -3050,7 +3051,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar) GLubyte grid_col[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][4]; static float grid_pos[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][3]; static GLushort indices[VIEWGRAD_RES_X - 1][VIEWGRAD_RES_X - 1][4]; - static char buf_calculated = FALSE; + static bool buf_calculated = false; IMB_colormanagement_pixel_to_display_space_v3(col_hor, &scene->world->horr, &scene->view_settings, &scene->display_settings); @@ -3089,7 +3090,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar) } } - buf_calculated = TRUE; + buf_calculated = true; } for (x = 0; x < VIEWGRAD_RES_X; x++) { @@ -3276,7 +3277,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const } } - view3d_draw_bgpic_test(scene, ar, v3d, FALSE, TRUE); + view3d_draw_bgpic_test(scene, ar, v3d, false, true); if (rv3d->rflag & RV3D_CLIPPING) ED_view3d_clipping_set(rv3d); @@ -3340,7 +3341,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const if (v3d->flag2 & V3D_SHOW_GPENCIL) { /* must be before xray draw which clears the depth buffer */ if (v3d->zbuf) glDisable(GL_DEPTH_TEST); - draw_gpencil_view3d(scene, v3d, ar, TRUE); + draw_gpencil_view3d(scene, v3d, ar, true); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); } @@ -3355,7 +3356,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const ED_view3d_clipping_disable(); /* important to do after clipping */ - view3d_draw_bgpic_test(scene, ar, v3d, TRUE, TRUE); + view3d_draw_bgpic_test(scene, ar, v3d, true, true); BIF_draw_manipulator(C); @@ -3409,7 +3410,7 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha if (v3d->flag2 & V3D_SHOW_GPENCIL) { /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ - draw_gpencil_view3d(scene, v3d, ar, FALSE); + draw_gpencil_view3d(scene, v3d, ar, false); } if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { @@ -3461,12 +3462,12 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); const char *grid_unit = NULL; - int draw_border = FALSE; + bool draw_border = false; if (rv3d->persp == RV3D_CAMOB) - draw_border = scene->r.mode & R_BORDER; + draw_border = (scene->r.mode & R_BORDER) != 0; else - draw_border = v3d->flag2 & V3D_RENDER_BORDER; + draw_border = (v3d->flag2 & V3D_RENDER_BORDER) != 0; /* draw viewport using opengl */ if (v3d->drawtype != OB_RENDER || !view3d_main_area_do_render_draw(C) || draw_border) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 8cb2f33e353..8251533223e 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -88,7 +88,7 @@ /* ********************** view3d_edit: view manipulations ********************* */ -int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d) +bool ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d) { return ((v3d->camera) && (v3d->camera->id.lib == NULL) && @@ -105,8 +105,8 @@ void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d) } } -/* return TRUE if the camera is moved */ -int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) +/* return true if the camera is moved */ +bool ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) { if (ED_view3d_camera_lock_check(v3d, rv3d)) { ObjectTfmProtectedChannels obtfm; @@ -130,7 +130,7 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) mult_m4_m4m4(parent_mat, diff_mat, root_parent->obmat); BKE_object_tfm_protected_backup(root_parent, &obtfm); - BKE_object_apply_mat4(root_parent, parent_mat, TRUE, FALSE); + BKE_object_apply_mat4(root_parent, parent_mat, true, false); BKE_object_tfm_protected_restore(root_parent, &obtfm, root_parent->protectflag); ob_update = v3d->camera; @@ -149,10 +149,10 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, v3d->camera); } - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -309,7 +309,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar) } /* 'clip' is used to know if our clip setting has changed */ -void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip) +void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip) { ARegion *ar_sync = NULL; RegionView3D *rv3d = ar->regiondata; @@ -323,7 +323,7 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip) viewlock = 0; else if ((viewlock & RV3D_BOXVIEW) == 0) { viewlock &= ~RV3D_BOXCLIP; - do_clip = TRUE; + do_clip = true; } for (; ar; ar = ar->prev) { @@ -367,7 +367,7 @@ typedef struct ViewOpsData { float mousevec[3]; /* dolly only */ float reverse, dist0, camzoom0; float grid, far; - short axis_snap; /* view rotate only */ + bool axis_snap; /* view rotate only */ float zfac; /* use for orbit selection and auto-dist */ @@ -856,11 +856,11 @@ static int viewrotate_modal(bContext *C, wmOperator *op, const wmEvent *event) event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_AXIS_SNAP_ENABLE: - vod->axis_snap = TRUE; + vod->axis_snap = true; event_code = VIEW_APPLY; break; case VIEWROT_MODAL_AXIS_SNAP_DISABLE: - vod->axis_snap = FALSE; + vod->axis_snap = false; event_code = VIEW_APPLY; break; case VIEWROT_MODAL_SWITCH_ZOOM: @@ -2176,7 +2176,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event) } if (event->type == MOUSEZOOM) { - /* Bypass Zoom invert flag for track pads (pass FALSE always) */ + /* Bypass Zoom invert flag for track pads (pass false always) */ if (U.uiflag & USER_ZOOM_HORIZ) { vod->origx = vod->oldx = event->x; @@ -2253,7 +2253,7 @@ void VIEW3D_OT_dolly(wmOperatorType *ot) static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar, const float min[3], const float max[3], - int ok_dist) + bool ok_dist) { RegionView3D *rv3d = ar->regiondata; float afm[3]; @@ -2292,7 +2292,7 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar, else { /* ortho */ if (size < 0.0001f) { /* bounding box was a single point so do not zoom */ - ok_dist = 0; + ok_dist = false; } else { /* adjust zoom so it looks nicer */ @@ -2327,7 +2327,7 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar, /* same as view3d_from_minmax but for all regions (except cameras) */ static void view3d_from_minmax_multi(bContext *C, View3D *v3d, const float min[3], const float max[3], - const int ok_dist) + const bool ok_dist) { ScrArea *sa = CTX_wm_area(C); ARegion *ar; @@ -2357,7 +2357,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in int center = RNA_boolean_get(op->ptr, "center"); float min[3], max[3]; - int ok = 1, onedone = FALSE; + bool change = false; if (center) { /* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */ @@ -2372,16 +2372,16 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in for (base = scene->base.first; base; base = base->next) { if (BASE_VISIBLE(v3d, base)) { - onedone = TRUE; + change = true; if (skip_camera && base->object == v3d->camera) { continue; } - BKE_object_minmax(base->object, min, max, FALSE); + BKE_object_minmax(base->object, min, max, false); } } - if (!onedone) { + if (!change) { ED_region_tag_redraw(ar); /* TODO - should this be cancel? * I think no, because we always move the cursor, with or without @@ -2393,15 +2393,11 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in return OPERATOR_FINISHED; } - if (ok == 0) { - return OPERATOR_FINISHED; - } - if (use_all_regions) { - view3d_from_minmax_multi(C, v3d, min, max, TRUE); + view3d_from_minmax_multi(C, v3d, min, max, true); } else { - view3d_from_minmax(C, v3d, ar, min, max, TRUE); + view3d_from_minmax(C, v3d, ar, min, max, true); } return OPERATOR_FINISHED; @@ -2438,7 +2434,7 @@ static int viewselected_exec(bContext *C, wmOperator *op) Object *ob = OBACT; Object *obedit = CTX_data_edit_object(C); float min[3], max[3]; - int ok = 0, ok_dist = 1; + bool ok = false, ok_dist = true; const short use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions"); const short skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) || /* any one of the regions may be locked */ @@ -2505,8 +2501,8 @@ static int viewselected_exec(bContext *C, wmOperator *op) } /* account for duplis */ - if (BKE_object_minmax_dupli(scene, base->object, min, max, FALSE) == 0) - BKE_object_minmax(base->object, min, max, FALSE); /* use if duplis not found */ + if (BKE_object_minmax_dupli(scene, base->object, min, max, false) == 0) + BKE_object_minmax(base->object, min, max, false); /* use if duplis not found */ ok = 1; } @@ -2737,7 +2733,7 @@ static int render_border_exec(bContext *C, wmOperator *op) /* calculate range */ if (rv3d->persp == RV3D_CAMOB) { - ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, false); } else { vb.xmin = 0; @@ -3040,7 +3036,7 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot) ot->flag = 0; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, false); } /* sets the view to 1:1 camera/render-pixel */ @@ -3106,7 +3102,7 @@ static EnumPropertyItem prop_view_items[] = { static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, float q1, float q2, float q3, float q4, - short view, int perspo, int align_active) + short view, int perspo, bool align_active) { RegionView3D *rv3d = ar->regiondata; /* no NULL check is needed, poll checks */ float new_quat[4]; @@ -3120,14 +3116,14 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, Object *obact = CTX_data_active_object(C); if (obact == NULL) { /* no active object, ignore this option */ - align_active = FALSE; + align_active = false; } else { float obact_quat[4]; float twmat[3][3]; /* same as transform manipulator when normal is set */ - ED_getTransformOrientationMatrix(C, twmat, FALSE); + ED_getTransformOrientationMatrix(C, twmat, false); mat3_to_quat(obact_quat, twmat); invert_qt(obact_quat); @@ -3137,7 +3133,7 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, } } - if (align_active == FALSE) { + if (align_active == false) { /* normal operation */ if (rv3d->viewlock) { /* only pass on if */ @@ -3186,7 +3182,8 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) RegionView3D *rv3d; Scene *scene = CTX_data_scene(C); static int perspo = RV3D_PERSP; - int viewnum, align_active, nextperspo; + int viewnum, nextperspo; + bool align_active; /* no NULL check is needed, poll checks */ ED_view3d_context_user_region(C, &v3d, &ar); @@ -3197,7 +3194,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) /* set this to zero, gets handled in axis_set_view */ if (rv3d->viewlock) - align_active = 0; + align_active = false; /* Use this to test if we started out with a camera */ @@ -3741,15 +3738,15 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) } if (ED_view3d_project_float_global(ar, fp, mval_fl, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { - short depth_used = FALSE; + bool depth_used = false; if (U.uiflag & USER_ZBUF_CURSOR) { /* maybe this should be accessed some other way */ view3d_operator_needs_opengl(C); if (ED_view3d_autodist(scene, ar, v3d, mval, fp, true)) - depth_used = TRUE; + depth_used = true; } - if (depth_used == FALSE) { + if (depth_used == false) { float dvec[3]; VECSUB2D(mval_fl, mval_fl, mval); ED_view3d_win_to_delta(ar, mval_fl, dvec, zfac); @@ -3917,7 +3914,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg } /* XXX todo Zooms in on a border drawn by the user */ -int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride) +bool ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride) { bglMats mats; /* ZBuffer depth vars */ float depth_close = FLT_MAX; @@ -3930,7 +3927,7 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2] depth_close = view_autodist_depth_margin(ar, mval, 4); if (depth_close == FLT_MAX) - return 0; + return false; cent[0] = (double)mval[0]; cent[1] = (double)mval[1]; @@ -3938,16 +3935,16 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2] if (!gluUnProject(cent[0], cent[1], depth_close, mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2])) { - return 0; + return false; } mouse_worldloc[0] = (float)p[0]; mouse_worldloc[1] = (float)p[1]; mouse_worldloc[2] = (float)p[2]; - return 1; + return true; } -int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) +void ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) { /* Get Z Depths, needed for perspective, nice for ortho */ switch (mode) { @@ -3958,13 +3955,11 @@ int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) draw_depth_gpencil(scene, ar, v3d); break; } - - return 1; } /* no 4x4 sampling, run #ED_view3d_autodist_init first */ -int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], - int margin, float *force_depth) +bool ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], + int margin, float *force_depth) { bglMats mats; /* ZBuffer depth vars, could cache? */ float depth; @@ -3977,7 +3972,7 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl depth = view_autodist_depth_margin(ar, mval, margin); if (depth == FLT_MAX) - return 0; + return false; cent[0] = (double)mval[0]; cent[1] = (double)mval[1]; @@ -3987,23 +3982,23 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl if (!gluUnProject(cent[0], cent[1], depth, mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2])) { - return 0; + return false; } mouse_worldloc[0] = (float)p[0]; mouse_worldloc[1] = (float)p[1]; mouse_worldloc[2] = (float)p[2]; - return 1; + return true; } -int ED_view3d_autodist_depth(ARegion *ar, const int mval[2], int margin, float *depth) +bool ED_view3d_autodist_depth(ARegion *ar, const int mval[2], int margin, float *depth) { *depth = view_autodist_depth_margin(ar, mval, margin); - return (*depth == FLT_MAX) ? 0 : 1; + return (*depth != FLT_MAX); } -static int depth_segment_cb(int x, int y, void *userData) +static bool depth_segment_cb(int x, int y, void *userData) { struct { ARegion *ar; int margin; float depth; } *data = userData; int mval[2]; @@ -4023,8 +4018,8 @@ static int depth_segment_cb(int x, int y, void *userData) } } -int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int mval_end[2], - int margin, float *depth) +bool ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int mval_end[2], + int margin, float *depth) { struct { ARegion *ar; int margin; float depth; } data = {NULL}; int p1[2]; @@ -4041,7 +4036,7 @@ int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int m *depth = data.depth; - return (*depth == FLT_MAX) ? 0 : 1; + return (*depth != FLT_MAX); } /* problem - ofs[3] can be on same location as camera itself. @@ -4155,7 +4150,7 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co { float mat[4][4]; ED_view3d_to_m4(mat, ofs, quat, dist); - BKE_object_apply_mat4(ob, mat, TRUE, TRUE); + BKE_object_apply_mat4(ob, mat, true, true); } BGpic *ED_view3D_background_image_new(View3D *v3d) @@ -4198,6 +4193,6 @@ void ED_view3D_lock_clear(View3D *v3d) { v3d->ob_centre = NULL; v3d->ob_centre_bone[0] = '\0'; - v3d->ob_centre_cursor = FALSE; + v3d->ob_centre_cursor = false; v3d->flag2 &= ~V3D_LOCK_CAMERA; } diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 700027d62a2..00a81c22865 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -170,11 +170,11 @@ typedef struct FlyInfo { wmTimer *timer; /* needed for redraws */ short state; - short redraw; - unsigned char use_precision; + bool redraw; + bool use_precision; /* if the user presses shift they can look about * without moving the direction there looking */ - unsigned char use_freelook; + bool use_freelook; int mval[2]; /* latest 2D mouse values */ wmNDOFMotionData *ndof; /* latest 3D mouse values */ @@ -182,14 +182,14 @@ typedef struct FlyInfo { /* fly state state */ float speed; /* the speed the view is moving per redraw */ short axis; /* Axis index to move along by default Z to move along the view */ - short pan_view; /* when true, pan the view instead of rotating */ + bool pan_view; /* when true, pan the view instead of rotating */ /* relative view axis locking - xlock, zlock * 0) disabled * 1) enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed * when the mouse moves, locking is set to 2 so checks are done. * 2) mouse moved and checking needed, if no view altering is done its changed back to 1 */ - short xlock, zlock; + bool xlock, zlock; float xlock_momentum, zlock_momentum; /* nicer dynamics */ float grid; /* world scale 1.0 default */ @@ -208,7 +208,7 @@ typedef struct FlyInfo { /* are we flying an ortho camera in perspective view, * which was originall in ortho view? * could probably figure it out but better be explicit */ - short is_ortho_cam; + bool is_ortho_cam; void *obtfm; /* backup the objects transform */ /* compare between last state */ @@ -272,7 +272,7 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), #define FLY_CANCEL 1 #define FLY_CONFIRM 2 -static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent *event) +static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent *event) { wmWindow *win = CTX_wm_window(C); float upvec[3]; /* tmp */ @@ -294,30 +294,30 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->id.lib) { BKE_report(op->reports, RPT_ERROR, "Cannot fly a camera from an external library"); - return FALSE; + return false; } if (fly->v3d->ob_centre) { BKE_report(op->reports, RPT_ERROR, "Cannot fly when the view is locked to an object"); - return FALSE; + return false; } if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->constraints.first) { BKE_report(op->reports, RPT_ERROR, "Cannot fly an object with constraints"); - return FALSE; + return false; } fly->state = FLY_RUNNING; fly->speed = 0.0f; fly->axis = 2; - fly->pan_view = FALSE; - fly->xlock = FALSE; - fly->zlock = FALSE; + fly->pan_view = false; + fly->xlock = false; + fly->zlock = false; fly->xlock_momentum = 0.0f; fly->zlock_momentum = 0.0f; fly->grid = 1.0f; - fly->use_precision = FALSE; - fly->use_freelook = FALSE; + fly->use_precision = false; + fly->use_freelook = false; #ifdef NDOF_FLY_DRAW_TOOMUCH fly->redraw = 1; @@ -354,10 +354,10 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent /* check for flying ortho camera - which we cant support well * we _could_ also check for an ortho camera but this is easier */ if ((fly->rv3d->persp == RV3D_CAMOB) && - (fly->rv3d->is_persp == FALSE)) + (fly->rv3d->is_persp == false)) { ((Camera *)fly->v3d->camera->data)->type = CAM_PERSP; - fly->is_ortho_cam = TRUE; + fly->is_ortho_cam = true; } if (fly->rv3d->persp == RV3D_CAMOB) { @@ -601,11 +601,11 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event) break; } case FLY_MODAL_PAN_ENABLE: - fly->pan_view = TRUE; + fly->pan_view = true; break; case FLY_MODAL_PAN_DISABLE: //XXX2.5 WM_cursor_warp(CTX_wm_window(C), cent_orig[0], cent_orig[1]); - fly->pan_view = FALSE; + fly->pan_view = false; break; /* implement WASD keys, @@ -694,17 +694,17 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event) break; case FLY_MODAL_PRECISION_ENABLE: - fly->use_precision = TRUE; + fly->use_precision = true; break; case FLY_MODAL_PRECISION_DISABLE: - fly->use_precision = FALSE; + fly->use_precision = false; break; case FLY_MODAL_FREELOOK_ENABLE: - fly->use_freelook = TRUE; + fly->use_freelook = true; break; case FLY_MODAL_FREELOOK_DISABLE: - fly->use_freelook = FALSE; + fly->use_freelook = false; break; } } @@ -733,7 +733,7 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); mult_m4_m4m4(diff_mat, view_mat, prev_view_imat); mult_m4_m4m4(parent_mat, diff_mat, fly->root_parent->obmat); - BKE_object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE); + BKE_object_apply_mat4(fly->root_parent, parent_mat, true, false); // BKE_object_where_is_calc(scene, fly->root_parent); @@ -748,7 +748,7 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien else { float view_mat[4][4]; ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); - BKE_object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE); + BKE_object_apply_mat4(v3d->camera, view_mat, true, false); id_key = &v3d->camera->id; } @@ -876,7 +876,7 @@ static int flyApply(bContext *C, FlyInfo *fly) copy_m3_m4(mat, rv3d->viewinv); - if (fly->pan_view == TRUE) { + if (fly->pan_view == true) { /* pan only */ dvec_tmp[0] = -moffset[0]; dvec_tmp[1] = -moffset[1]; @@ -1059,19 +1059,19 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) const int flag = U.ndof_flag; #if 0 - int shouldRotate = (flag & NDOF_SHOULD_ROTATE) && (fly->pan_view == FALSE); - int shouldTranslate = (flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM)); + bool do_rotate = (flag & NDOF_SHOULD_ROTATE) && (fly->pan_view == false); + bool do_translate = (flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM)); #endif - int shouldRotate = (fly->pan_view == FALSE); - int shouldTranslate = TRUE; + bool do_rotate = (fly->pan_view == false); + bool do_translate = true; float view_inv[4]; invert_qt_qt(view_inv, rv3d->viewquat); rv3d->rot_angle = 0.0f; /* disable onscreen rotation doo-dad */ - if (shouldTranslate) { + if (do_translate) { const float forward_sensitivity = 1.0f; const float vertical_sensitivity = 0.4f; const float lateral_sensitivity = 0.6f; @@ -1107,14 +1107,14 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) if (!is_zero_v3(trans)) { /* move center of view opposite of hand motion (this is camera mode, not object mode) */ sub_v3_v3(rv3d->ofs, trans); - shouldTranslate = TRUE; + do_translate = true; } else { - shouldTranslate = FALSE; + do_translate = false; } } - if (shouldRotate) { + if (do_rotate) { const float turn_sensitivity = 1.0f; float rotation[4]; @@ -1122,7 +1122,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) float angle = turn_sensitivity * ndof_to_axis_angle(ndof, axis); if (fabsf(angle) > 0.0001f) { - shouldRotate = TRUE; + do_rotate = true; if (fly->use_precision) angle *= 0.2f; @@ -1164,15 +1164,15 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) rv3d->view = RV3D_VIEW_USER; } else { - shouldRotate = FALSE; + do_rotate = false; } } - if (shouldTranslate || shouldRotate) { - fly->redraw = TRUE; + if (do_translate || do_rotate) { + fly->redraw = true; if (rv3d->persp == RV3D_CAMOB) { - move_camera(C, rv3d, fly, shouldRotate, shouldTranslate); + move_camera(C, rv3d, fly, do_rotate, do_translate); } } @@ -1191,7 +1191,7 @@ static int fly_invoke(bContext *C, wmOperator *op, const wmEvent *event) op->customdata = fly; - if (initFlyInfo(C, fly, op, event) == FALSE) { + if (initFlyInfo(C, fly, op, event) == false) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; } @@ -1217,7 +1217,7 @@ static int fly_cancel(bContext *C, wmOperator *op) static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event) { int exit_code; - short do_draw = FALSE; + bool do_draw = false; FlyInfo *fly = op->customdata; RegionView3D *rv3d = fly->rv3d; Object *fly_object = fly->root_parent ? fly->root_parent : fly->v3d->camera; @@ -1240,7 +1240,7 @@ static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event) exit_code = flyEnd(C, fly); if (exit_code != OPERATOR_RUNNING_MODAL) - do_draw = TRUE; + do_draw = true; if (do_draw) { if (rv3d->persp == RV3D_CAMOB) { diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 430ed8698d7..466afa0c1ef 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -198,7 +198,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op) if (v3d->scenelock) handle_view3d_lock(C); - DAG_on_visible_update(CTX_data_main(C), FALSE); + DAG_on_visible_update(CTX_data_main(C), false); ED_area_tag_redraw(sa); @@ -215,7 +215,7 @@ static int view3d_layers_invoke(bContext *C, wmOperator *op, const wmEvent *even if (event->shift) RNA_boolean_set(op->ptr, "extend", TRUE); else - RNA_boolean_set(op->ptr, "extend", FALSE); + RNA_boolean_set(op->ptr, "extend", false); if (event->alt) { int nr = RNA_int_get(op->ptr, "nr") + 10; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 8bce8cd3e01..11cd0fdb1d7 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -122,14 +122,14 @@ void draw_motion_paths_cleanup(View3D *v3d); /* drawobject.c */ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, const short dflag); -int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const char dt); +bool draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const char dt); void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline); void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); void drawaxes(float size, char drawtype); void view3d_cached_text_draw_begin(void); void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]); -void view3d_cached_text_draw_end(View3D * v3d, ARegion * ar, int depth_write, float mat[4][4]); +void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write, float mat[4][4]); enum { V3D_CACHE_TEXT_ZBUF = (1 << 0), @@ -140,9 +140,9 @@ enum { }; /* drawarmature.c */ -int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4], - const short is_outline); +bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, + const short dt, const short dflag, const unsigned char ob_wire_col[4], + const bool is_outline); /* drawmesh.c */ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, @@ -176,7 +176,7 @@ void VIEW3D_OT_localview(struct wmOperatorType *ot); void VIEW3D_OT_game_start(struct wmOperatorType *ot); -int ED_view3d_boundbox_clip(RegionView3D * rv3d, float obmat[4][4], struct BoundBox *bb); +bool ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], const struct BoundBox *bb); void view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens); @@ -200,7 +200,7 @@ void view3d_toolshelf_register(struct ARegionType *art); void view3d_tool_props_register(struct ARegionType *art); /* view3d_snap.c */ -int ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]); +bool ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]); void VIEW3D_OT_snap_selected_to_grid(struct wmOperatorType *ot); void VIEW3D_OT_snap_selected_to_cursor(struct wmOperatorType *ot); @@ -239,7 +239,7 @@ void draw_smoke_heat(struct SmokeDomainSettings *domain, struct Object *ob); #define VIEW3D_CAMERA_BORDER_HACK #ifdef VIEW3D_CAMERA_BORDER_HACK extern unsigned char view3d_camera_border_hack_col[3]; -extern short view3d_camera_border_hack_test; +extern bool view3d_camera_border_hack_test; #endif #endif /* __VIEW3D_INTERN_H__ */ diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 30a100283cc..7d728234c92 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -110,8 +110,8 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *bas } /* perspmat is typically... - * - 'rv3d->perspmat', is_local == FALSE - * - 'rv3d->persmatob', is_local == TRUE + * - 'rv3d->perspmat', is_local == false + * - 'rv3d->persmatob', is_local == true */ static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar, float perspmat[4][4], const bool is_local, /* normally hidden */ @@ -231,39 +231,39 @@ eV3DProjStatus ED_view3d_project_float_ex(const ARegion *ar, float perspmat[4][4 eV3DProjStatus ED_view3d_project_short_global(const ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag) { RegionView3D *rv3d = ar->regiondata; - return ED_view3d_project_short_ex(ar, rv3d->persmat, FALSE, co, r_co, flag); + return ED_view3d_project_short_ex(ar, rv3d->persmat, false, co, r_co, flag); } /* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_short_object(const ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag) { RegionView3D *rv3d = ar->regiondata; - return ED_view3d_project_short_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag); + return ED_view3d_project_short_ex(ar, rv3d->persmatob, true, co, r_co, flag); } /* --- int --- */ eV3DProjStatus ED_view3d_project_int_global(const ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag) { RegionView3D *rv3d = ar->regiondata; - return ED_view3d_project_int_ex(ar, rv3d->persmat, FALSE, co, r_co, flag); + return ED_view3d_project_int_ex(ar, rv3d->persmat, false, co, r_co, flag); } /* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_int_object(const ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag) { RegionView3D *rv3d = ar->regiondata; - return ED_view3d_project_int_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag); + return ED_view3d_project_int_ex(ar, rv3d->persmatob, true, co, r_co, flag); } /* --- float --- */ eV3DProjStatus ED_view3d_project_float_global(const ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag) { RegionView3D *rv3d = ar->regiondata; - return ED_view3d_project_float_ex(ar, rv3d->persmat, FALSE, co, r_co, flag); + return ED_view3d_project_float_ex(ar, rv3d->persmat, false, co, r_co, flag); } /* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_float_object(const ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag) { RegionView3D *rv3d = ar->regiondata; - return ED_view3d_project_float_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag); + return ED_view3d_project_float_ex(ar, rv3d->persmatob, true, co, r_co, flag); } @@ -367,7 +367,7 @@ void ED_view3d_win_to_3d(const ARegion *ar, const float depth_pt[3], const float ED_view3d_win_to_vector(ar, mval, mousevec); add_v3_v3v3(line_end, line_sta, mousevec); - if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) { + if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], true) == 0) { /* highly unlikely to ever happen, mouse vec paralelle with view plane */ zero_v3(out); } @@ -435,7 +435,8 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3 normalize_v3(out); } -void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]) +void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2], + float ray_start[3], float ray_end[3]) { RegionView3D *rv3d = ar->regiondata; @@ -472,9 +473,10 @@ void ED_view3d_win_to_segment(const ARegion *ar, View3D *v3d, const float mval[2 * \param mval The area relative 2d location (such as event->mval, converted into float[2]). * \param ray_start The world-space starting point of the segment. * \param ray_end The world-space end point of the segment. - * \return success, FALSE if the segment is totally clipped. + * \return success, false if the segment is totally clipped. */ -int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]) +bool ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mval[2], + float ray_start[3], float ray_end[3]) { RegionView3D *rv3d = ar->regiondata; ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end); @@ -482,14 +484,14 @@ int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mv /* clipping */ if (rv3d->rflag & RV3D_CLIPPING) { /* if the ray is totally clipped, - * restore the original values but return FALSE + * restore the original values but return false * caller can choose what to do */ float tray_start[3] = {UNPACK3(ray_start)}; float tray_end[3] = {UNPACK3(ray_end)}; int a; for (a = 0; a < 4; a++) { - if (clip_line_plane(tray_start, tray_end, rv3d->clip[a]) == FALSE) { - return FALSE; + if (clip_line_plane(tray_start, tray_end, rv3d->clip[a]) == false) { + return false; } } @@ -498,7 +500,7 @@ int ED_view3d_win_to_segment_clip(const ARegion *ar, View3D *v3d, const float mv copy_v3_v3(ray_end, tray_end); } - return TRUE; + return true; } diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 6edcf980d58..eb32baf4c3f 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -101,7 +101,7 @@ static void special_transvert_update(Object *obedit) if (obedit->type == OB_MESH) { BMEditMesh *em = BMEdit_FromObject(obedit); - BM_mesh_normals_update(em->bm, TRUE); /* does face centers too */ + BM_mesh_normals_update(em->bm, true); /* does face centers too */ } else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { Curve *cu = obedit->data; @@ -1075,7 +1075,7 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot) /* **************************************************** */ -int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3]) +bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3]) { TransVert *tv; float centroid[3], vec[3], bmat[3][3]; @@ -1085,7 +1085,7 @@ int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3]) if (ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE)) make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS); - if (tottrans == 0) return 0; + if (tottrans == 0) return false; copy_m3_m4(bmat, obedit->obmat); @@ -1101,5 +1101,5 @@ int ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3]) MEM_freeN(transvmain); transvmain = NULL; - return 1; + return true; } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index b2e10fa8457..b227d32d987 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -460,7 +460,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o /* only touch location */ BKE_object_tfm_protected_backup(camera_ob, &obtfm); - BKE_object_apply_mat4(camera_ob, obmat_new, TRUE, TRUE); + BKE_object_apply_mat4(camera_ob, obmat_new, true, true); BKE_object_tfm_protected_restore(camera_ob, &obtfm, OB_LOCK_SCALE | OB_LOCK_ROT4D); /* notifiers */ @@ -479,7 +479,7 @@ static int view3d_camera_to_view_selected_poll(bContext *C) if (v3d && v3d->camera && v3d->camera->id.lib == NULL) { RegionView3D *rv3d = CTX_wm_region_view3d(C); if (rv3d) { - if (rv3d->is_persp == FALSE) { + if (rv3d->is_persp == false) { CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view"); } else if (!rv3d->viewlock) { @@ -612,7 +612,7 @@ void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], bglMats *mats, co } -int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb) +bool ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], const BoundBox *bb) { /* return 1: draw */ @@ -620,8 +620,8 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb) float vec[4], min, max; int a, flag = -1, fl; - if (bb == NULL) return 1; - if (bb->flag & OB_BB_DISABLED) return 1; + if (bb == NULL) return true; + if (bb->flag & OB_BB_DISABLED) return true; mult_m4_m4m4(mat, rv3d->persmat, obmat); @@ -641,10 +641,10 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[4][4], BoundBox *bb) if (vec[2] > max) fl += 32; flag &= fl; - if (flag == 0) return 1; + if (flag == 0) return true; } - return 0; + return false; } float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y) @@ -663,7 +663,7 @@ float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y) void ED_view3d_depth_tag_update(RegionView3D *rv3d) { if (rv3d->depths) - rv3d->depths->damaged = 1; + rv3d->depths->damaged = true; } /* copies logic of get_view3d_viewplane(), keep in sync */ @@ -951,7 +951,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b Base tbase; tbase.flag = OB_FROMDUPLI; - lb = object_duplilist(scene, base->object, FALSE); + lb = object_duplilist(scene, base->object, false); for (dob = lb->first; dob; dob = dob->next) { tbase.object = dob->ob; @@ -975,7 +975,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b } } } - v3d->xray = FALSE; /* restore */ + v3d->xray = false; /* restore */ } glPopName(); /* see above (pushname) */ @@ -1073,14 +1073,14 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active) return lay; } -static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportList *reports) +static bool view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportList *reports) { View3D *v3d = sa->spacedata.first; Base *base; float min[3], max[3], box[3]; float size = 0.0f, size_persp = 0.0f, size_ortho = 0.0f; unsigned int locallay; - int ok = FALSE; + bool ok = false; if (v3d->localvd) { return ok; @@ -1092,13 +1092,13 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL if (locallay == 0) { BKE_report(reports, RPT_ERROR, "No more than 8 local views"); - ok = FALSE; + ok = false; } else { if (scene->obedit) { - BKE_object_minmax(scene->obedit, min, max, FALSE); + BKE_object_minmax(scene->obedit, min, max, false); - ok = TRUE; + ok = true; BASACT->lay |= locallay; scene->obedit->lay = BASACT->lay; @@ -1106,10 +1106,10 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL else { for (base = FIRSTBASE; base; base = base->next) { if (TESTBASE(v3d, base)) { - BKE_object_minmax(base->object, min, max, FALSE); + BKE_object_minmax(base->object, min, max, false); base->lay |= locallay; base->object->lay = base->lay; - ok = TRUE; + ok = true; } } } @@ -1125,7 +1125,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL size_ortho = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f) * VIEW3D_MARGIN; } - if (ok == TRUE) { + if (ok == true) { ARegion *ar; v3d->localvd = MEM_mallocN(sizeof(View3D), "localview"); @@ -1220,7 +1220,7 @@ static void restore_localviewdata(ScrArea *sa, int free) } } -static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa) +static bool view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa) { View3D *v3d = sa->spacedata.first; struct Base *base; @@ -1247,12 +1247,12 @@ static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa) } } - DAG_on_visible_update(bmain, FALSE); + DAG_on_visible_update(bmain, false); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -1262,7 +1262,7 @@ static int localview_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); ScrArea *sa = CTX_wm_area(C); View3D *v3d = CTX_wm_view3d(C); - int change; + bool change; if (v3d->localvd) { change = view3d_localview_exit(bmain, scene, sa); @@ -1403,7 +1403,7 @@ static int game_engine_poll(bContext *C) return 1; } -int ED_view3d_context_activate(bContext *C) +bool ED_view3d_context_activate(bContext *C) { bScreen *sc = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); @@ -1416,20 +1416,20 @@ int ED_view3d_context_activate(bContext *C) break; if (!sa) - return 0; + return false; for (ar = sa->regionbase.first; ar; ar = ar->next) if (ar->regiontype == RGN_TYPE_WINDOW) break; if (!ar) - return 0; + return false; /* bad context switch .. */ CTX_wm_area_set(C, sa); CTX_wm_region_set(C, ar); - return 1; + return true; } static int game_engine_exec(bContext *C, wmOperator *op) @@ -1466,7 +1466,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) { /* Letterbox */ rctf cam_framef; - ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, FALSE); + ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, false); cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin; cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin; cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 4fe36a15802..b12c0906fa0 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -884,7 +884,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], return result; } -void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[3][3], int activeOnly) +void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[3][3], const bool activeOnly) { float normal[3] = {0.0, 0.0, 0.0}; float plane[3] = {0.0, 0.0, 0.0}; diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index 974865db1c0..959c5126305 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -69,7 +69,7 @@ void GPU_state_print(void); * - after drawing, the material must be disabled again */ void GPU_begin_object_materials(struct View3D *v3d, struct RegionView3D *rv3d, - struct Scene *scene, struct Object *ob, int glsl, int *do_alpha_after); + struct Scene *scene, struct Object *ob, bool glsl, bool *do_alpha_after); void GPU_end_object_materials(void); int GPU_enable_material(int nr, void *attribs); @@ -124,7 +124,7 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap); void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h); void GPU_update_images_framechange(void); int GPU_update_image_time(struct Image *ima, double time); -int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap, int isdata); +int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap, bool is_data); void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float *frect, int rectw, int recth, int mipmap, int use_hight_bit_depth, struct Image *ima); void GPU_create_gl_tex_compressed(unsigned int *bind, unsigned int *pix, int x, int y, int mipmap, struct Image *ima, struct ImBuf *ibuf); int GPU_upload_dxt_texture(struct ImBuf *ibuf); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index e153651caca..33402426b62 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -439,7 +439,7 @@ static void gpu_verify_reflection(Image *ima) } } -int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap, int is_data) +int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap, bool is_data) { ImBuf *ibuf = NULL; unsigned int *bind = NULL; @@ -1275,7 +1275,7 @@ static Material *gpu_active_node_material(Material *ma) return ma; } -void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, Object *ob, int glsl, int *do_alpha_after) +void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, Object *ob, bool glsl, bool *do_alpha_after) { Material *ma; GPUMaterial *gpumat; @@ -1308,7 +1308,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O GMS.use_alpha_pass = (do_alpha_after != NULL); GMS.is_alpha_pass = (v3d->transp != FALSE); if (GMS.use_alpha_pass) - *do_alpha_after = FALSE; + *do_alpha_after = false; if (GMS.totmat > FIXEDMAT) { GMS.matbuf= MEM_callocN(sizeof(GPUMaterialFixed)*GMS.totmat, "GMS.matbuf"); @@ -1381,7 +1381,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O * drawn in a second alpha pass for improved blending */ if (do_alpha_after && !GMS.is_alpha_pass) if (ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT)) - *do_alpha_after = TRUE; + *do_alpha_after = true; GMS.alphablend[a]= alphablend; } diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index 5df860750fc..cb35b0045f7 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -108,7 +108,7 @@ typedef struct RenderEngine { } RenderEngine; RenderEngine *RE_engine_create(RenderEngineType *type); -RenderEngine *RE_engine_create_ex(RenderEngineType *type, int use_for_viewport); +RenderEngine *RE_engine_create_ex(RenderEngineType *type, bool use_for_viewport); void RE_engine_free(RenderEngine *engine); void RE_layer_load_from_file(struct RenderLayer *layer, struct ReportList *reports, const char *filename, int x, int y); diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 4a48b6cc5f4..90528fddc85 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -132,7 +132,7 @@ RenderEngine *RE_engine_create(RenderEngineType *type) return RE_engine_create_ex(type, FALSE); } -RenderEngine *RE_engine_create_ex(RenderEngineType *type, int use_for_viewport) +RenderEngine *RE_engine_create_ex(RenderEngineType *type, bool use_for_viewport) { RenderEngine *engine = MEM_callocN(sizeof(RenderEngine), "RenderEngine"); engine->type = type; -- cgit v1.2.3