diff options
Diffstat (limited to 'source/blender/editors')
36 files changed, 103 insertions, 102 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 57bf6978174..f157487955b 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -787,7 +787,7 @@ static AnimChanRearrangeFp rearrange_get_mode_func(short mode) static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *srcList, Link *channel, short type) { tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */ - short is_sel = 0, is_untouchable = 0; + bool is_sel = false, is_untouchable = false; /* get flags - selected and untouchable from the channel */ switch (type) { diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 5e93fda0cd4..be1d300fcdb 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1766,7 +1766,7 @@ static size_t animdata_filter_ds_material(bAnimContext *ac, ListBase *anim_data, static size_t animdata_filter_ds_materials(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode) { - short has_nested = 0; + bool has_nested = false; size_t items = 0; int a = 0; @@ -1780,8 +1780,9 @@ static size_t animdata_filter_ds_materials(bAnimContext *ac, ListBase *anim_data items += animdata_filter_ds_material(ac, anim_data, ads, ma, filter_mode); /* for optimising second pass - check if there's a nested material here to come back for */ - if (has_nested == 0) - has_nested = give_node_material(ma) != NULL; + if (has_nested == false) { + has_nested = (give_node_material(ma) != NULL); + } } } diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index f07d575ae5f..b2a5844ccea 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3906,7 +3906,7 @@ static void rotate_direction_nurb(Nurb *nu) MEM_freeN(temp); } -static int is_u_selected(Nurb *nu, int u) +static bool is_u_selected(Nurb *nu, int u) { BPoint *bp; int v; diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index e7033ef0147..5f829a1cb27 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -113,7 +113,7 @@ static void gp_ui_layer_down_cb(bContext *C, void *gpd_v, void *gpl_v) /* ------- Drawing Code ------- */ /* draw the controls for a given layer */ -static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, const short is_v3d) +static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, const bool is_v3d) { uiLayout *box = NULL, *split = NULL; uiLayout *col = NULL; @@ -293,7 +293,7 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin uiLayout *col, *row; SpaceClip *sc = CTX_wm_space_clip(C); short v3d_stroke_opts = STROKE_OPTS_NORMAL; - const short is_v3d = CTX_wm_view3d(C) != NULL; + const bool is_v3d = CTX_wm_view3d(C) != NULL; /* make new PointerRNA for Grease Pencil block */ RNA_id_pointer_create((ID *)gpd, &gpd_ptr); diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index bdc5cbdbefe..36f31897c7d 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -47,10 +47,10 @@ void ED_space_image_set(struct SpaceImage *sima, struct Scene *scene, s struct Mask *ED_space_image_get_mask(struct SpaceImage *sima); void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask); -int ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *ar, int mval[2], float r_col[3]); +bool ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *ar, int mval[2], float r_col[3]); struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r); void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock); -int ED_space_image_has_buffer(struct SpaceImage *sima); +bool ED_space_image_has_buffer(struct SpaceImage *sima); void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height); void ED_space_image_get_size_fl(struct SpaceImage *sima, float size[2]); @@ -66,12 +66,12 @@ void ED_image_mouse_pos(struct SpaceImage *sima, struct ARegion *ar, const int m void ED_image_point_pos(struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr); void ED_image_point_pos__reverse(struct SpaceImage *sima, struct ARegion *ar, const float co[2], float r_co[2]); -int ED_space_image_show_render(struct SpaceImage *sima); -int ED_space_image_show_paint(struct SpaceImage *sima); -int ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit); -int ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit); +bool ED_space_image_show_render(struct SpaceImage *sima); +bool ED_space_image_show_paint(struct SpaceImage *sima); +bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit); +bool ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit); -int ED_space_image_check_show_maskedit(struct Scene *scene, struct SpaceImage *sima); +bool ED_space_image_check_show_maskedit(struct Scene *scene, struct SpaceImage *sima); int ED_space_image_maskedit_poll(struct bContext *C); int ED_space_image_maskedit_mask_poll(struct bContext *C); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 4c838136c00..dda02ebde6c 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -469,7 +469,7 @@ static void draw_scope_end(const rctf *rect, GLint *scissor) } static void histogram_draw_one(float r, float g, float b, float alpha, - float x, float y, float w, float h, float *data, int res, const short is_line) + float x, float y, float w, float h, float *data, int res, const bool is_line) { int i; @@ -533,7 +533,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) rctf rect; int i; float w, h; - const short is_line = (hist->flag & HISTO_FLAG_LINE) != 0; + const bool is_line = (hist->flag & HISTO_FLAG_LINE) != 0; //float alpha; GLint scissor[4]; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 62e1c4ad60b..1f06358eb78 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1848,7 +1848,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, strCursorJump const char *str = data->str; const int len = strlen(str); const int pos_prev = but->pos; - const int has_sel = (but->selend - but->selsta) > 0; + const bool has_sel = (but->selend - but->selsta) > 0; ui_check_but(but); @@ -5207,7 +5207,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) uiLayout *layout; uiStyle *style = UI_GetStyleDraw(); IDProperty *prop = (but->opptr) ? but->opptr->data : NULL; - int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); + int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, true, &km); kmi = WM_keymap_item_find_id(km, kmi_id); @@ -5286,7 +5286,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) wmKeyMap *km; wmKeyMapItem *kmi; IDProperty *prop = (but->opptr) ? but->opptr->data : NULL; - int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); + int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, true, &km); kmi = WM_keymap_item_find_id(km, kmi_id); WM_keymap_remove_item(km, kmi); @@ -5522,7 +5522,7 @@ static bool ui_but_menu(bContext *C, uiBut *but) int w = uiLayoutGetWidth(layout); wmKeyMap *km; wmKeyMapItem *kmi = NULL; - int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); + int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, true, &km); if (kmi_id) kmi = WM_keymap_item_find_id(km, kmi_id); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index cc6d0348ab6..729cbc23efd 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -981,7 +981,7 @@ PreviewImage *UI_icon_to_preview(int icon_id) } static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, - unsigned int *rect, float alpha, const float rgb[3], short is_preview) + unsigned int *rect, float alpha, const float rgb[3], const bool is_preview) { ImBuf *ima = NULL; diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 812eb9345ac..2b9d7a74e95 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -156,7 +156,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, if (label_align != '\0') { PropertyType type = RNA_property_type(prop); - int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop)); + const bool is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop)); name = RNA_property_ui_name(prop); diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 1a0fea51581..a442d549a14 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -80,7 +80,7 @@ static Object *make_prim_init(bContext *C, const char *idname, static void make_prim_finish(bContext *C, Object *obedit, bool was_editmode, int enter_editmode) { BMEditMesh *em = BKE_editmesh_from_object(obedit); - const int exit_editmode = ((was_editmode == true) && (enter_editmode == false)); + const bool exit_editmode = ((was_editmode == true) && (enter_editmode == false)); /* Primitive has all verts selected, use vert select flush * to push this up to edges & faces. */ diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 23a17f26569..244bd5c1d71 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1171,7 +1171,7 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op)) Object *ob = ptr.id.data; bConstraint *con = ptr.data; ListBase *lb = get_constraint_lb(ob, con, NULL); - const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK); + const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK); /* free the constraint */ if (BKE_remove_constraint(lb, con)) { diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 32de1f4a9a5..f1a04f81979 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1319,7 +1319,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); unsigned int lay, local; - /* int is_lamp = FALSE; */ /* UNUSED */ + /* bool is_lamp = FALSE; */ /* UNUSED */ lay = move_to_layer_init(C, op); lay &= 0xFFFFFF; diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index e9d1f133181..4ff4150e06a 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -282,8 +282,8 @@ static int screen_render_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); Main *mainp = CTX_data_main(C); unsigned int lay_override; - const short is_animation = RNA_boolean_get(op->ptr, "animation"); - const short is_write_still = RNA_boolean_get(op->ptr, "write_still"); + const bool is_animation = RNA_boolean_get(op->ptr, "animation"); + const bool is_write_still = RNA_boolean_get(op->ptr, "write_still"); struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL; /* custom scene and single layer re-render */ diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 6ad7e8aaf5a..3ef3ff8f366 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -92,7 +92,7 @@ typedef struct OGLRender { short obcenter_dia_back; /* temp overwrite */ - short is_sequencer; + bool is_sequencer; SpaceSeq *sseq; @@ -323,7 +323,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) MEM_freeN(rect); } -static int screen_opengl_render_init(bContext *C, wmOperator *op) +static bool screen_opengl_render_init(bContext *C, wmOperator *op) { /* new render clears all callbacks */ wmWindowManager *wm = CTX_wm_manager(C); @@ -336,36 +336,36 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) GPUOffScreen *ofs; OGLRender *oglrender; int sizex, sizey; - short is_view_context = RNA_boolean_get(op->ptr, "view_context"); - const short is_animation = RNA_boolean_get(op->ptr, "animation"); - const short is_sequencer = RNA_boolean_get(op->ptr, "sequencer"); - const short is_write_still = RNA_boolean_get(op->ptr, "write_still"); + bool is_view_context = RNA_boolean_get(op->ptr, "view_context"); + const bool is_animation = RNA_boolean_get(op->ptr, "animation"); + const bool is_sequencer = RNA_boolean_get(op->ptr, "sequencer"); + const bool is_write_still = RNA_boolean_get(op->ptr, "write_still"); char err_out[256] = "unknown"; if (G.background) { BKE_report(op->reports, RPT_ERROR, "Cannot use OpenGL render in background mode (no opengl context)"); - return 0; + return false; } /* ensure we have a 3d view */ if (!ED_view3d_context_activate(C)) { RNA_boolean_set(op->ptr, "view_context", FALSE); - is_view_context = 0; + is_view_context = false; } /* only one render job at a time */ if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) - return 0; + return false; if (!is_view_context && scene->camera == NULL) { BKE_report(op->reports, RPT_ERROR, "Scene has no camera"); - return 0; + return false; } if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected"); - return 0; + return false; } /* stop all running jobs, except screen one. currently previews frustrate Render */ @@ -380,7 +380,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) if (!ofs) { BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL off-screen buffer, %s", err_out); - return 0; + return false; } /* allocate opengl render */ @@ -444,7 +444,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->wm = wm; oglrender->win = win; - return 1; + return true; } static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index 9f72ddc179f..c1cd17465cf 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -138,7 +138,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my) Scene *scene = CTX_data_scene(C); ScrArea *sa = NULL; SpaceImage *sima; - int area_was_image = 0; + bool area_was_image = false; if (scene->r.displaymode == R_OUTPUT_NONE) return NULL; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 8b7246b4b90..e6273749157 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3753,7 +3753,7 @@ float ED_region_blend_factor(ARegion *ar) } /* assumes region has running region-blend timer */ -static void region_blend_end(bContext *C, ARegion *ar, int is_running) +static void region_blend_end(bContext *C, ARegion *ar, const bool is_running) { RegionAlphaInfo *rgi = ar->regiontimer->customdata; @@ -3789,7 +3789,7 @@ void region_blend_start(bContext *C, ScrArea *sa, ARegion *ar) /* end running timer */ if (ar->regiontimer) { - region_blend_end(C, ar, 1); + region_blend_end(C, ar, true); } rgi = MEM_callocN(sizeof(RegionAlphaInfo), "RegionAlphaInfo"); @@ -3835,7 +3835,7 @@ static int region_blend_invoke(bContext *C, wmOperator *UNUSED(op), const wmEven /* end timer? */ if (rgi->ar->regiontimer->duration > (double)TIMEOUT) { - region_blend_end(C, rgi->ar, 0); + region_blend_end(C, rgi->ar, false); return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH); } diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 1b6f3509b88..dc0c097c558 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -162,7 +162,7 @@ void PAINT_OT_mask_flood_fill(struct wmOperatorType *ot) /* Box select, operator is VIEW3D_OT_select_border, defined in view3d_select.c */ -static int is_effected(float planes[4][4], const float co[3]) +static bool is_effected(float planes[4][4], const float co[3]) { return isect_point_planes_v3(planes, 4, co); } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 70eb2619415..f04e94719c0 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1376,7 +1376,7 @@ static void do_weight_paint_normalize_all_active(MDeformVert *dvert, const int d /* * See if the current deform vertex has a locked group */ -static char has_locked_group(MDeformVert *dvert, const int defbase_tot, +static bool has_locked_group(MDeformVert *dvert, const int defbase_tot, const bool *bone_groups, const bool *lock_flags) { int i; @@ -1405,8 +1405,8 @@ static bool has_locked_group_selected(int defbase_tot, const bool *defbase_sel, #if 0 /* UNUSED */ -static int has_unselected_unlocked_bone_group(int defbase_tot, bool *defbase_sel, int selected, - const bool *lock_flags, const bool *vgroup_validmap) +static bool has_unselected_unlocked_bone_group(int defbase_tot, bool *defbase_sel, int selected, + const bool *lock_flags, const bool *vgroup_validmap) { int i; if (defbase_tot == selected) { diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 4fbf5aa5fb7..c0837b627b3 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -113,7 +113,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) /* add slash for directories, important for some properties */ if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) { - int is_relative = RNA_boolean_get(op->ptr, "relative_path"); + const bool is_relative = RNA_boolean_get(op->ptr, "relative_path"); id = fbo->ptr.id.data; BLI_strncpy(path, str, FILE_MAX); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index e31d813fc5e..5c6678967b5 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -461,7 +461,7 @@ void file_draw_list(const bContext *C, ARegion *ar) int offset; int textwidth, textheight; int i; - short is_icon; + bool is_icon; short align; bool do_drag; int column_space = 0.6f * UI_UNIT_X; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 6f026a4adcd..3d5ae8c26cf 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -378,7 +378,7 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op)) FileSelection sel; int numfiles = filelist_numfiles(sfile->files); int i; - int is_selected = 0; + bool is_selected = false; sel.first = 0; sel.last = numfiles - 1; @@ -386,7 +386,7 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op)) /* Is any file selected ? */ for (i = 0; i < numfiles; ++i) { if (filelist_is_selected(sfile->files, i, CHECK_ALL)) { - is_selected = 1; + is_selected = true; break; } } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 748a0bd884c..7282b024399 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -120,7 +120,7 @@ typedef struct FileList { short hide_parent; void (*readf)(struct FileList *); - int (*filterf)(struct direntry *file, const char *dir, unsigned int filter, short hide_dot); + bool (*filterf)(struct direntry *file, const char *dir, unsigned int filter, short hide_dot); } FileList; @@ -296,9 +296,9 @@ static int compare_extension(const void *a1, const void *a2) return (BLI_strcasecmp(sufix1, sufix2)); } -static int is_hidden_file(const char *filename, short hide_dot) +static bool is_hidden_file(const char *filename, short hide_dot) { - int is_hidden = 0; + bool is_hidden = false; if (hide_dot) { if (filename[0] == '.' && filename[1] != '.' && filename[1] != 0) { @@ -322,9 +322,9 @@ static int is_hidden_file(const char *filename, short hide_dot) return is_hidden; } -static int is_filtered_file(struct direntry *file, const char *UNUSED(dir), unsigned int filter, short hide_dot) +static bool is_filtered_file(struct direntry *file, const char *UNUSED(dir), unsigned int filter, short hide_dot) { - int is_filtered = 0; + bool is_filtered = false; if (filter) { if (file->flags & filter) { is_filtered = 1; @@ -341,9 +341,9 @@ static int is_filtered_file(struct direntry *file, const char *UNUSED(dir), unsi return is_filtered && !is_hidden_file(file->relname, hide_dot); } -static int is_filtered_lib(struct direntry *file, const char *dir, unsigned int filter, short hide_dot) +static bool is_filtered_lib(struct direntry *file, const char *dir, unsigned int filter, short hide_dot) { - int is_filtered = 0; + bool is_filtered = false; char tdir[FILE_MAX], tgroup[GROUP_MAX]; if (BLO_is_a_library(dir, tdir, tgroup)) { is_filtered = !is_hidden_file(file->relname, hide_dot); @@ -354,7 +354,7 @@ static int is_filtered_lib(struct direntry *file, const char *dir, unsigned int return is_filtered; } -static int is_filtered_main(struct direntry *file, const char *UNUSED(dir), unsigned int UNUSED(filter), short hide_dot) +static bool is_filtered_main(struct direntry *file, const char *UNUSED(dir), unsigned int UNUSED(filter), short hide_dot) { return !is_hidden_file(file->relname, hide_dot); } diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index d329d505138..e00d0f34dd9 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -111,11 +111,11 @@ short ED_fileselect_set_params(SpaceFile *sfile) /* set the parameters from the operator, if it exists */ if (op) { PropertyRNA *prop; - const short is_files = (RNA_struct_find_property(op->ptr, "files") != NULL); - const short is_filepath = (RNA_struct_find_property(op->ptr, "filepath") != NULL); - const short is_filename = (RNA_struct_find_property(op->ptr, "filename") != NULL); - const short is_directory = (RNA_struct_find_property(op->ptr, "directory") != NULL); - const short is_relative_path = (RNA_struct_find_property(op->ptr, "relative_path") != NULL); + const bool is_files = (RNA_struct_find_property(op->ptr, "files") != NULL); + const bool is_filepath = (RNA_struct_find_property(op->ptr, "filepath") != NULL); + const bool is_filename = (RNA_struct_find_property(op->ptr, "filename") != NULL); + const bool is_directory = (RNA_struct_find_property(op->ptr, "directory") != NULL); + const bool is_relative_path = (RNA_struct_find_property(op->ptr, "relative_path") != NULL); BLI_strncpy_utf8(params->title, RNA_struct_ui_name(op->type->srna), sizeof(params->title)); @@ -296,9 +296,9 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar) } } -static int is_inside(int x, int y, int cols, int rows) +static bool is_inside(int x, int y, int cols, int rows) { - return ( (x >= 0) && (x < cols) && (y >= 0) && (y < rows) ); + return ((x >= 0) && (x < cols) && (y >= 0) && (y < rows)); } FileSelection ED_fileselect_layout_offset_rect(FileLayout *layout, const rcti *rect) diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index 5ce3ade7d30..07a582f7556 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -195,7 +195,7 @@ int graphop_active_fcurve_poll(bContext *C) bAnimContext ac; bAnimListElem *ale; ScrArea *sa = CTX_wm_area(C); - short has_fcurve = 0; + bool has_fcurve = 0; /* firstly, check if in Graph Editor */ // TODO: also check for region? diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 003476882f7..dd302829f8e 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -241,7 +241,7 @@ static void preview_cb(ScrArea *sa, struct uiBlock *block) } -static int is_preview_allowed(ScrArea *cur) +static bool is_preview_allowed(ScrArea *cur) { SpaceImage *sima = cur->spacedata.first; ScrArea *sa; @@ -677,13 +677,13 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char if (ima->source != IMA_SRC_GENERATED) { if (compact == 0) { /* background image view doesnt need these */ ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL); - int has_alpha = TRUE; + bool has_alpha = true; if (ibuf) { int imtype = BKE_ftype_to_imtype(ibuf->ftype); char valid_channels = BKE_imtype_valid_channels(imtype); - has_alpha = valid_channels & IMA_CHAN_FLAG_ALPHA; + has_alpha = (valid_channels & IMA_CHAN_FLAG_ALPHA) != 0; BKE_image_release_ibuf(ima, ibuf, NULL); } @@ -764,7 +764,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man PropertyRNA *prop; const int depth_ok = BKE_imtype_valid_depths(imf->imtype); /* some settings depend on this being a scene thats rendered */ - const short is_render_out = (id && GS(id->name) == ID_SCE); + const bool is_render_out = (id && GS(id->name) == ID_SCE); uiLayout *col, *row, *split, *sub; int show_preview = FALSE; diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 217a9687c01..9b9c13a1d4f 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -135,11 +135,11 @@ void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock) BKE_image_release_ibuf(sima->image, ibuf, lock); } -int ED_space_image_has_buffer(SpaceImage *sima) +bool ED_space_image_has_buffer(SpaceImage *sima) { ImBuf *ibuf; void *lock; - int has_buffer; + bool has_buffer; ibuf = ED_space_image_acquire_buffer(sima, &lock); has_buffer = (ibuf != NULL); @@ -291,12 +291,12 @@ void ED_image_point_pos__reverse(SpaceImage *sima, ARegion *ar, const float co[2 r_co[1] = (co[1] * height * zoomy) + (float)sy; } -int ED_space_image_show_render(SpaceImage *sima) +bool ED_space_image_show_render(SpaceImage *sima) { return (sima->image && ELEM(sima->image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)); } -int ED_space_image_show_paint(SpaceImage *sima) +bool ED_space_image_show_paint(SpaceImage *sima) { if (ED_space_image_show_render(sima)) return 0; @@ -304,7 +304,7 @@ int ED_space_image_show_paint(SpaceImage *sima) return (sima->mode == SI_MODE_PAINT); } -int ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) +bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) { if (sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima))) return 0; @@ -321,7 +321,7 @@ int ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) return 0; } -int ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit) +bool ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit) { if (ED_space_image_show_render(sima)) return 0; @@ -340,7 +340,7 @@ int ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit) } /* matches clip function */ -int ED_space_image_check_show_maskedit(Scene *scene, SpaceImage *sima) +bool ED_space_image_check_show_maskedit(Scene *scene, SpaceImage *sima) { /* check editmode - this is reserved for UV editing */ Object *ob = OBACT; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 28027e74f13..38d19923c3d 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1344,12 +1344,12 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, if (ibuf) { Image *ima = sima->image; - short is_depth_set = FALSE; + bool is_depth_set = false; if (ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { /* imtype */ simopts->im_format = scene->r.im_format; - is_depth_set = TRUE; + is_depth_set = true; } else { if (ima->source == IMA_SRC_GENERATED) { @@ -1376,7 +1376,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, } /* depth, account for float buffer and format support */ - if (is_depth_set == FALSE) { + if (is_depth_set == false) { simopts->im_format.depth = imtype_best_depth(ibuf, simopts->im_format.imtype); } @@ -2311,12 +2311,12 @@ static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info) /* returns color in SRGB */ /* matching ED_space_node_color_sample() */ -int ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], float r_col[3]) +bool ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], float r_col[3]) { void *lock; ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock); float fx, fy; - int ret = FALSE; + bool ret = false; if (ibuf == NULL) { ED_space_image_release_buffer(sima, ibuf, lock); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 0f70c5a5972..360b394d406 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -613,12 +613,12 @@ void snode_update(SpaceNode *snode, bNode *node) void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) { - int was_active_texture = (node->flag & NODE_ACTIVE_TEXTURE); + const bool was_active_texture = (node->flag & NODE_ACTIVE_TEXTURE) != 0; nodeSetActive(ntree, node); if (node->type != NODE_GROUP) { - int was_output = (node->flag & NODE_DO_OUTPUT); + const bool was_output = (node->flag & NODE_DO_OUTPUT) != 0; int do_update = 0; /* generic node group output: set node as active output */ @@ -1995,7 +1995,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) bNodeLink *link; int num_nodes; float center[2]; - int is_clipboard_valid, all_nodes_valid; + bool is_clipboard_valid, all_nodes_valid; /* validate pointers in the clipboard */ is_clipboard_valid = BKE_node_clipboard_validate(); diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index ff441d63479..50904ed912c 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -74,7 +74,7 @@ int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, float oldwidth, oldheight, width, height; float oldasp, asp; int tot = 0; - int has_frame = FALSE; + bool has_frame = false; oldwidth = BLI_rctf_size_x(&ar->v2d.cur); oldheight = BLI_rctf_size_y(&ar->v2d.cur); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 24cb03d62e5..b17fff3aca9 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -591,7 +591,7 @@ static int text_run_script(bContext *C, ReportList *reports) { #ifdef WITH_PYTHON Text *text = CTX_data_edit_text(C); - const short is_live = (reports == NULL); + const bool is_live = (reports == NULL); /* only for comparison */ void *curl_prev = text->curl; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 0caf679d775..dd2138b5420 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2948,7 +2948,7 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe } BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - const int is_face_sel = BM_elem_flag_test(efa, BM_ELEM_SELECT); + const bool is_face_sel = BM_elem_flag_test_bool(efa, BM_ELEM_SELECT); if (is_face_sel || do_moving) { BMIter liter; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index f95883f28ec..323bc6bc436 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1211,7 +1211,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event) const float zoom_sensitivity = 1.f; #endif const float pan_sensitivity = 1.f; - const int has_rotation = rv3d->viewlock != RV3D_LOCKED && !is_zero_v3(ndof->rvec); + const bool has_rotation = rv3d->viewlock != RV3D_LOCKED && !is_zero_v3(ndof->rvec); float view_inv[4]; invert_qt_qt(view_inv, rv3d->viewquat); @@ -1295,7 +1295,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev const float zoom_sensitivity = 1.f; const float pan_sensitivity = 1.f; - const int has_rotation = rv3d->viewlock != RV3D_LOCKED && !is_zero_v3(ndof->rvec); + const bool has_rotation = rv3d->viewlock != RV3D_LOCKED && !is_zero_v3(ndof->rvec); float view_inv[4]; invert_qt_qt(view_inv, rv3d->viewquat); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index ce5c76b3452..47bd52755a7 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4501,7 +4501,7 @@ static void freeSeqData(TransInfo *t) } if (overlap) { - int has_effect = 0; + bool has_effect = false; for (seq = seqbasep->first; seq; seq = seq->next) seq->tmp = NULL; @@ -4512,7 +4512,7 @@ static void freeSeqData(TransInfo *t) if ((seq != seq_prev)) { /* check effects strips, we cant change their time */ if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) { - has_effect = TRUE; + has_effect = true; } else { /* Tag seq with a non zero value, used by BKE_sequence_base_shuffle_time to identify the ones to shuffle */ @@ -6008,7 +6008,7 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node, const td->extra = node; } -static int is_node_parent_select(bNode *node) +static bool is_node_parent_select(bNode *node) { while ((node = node->parent)) { if (node->flag & NODE_TRANSFORM) { @@ -6624,7 +6624,7 @@ void flushTransTracking(TransInfo *t) /* * masking * */ typedef struct TransDataMasking { - int is_handle; + bool is_handle; float handle[2], orig_handle[2]; float vec[3][3]; @@ -6638,8 +6638,8 @@ static void MaskPointToTransData(Scene *scene, MaskSplinePoint *point, const int propmode, const float asp[2]) { BezTriple *bezt = &point->bezt; - short is_sel_point = MASKPOINT_ISSEL_KNOT(point); - short is_sel_any = MASKPOINT_ISSEL_ANY(point); + const bool is_sel_point = MASKPOINT_ISSEL_KNOT(point); + const bool is_sel_any = MASKPOINT_ISSEL_ANY(point); float parent_matrix[3][3], parent_inverse_matrix[3][3]; tdm->point = point; diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index e8146c34f5e..399b0f86d5f 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -323,7 +323,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma int a, numVerts = 0; float (*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL; MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0); - int has_multires = mmd != NULL && mmd->sculptlvl > 0; + const bool has_multires = mmd != NULL && mmd->sculptlvl > 0; int numleft = 0; VirtualModifierData virtualModifierData; diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 7f4e05ddefa..caa5e7659f8 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -205,7 +205,7 @@ static void undo_clean_stack(bContext *C) uel = undobase.first; while (uel) { void *editdata = uel->getdata(C); - int is_valid = FALSE; + bool is_valid = false; next = uel->next; /* for when objects are converted, renamed, or global undo changes pointers... */ diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 7c8a0f24f0b..0d1778ea69f 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2475,8 +2475,8 @@ static int uv_select_split_exec(bContext *C, wmOperator *op) BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { - int is_sel = FALSE; - int is_unsel = FALSE; + bool is_sel = false; + bool is_unsel = false; tf = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset); if (!uvedit_face_visible_test(scene, ima, efa, tf)) |