diff options
Diffstat (limited to 'source/blender')
65 files changed, 241 insertions, 226 deletions
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index e2d49aa51ff..c866fbb7b13 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -48,7 +48,7 @@ struct Scene; void init_def_material(void); void BKE_material_free(struct Material *sc); -void BKE_material_free_ex(struct Material *ma, int do_id_user); +void BKE_material_free_ex(struct Material *ma, bool do_id_user); void test_object_materials(struct Main *bmain, struct ID *id); void BKE_material_resize_object(struct Object *ob, const short totcol, bool do_id_user); void init_material(struct Material *ma); diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index fc0359d8ff0..664c1a6b051 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -339,11 +339,11 @@ void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree); struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char *idname); /* copy/free funcs, need to manage ID users */ -void ntreeFreeTree_ex(struct bNodeTree *ntree, const short do_id_user); +void ntreeFreeTree_ex(struct bNodeTree *ntree, const bool do_id_user); void ntreeFreeTree(struct bNodeTree *ntree); -struct bNodeTree *ntreeCopyTree_ex(struct bNodeTree *ntree, const short do_id_user); +struct bNodeTree *ntreeCopyTree_ex(struct bNodeTree *ntree, const bool do_id_user); struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree); -void ntreeSwitchID_ex(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to, const short do_id_user); +void ntreeSwitchID_ex(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to, const bool do_id_user); void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to); /* node->id user count */ void ntreeUserIncrefID(struct bNodeTree *ntree); @@ -488,7 +488,7 @@ int nodeSocketIsHidden(struct bNodeSocket *sock); /* Node Clipboard */ void BKE_node_clipboard_init(struct bNodeTree *ntree); void BKE_node_clipboard_clear(void); -int BKE_node_clipboard_validate(void); +bool BKE_node_clipboard_validate(void); void BKE_node_clipboard_add_node(struct bNode *node); void BKE_node_clipboard_add_link(struct bNodeLink *link); const struct ListBase *BKE_node_clipboard_get_nodes(void); diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index e9e351f8f37..cf192234906 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -100,7 +100,7 @@ void set_current_material_texture(struct Material *ma, struct Tex *tex); void set_current_lamp_texture(struct Lamp *la, struct Tex *tex); void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex); -int has_current_material_texture(struct Material *ma); +bool has_current_material_texture(struct Material *ma); struct TexMapping *add_tex_mapping(int type); void default_tex_mapping(struct TexMapping *texmap, int type); diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index 6bb35e46539..7f4ba6c615e 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -37,7 +37,7 @@ struct Main; struct World; void BKE_world_free(struct World *sc); -void BKE_world_free_ex(struct World *sc, int do_id_user); +void BKE_world_free_ex(struct World *sc, bool do_id_user); struct World *add_world(struct Main *bmian, const char *name); struct World *BKE_world_copy(struct World *wrld); struct World *localize_world(struct World *wrld); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index cc0e80c81e9..83e0d99bc6b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1429,20 +1429,21 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos DerivedMesh *dm = NULL, *orcodm, *clothorcodm, *finaldm; int numVerts = me->totvert; int required_mode; - int isPrevDeform = FALSE; - int skipVirtualArmature = (useDeform < 0); + bool isPrevDeform = false; + const bool skipVirtualArmature = (useDeform < 0); MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0); - int has_multires = mmd != NULL, multires_applied = 0; - int sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt; - int sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm); - int draw_flag = dm_drawflag_calc(scene->toolsettings); + const bool has_multires = (mmd && mmd->sculptlvl != 0); + bool multires_applied = false; + const bool sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt; + const bool sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm); + const int draw_flag = dm_drawflag_calc(scene->toolsettings); /* Generic preview only in object mode! */ - const int do_mod_mcol = (ob->mode == OB_MODE_OBJECT); + const bool do_mod_mcol = (ob->mode == OB_MODE_OBJECT); #if 0 /* XXX Will re-enable this when we have global mod stack options. */ - const int do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol; + const bool do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol; #endif - const int do_final_wmcol = FALSE; + const bool do_final_wmcol = FALSE; int do_init_wmcol = ((dataMask & CD_MASK_PREVIEW_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && !do_final_wmcol); /* XXX Same as above... For now, only weights preview in WPaint mode. */ const int do_mod_wmcol = do_init_wmcol; @@ -1456,9 +1457,6 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if (useDeform) deform_app_flags |= MOD_APPLY_USECACHE; - if (mmd && !mmd->sculptlvl) - has_multires = 0; - if (!skipVirtualArmature) { firstmd = modifiers_getVirtualModifierList(ob, &virtualModifierData); } @@ -1570,7 +1568,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if (sculpt_mode && (!has_multires || multires_applied || ob->sculpt->bm)) { - int unsupported = 0; + bool unsupported = false; if (md->type == eModifierType_Multires && ((MultiresModifierData *)md)->sculptlvl == 0) { /* If multires is on level 0 skip it silently without warning message. */ @@ -1578,10 +1576,10 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos } if (sculpt_dyntopo && !useRenderParams) - unsupported = TRUE; + unsupported = true; if (scene->toolsettings->sculpt->flags & SCULPT_ONLY_DEFORM) - unsupported |= mti->type != eModifierTypeType_OnlyDeform; + unsupported |= (mti->type != eModifierTypeType_OnlyDeform); unsupported |= multires_applied; @@ -1786,8 +1784,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if ((index >= 0) && (BLI_findindex(&ob->modifiers, md) >= index)) break; - if (sculpt_mode && md->type == eModifierType_Multires) - multires_applied = 1; + if (sculpt_mode && md->type == eModifierType_Multires) { + multires_applied = true; + } } for (md = firstmd; md; md = md->next) @@ -1970,10 +1969,10 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D #if 0 /* XXX Will re-enable this when we have global mod stack options. */ const int do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol; #endif - const int do_final_wmcol = FALSE; - int do_init_wmcol = ((((Mesh *)ob->data)->drawflag & ME_DRAWEIGHT) && !do_final_wmcol); - int do_init_statvis = ((((Mesh *)ob->data)->drawflag & ME_DRAW_STATVIS) && !do_init_wmcol); - const int do_mod_wmcol = do_init_wmcol; + const bool do_final_wmcol = FALSE; + const bool do_init_wmcol = ((((Mesh *)ob->data)->drawflag & ME_DRAWEIGHT) && !do_final_wmcol); + const bool do_init_statvis = ((((Mesh *)ob->data)->drawflag & ME_DRAW_STATVIS) && !do_init_wmcol); + const bool do_mod_wmcol = do_init_wmcol; VirtualModifierData virtualModifierData; modifiers_clearErrors(ob); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index f20fa0c401d..a46b308f76b 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -2233,7 +2233,7 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData { NlaTrack *nlt; short track_index = 0; - short has_strips = 0; + bool has_strips = false; ListBase estrips = {NULL, NULL}; NlaEvalStrip *nes; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 0c1bf476908..e91b1c5424a 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -84,7 +84,7 @@ void BKE_material_free(Material *ma) } /* not material itself */ -void BKE_material_free_ex(Material *ma, int do_id_user) +void BKE_material_free_ex(Material *ma, bool do_id_user) { MTex *mtex; int a; diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 79f77416639..02751e0cbb3 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1209,7 +1209,7 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool do_ return newtree; } -bNodeTree *ntreeCopyTree_ex(bNodeTree *ntree, const short do_id_user) +bNodeTree *ntreeCopyTree_ex(bNodeTree *ntree, const bool do_id_user) { return ntreeCopyTree_internal(ntree, G.main, do_id_user, TRUE, TRUE); } @@ -1219,7 +1219,7 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree) } /* use when duplicating scenes */ -void ntreeSwitchID_ex(bNodeTree *ntree, ID *id_from, ID *id_to, const short do_id_user) +void ntreeSwitchID_ex(bNodeTree *ntree, ID *id_from, ID *id_to, const bool do_id_user) { bNode *node; @@ -1702,7 +1702,7 @@ static void free_localized_node_groups(bNodeTree *ntree) } /* do not free ntree itself here, BKE_libblock_free calls this function too */ -void ntreeFreeTree_ex(bNodeTree *ntree, const short do_id_user) +void ntreeFreeTree_ex(bNodeTree *ntree, const bool do_id_user) { bNodeTree *tntree; bNode *node, *next; @@ -2552,9 +2552,9 @@ void BKE_node_clipboard_clear(void) } /* return FALSE when one or more ID's are lost */ -int BKE_node_clipboard_validate(void) +bool BKE_node_clipboard_validate(void) { - int ok = TRUE; + bool ok = true; #ifdef USE_NODE_CB_VALIDATE bNodeClipboardExtraInfo *node_info; @@ -2585,7 +2585,7 @@ int BKE_node_clipboard_validate(void) node->id = BLI_findstring(lb, node_info->id_name + 2, offsetof(ID, name) + 2); if (node->id == NULL) { - ok = FALSE; + ok = false; } } } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index a3ae6017706..786a490fa10 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1121,7 +1121,7 @@ void set_current_material_texture(Material *ma, Tex *newtex) } } -int has_current_material_texture(Material *ma) +bool has_current_material_texture(Material *ma) { bNode *node; diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index a6c30ce0d3a..af8cf62484d 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -50,7 +50,7 @@ #include "BKE_node.h" #include "BKE_world.h" -void BKE_world_free_ex(World *wrld, int do_id_user) +void BKE_world_free_ex(World *wrld, bool do_id_user) { MTex *mtex; int a; diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 612740baa94..fa2c9b182e3 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -2144,7 +2144,7 @@ static NewVert *mesh_vert_canon(VMesh *vm, int i, int j, int k) return ans; } -static int is_canon(VMesh *vm, int i, int j, int k) +static bool is_canon(VMesh *vm, int i, int j, int k) { int ns2 = vm->seg / 2; if (vm->seg % 2 == 1) diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp index e92d2a3d004..59714282d93 100644 --- a/source/blender/compositor/intern/COM_compositor.cpp +++ b/source/blender/compositor/intern/COM_compositor.cpp @@ -36,7 +36,7 @@ extern "C" { #include "COM_MovieDistortionOperation.h" static ThreadMutex s_compositorMutex; -static char is_compositorMutex_init = FALSE; +static bool is_compositorMutex_init = FALSE; static void intern_freeCompositorCaches() { 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)) diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index ec5fc4e43b4..d2c44cd1281 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -215,7 +215,7 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4], BMOpSlot dupe_op_slot_args[BMO_OP_MAX_SLOTS], const char *dupe_slot_name, BMOperator *weld_op) { - const int is_input = (dupe_op->slots_in == dupe_op_slot_args); + const bool is_input = (dupe_op->slots_in == dupe_op_slot_args); BMVert *v, *v2, *v3; BMIter iter; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 44cf240816e..76a0ed59d06 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -130,7 +130,7 @@ static void sphere_do( Object *ctrl_ob = NULL; int i, defgrp_index; - int has_radius = 0; + bool has_radius = false; short flag, type; float len = 0.0f; float fac = cmd->fac; @@ -250,7 +250,7 @@ static void cuboid_do( Object *ctrl_ob = NULL; int i, defgrp_index; - int has_radius = 0; + bool has_radius = false; short flag; float fac = cmd->fac; float facm = 1.0f - fac; diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index 9f65915fd26..febd81e2f1b 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -285,7 +285,7 @@ static void init_laplacian_matrix(LaplacianSystem *sys) float areaf; int i, j; unsigned int idv1, idv2, idv3, idv4, idv[4]; - int has_4_vert; + bool has_4_vert; for (i = 0; i < sys->numEdges; i++) { idv1 = sys->medges[i].v1; idv2 = sys->medges[i].v2; @@ -405,7 +405,7 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) float *v1, *v2, *v3, *v4; float w2, w3, w4; int i, j; - int has_4_vert; + bool has_4_vert; unsigned int idv1, idv2, idv3, idv4, idv[4]; for (i = 0; i < sys->numFaces; i++) { diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index b3b08ce5c85..c95cd96757f 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -76,7 +76,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, Mesh *me = (Mesh *)ob->data; const int useRenderParams = flag & MOD_APPLY_RENDER; MultiresFlags flags = 0; - int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK); + const bool has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK); if (mmd->totlvl) { if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) { diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 1d9f590378d..b5c0ae8b93f 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -141,8 +141,8 @@ static void add_poly(SkinOutput *so, /***************************** Convex Hull ****************************/ -static int is_quad_symmetric(BMVert *quad[4], - const SkinModifierData *smd) +static bool is_quad_symmetric(BMVert *quad[4], + const SkinModifierData *smd) { const float threshold = 0.0001f; const float threshold_squared = threshold * threshold; diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index c3cbe7ddbf9..938a4cc8049 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -1002,22 +1002,22 @@ PyTypeObject BPy_IDGroup_Type = { /********Array Wrapper********/ -static PyTypeObject *idp_array_py_type(BPy_IDArray *self, short *is_double) +static PyTypeObject *idp_array_py_type(BPy_IDArray *self, bool *r_is_double) { switch (self->prop->subtype) { case IDP_FLOAT: - *is_double = 0; + *r_is_double = false; return &PyFloat_Type; case IDP_DOUBLE: - *is_double = 1; + *r_is_double = true; return &PyFloat_Type; case IDP_INT: - *is_double = 0; + *r_is_double = false; return &PyLong_Type; + default: + *r_is_double = false; + return NULL; } - - *is_double = 0; - return NULL; } static PyObject *BPy_IDArray_repr(BPy_IDArray *self) @@ -1188,7 +1188,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject *seq) { IDProperty *prop = self->prop; - short is_double = 0; + bool is_double; const PyTypeObject *py_type = idp_array_py_type(self, &is_double); const size_t elem_size = is_double ? sizeof(double) : sizeof(float); size_t alloc_len; diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 796f6388eb3..7eee0d4a42a 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -197,7 +197,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc PyObject *args; PyObject *self; PyObject *ret; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -248,7 +248,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int value; BLI_assert(py_data != NULL); @@ -306,7 +306,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA * PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -360,7 +360,7 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int i, len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -422,7 +422,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert PyObject *py_values; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -482,7 +482,7 @@ static int bpy_prop_int_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop) PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int value; BLI_assert(py_data != NULL); @@ -540,7 +540,7 @@ static void bpy_prop_int_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -594,7 +594,7 @@ static void bpy_prop_int_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int i, len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -656,7 +656,7 @@ static void bpy_prop_int_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA PyObject *py_values; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -716,7 +716,7 @@ static float bpy_prop_float_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); float value; BLI_assert(py_data != NULL); @@ -774,7 +774,7 @@ static void bpy_prop_float_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pr PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -828,7 +828,7 @@ static void bpy_prop_float_array_get_cb(struct PointerRNA *ptr, struct PropertyR PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int i, len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -890,7 +890,7 @@ static void bpy_prop_float_array_set_cb(struct PointerRNA *ptr, struct PropertyR PyObject *py_values; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -950,7 +950,7 @@ static void bpy_prop_string_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -1009,7 +1009,7 @@ static int bpy_prop_string_length_cb(struct PointerRNA *ptr, struct PropertyRNA PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int length; BLI_assert(py_data != NULL); @@ -1071,7 +1071,7 @@ static void bpy_prop_string_set_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); PyObject *py_value; BLI_assert(py_data != NULL); @@ -1132,7 +1132,7 @@ static int bpy_prop_enum_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int value; BLI_assert(py_data != NULL); @@ -1190,7 +1190,7 @@ static void bpy_prop_enum_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pro PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b8640f7208b..23308bf997d 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -606,7 +606,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) #ifdef USE_MATHUTILS int subtype, totdim; int len; - int is_thick; + bool is_thick; const int flag = RNA_property_flag(prop); /* disallow dynamic sized arrays to be wrapped since the size could change @@ -617,7 +617,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) len = RNA_property_array_length(ptr, prop); subtype = RNA_property_subtype(prop); totdim = RNA_property_array_dimension(ptr, prop, NULL); - is_thick = (flag & PROP_THICK_WRAP); + is_thick = (flag & PROP_THICK_WRAP) != 0; if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) { if (!is_thick) @@ -3640,7 +3640,7 @@ static int pyrna_struct_pydict_contains(PyObject *self, PyObject *pyname) #endif /* --------------- setattr------------------------------------------- */ -static int pyrna_is_deferred_prop(const PyObject *value) +static bool pyrna_is_deferred_prop(const PyObject *value) { return PyTuple_CheckExact(value) && PyTuple_GET_SIZE(value) == 2 && @@ -3682,7 +3682,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyObject *value) { StructRNA *srna = srna_from_self(cls, "StructRNA.__setattr__"); - const int is_deferred_prop = (value && pyrna_is_deferred_prop(value)); + const bool is_deferred_prop = (value && pyrna_is_deferred_prop(value)); const char *attr_str = _PyUnicode_AsString(attr); if (srna && !pyrna_write_check() && (is_deferred_prop || RNA_struct_type_find_property(srna, attr_str))) { @@ -6901,7 +6901,7 @@ static int rna_function_arg_count(FunctionRNA *func, int *min_count) PropertyRNA *parm; Link *link; int flag = RNA_function_flag(func); - int is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE); + const bool is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE); int count = is_staticmethod ? 0 : 1; bool done_min_count = false; @@ -6934,7 +6934,8 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v PyObject *py_class = (PyObject *)py_data; PyObject *base_class = RNA_struct_py_type_get(srna); PyObject *item; - int i, flag, is_staticmethod, arg_count, func_arg_count, func_arg_min_count = 0; + int i, flag, arg_count, func_arg_count, func_arg_min_count = 0; + bool is_staticmethod; const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; /* __name__ */ if (srna_base) { @@ -7119,10 +7120,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param PyGILState_STATE gilstate; #ifdef USE_PEDANTIC_WRITE - const int is_operator = RNA_struct_is_a(ptr->type, &RNA_Operator); + const bool is_operator = RNA_struct_is_a(ptr->type, &RNA_Operator); // const char *func_id = RNA_function_identifier(func); /* UNUSED */ /* testing, for correctness, not operator and not draw function */ - const short is_readonly = !(RNA_function_flag(func) & FUNC_ALLOW_WRITE); + const bool is_readonly = !(RNA_function_flag(func) & FUNC_ALLOW_WRITE); #endif py_class = RNA_struct_py_type_get(ptr->type); diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index e473af9fac8..3320043aeb5 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -58,7 +58,7 @@ static int pyrna_struct_anim_args_parse( PointerRNA *ptr, const char *error_prefix, const char *path, const char **path_full, int *index) { - const int is_idbase = RNA_struct_is_ID(ptr->type); + const bool is_idbase = RNA_struct_is_ID(ptr->type); PropertyRNA *prop; PointerRNA r_ptr; diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 91055a55bfa..0e6864047a2 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1261,7 +1261,7 @@ static int Vector_len(VectorObject *self) return self->size; } /* sequence accessor (get): vector[index] */ -static PyObject *vector_item_internal(VectorObject *self, int i, const int is_attr) +static PyObject *vector_item_internal(VectorObject *self, int i, const bool is_attr) { if (i < 0) i = self->size - i; @@ -1289,7 +1289,7 @@ static PyObject *Vector_item(VectorObject *self, int i) return vector_item_internal(self, i, false); } /* sequence accessor (set): vector[index] = value */ -static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, const int is_attr) +static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, const bool is_attr) { float scalar; if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index ae87aedf175..bcde98aea8f 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3132,7 +3132,7 @@ static EdgeHash *make_freestyle_edge_mark_hash(Mesh *me, DerivedMesh *dm) return edge_hash; } -static int has_freestyle_edge_mark(EdgeHash *edge_hash, int v1, int v2) +static bool has_freestyle_edge_mark(EdgeHash *edge_hash, int v1, int v2) { MEdge *medge= BLI_edgehash_lookup(edge_hash, v1, v2); return (!medge) ? 0 : 1; diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 17e438599c1..6807af0abc9 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -292,7 +292,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi) return obi->obr->raytree; } -static int has_special_rayobject(Render *re, ObjectInstanceRen *obi) +static bool has_special_rayobject(Render *re, ObjectInstanceRen *obi) { if ( (obi->flag & R_TRANSFORMED) && (re->r.raytrace_options & R_RAYTRACE_USE_INSTANCES) ) { ObjectRen *obr = obi->obr; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 1690a1a8641..ed86cc01a16 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -232,7 +232,7 @@ int WM_operator_call_notest(struct bContext *C, struct wmOperator *op); int WM_operator_repeat (struct bContext *C, struct wmOperator *op); int WM_operator_repeat_check(const struct bContext *C, struct wmOperator *op); int WM_operator_name_call (struct bContext *C, const char *opstring, short context, struct PointerRNA *properties); -int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, short context, struct PointerRNA *properties, struct ReportList *reports, short is_undo); +int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, short context, struct PointerRNA *properties, struct ReportList *reports, const bool is_undo); void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */ void WM_operator_properties_sanitize(struct PointerRNA *ptr, const bool no_context); /* make props context sensitive or not */ @@ -288,14 +288,14 @@ void WM_operator_py_idname(char *to, const char *from); /* *************** uilist types ******************** */ void WM_uilisttype_init(void); struct uiListType *WM_uilisttype_find(const char *idname, bool quiet); -int WM_uilisttype_add(struct uiListType *ult); +bool WM_uilisttype_add(struct uiListType *ult); void WM_uilisttype_freelink(struct uiListType *ult); void WM_uilisttype_free(void); /* *************** menu types ******************** */ void WM_menutype_init(void); struct MenuType *WM_menutype_find(const char *idname, bool quiet); -int WM_menutype_add(struct MenuType *mt); +bool WM_menutype_add(struct MenuType *mt); void WM_menutype_freelink(struct MenuType *mt); void WM_menutype_free(void); diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index f5488cbbe59..9645c95f62b 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -96,9 +96,13 @@ int WM_keymap_map_type_get(struct wmKeyMapItem *kmi); /* Key Event */ -const char *WM_key_event_string(short type); -int WM_key_event_operator_id(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, int hotkey, struct wmKeyMap **keymap_r); -char *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, const bool strict, char *str, int len); +const char *WM_key_event_string(short type); +int WM_key_event_operator_id( + const struct bContext *C, const char *opname, int opcontext, + struct IDProperty *properties, const bool is_hotkey, struct wmKeyMap **keymap_r); +char *WM_key_event_operator_string( + const struct bContext *C, const char *opname, int opcontext, + struct IDProperty *properties, const bool is_strict, char *str, int len); const char *WM_bool_as_string(bool test); diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 6a91eca2c7f..4460a1167ff 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -230,7 +230,7 @@ uiListType *WM_uilisttype_find(const char *idname, bool quiet) return NULL; } -int WM_uilisttype_add(uiListType *ult) +bool WM_uilisttype_add(uiListType *ult) { BLI_ghash_insert(uilisttypes_hash, (void *)ult->idname, ult); return 1; @@ -238,7 +238,12 @@ int WM_uilisttype_add(uiListType *ult) void WM_uilisttype_freelink(uiListType *ult) { - BLI_ghash_remove(uilisttypes_hash, ult->idname, NULL, MEM_freeN); + bool ok; + + ok = BLI_ghash_remove(uilisttypes_hash, ult->idname, NULL, MEM_freeN); + + BLI_assert(ok); + (void)ok; } /* called on initialize WM_init() */ @@ -283,15 +288,20 @@ MenuType *WM_menutype_find(const char *idname, bool quiet) return NULL; } -int WM_menutype_add(MenuType *mt) +bool WM_menutype_add(MenuType *mt) { BLI_ghash_insert(menutypes_hash, (void *)mt->idname, mt); - return 1; + return true; } void WM_menutype_freelink(MenuType *mt) { - BLI_ghash_remove(menutypes_hash, mt->idname, NULL, MEM_freeN); + bool ok; + + ok = BLI_ghash_remove(menutypes_hash, mt->idname, NULL, MEM_freeN); + + BLI_assert(ok); + (void)ok; } /* called on initialize WM_init() */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 01086fad305..1256fcf70a2 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -394,8 +394,8 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); ARegion *menu = CTX_wm_menu(C); - static int do_wheel_ui = TRUE; - int is_wheel = ELEM3(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN); + static bool do_wheel_ui = true; + const bool is_wheel = ELEM3(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN); int retval; /* UI code doesn't handle return values - it just always returns break. @@ -405,11 +405,11 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve /* UI is quite aggressive with swallowing events, like scrollwheel */ /* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */ - if (do_wheel_ui == FALSE) { + if (do_wheel_ui == false) { if (is_wheel) return WM_HANDLER_CONTINUE; else if (wm_event_always_pass(event) == 0) - do_wheel_ui = TRUE; + do_wheel_ui = true; } /* we set context to where ui handler came from */ @@ -437,7 +437,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve /* event not handled in UI, if wheel then we temporarily disable it */ if (is_wheel) - do_wheel_ui = FALSE; + do_wheel_ui = false; return WM_HANDLER_CONTINUE; } @@ -985,7 +985,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, if (WM_operator_poll(C, ot)) { wmWindowManager *wm = CTX_wm_manager(C); wmOperator *op = wm_operator_create(wm, ot, properties, reports); /* if reports == NULL, they'll be initialized */ - const short is_nested_call = (wm->op_undo_depth != 0); + const bool is_nested_call = (wm->op_undo_depth != 0); op->flag |= OP_IS_INVOKE; @@ -1254,7 +1254,7 @@ int WM_operator_name_call(bContext *C, const char *opstring, short context, Poin * - reports can be passed to this function (so python can report them as exceptions) */ int WM_operator_call_py(bContext *C, wmOperatorType *ot, short context, - PointerRNA *properties, ReportList *reports, short is_undo) + PointerRNA *properties, ReportList *reports, const bool is_undo) { int retval = OPERATOR_CANCELLED; @@ -2148,7 +2148,7 @@ void wm_event_do_handlers(bContext *C) int is_playing_sound = sound_scene_playing(win->screen->scene); if (is_playing_sound != -1) { - int is_playing_screen; + bool is_playing_screen; CTX_wm_window_set(C, win); CTX_wm_screen_set(C, win->screen); CTX_data_scene_set(C, scene); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 10837178f35..7caa5b31df4 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -928,7 +928,7 @@ int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, const int len) static wmKeyMapItem *wm_keymap_item_find_handlers( const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext), - IDProperty *properties, int is_strict, int hotkey, wmKeyMap **keymap_r) + IDProperty *properties, const bool is_strict, const bool is_hotkey, wmKeyMap **keymap_r) { wmWindowManager *wm = CTX_wm_manager(C); wmEventHandler *handler; @@ -943,7 +943,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers( for (kmi = keymap->items.first; kmi; kmi = kmi->next) { if (strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0]) { - if (hotkey) + if (is_hotkey) if (!ISHOTKEY(kmi->type)) continue; @@ -982,7 +982,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers( static wmKeyMapItem *wm_keymap_item_find_props( const bContext *C, const char *opname, int opcontext, - IDProperty *properties, int is_strict, int hotkey, wmKeyMap **keymap_r) + IDProperty *properties, const bool is_strict, const bool is_hotkey, wmKeyMap **keymap_r) { wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); @@ -991,10 +991,10 @@ static wmKeyMapItem *wm_keymap_item_find_props( /* look into multiple handler lists to find the item */ if (win) - found = wm_keymap_item_find_handlers(C, &win->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r); + found = wm_keymap_item_find_handlers(C, &win->handlers, opname, opcontext, properties, is_strict, is_hotkey, keymap_r); if (sa && found == NULL) - found = wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r); + found = wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, is_strict, is_hotkey, keymap_r); if (found == NULL) { if (ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) { @@ -1003,7 +1003,7 @@ static wmKeyMapItem *wm_keymap_item_find_props( ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (ar) - found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r); + found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, is_hotkey, keymap_r); } } else if (ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) { @@ -1011,18 +1011,18 @@ static wmKeyMapItem *wm_keymap_item_find_props( ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS); if (ar) - found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r); + found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, is_hotkey, keymap_r); } else if (ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) { if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW)) ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW); if (ar) - found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r); + found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, is_hotkey, keymap_r); } else { if (ar) - found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, hotkey, keymap_r); + found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, is_hotkey, keymap_r); } } @@ -1031,9 +1031,9 @@ static wmKeyMapItem *wm_keymap_item_find_props( static wmKeyMapItem *wm_keymap_item_find( const bContext *C, const char *opname, int opcontext, - IDProperty *properties, const short hotkey, const bool strict, wmKeyMap **keymap_r) + IDProperty *properties, const bool is_hotkey, const bool is_strict, wmKeyMap **keymap_r) { - wmKeyMapItem *found = wm_keymap_item_find_props(C, opname, opcontext, properties, strict, hotkey, keymap_r); + wmKeyMapItem *found = wm_keymap_item_find_props(C, opname, opcontext, properties, is_strict, is_hotkey, keymap_r); if (!found && properties) { wmOperatorType *ot = WM_operatortype_find(opname, TRUE); @@ -1046,14 +1046,14 @@ static wmKeyMapItem *wm_keymap_item_find( RNA_pointer_create(NULL, ot->srna, properties_default, &opptr); if (WM_operator_properties_default(&opptr, true) || - (!strict && ot->prop && RNA_property_is_set(&opptr, ot->prop))) + (!is_strict && ot->prop && RNA_property_is_set(&opptr, ot->prop))) { /* for operator that has enum menu, unset it so it always matches */ - if (!strict && ot->prop) { + if (!is_strict && ot->prop) { RNA_property_unset(&opptr, ot->prop); } - found = wm_keymap_item_find_props(C, opname, opcontext, properties_default, false, hotkey, keymap_r); + found = wm_keymap_item_find_props(C, opname, opcontext, properties_default, false, is_hotkey, keymap_r); } IDP_FreeProperty(properties_default); @@ -1066,9 +1066,9 @@ static wmKeyMapItem *wm_keymap_item_find( char *WM_key_event_operator_string( const bContext *C, const char *opname, int opcontext, - IDProperty *properties, const bool strict, char *str, int len) + IDProperty *properties, const bool is_strict, char *str, int len) { - wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, 0, strict, NULL); + wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, false, is_strict, NULL); if (kmi) { WM_keymap_item_to_string(kmi, str, len); @@ -1080,9 +1080,9 @@ char *WM_key_event_operator_string( int WM_key_event_operator_id( const bContext *C, const char *opname, int opcontext, - IDProperty *properties, int hotkey, wmKeyMap **keymap_r) + IDProperty *properties, const bool is_hotkey, wmKeyMap **keymap_r) { - wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, hotkey, true, keymap_r); + wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, is_hotkey, true, keymap_r); if (kmi) return kmi->id; |