From f5e55c33378b96e614710006121860eb880e6820 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 2 Sep 2020 19:10:18 +0200 Subject: Cleanup: use bool instead of int in various places --- source/blender/editors/gpencil/gpencil_primitive.c | 10 ++++---- source/blender/editors/include/ED_object.h | 2 +- .../interface/interface_eyedropper_datablock.c | 4 +-- .../editors/interface/interface_eyedropper_depth.c | 6 ++--- .../interface/interface_eyedropper_driver.c | 4 +-- .../blender/editors/interface/interface_handlers.c | 4 +-- source/blender/editors/interface/interface_ops.c | 8 +++--- source/blender/editors/interface/view2d_ops.c | 22 ++++++++-------- source/blender/editors/lattice/editlattice_tools.c | 2 +- source/blender/editors/mask/mask_editaction.c | 4 +-- .../editors/object/object_gpencil_modifier.c | 8 +++--- source/blender/editors/object/object_hook.c | 10 ++++---- source/blender/editors/object/object_modifier.c | 30 +++++++++++----------- source/blender/editors/sculpt_paint/sculpt.c | 4 +-- source/blender/editors/sculpt_paint/sculpt_uv.c | 4 +-- source/blender/editors/sound/sound_ops.c | 4 +-- source/blender/editors/space_file/space_file.c | 4 +-- source/blender/editors/space_graph/graph_buttons.c | 16 ++++++------ source/blender/editors/space_graph/graph_select.c | 6 ++--- source/blender/editors/space_image/image_ops.c | 10 ++++---- source/blender/editors/space_node/drawnode.c | 12 ++++----- source/blender/editors/space_node/node_add.c | 4 +-- source/blender/editors/space_node/node_draw.c | 14 +++++----- source/blender/editors/space_node/node_edit.c | 16 ++++++------ source/blender/editors/space_node/node_intern.h | 2 +- source/blender/editors/space_view3d/view3d_utils.c | 4 +-- source/blender/editors/space_view3d/view3d_view.c | 4 +-- 27 files changed, 109 insertions(+), 109 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index a4c8fc770e2..04e440a1960 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -255,13 +255,13 @@ static bool gpencil_primitive_add_poll(bContext *C) /* only 3D view */ ScrArea *area = CTX_wm_area(C); if (area && area->spacetype != SPACE_VIEW3D) { - return 0; + return false; } /* need data to create primitive */ bGPdata *gpd = CTX_data_gpencil_data(C); if (gpd == NULL) { - return 0; + return false; } /* only in edit and paint modes @@ -271,7 +271,7 @@ static bool gpencil_primitive_add_poll(bContext *C) */ if ((gpd->flag & (GP_DATA_STROKE_PAINTMODE | GP_DATA_STROKE_EDITMODE)) == 0) { CTX_wm_operator_poll_msg_set(C, "Primitives can only be added in Draw or Edit modes"); - return 0; + return false; } /* don't allow operator to function if the active layer is locked/hidden @@ -281,10 +281,10 @@ static bool gpencil_primitive_add_poll(bContext *C) if ((gpl) && (gpl->flag & (GP_LAYER_LOCKED | GP_LAYER_HIDE))) { CTX_wm_operator_poll_msg_set(C, "Primitives cannot be added as active layer is locked or hidden"); - return 0; + return false; } - return 1; + return true; } /* Allocate memory to stroke, adds MAX_EDGES on every call */ diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index f1ddc10f1a8..dc674aefe2e 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -381,7 +381,7 @@ bool ED_object_modifier_move_to_index(struct ReportList *reports, struct ModifierData *md, const int index); -int ED_object_modifier_convert(struct ReportList *reports, +bool ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c index dd55d2c364b..6a12f550d7c 100644 --- a/source/blender/editors/interface/interface_eyedropper_datablock.c +++ b/source/blender/editors/interface/interface_eyedropper_datablock.c @@ -355,12 +355,12 @@ static bool datadropper_poll(bContext *C) StructRNA *type = RNA_property_pointer_type(&ptr, prop); const short idcode = RNA_type_to_ID_code(type); if ((idcode == ID_OB) || OB_DATA_SUPPORT_ID(idcode)) { - return 1; + return true; } } } - return 0; + return false; } void UI_OT_eyedropper_id(wmOperatorType *ot) diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c index ac142fe7217..fbc0ed1fc1f 100644 --- a/source/blender/editors/interface/interface_eyedropper_depth.c +++ b/source/blender/editors/interface/interface_eyedropper_depth.c @@ -351,7 +351,7 @@ static bool depthdropper_poll(bContext *C) if ((RNA_property_type(prop) == PROP_FLOAT) && (RNA_property_subtype(prop) & PROP_UNIT_LENGTH) && (RNA_property_array_check(prop) == false)) { - return 1; + return true; } } else { @@ -359,12 +359,12 @@ static bool depthdropper_poll(bContext *C) if (rv3d && rv3d->persp == RV3D_CAMOB) { View3D *v3d = CTX_wm_view3d(C); if (v3d->camera && v3d->camera->data && !ID_IS_LINKED(v3d->camera->data)) { - return 1; + return true; } } } - return 0; + return false; } void UI_OT_eyedropper_depth(wmOperatorType *ot) diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c index d13e47624ee..29c0368219b 100644 --- a/source/blender/editors/interface/interface_eyedropper_driver.c +++ b/source/blender/editors/interface/interface_eyedropper_driver.c @@ -207,9 +207,9 @@ static int driverdropper_exec(bContext *C, wmOperator *op) static bool driverdropper_poll(bContext *C) { if (!CTX_wm_window(C)) { - return 0; + return false; } - return 1; + return true; } void UI_OT_eyedropper_driver(wmOperatorType *ot) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index bf88b3c0318..143ca6a0ef1 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -10988,11 +10988,11 @@ bool UI_but_active_drop_name(bContext *C) if (but) { if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) { - return 1; + return true; } } - return 0; + return false; } bool UI_but_active_drop_color(bContext *C) diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index d6919fb4de7..c9f21c7fc2e 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -91,11 +91,11 @@ static bool copy_data_path_button_poll(bContext *C) if (path) { MEM_freeN(path); - return 1; + return true; } } - return 0; + return false; } static int copy_data_path_button_exec(bContext *C, wmOperator *op) @@ -182,11 +182,11 @@ static bool copy_as_driver_button_poll(bContext *C) if (path) { MEM_freeN(path); - return 1; + return true; } } - return 0; + return false; } static int copy_as_driver_button_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 7234e279da8..c6b29f79137 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -107,7 +107,7 @@ typedef struct v2dViewPanData { } v2dViewPanData; /* initialize panning customdata */ -static int view_pan_init(bContext *C, wmOperator *op) +static bool view_pan_init(bContext *C, wmOperator *op) { ARegion *region = CTX_wm_region(C); v2dViewPanData *vpd; @@ -116,13 +116,13 @@ static int view_pan_init(bContext *C, wmOperator *op) /* regions now have v2d-data by default, so check for region */ if (region == NULL) { - return 0; + return false; } /* check if panning is allowed at all */ v2d = ®ion->v2d; if ((v2d->keepofs & V2D_LOCKOFS_X) && (v2d->keepofs & V2D_LOCKOFS_Y)) { - return 0; + return false; } /* set custom-data for operator */ @@ -141,7 +141,7 @@ static int view_pan_init(bContext *C, wmOperator *op) vpd->facx = (BLI_rctf_size_x(&v2d->cur)) / winx; vpd->facy = (BLI_rctf_size_y(&v2d->cur)) / winy; - return 1; + return true; } #ifdef WITH_INPUT_NDOF @@ -152,17 +152,17 @@ static bool view_pan_poll(bContext *C) /* check if there's a region in context to work with */ if (region == NULL) { - return 0; + return false; } v2d = ®ion->v2d; /* check that 2d-view can pan */ if ((v2d->keepofs & V2D_LOCKOFS_X) && (v2d->keepofs & V2D_LOCKOFS_Y)) { - return 0; + return false; } /* view can pan */ - return 1; + return true; } #endif @@ -808,7 +808,7 @@ static void view_zoom_axis_lock_defaults(bContext *C, bool r_do_zoom_xy[2]) } /* initialize panning customdata */ -static int view_zoomdrag_init(bContext *C, wmOperator *op) +static bool view_zoomdrag_init(bContext *C, wmOperator *op) { ARegion *region = CTX_wm_region(C); v2dViewZoomData *vzd; @@ -816,13 +816,13 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op) /* regions now have v2d-data by default, so check for region */ if (region == NULL) { - return 0; + return false; } v2d = ®ion->v2d; /* check that 2d-view is zoomable */ if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y)) { - return 0; + return false; } /* set custom-data for operator */ @@ -833,7 +833,7 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op) vzd->v2d = v2d; vzd->region = region; - return 1; + return true; } /* check if step-zoom can be applied */ diff --git a/source/blender/editors/lattice/editlattice_tools.c b/source/blender/editors/lattice/editlattice_tools.c index 0cfe59ef06c..d503cbc87b8 100644 --- a/source/blender/editors/lattice/editlattice_tools.c +++ b/source/blender/editors/lattice/editlattice_tools.c @@ -58,7 +58,7 @@ static bool make_regular_poll(bContext *C) Object *ob; if (ED_operator_editlattice(C)) { - return 1; + return true; } ob = CTX_data_active_object(C); diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 31fc403b157..af99df4c5d8 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -122,12 +122,12 @@ bool ED_masklayer_frame_select_check(MaskLayer *mask_layer) for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; mask_layer_shape = mask_layer_shape->next) { if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { - return 1; + return true; } } /* not found */ - return 0; + return false; } /* helper function - select mask-frame based on SELECT_* mode */ diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c index cfa55c68a56..575ef38476c 100644 --- a/source/blender/editors/object/object_gpencil_modifier.c +++ b/source/blender/editors/object/object_gpencil_modifier.c @@ -117,7 +117,7 @@ static bool gpencil_object_modifier_remove(Main *bmain, * get called twice on same modifier, so make * sure it is in list. */ if (BLI_findindex(&ob->greasepencil_modifiers, md) == -1) { - return 0; + return false; } DEG_relations_tag_update(bmain); @@ -126,7 +126,7 @@ static bool gpencil_object_modifier_remove(Main *bmain, BKE_gpencil_modifier_free(md); BKE_object_free_derived_caches(ob); - return 1; + return true; } bool ED_object_gpencil_modifier_remove(ReportList *reports, @@ -141,13 +141,13 @@ bool ED_object_gpencil_modifier_remove(ReportList *reports, if (!ok) { BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", md->name, ob->id.name); - return 0; + return false; } DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); DEG_relations_tag_update(bmain); - return 1; + return true; } void ED_object_gpencil_modifier_clear(Main *bmain, Object *ob) diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 6bb03e62191..aaf76ff649e 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -482,18 +482,18 @@ static bool hook_op_edit_poll(bContext *C) if (obedit) { if (ED_operator_editmesh(C)) { - return 1; + return true; } if (ED_operator_editsurfcurve(C)) { - return 1; + return true; } if (ED_operator_editlattice(C)) { - return 1; + return true; } - // if (ED_operator_editmball(C)) return 1; + // if (ED_operator_editmball(C)) return true; } - return 0; + return false; } static Object *add_hook_object_new( diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 14882ab8ffc..692a445fe9c 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -397,13 +397,13 @@ bool ED_object_modifier_remove( if (!ok) { BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", md->name, ob->id.name); - return 0; + return false; } DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); DEG_relations_tag_update(bmain); - return 1; + return true; } void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob) @@ -513,13 +513,13 @@ bool ED_object_modifier_move_to_index(ReportList *reports, return true; } -int ED_object_modifier_convert(ReportList *UNUSED(reports), - Main *bmain, - Depsgraph *depsgraph, - Scene *scene, - ViewLayer *view_layer, - Object *ob, - ModifierData *md) +bool ED_object_modifier_convert(ReportList *UNUSED(reports), + Main *bmain, + Depsgraph *depsgraph, + Scene *scene, + ViewLayer *view_layer, + Object *ob, + ModifierData *md) { Object *obn; ParticleSystem *psys_orig, *psys_eval; @@ -533,21 +533,21 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), int totpart = 0, totchild = 0; if (md->type != eModifierType_ParticleSystem) { - return 0; + return false; } if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) { - return 0; + return false; } psys_orig = ((ParticleSystemModifierData *)md)->psys; part = psys_orig->part; if (part->ren_as != PART_DRAW_PATH) { - return 0; + return false; } psys_eval = psys_eval_get(depsgraph, ob, psys_orig); if (psys_eval->pathcache == NULL) { - return 0; + return false; } totpart = psys_eval->totcached; @@ -579,7 +579,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), } if (totvert == 0) { - return 0; + return false; } /* add new mesh */ @@ -637,7 +637,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), DEG_relations_tag_update(bmain); - return 1; + return true; } /* Gets mesh for the modifier which corresponds to an evaluated state. */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7a066f35f23..7cb4f74282b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1771,10 +1771,10 @@ static bool sculpt_brush_test_cyl(SculptBrushTest *test, test->dist = dist; - return 1; + return true; } - return 0; + return false; } #endif diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index be509f4aed6..5be72ec87e7 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -472,9 +472,9 @@ static bool uv_edge_compare(const void *a, const void *b) const UvEdge *edge2 = b; if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) { - return 0; + return false; } - return 1; + return true; } static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wmEvent *event) diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index d4f5f066d48..87b84c475fd 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -749,10 +749,10 @@ static bool sound_poll(bContext *C) Editing *ed = CTX_data_scene(C)->ed; if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_TYPE_SOUND_RAM) { - return 0; + return false; } - return 1; + return true; } /********************* pack operator *********************/ diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 61d6d8bf678..edc1e83e882 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -662,10 +662,10 @@ static bool filepath_drop_poll(bContext *C, if (drag->type == WM_DRAG_PATH) { SpaceFile *sfile = CTX_wm_space_file(C); if (sfile) { - return 1; + return true; } } - return 0; + return false; } static void filepath_drop_copy(wmDrag *drag, wmDropBox *drop) diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 0158e12c79c..6dbf6226de8 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -72,7 +72,7 @@ /* -------------- */ -static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **fcu) +static bool graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **fcu) { bAnimContext ac; bAnimListElem *elem = NULL; @@ -83,13 +83,13 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve ** * There's no point showing empty panels? */ if (ANIM_animdata_get_context(C, &ac) == 0) { - return 0; + return false; } /* try to find 'active' F-Curve */ elem = get_active_fcurve_channel(&ac); if (elem == NULL) { - return 0; + return false; } if (fcu) { @@ -102,7 +102,7 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve ** MEM_freeN(elem); } - return 1; + return true; } static bool graph_panel_poll(const bContext *C, PanelType *UNUSED(pt)) @@ -235,7 +235,7 @@ static void graph_panel_properties(const bContext *C, Panel *panel) /* ******************* active Keyframe ************** */ /* get 'active' keyframe for panel editing */ -static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezTriple **prevbezt) +static bool get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezTriple **prevbezt) { BezTriple *b; int i; @@ -245,7 +245,7 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT /* sanity checks */ if ((fcu->bezt == NULL) || (fcu->totvert == 0)) { - return 0; + return false; } /* find first selected keyframe for now, and call it the active one @@ -261,12 +261,12 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT *prevbezt = (i > 0) ? b - 1 : b; *bezt = b; - return 1; + return true; } } /* not found */ - return 0; + return false; } /* update callback for active keyframe properties - base updates stuff */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 160b731629c..0c05942ec4b 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -95,12 +95,12 @@ typedef enum eGraphVertIndex { static bool fcurve_handle_sel_check(SpaceGraph *sipo, BezTriple *bezt) { if (sipo->flag & SIPO_NOHANDLES) { - return 0; + return false; } if ((sipo->flag & SIPO_SELVHANDLESONLY) && BEZT_ISSEL_ANY(bezt) == 0) { - return 0; + return false; } - return 1; + return true; } /* check if the given vertex is within bounds or not */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index f312981d0e1..0a8bcd91f34 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -270,10 +270,10 @@ static bool space_image_main_area_not_uv_brush_poll(bContext *C) ToolSettings *toolsettings = scene->toolsettings; if (sima && !toolsettings->uvsculpt && (CTX_data_edit_object(C) == NULL)) { - return 1; + return true; } - return 0; + return false; } /** \} */ @@ -2897,16 +2897,16 @@ static bool image_pack_test(bContext *C, wmOperator *op) Image *ima = image_from_context(C); if (!ima) { - return 0; + return false; } if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE, IMA_SRC_TILED)) { BKE_report( op->reports, RPT_ERROR, "Packing movies, image sequences or tiled images not supported"); - return 0; + return false; } - return 1; + return true; } static int image_pack_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 5866b5cc12f..82f3b71eb32 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3766,7 +3766,7 @@ static bool node_link_bezier_handles(View2D *v2d, } else { if (snode == NULL) { - return 0; + return false; } copy_v2_v2(vec[0], cursor); fromreroute = 0; @@ -3778,7 +3778,7 @@ static bool node_link_bezier_handles(View2D *v2d, } else { if (snode == NULL) { - return 0; + return false; } copy_v2_v2(vec[3], cursor); toreroute = 0; @@ -3791,7 +3791,7 @@ static bool node_link_bezier_handles(View2D *v2d, /* Straight line: align all points. */ mid_v2_v2v2(vec[1], vec[0], vec[3]); mid_v2_v2v2(vec[2], vec[1], vec[3]); - return 1; + return true; } dist = curving * 0.10f * fabsf(vec[0][0] - vec[3][0]); @@ -3828,13 +3828,13 @@ static bool node_link_bezier_handles(View2D *v2d, } if (v2d && min_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) { - return 0; /* clipped */ + return false; /* clipped */ } if (v2d && max_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) { - return 0; /* clipped */ + return false; /* clipped */ } - return 1; + return true; } /* if v2d not NULL, it clips and returns 0 if not visible */ diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 037fe575973..68f4bd0ff38 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -109,12 +109,12 @@ static bool add_reroute_intersect_check(bNodeLink *link, if (isect_seg_seg_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0) { result[0] = (mcoords[i][0] + mcoords[i + 1][0]) / 2.0f; result[1] = (mcoords[i][1] + mcoords[i + 1][1]) / 2.0f; - return 1; + return true; } } } } - return 0; + return false; } typedef struct bNodeSocketLink { diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 56e53e79a8d..ba6b164704f 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -188,7 +188,7 @@ static bool compare_nodes(const bNode *a, const bNode *b) for (parent = a->parent; parent; parent = parent->parent) { /* if b is an ancestor, it is always behind a */ if (parent == b) { - return 1; + return true; } /* any selected ancestor moves the node forward */ if (parent->flag & NODE_ACTIVE) { @@ -201,7 +201,7 @@ static bool compare_nodes(const bNode *a, const bNode *b) for (parent = b->parent; parent; parent = parent->parent) { /* if a is an ancestor, it is always behind b */ if (parent == a) { - return 0; + return false; } /* any selected ancestor moves the node forward */ if (parent->flag & NODE_ACTIVE) { @@ -214,21 +214,21 @@ static bool compare_nodes(const bNode *a, const bNode *b) /* if one of the nodes is in the background and the other not */ if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND)) { - return 0; + return false; } if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND)) { - return 1; + return true; } /* if one has a higher selection state (active > selected > nothing) */ if (!b_active && a_active) { - return 1; + return true; } if (!b_select && (a_active || a_select)) { - return 1; + return true; } - return 0; + return false; } /* Sorts nodes by selection: unselected nodes first, then selected, diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index ef931dd9bb8..eae8bd05a93 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -358,10 +358,10 @@ bool composite_node_active(bContext *C) if (ED_operator_node_active(C)) { SpaceNode *snode = CTX_wm_space_node(C); if (ED_node_is_compositor(snode)) { - return 1; + return true; } } - return 0; + return false; } /* operator poll callback */ @@ -370,10 +370,10 @@ bool composite_node_editable(bContext *C) if (ED_operator_node_editable(C)) { SpaceNode *snode = CTX_wm_space_node(C); if (ED_node_is_compositor(snode)) { - return 1; + return true; } } - return 0; + return false; } void snode_dag_update(bContext *C, SpaceNode *snode) @@ -1089,21 +1089,21 @@ void NODE_OT_resize(wmOperatorType *ot) /* ********************** hidden sockets ******************** */ -int node_has_hidden_sockets(bNode *node) +bool node_has_hidden_sockets(bNode *node) { bNodeSocket *sock; for (sock = node->inputs.first; sock; sock = sock->next) { if (sock->flag & SOCK_HIDDEN) { - return 1; + return true; } } for (sock = node->outputs.first; sock; sock = sock->next) { if (sock->flag & SOCK_HIDDEN) { - return 1; + return true; } } - return 0; + return false; } void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set) diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 9461892360e..7e62170bce5 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -212,7 +212,7 @@ void snode_update(struct SpaceNode *snode, struct bNode *node); bool composite_node_active(struct bContext *C); bool composite_node_editable(struct bContext *C); -int node_has_hidden_sockets(struct bNode *node); +bool node_has_hidden_sockets(struct bNode *node); void node_set_hidden_sockets(struct SpaceNode *snode, bNode *node, int set); int node_render_changed_exec(bContext *, struct wmOperator *); int node_find_indicated_socket(struct SpaceNode *snode, diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index a264e1560c6..ffd5c4e182a 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -1077,9 +1077,9 @@ static bool depth_segment_cb(int x, int y, void *userData) if (depth != FLT_MAX) { data->depth = depth; - return 0; + return false; } - return 1; + return true; } bool ED_view3d_autodist_depth_seg( diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index d015b5dcc89..7000a4d89cd 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -496,13 +496,13 @@ static bool view3d_camera_to_view_poll(bContext *C) if (v3d && v3d->camera && !ID_IS_LINKED(v3d->camera)) { if (rv3d && (RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ANY_TRANSFORM) == 0) { if (rv3d->persp != RV3D_CAMOB) { - return 1; + return true; } } } } - return 0; + return false; } void VIEW3D_OT_camera_to_view(wmOperatorType *ot) -- cgit v1.2.3